install-build-deps.sh has --dont-install and --platform options.

All docker files do not call isntall-build-deps.sh. Instead, cmake passes
REQUIREDPKGS to Dockerfiles, which is derived from the output of
./scripts/install-build-deps.sh --dont-install --platform PLATFORM.
This change enables caching package installaion during docker build.
This commit is contained in:
Ryo Nakamura
2024-02-11 14:04:43 +09:00
parent d819f715c8
commit 45ba6b077e
12 changed files with 122 additions and 87 deletions

View File

@@ -3,34 +3,71 @@
# Install build dpenedencies.
set -e
set -u
#set -u
function print_help() {
echo "$0 [options]"
echo " --dont-install Print required packages."
echo " --platform [PLATFORM] PLATFORM is Kernel-ID, e.g., Linux-ubuntu."
echo " Automatically detected if not specified."
}
platform=$(uname -s)
doinstall=1
if [ -e /etc/os-release ]; then
source /etc/os-release
platform=${platform}-${ID}
fi
set -x
while getopts h-: opt; do
optarg="${!OPTIND}"
[[ "$opt" = - ]] && opt="-$OPTARG"
case "-${opt}" in
--dont-install)
doinstall=0
;;
--platform)
platform=$optarg
shift
;;
-h)
print_help
exit 0
;;
*)
print_help
exit 1
;;
esac
done
case $platform in
Darwin)
brew install openssl@1.1
cmd="brew install"
pkgs="openssl@1.1"
;;
Linux-ubuntu*)
apt-get install --no-install-recommends -y \
gcc make cmake zlib1g-dev libssl-dev libkrb5-dev
cmd="apt-get install --no-install-recommends -y"
pkgs="gcc make cmake zlib1g-dev libssl-dev libkrb5-dev"
;;
Linux-centos* | Linux-rhel* | Linux-rocky* | Linux-almalinux)
yum install -y \
gcc make cmake zlib-devel openssl-devel rpm-build
cmd="yum install -y"
pkgs="gcc make cmake zlib-devel openssl-devel rpm-build"
;;
FreeBSD-freebsd)
pkg install cmake
cmd="pkg install"
pkgs="cmake"
;;
*)
echo "unsupported platform: $platform"
exit 1
;;
esac
if [ $doinstall -gt 0 ]; then
echo do "$cmd $pkgs"
$cmd $pkgs
else
echo $pkgs
fi