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" }