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.
This commit is contained in:
agw
2026-09-03 21:20:00 +02:00
parent d95597e945
commit 2d5b6a8a0d
2 changed files with 19 additions and 6 deletions
+9 -2
View File
@@ -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
+10 -4
View File
@@ -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"
}