From c2e15be908c9be3c1442fe70f7f08d10cbe38ec5 Mon Sep 17 00:00:00 2001 From: Hardcore Sushi Date: Tue, 13 Feb 2024 20:40:12 +0100 Subject: [PATCH] Add locks in android-build.sh scripts --- vendor/boost/Boost-for-Android | 2 +- vendor/boost/android-build.sh | 14 ++++++++++---- vendor/cryptopp/android-build.sh | 17 +++++++++++------ 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/vendor/boost/Boost-for-Android b/vendor/boost/Boost-for-Android index c6012c57..83ba7174 160000 --- a/vendor/boost/Boost-for-Android +++ b/vendor/boost/Boost-for-Android @@ -1 +1 @@ -Subproject commit c6012c576e30ff6000ddab0988d59bad849200ce +Subproject commit 83ba7174dea6e0595085dc30051eb17747e7260a diff --git a/vendor/boost/android-build.sh b/vendor/boost/android-build.sh index 4b139cb9..45348e66 100755 --- a/vendor/boost/android-build.sh +++ b/vendor/boost/android-build.sh @@ -1,19 +1,25 @@ #!/bin/sh +set -e + if [ $(find build/$2/lib -name libboost_*.a 2>/dev/null |wc -l) -eq 10 ]; then echo "boost already built for $2"; exit 0 fi -mkdir -p build && rm -rf build/$2 && cd Boost-for-Android || exit 1 +exec 9>/var/tmp/libcryfs-boost.lock +flock 9 + +mkdir -p build && rm -rf build/$2 && cd Boost-for-Android BOOST_TAR=boost_1_77_0.tar.bz2 if [ ! -f $BOOST_TAR ]; then - wget -O $BOOST_TAR https://boostorg.jfrog.io/artifactory/main/release/1.77.0/source/boost_1_77_0.tar.bz2 || exit 1 + wget -O $BOOST_TAR https://boostorg.jfrog.io/artifactory/main/release/1.77.0/source/boost_1_77_0.tar.bz2 fi +sha256sum -c ../checksum.txt -sha256sum -c ../checksum.txt && \ ./build-android.sh --boost=1.77.0 --arch=$2 --target-version=21 \ --with-libraries=atomic,chrono,container,date_time,exception,filesystem,serialization,system,thread \ - $1 && \ + $1 + mv build/out/$2 ../build diff --git a/vendor/cryptopp/android-build.sh b/vendor/cryptopp/android-build.sh index 6aedfb17..c7ecf385 100755 --- a/vendor/cryptopp/android-build.sh +++ b/vendor/cryptopp/android-build.sh @@ -1,14 +1,19 @@ #!/usr/bin/env bash +set -e + if [ -f "vendor_cryptopp/build/$2/libcryptopp.a" ]; then echo "Crypto++ already built for $2"; exit 0; fi -export ANDROID_NDK_ROOT=$1 && \ -cd vendor_cryptopp && \ -make clean && \ -mkdir -p build/$2 && \ -source TestScripts/setenv-android.sh 21 $2 && \ -make -f GNUmakefile-cross static && \ +exec 9>/var/tmp/libcryfs-cryptopp.lock +flock 9 + +export ANDROID_NDK_ROOT=$1 +cd vendor_cryptopp +make clean +mkdir -p build/$2 +source TestScripts/setenv-android.sh 21 $2 +make -f GNUmakefile-cross static mv libcryptopp.a build/$2