Skip to content

Commit b0a9b55

Browse files
rustyrussellShahanaFarooqui
authored andcommitted
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 <[email protected]>
1 parent b77d648 commit b0a9b55

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

tools/build-release.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,16 @@ if [ "$1" = "--inside-docker" ]; then
88
PLTFM="$3"
99
PLTFMVER="$4"
1010
ARCH="$5"
11+
MAKEPAR="$6"
1112
git config --global --add safe.directory /src/.git
1213
git clone /src /build
1314
cd /build || exit
1415
uv venv
1516
uv export --format requirements.txt > /tmp/requirements.txt
1617
uv pip install -r /tmp/requirements.txt
1718
./configure
18-
uv run make VERSION="$VER"
19-
uv run make install DESTDIR=/"$VER-$PLTFM-$PLTFMVER-$ARCH" RUST_PROFILE=release
19+
uv run make -j"$MAKEPAR" VERSION="$VER"
20+
uv run make -j"$MAKEPAR" install DESTDIR=/"$VER-$PLTFM-$PLTFMVER-$ARCH" RUST_PROFILE=release
2021
cd /"$VER-$PLTFM-$PLTFMVER-$ARCH" && tar cvfz /release/clightning-"$VER-$PLTFM-$PLTFMVER-$ARCH".tar.gz -- *
2122
echo "Inside docker: build finished"
2223
exit 0
@@ -97,6 +98,9 @@ if [ -z "$MTIME" ]; then
9798
exit 1
9899
fi
99100

101+
MAKEPAR=${MAKEPAR:-$(nproc)}
102+
echo "Parallel: $MAKEPAR"
103+
100104
if [ "$VERIFY_RELEASE" = "true" ]; then
101105
if [ -f "SHA256SUMS-$VERSION.asc" ] && [ -f "SHA256SUMS-$VERSION" ]; then
102106
ALL_TARGETS="bin-Ubuntu"
@@ -165,7 +169,7 @@ for target in $TARGETS; do
165169
DOCKERFILE=contrib/docker/Dockerfile.builder.fedora
166170
FEDORA_VERSION=$(grep -oP '^FROM fedora:\K[0-9]+' "$DOCKERFILE")
167171
docker build -f $DOCKERFILE -t $TAG --load .
168-
docker run --rm=true -v "$(pwd)":/src:ro -v "$RELEASEDIR":/release $TAG /src/tools/build-release.sh --inside-docker "$VERSION" "$platform" "$FEDORA_VERSION" "$ARCH"
172+
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"
169173
docker run --rm=true -w /build $TAG rm -rf /"$VERSION-$platform-$FEDORA_VERSION-$ARCH" /build
170174
echo "Fedora Image Built"
171175
;;

tools/repro-build.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ fi
5656
ARCH=$(dpkg --print-architecture)
5757
PLATFORM="$OS"-"$VER"
5858
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')}
59+
MAKEPAR=${MAKEPAR:-1}
5960

6061
# eg. ## [0.6.3] - 2019-01-09: "The Smallblock Conspiracy"
6162
# Skip 'v' here in $VERSION
@@ -160,8 +161,8 @@ $INST $(cut -c66- < /tmp/SHASUMS)
160161
# Once everyone has gcc8, we can use CC="gcc -ffile-prefix-map=$(pwd)=/home/clightning"
161162
./configure --prefix=/usr CC="gcc -fdebug-prefix-map=$(pwd)=/home/clightning"
162163
# libwally wants "python". Seems to work to force it here.
163-
make PYTHON_VERSION=3 VERSION="$VERSION"
164-
make install DESTDIR=inst/
164+
make -j"$MAKEPAR" PYTHON_VERSION=3 VERSION="$VERSION"
165+
make -j"$MAKEPAR" install DESTDIR=inst/
165166

166167
cd inst && tar --sort=name \
167168
--mtime="$MTIME 00:00Z" \

0 commit comments

Comments
 (0)