1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-13 15:17:42 +02:00

Add a framework to generate offline dependencies

`prepare_offline_dependencies.sh` will generate a tarball containing:

* Files required for PIP to install Conan
* Conan download cache

The resulting tarball content depends on CMake flags passed down
to the script.

`build_package.sh` demonstrates how to use the offline dependecies
to build Audacity. The script requires the exact CMake options that were
provided to `prepare_offline_dependencies.sh`

`build_packages.sh` allows validating the build process for different
Linux distros. It uses Docker to:

* Generate the dependencies tarball.
* Execute an offline build using `build_package.sh`.
* Generate distro specific packages, offline as well.
This commit is contained in:
Dmitry Vedenko 2021-07-30 18:52:25 +03:00 committed by Dmitry Vedenko
parent b25e3b767f
commit cf328b9d87
3 changed files with 120 additions and 0 deletions

23
linux/packages/build_package.sh Executable file
View File

@ -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 .

View File

@ -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"

View File

@ -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