contrib: also patchelf the 'liana-cli' binary

This commit is contained in:
Antoine Poinsot 2023-02-01 14:49:27 +01:00
parent 46de2e07a8
commit 81aa0c7d8e
No known key found for this signature in database
GPG Key ID: E13FC145CD3F4304
3 changed files with 20 additions and 12 deletions

View File

@ -35,11 +35,19 @@ RUSTC_BOOTSTRAP=1 cargo -vvv \
--release \
--target-dir "/out"
# 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 "/out/release/$BINARY_NAME"
if [ "$IS_GUI" = "1" ]; then
BIN_NAMES="liana-gui"
else
BIN_NAMES="lianad liana-cli"
fi
# FIXME: Find a way to use GUIX_LD_WRAPPER_DISABLE_RPATH=yes instead
patchelf --remove-rpath "/out/release/$BINARY_NAME"
for bin_name in $BIN_NAMES; do
# 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 "/out/release/$bin_name"
# FIXME: Find a way to use GUIX_LD_WRAPPER_DISABLE_RPATH=yes instead
patchelf --remove-rpath "/out/release/$bin_name"
done
set +ex

View File

@ -104,9 +104,9 @@ for project_folder in "" "gui"; do
# FIXME: find a cleaner way to get the binary name, or get rid of patchelf entirely
# Note: we also rely on it in manifest.scm
if [ "$project_folder" = "" ]; then
BINARY_NAME="lianad"
IS_GUI=0
elif [ "$project_folder" = "gui" ]; then
BINARY_NAME="liana-gui"
IS_GUI=1
else
echo "Can't determine binary name"
exit 1
@ -114,10 +114,10 @@ for project_folder in "" "gui"; do
# Bootstrap a reproducible environment as specified by the manifest in an isolated
# container, and build the project.
# NOTE: it looks like "--rebuild-cache" is necessary for the BINARY_NAME variable to
# NOTE: it looks like "--rebuild-cache" is necessary for the IS_GUI variable to
# be taken into account when building the container (otherwise the GUI container could
# miss some dependencies).
BINARY_NAME="$BINARY_NAME" time_machine shell --no-cwd \
IS_GUI="$IS_GUI" time_machine shell --no-cwd \
--expose="$PROJECT_ROOT/src=/liana/src" \
--expose="$PWD/gui/static=/liana/static" \
--expose="$PROJECT_ROOT/Cargo.toml=/liana/Cargo.toml" \
@ -131,7 +131,7 @@ for project_folder in "" "gui"; do
--fallback \
--rebuild-cache \
-m $PWD/contrib/reproducible/guix/manifest.scm \
-- env CC=gcc VENDOR_DIR="$PROJECT_VENDOR_DIR" TARGET_DIR="$PROJECT_OUT_DIR" BINARY_NAME="$BINARY_NAME" JOBS="$JOBS" \
-- env CC=gcc VENDOR_DIR="$PROJECT_VENDOR_DIR" TARGET_DIR="$PROJECT_OUT_DIR" IS_GUI="$IS_GUI" JOBS="$JOBS" \
/bin/sh -c "cd /liana && ./build.sh"
done

View File

@ -6,9 +6,9 @@
"patchelf"
"gcc-toolchain@10.3.0")
;; Additional dependencies for building the GUI
(let ((binary_name (getenv "BINARY_NAME")))
(let ((is_gui (getenv "IS_GUI")))
(if
(string=? binary_name "liana-gui")
(string=? is_gui "1")
(list "pkg-config"
"eudev"
"fontconfig")