build-release.sh: do make -j inside docker image.

Defaults to nproc, but you can set MAKEPAR=N to override it.

Timings on my laptop are only a little better, because Rust.

Before:
	time tools/build-release.sh bin-Fedora bin-Ubuntu
	...
	real	33m17.104s
	user	0m4.259s
	sys	0m3.605s

After:
	time tools/build-release.sh bin-Fedora bin-Ubuntu
	...
	real	25m25.556s
	user	0m4.297s
	sys	0m3.743s

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2025-09-04 13:40:59 +09:30
committed by ShahanaFarooqui
parent b77d648630
commit b0a9b55e65
2 changed files with 10 additions and 5 deletions

View File

@@ -8,6 +8,7 @@ if [ "$1" = "--inside-docker" ]; then
PLTFM="$3"
PLTFMVER="$4"
ARCH="$5"
MAKEPAR="$6"
git config --global --add safe.directory /src/.git
git clone /src /build
cd /build || exit
@@ -15,8 +16,8 @@ if [ "$1" = "--inside-docker" ]; then
uv export --format requirements.txt > /tmp/requirements.txt
uv pip install -r /tmp/requirements.txt
./configure
uv run make VERSION="$VER"
uv run make install DESTDIR=/"$VER-$PLTFM-$PLTFMVER-$ARCH" RUST_PROFILE=release
uv run make -j"$MAKEPAR" VERSION="$VER"
uv run make -j"$MAKEPAR" install DESTDIR=/"$VER-$PLTFM-$PLTFMVER-$ARCH" RUST_PROFILE=release
cd /"$VER-$PLTFM-$PLTFMVER-$ARCH" && tar cvfz /release/clightning-"$VER-$PLTFM-$PLTFMVER-$ARCH".tar.gz -- *
echo "Inside docker: build finished"
exit 0
@@ -97,6 +98,9 @@ if [ -z "$MTIME" ]; then
exit 1
fi
MAKEPAR=${MAKEPAR:-$(nproc)}
echo "Parallel: $MAKEPAR"
if [ "$VERIFY_RELEASE" = "true" ]; then
if [ -f "SHA256SUMS-$VERSION.asc" ] && [ -f "SHA256SUMS-$VERSION" ]; then
ALL_TARGETS="bin-Ubuntu"
@@ -165,7 +169,7 @@ for target in $TARGETS; do
DOCKERFILE=contrib/docker/Dockerfile.builder.fedora
FEDORA_VERSION=$(grep -oP '^FROM fedora:\K[0-9]+' "$DOCKERFILE")
docker build -f $DOCKERFILE -t $TAG --load .
docker run --rm=true -v "$(pwd)":/src:ro -v "$RELEASEDIR":/release $TAG /src/tools/build-release.sh --inside-docker "$VERSION" "$platform" "$FEDORA_VERSION" "$ARCH"
docker run --rm=true -v "$(pwd)":/src:ro -v "$RELEASEDIR":/release $TAG /src/tools/build-release.sh --inside-docker "$VERSION" "$platform" "$FEDORA_VERSION" "$ARCH" "$MAKEPAR"
docker run --rm=true -w /build $TAG rm -rf /"$VERSION-$platform-$FEDORA_VERSION-$ARCH" /build
echo "Fedora Image Built"
;;

View File

@@ -56,6 +56,7 @@ fi
ARCH=$(dpkg --print-architecture)
PLATFORM="$OS"-"$VER"
VERSION=${FORCE_VERSION:-$(git describe --tags --always --dirty=-modded --abbrev=7 2>/dev/null || pwd | sed -n 's,.*/clightning-\(v[0-9.rc\-]*\)$,\1,p')}
MAKEPAR=${MAKEPAR:-1}
# eg. ## [0.6.3] - 2019-01-09: "The Smallblock Conspiracy"
# Skip 'v' here in $VERSION
@@ -160,8 +161,8 @@ $INST $(cut -c66- < /tmp/SHASUMS)
# Once everyone has gcc8, we can use CC="gcc -ffile-prefix-map=$(pwd)=/home/clightning"
./configure --prefix=/usr CC="gcc -fdebug-prefix-map=$(pwd)=/home/clightning"
# libwally wants "python". Seems to work to force it here.
make PYTHON_VERSION=3 VERSION="$VERSION"
make install DESTDIR=inst/
make -j"$MAKEPAR" PYTHON_VERSION=3 VERSION="$VERSION"
make -j"$MAKEPAR" install DESTDIR=inst/
cd inst && tar --sort=name \
--mtime="$MTIME 00:00Z" \