From 2d5b6a8a0d6819ce1d6aa9cb757a2ee161d11cd8 Mon Sep 17 00:00:00 2001 From: agw Date: Thu, 3 Sep 2026 21:20:00 +0200 Subject: [PATCH] Keep the bundled R on the rpath, and stop makepkg tidying the tree First run of the actual binary: ldd reported 'libR.so => not found'. patchelf --set-rpath replaces the existing rpath rather than appending, so setting it to $PREFIX/lib discarded the -Wl,-rpath the build had given the JASP binary for the bundled R. Every other bundled library resolved; only R went missing, because libR.so/libRblas.so/libRlapack.so live under R/lib/R/lib rather than in the bundled lib directory. The rpath now lists both. Two smaller things the same run surfaced: - makepkg ran its tidying steps on a tree that was already built and verified - removing libtool and static library files, purging, compressing man pages. For a -bin package that is a difference between what was tested and what gets installed. All of them are now disabled. - /opt/jasp-desktop/bin/JASP was not on PATH; the package now symlinks /usr/bin/jasp. --- build/bundle-libs.sh | 11 +++++++++-- packaging/PKGBUILD.in | 14 ++++++++++---- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/build/bundle-libs.sh b/build/bundle-libs.sh index 03aaa1c..ffb4cb4 100755 --- a/build/bundle-libs.sh +++ b/build/bundle-libs.sh @@ -95,11 +95,18 @@ chmod u+w "$LIBDIR"/*.so* 2>/dev/null || true # An absolute rpath is safe here because the tarball always unpacks to $PREFIX; # it avoids $ORIGIN arithmetic across bin/, R/lib/R/lib/ and the per-package # libs/ directories, which all sit at different depths. -echo ":: setting rpath on ELF objects" +# +# Both directories must be listed. patchelf --set-rpath *replaces* the existing +# rpath rather than appending to it, so setting only $PREFIX/lib discards the +# -Wl,-rpath the build gave the JASP binary for the bundled R and leaves +# "libR.so => not found". libR.so, libRblas.so and libRlapack.so live under +# R/lib/R/lib, not in the bundled lib directory. +RPATH="${PREFIX}/lib:${PREFIX}/R/lib/R/lib" +echo ":: setting rpath to ${RPATH}" patched=0 for obj in "${elf_files[@]}" "$LIBDIR"/*.so*; do [[ -f "$obj" ]] || continue - if patchelf --set-rpath "${PREFIX}/lib" "$obj" 2>/dev/null; then + if patchelf --set-rpath "$RPATH" "$obj" 2>/dev/null; then patched=$((patched + 1)) fi done diff --git a/packaging/PKGBUILD.in b/packaging/PKGBUILD.in index 5a0d7fb..5569f32 100644 --- a/packaging/PKGBUILD.in +++ b/packaging/PKGBUILD.in @@ -44,10 +44,12 @@ depends=( 'fontconfig' 'freetype2' 'libxkbcommon' 'hicolor-icon-theme' ) -# The tarball is a complete /opt + /usr install tree. Stripping would be slow and -# is a good way to break a bundled R plus several hundred compiled R modules; -# the rpath set at build time must also survive untouched. -options=('!strip' '!debug') +# The tarball is a complete, already-verified /opt + /usr install tree, so every +# one of makepkg's tidying steps is unwanted here: they would modify content +# that was tested in exactly this form. Stripping in particular would be slow +# and is a good way to break a bundled R plus several hundred compiled R +# modules, and the rpath set at build time must survive untouched. +options=('!strip' '!debug' '!libtool' '!staticlibs' '!zipman' '!purge' '!emptydirs') source=("jasp-desktop-${pkgver}-${pkgrel}-x86_64.tar.zst::@DOWNLOAD_URL@") sha256sums=('@SHA256@') @@ -55,4 +57,8 @@ sha256sums=('@SHA256@') package() { cp -a "${srcdir}/opt" "${pkgdir}/opt" cp -a "${srcdir}/usr" "${pkgdir}/usr" + + # The application lives under /opt; give it a name on PATH. + install -d "${pkgdir}/usr/bin" + ln -s /opt/jasp-desktop/bin/JASP "${pkgdir}/usr/bin/jasp" }