diff --git a/native/android/app/bash/build_openssl.sh b/native/android/app/bash/build_openssl.sh index 66e767b88..e6f4f70b9 100755 --- a/native/android/app/bash/build_openssl.sh +++ b/native/android/app/bash/build_openssl.sh @@ -1,65 +1,65 @@ -#!/bin/bash +#!/usr/bin/env bash # OpenSSL library building automation script for # the Gradle build process integration. # # Libraries will be installed into: # $OPENSSL_SUBMODULE_PATH/build/$ANDROID_ARCH_ABI set -e # Arguments: readonly OPENSSL_SUBMODULE_PATH=$1 readonly HOST_TAG=$2 # darwin-x86_64 / linux-x86_64 readonly ANDROID_ARCH_ABI=$3 # arm64-v8a / armeabi-v7a / x86 / x86_64 readonly MIN_SDK_VERSION=$4 readonly THREADS=$6 export ANDROID_NDK_HOME=$5 case "$ANDROID_ARCH_ABI" in "arm64-v8a") TARGET_ARCH="aarch64-linux-android" BUILD_ARCH="android-arm64" ;; "armeabi-v7a") TARGET_ARCH="armv7a-linux-androideabi" BUILD_ARCH="android-arm" ;; "x86") TARGET_ARCH="i686-linux-android" BUILD_ARCH="android-x86" ;; "x86_64") TARGET_ARCH="x86_64-linux-android" BUILD_ARCH="android-x86_64" ;; *) echo "Unsupported architecture: $ANDROID_ARCH_ABI" exit 1 ;; esac CONFIGURE_AND_BUILD() { # Local arguments: readonly TARGET_ARCH=$1 readonly BUILD_ARCH=$2 readonly BUILD_PREFIX=$3 echo "Building OpenSSL library for ${BUILD_PREFIX} (${TARGET_ARCH})" cd $OPENSSL_SUBMODULE_PATH # Compilation flags: export CFLAGS="-Os -ffunction-sections -fdata-sections -fno-unwind-tables -fno-asynchronous-unwind-tables" export LDFLAGS="-Wl,-s -Wl,-Bsymbolic -Wl,--gc-sections" export TOOLCHAIN=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/$HOST_TAG export TARGET_HOST=${TARGET_ARCH} PATH=$TOOLCHAIN/bin:$PATH ./config no-asm -Wl,--enable-new-dtags,-rpath,'$(LIBRPATH)' ./Configure ${BUILD_ARCH} no-shared \ -D__ANDROID_API__=$MIN_SDK_VERSION \ --prefix=$OPENSSL_SUBMODULE_PATH/build/${BUILD_PREFIX} make -j"$THREADS" make install_sw make clean } CONFIGURE_AND_BUILD $TARGET_ARCH $BUILD_ARCH $ANDROID_ARCH_ABI diff --git a/native/android/app/bash/detect_abis.sh b/native/android/app/bash/detect_abis.sh index 3eef1ff5e..3df627420 100755 --- a/native/android/app/bash/detect_abis.sh +++ b/native/android/app/bash/detect_abis.sh @@ -1,18 +1,18 @@ -#!/bin/bash +#!/usr/bin/env bash set -e IDS=$(adb devices -l | tail -n +2 | cut -d ' ' -f 1) ABIS=() for ID in ${IDS} do ABI="$(adb -s $ID shell getprop ro.product.cpu.abi)" # check if we already have this ABI if [[ " ${ABIS[*]} " =~ " ${ABI} " ]]; then continue fi ABIS+="${ABI} " done echo $ABIS diff --git a/native/scripts/mark-generated.sh b/native/scripts/mark-generated.sh index d19a2a9c9..c850091e7 100755 --- a/native/scripts/mark-generated.sh +++ b/native/scripts/mark-generated.sh @@ -1,3 +1,3 @@ -#!/bin/bash +#!/usr/bin/env bash sed -i '' 's/\/\/ Generated by /\/\/ @generated by /g' cpp/CommonCpp/grpc/_generated/* \ No newline at end of file diff --git a/services/base-image/contents/install_aws_sdk.sh b/services/base-image/contents/install_aws_sdk.sh index 663b97ea4..a54639517 100755 --- a/services/base-image/contents/install_aws_sdk.sh +++ b/services/base-image/contents/install_aws_sdk.sh @@ -1,15 +1,15 @@ -#!/bin/bash +#!/usr/bin/env bash set -e cd /tmp git clone --recurse-submodules -b 1.9.176 --single-branch https://github.com/aws/aws-sdk-cpp mkdir aws-sdk-cpp/build pushd aws-sdk-cpp/build cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=/usr/local/aws_sdk -DBUILD_ONLY="core;s3;dynamodb" make make install popd # aws-sdk-cpp/build rm -rf aws-sdk-cpp diff --git a/services/base-image/contents/install_folly.sh b/services/base-image/contents/install_folly.sh index 80d0fd0de..a23aff910 100755 --- a/services/base-image/contents/install_folly.sh +++ b/services/base-image/contents/install_folly.sh @@ -1,11 +1,11 @@ -#!/bin/bash +#!/usr/bin/env bash set -e pushd /usr/lib git clone https://github.com/facebook/folly.git --branch v2020.01.13.00 --single-branch git clone https://github.com/google/glog.git --branch v0.4.0 --single-branch git clone https://github.com/google/double-conversion.git --branch v3.1.5 --single-branch popd # /usr/lib diff --git a/services/base-image/contents/install_grpc.sh b/services/base-image/contents/install_grpc.sh index bbdb7a531..dd886efdc 100755 --- a/services/base-image/contents/install_grpc.sh +++ b/services/base-image/contents/install_grpc.sh @@ -1,47 +1,47 @@ -#!/bin/bash +#!/usr/bin/env bash set -e echo "installing grpc..." cd /tmp git clone --recurse-submodules -b v1.39.1 https://github.com/grpc/grpc pushd grpc mkdir -p cmake/build pushd cmake/build cmake \ -DgRPC_INSTALL=ON \ -DgRPC_SSL_PROVIDER=package \ -DgRPC_ZLIB_PROVIDER=package \ -DgRPC_BUILD_TESTS=OFF \ -DgRPC_BUILD_CSHARP_EXT=OFF \ -DgRPC_BUILD_GRPC_CPP_PLUGIN=ON \ -DgRPC_BUILD_GRPC_CSHARP_PLUGIN=OFF \ -DgRPC_BUILD_GRPC_NODE_PLUGIN=OFF \ -DgRPC_BUILD_GRPC_OBJECTIVE_C_PLUGIN=OFF \ -DgRPC_BUILD_GRPC_PHP_PLUGIN=OFF \ -DgRPC_BUILD_GRPC_PYTHON_PLUGIN=OFF \ -DgRPC_BUILD_GRPC_RUBY_PLUGIN=OFF \ ../.. make make install popd # cmake/build # Explicitly install abseil-cpp because of https://github.com/grpc/grpc/issues/25949 # This should be removed after upgrading to v1.41 pushd third_party/abseil-cpp/ mkdir -p cmake/build pushd cmake/build cmake \ -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE \ ../.. make make install popd # cmake/build popd # third_party/abseil-cpp/ popd # grpc rm -rf grpc diff --git a/services/lib/docker/build_service.sh b/services/lib/docker/build_service.sh index c182ea9fe..1f32e78ea 100755 --- a/services/lib/docker/build_service.sh +++ b/services/lib/docker/build_service.sh @@ -1,23 +1,23 @@ -#!/bin/bash +#!/usr/bin/env bash set -e # folly hack - https://github.com/facebook/folly/pull/1231 sed -i 's/#if __has_include()/#if __has_include()/g' /usr/lib/folly/folly/detail/Demangle.h rm -rf lib mkdir lib pushd lib ln -s /usr/lib/folly ln -s /usr/lib/glog ln -s /usr/lib/double-conversion popd # lib rm -rf _generated mkdir _generated rm -rf cmake/build mkdir -p cmake/build scripts/proto_codegen.sh scripts/build_sources.sh diff --git a/services/lib/docker/build_sources.sh b/services/lib/docker/build_sources.sh index 4b180f053..73e109049 100755 --- a/services/lib/docker/build_sources.sh +++ b/services/lib/docker/build_sources.sh @@ -1,20 +1,20 @@ -#!/bin/bash +#!/usr/bin/env bash set -e NPROC=0 NPROC=$(nproc 2> /dev/null || echo 1) if [[ $NPROC -eq 1 ]]; then NPROC=$(sysctl -n hw.physicalcpu 2> /dev/null || echo 1) fi echo "building the server (nproc=$NPROC)..." pushd cmake/build cmake ../.. make -j $NPROC popd echo "success - server built" diff --git a/services/lib/docker/proto_codegen.sh b/services/lib/docker/proto_codegen.sh index aa795c8ff..00f8470bd 100755 --- a/services/lib/docker/proto_codegen.sh +++ b/services/lib/docker/proto_codegen.sh @@ -1,11 +1,11 @@ -#!/bin/bash +#!/usr/bin/env bash set -e echo "generating files from protos..." for PROTO_FILE in $(ls ./protos); do protoc -I=./protos --cpp_out=_generated --grpc_out=_generated --plugin=protoc-gen-grpc=`which grpc_cpp_plugin` ./protos/$PROTO_FILE done echo "success - code generated from protos" diff --git a/services/lib/docker/run_service.sh b/services/lib/docker/run_service.sh index 828f75ffb..800a7b54d 100755 --- a/services/lib/docker/run_service.sh +++ b/services/lib/docker/run_service.sh @@ -1,15 +1,15 @@ -#!/bin/bash +#!/usr/bin/env bash set -e EXE_PATH="./cmake/build/bin" EXE=`ls $EXE_PATH` EXES=`ls $EXE_PATH | wc -l` if [[ $EXES -ne 1 ]]; then echo "there should be exactly one executable of a service, $EXES found"; exit 1; fi $EXE_PATH/$EXE diff --git a/services/lib/docker/run_tests.sh b/services/lib/docker/run_tests.sh index 1fae22919..f8f1f760a 100755 --- a/services/lib/docker/run_tests.sh +++ b/services/lib/docker/run_tests.sh @@ -1,7 +1,7 @@ -#!/bin/bash +#!/usr/bin/env bash set -e pushd cmake/build make test ARGS="-V" popd # cmake/build diff --git a/services/scripts/run_local_cloud.sh b/services/scripts/run_local_cloud.sh index 9ac151ad9..54a97208a 100755 --- a/services/scripts/run_local_cloud.sh +++ b/services/scripts/run_local_cloud.sh @@ -1,13 +1,13 @@ -#!/bin/bash +#!/usr/bin/env bash set -e # use the commented-out command to force container recreation # docker-compose up -d --force-recreate localstack docker-compose up -d localstack pushd terraform ./run.sh popd # terraform diff --git a/services/terraform/run.sh b/services/terraform/run.sh index 007134cba..eccf24d64 100755 --- a/services/terraform/run.sh +++ b/services/terraform/run.sh @@ -1,7 +1,7 @@ -#!/bin/bash +#!/usr/bin/env bash set -e terraform init terraform apply -auto-approve diff --git a/services/tunnelbroker/docker/build_server.sh b/services/tunnelbroker/docker/build_server.sh index 8af982b7c..3d4be44b5 100755 --- a/services/tunnelbroker/docker/build_server.sh +++ b/services/tunnelbroker/docker/build_server.sh @@ -1,23 +1,23 @@ -#!/bin/bash +#!/usr/bin/env bash set -e # folly hack - https://github.com/facebook/folly/pull/1231 sed -i 's/#if __has_include()/#if __has_include()/g' /usr/lib/folly/folly/detail/Demangle.h rm -rf lib mkdir lib pushd lib ln -s /usr/lib/folly ln -s /usr/lib/glog ln -s /usr/lib/double-conversion popd # lib rm -rf cmake/build mkdir -p cmake/build echo "building the server (MAKEFLAGS=$MAKEFLAGS)..." pushd cmake/build cmake ../.. make popd # cmake/build diff --git a/services/tunnelbroker/docker/install_amqp_cpp.sh b/services/tunnelbroker/docker/install_amqp_cpp.sh index 52dff4547..bffb90815 100755 --- a/services/tunnelbroker/docker/install_amqp_cpp.sh +++ b/services/tunnelbroker/docker/install_amqp_cpp.sh @@ -1,15 +1,15 @@ -#!/bin/bash +#!/usr/bin/env bash set -e cd /tmp git clone --recurse-submodules -b v4.3.16 --single-branch https://github.com/CopernicaMarketingSoftware/AMQP-CPP pushd AMQP-CPP mkdir build pushd build cmake .. -DAMQP-CPP_BUILD_SHARED=ON -DAMQP-CPP_LINUX_TCP=ON cmake --build . --target install popd # build popd # AMQP-CPP-BUILD rm -rf AMQP-CPP-BUILD diff --git a/services/tunnelbroker/docker/install_cryptopp.sh b/services/tunnelbroker/docker/install_cryptopp.sh index 36a392c66..7554897c7 100755 --- a/services/tunnelbroker/docker/install_cryptopp.sh +++ b/services/tunnelbroker/docker/install_cryptopp.sh @@ -1,15 +1,15 @@ -#!/bin/bash +#!/usr/bin/env bash set -e cd /tmp git clone --recurse-submodules -b CRYPTOPP_8_6_0 --single-branch https://github.com/weidai11/cryptopp pushd cryptopp mkdir build CXXFLAGS="-DNDEBUG -g2 -O3 -std=c++11" make make libcryptopp.pc make install popd # cryptopp rm -rf cryptopp diff --git a/services/tunnelbroker/docker/install_folly.sh b/services/tunnelbroker/docker/install_folly.sh index 80d0fd0de..a23aff910 100755 --- a/services/tunnelbroker/docker/install_folly.sh +++ b/services/tunnelbroker/docker/install_folly.sh @@ -1,11 +1,11 @@ -#!/bin/bash +#!/usr/bin/env bash set -e pushd /usr/lib git clone https://github.com/facebook/folly.git --branch v2020.01.13.00 --single-branch git clone https://github.com/google/glog.git --branch v0.4.0 --single-branch git clone https://github.com/google/double-conversion.git --branch v3.1.5 --single-branch popd # /usr/lib diff --git a/services/tunnelbroker/docker/install_libuv.sh b/services/tunnelbroker/docker/install_libuv.sh index e46793483..efcedab31 100755 --- a/services/tunnelbroker/docker/install_libuv.sh +++ b/services/tunnelbroker/docker/install_libuv.sh @@ -1,15 +1,15 @@ -#!/bin/bash +#!/usr/bin/env bash set -e cd /tmp git clone --recurse-submodules -b v1.43.0 --single-branch https://github.com/libuv/libuv.git pushd libuv mkdir build cd build cmake .. -DBUILD_TESTING=OFF make make install popd # libuv rm -rf libuv diff --git a/services/tunnelbroker/docker/run_server.sh b/services/tunnelbroker/docker/run_server.sh index c7e525f71..a8b846be3 100755 --- a/services/tunnelbroker/docker/run_server.sh +++ b/services/tunnelbroker/docker/run_server.sh @@ -1,5 +1,5 @@ -#!/bin/bash +#!/usr/bin/env bash set -e cmake/build/bin/tunnelbroker diff --git a/services/tunnelbroker/docker/run_tests.sh b/services/tunnelbroker/docker/run_tests.sh index 1fae22919..f8f1f760a 100755 --- a/services/tunnelbroker/docker/run_tests.sh +++ b/services/tunnelbroker/docker/run_tests.sh @@ -1,7 +1,7 @@ -#!/bin/bash +#!/usr/bin/env bash set -e pushd cmake/build make test ARGS="-V" popd # cmake/build