diff --git a/linux/packages/build_package.sh b/linux/packages/build_package.sh new file mode 100755 index 000000000..558119d16 --- /dev/null +++ b/linux/packages/build_package.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +set -euxo pipefail + +if [[ -d "audacity-offline-dependencies" ]]; then + depsDir=$(readlink -f ./audacity-offline-dependencies) + python3 -m venv conan_env + + source conan_env/bin/activate + pip3 install --no-index --find-links "$depsDir/pip_cache" conan + + export CONAN_USER_HOME="$depsDir/conan_home" + mkdir -p $CONAN_USER_HOME + + conan config home + conan config init + conan config set storage.download_cache="$CONAN_USER_HOME/download_cache" +fi + +cmake -S audacity -B build $@ +cmake --build build -- -j`nproc` + +tar -czf audacity-linux_x86_64.tar.gz -C build/bin . diff --git a/linux/packages/build_packages.sh b/linux/packages/build_packages.sh new file mode 100755 index 000000000..58cff8b7f --- /dev/null +++ b/linux/packages/build_packages.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env bash + +set -euxo pipefail + +scriptLocation=$(dirname "$(readlink -f "$0")") +audacityLocation=$(readlink -f "$scriptLocation/../..") +workDir="$scriptLocation/work_dir" + +mkdir -p "$workDir" + +pushd "$workDir" + +tar --exclude '.git' \ + --exclude "audacity-sources.tar.gz" \ + -C "$audacityLocation/.." \ + -czf audacity-sources.tar.gz audacity + +for distro in "$@" +do + echo "Building $distro" + + imageName="audacity-packaging-$distro" + + docker build -t $imageName "$scriptLocation/$distro" + docker run -ti --volume=$workDir:/work_dir --rm $imageName prepare + docker run -ti --volume=$workDir:/work_dir --rm --network none $imageName build + docker run -ti --volume=$workDir:/work_dir --rm --network none $imageName package +done + +rm audacity-sources.tar.gz + +popd + +cp -r $workDir/* ./ +rm -R "$workDir" diff --git a/linux/packages/prepare_offline_dependencies.sh b/linux/packages/prepare_offline_dependencies.sh new file mode 100755 index 000000000..40010fd40 --- /dev/null +++ b/linux/packages/prepare_offline_dependencies.sh @@ -0,0 +1,62 @@ +#!/usr/bin/env bash + +# Usage prepare_offline_environment.sh cmake-options... + +set -euxo pipefail + +packageName="audacity-offline-dependencies" +scriptLocation=$(dirname "$(readlink -f "$0")") +audacityLocation=$(readlink -f "$scriptLocation/../..") +resultsLocation=$(pwd) +packageLocation="$resultsLocation/$packageName" + +echo "Audacity location: $audacityLocation" +echo "Result location: $resultsLocation" + +mkdir -p $packageLocation + +cd $packageLocation + +# Create pip download cache containing all the +# packages requiredf to istall Conan + +mkdir -p pip_cache + +pushd pip_cache + + pip3 download conan + +popd + +# Cache all Conan dependencies + +mkdir -p temp + +pushd temp + python3 -m venv conan_env + + source conan_env/bin/activate + pip3 install --no-index --find-links "$packageLocation/pip_cache" conan + + export CONAN_USER_HOME="$packageLocation/conan_home" + mkdir -p $CONAN_USER_HOME + + conan config home + conan config init + conan config set storage.download_cache="$CONAN_USER_HOME/download_cache" + + # Configure Audacity so we can collect the required + # packages. + + cmake ${@} $audacityLocation + + conan remove "*" --src --builds --packages --force +popd + +rm -R temp + +cd $resultsLocation + +tar -czf "$packageName.tar.gz" $packageName + +rm -R $packageLocation