misc: update podman images, add build-all script

This commit is contained in:
Markus F.X.J. Oberhumer 2022-11-27 23:50:22 +01:00
parent 65a2da4b40
commit 8d1a98e03b
7 changed files with 96 additions and 7 deletions

View File

@ -6,10 +6,10 @@ argv0=$0; argv0abs="$(readlink -fn "$argv0")"; argv0dir="$(dirname "$argv0abs")"
# create the image from Dockerfile
# using a rootless Podman container
# NOTE: this image is based on rebuild-stubs-with-upx/upx-stubtools-20210104-v8,
# NOTE: this image is based on rebuild-stubs-with-upx/upx-stubtools-20210104-v10,
# so you have to create that image first
# WARNING: we install many packages, so the resulting image needs A LOT of disk space!
image=upx-cross-compile-20221108-v8
image=upx-cross-compile-20221108-v10
podman build -t "$image" -f "$argv0dir/Dockerfile" "$argv0dir"

View File

@ -6,7 +6,7 @@ argv0=$0; argv0abs="$(readlink -fn "$argv0")"; argv0dir="$(dirname "$argv0abs")"
# run an interactive shell in the image
# using a rootless Podman container
image=upx-cross-compile-20221108-v8
image=upx-cross-compile-20221108-v10
flags=( -ti --read-only --rm )
flags+=( --cap-drop=all ) # drop all capabilities

View File

@ -1,7 +1,8 @@
# NOTE: this image is based on rebuild-stubs-with-upx/upx-stubtools-20210104-v8,
# NOTE: this image is based on rebuild-stubs-with-upx/upx-stubtools-20210104-v10,
# so you have to create that image first
# WARNING: we install many packages, so the resulting image needs A LOT of disk space!
FROM localhost/upx-stubtools-20210104-v8
FROM localhost/upx-stubtools-20210104-v10
ENV UPX_CONTAINER_IMAGE_NAME=upx-cross-compile-20221108-v10
ARG DEBIAN_FRONTEND=noninteractive
USER root

View File

@ -0,0 +1,87 @@
#! /usr/bin/env bash
## vim:set ts=4 sw=4 et:
set -e; set -o pipefail
argv0=$0; argv0abs="$(readlink -fn "$argv0")"; argv0dir="$(dirname "$argv0abs")"
# build UPX for 21 targets; must be run inside the container!
# using a rootless Podman container
# simple sanity check that we are indeed running inside the container
if [[ $UPX_CONTAINER_IMAGE_NAME != upx-cross-compile-* ]]; then
echo "$argv0: NOTE: please run this script *inside* the container"
exit 1
fi
# go to upx top-level directory
cd $argv0dir/../..
pwd
[[ -f src/version.h ]] || exit 1 # sanity check
function run_config_and_build {
# requires: AR CC CXX RANLIB
local toolchain=$1
local cmake_config_flags build_type bdir
# cmake flags
cmake_config_flags=
case $toolchain in
# these old architectures do not support sanitize
alpha-linux-gnu) cmake_config_flags=-DUPX_CONFIG_DISABLE_SANITIZE=ON ;;
hppa-linux-gnu) cmake_config_flags=-DUPX_CONFIG_DISABLE_SANITIZE=ON ;;
# avoid link errors with Windows cross compilers; need to install some more support libs??
i686-w64-mingw32) cmake_config_flags=-DUPX_CONFIG_DISABLE_SANITIZE=ON ;;
x86_64-w64-mingw32) cmake_config_flags=-DUPX_CONFIG_DISABLE_SANITIZE=ON ;;
esac
# for all build types
for build_type in Debug Release; do
bdir=build/cross/$toolchain/${build_type,,}
mkdir -p $bdir
# run_config
if [[ ! -f $bdir/CMakeCache.txt ]]; then
cmake -S . -B $bdir -DCMAKE_BUILD_TYPE=$build_type -DCMAKE_AR=$AR -DCMAKE_RANLIB=$RANLIB $cmake_config_flags
fi
# run_build
cmake --build $bdir --config $build_type --parallel
done
}
# see Dockerfile for packages
for package in \
g++-aarch64-linux-gnu \
g++-alpha-linux-gnu \
g++-arm-linux-gnueabi \
g++-arm-linux-gnueabihf \
g++-hppa-linux-gnu \
g++-i686-linux-gnu \
g++-m68k-linux-gnu \
g++-mips-linux-gnu \
g++-mipsel-linux-gnu \
g++-mips64-linux-gnuabi64 \
g++-mips64el-linux-gnuabi64 \
g++-powerpc-linux-gnu \
g++-powerpc64-linux-gnu \
g++-powerpc64le-linux-gnu \
g++-riscv64-linux-gnu \
g++-s390x-linux-gnu \
g++-sh4-linux-gnu \
g++-sparc64-linux-gnu \
g++-x86-64-linux-gnux32 \
g++-mingw-w64-i686 \
g++-mingw-w64-x86-64
do
# setup toolchain and environment variables
toolchain=$package
toolchain=${toolchain/-x86-64/-x86_64}
toolchain=${toolchain/g++-/}
case $toolchain in
mingw-w64-i686) toolchain=i686-w64-mingw32 ;;
mingw-w64-x86_64) toolchain=x86_64-w64-mingw32 ;;
esac
echo "========== $toolchain"
export AR=/usr/bin/${toolchain}-ar
export CC=/usr/bin/${toolchain}-gcc
export CXX=/usr/bin/${toolchain}-g++
export RANLIB=/usr/bin/${toolchain}-ranlib
ls -l $AR $CC $CXX $RANLIB
run_config_and_build $toolchain
unset AR CC CXX RANLIB
done

View File

@ -6,7 +6,7 @@ argv0=$0; argv0abs="$(readlink -fn "$argv0")"; argv0dir="$(dirname "$argv0abs")"
# create the image from Dockerfile
# using a rootless Podman container
image=upx-stubtools-20210104-v8
image=upx-stubtools-20210104-v10
podman build -t "$image" -f "$argv0dir/Dockerfile" "$argv0dir"

View File

@ -6,7 +6,7 @@ argv0=$0; argv0abs="$(readlink -fn "$argv0")"; argv0dir="$(dirname "$argv0abs")"
# run an interactive shell in the image
# using a rootless Podman container
image=upx-stubtools-20210104-v8
image=upx-stubtools-20210104-v10
flags=( -ti --read-only --rm )
flags+=( --cap-drop=all ) # drop all capabilities

View File

@ -1,4 +1,5 @@
FROM docker.io/library/ubuntu:22.04
ENV UPX_CONTAINER_IMAGE_NAME=upx-stubtools-20210104-v10
ARG DEBIAN_FRONTEND=noninteractive
ENV LANG=C.UTF-8