guix: use patchelf to strip interpreter and RPATH

This commit is contained in:
Antoine Poinsot 2022-12-03 13:03:01 +01:00
parent 3906a1b5bc
commit 940c28d072
No known key found for this signature in database
GPG Key ID: E13FC145CD3F4304
3 changed files with 19 additions and 4 deletions

View File

@ -22,7 +22,6 @@ EOF
# We need to set RUSTC_BOOTSTRAP=1 as a workaround to be able to use unstable
# features in the GUI dependencies
# FIXME: GUIX_LD_WRAPPER_DISABLE_RPATH=yes
RUSTC_BOOTSTRAP=1 cargo -vvv \
--color always \
--frozen \
@ -31,4 +30,11 @@ RUSTC_BOOTSTRAP=1 cargo -vvv \
--release \
--target-dir "$TARGET_DIR"
# Assume 64bits. Even bitcoind doesn't ship 32bits binaries for x86.
# FIXME: is there a cleaner way than using patchelf for this?
patchelf --set-interpreter /lib64/ld-linux-x86-64.so.2 "$TARGET_DIR/release/$BINARY_NAME"
# FIXME: Find a way to use GUIX_LD_WRAPPER_DISABLE_RPATH=yes instead
patchelf --remove-rpath "$TARGET_DIR/release/$BINARY_NAME"
set +ex

View File

@ -101,6 +101,16 @@ for project_folder in "" "gui"; do
sed -i '/checksum/d' "$BUILD_ROOT/Cargo.lock"
fi
# FIXME: find a cleaner way to get the binary name, or get rid of patchelf entirely
if [ "$project_folder" = "" ]; then
BINARY_NAME="lianad"
elif [ "$project_folder" = "gui" ]; then
BINARY_NAME="liana-gui"
else
echo "Can't determine binary name"
exit 1
fi
# Bootstrap a reproducible environment as specified by the manifest in an isolated
# container, and build the project.
time_machine shell --no-cwd \
@ -113,7 +123,7 @@ for project_folder in "" "gui"; do
--share="$PROJECT_OUT_DIR=$PROJECT_OUT_DIR" \
--container \
-m $PWD/contrib/guix/manifest.scm \
-- env CC=gcc VENDOR_DIR="$PROJECT_VENDOR_DIR" TARGET_DIR="$PROJECT_OUT_DIR" \
-- env CC=gcc VENDOR_DIR="$PROJECT_VENDOR_DIR" TARGET_DIR="$PROJECT_OUT_DIR" BINARY_NAME="$BINARY_NAME" \
/bin/sh -c "cd /liana && ./build.sh"
done

View File

@ -5,7 +5,6 @@
"coreutils"
"pkg-config" ;; For the GUI
"eudev" ;; For the GUI
"cmake" ;; For the GUI
"make" ;; For the GUI
"fontconfig" ;; For the GUI
"patchelf"
"gcc-toolchain@10.3.0"))