From 6e408b8a2a54b814cd23868e9ea3b14f6021b914 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= Date: Fri, 10 Dec 2021 14:01:01 -0300 Subject: [PATCH] maxima: use a shared lib --- .../maxima/patches/use-shared-library.patch | 21 ++++++++ srcpkgs/maxima/template | 50 +++++++++++++------ 2 files changed, 55 insertions(+), 16 deletions(-) create mode 100644 srcpkgs/maxima/patches/use-shared-library.patch diff --git a/srcpkgs/maxima/patches/use-shared-library.patch b/srcpkgs/maxima/patches/use-shared-library.patch new file mode 100644 index 0000000000..a8f986ac70 --- /dev/null +++ b/srcpkgs/maxima/patches/use-shared-library.patch @@ -0,0 +1,21 @@ +--- a/src/maxima.system 2021-12-02 00:26:23.955984864 -0300 ++++ b/src/maxima.system 2021-12-02 00:31:22.299541969 -0300 +@@ -87,13 +87,15 @@ + (let ((obj (mapcar #'(lambda (p) + ;; Convert dir/foo.fas to dir/foo.o + (make-pathname :type "o" :defaults p)) +- files))) +- (c::build-fasl "binary-ecl/maxima" :lisp-files obj ++ files)) ++ (lib '("binary-ecl/libmaxima-ecl.so"))) ++ (c::build-shared-library "binary-ecl/maxima-ecl" :lisp-files obj) ++ (c::build-fasl "binary-ecl/maxima" :lisp-files lib + :ld-flags + (let ((x (symbol-value (find-symbol "*AUTOCONF-LD-FLAGS*" + (find-package "MAXIMA"))))) + (if (and x (not (string= x ""))) (split-string x)))) +- (c::build-program "binary-ecl/maxima" :lisp-files obj ++ (c::build-program "binary-ecl/maxima" :lisp-files lib + :ld-flags + (let ((x (symbol-value (find-symbol "*AUTOCONF-LD-FLAGS*" + (find-package "MAXIMA"))))) diff --git a/srcpkgs/maxima/template b/srcpkgs/maxima/template index 798b4f9f00..1a4bec0dba 100644 --- a/srcpkgs/maxima/template +++ b/srcpkgs/maxima/template @@ -4,7 +4,7 @@ version=5.45.1 revision=2 build_style=gnu-configure configure_args="$(vopt_enable clisp) $(vopt_enable sbcl sbcl-exec) $(vopt_enable ecl)" -hostmakedepends="python3 perl emacs texinfo" +hostmakedepends="python3 perl emacs texinfo patchelf" makedepends="$(vopt_if clisp clisp) $(vopt_if sbcl sbcl) $(vopt_if ecl ecl)" depends="$(vopt_if clisp clisp) rlwrap" checkdepends="gnuplot" @@ -24,6 +24,29 @@ desc_option_ecl="Build with ECL" build_options_default="sbcl ecl" vopt_conflict clisp sbcl +post_build() { + if [ "$build_option_ecl" ]; then + # everything will go in the same directory, use rpath=$ORIGIN + patchelf --remove-rpath src/binary-ecl/libmaxima-ecl.so + patchelf --set-rpath \$ORIGIN \ + src/binary-ecl/{maxima,maxima.fas} + patchelf \ + --replace-needed binary-ecl/libmaxima-ecl.so libmaxima-ecl.so \ + src/binary-ecl/{maxima,maxima.fas} + fi +} + +do_check() { + if [ "$build_option_ecl" ]; then + echo "Check that maxima.fas works" + ecl --eval "(require 'maxima \"src/binary-ecl/maxima.fas\")" \ + --eval "(quit)" + fi + + # now run the testsuite + make ${makejobs} check +} + post_install() { vmkdir usr/share/doc ln -sf ../maxima/${version}/doc ${DESTDIR}/usr/share/doc/maxima @@ -68,25 +91,20 @@ xmaxima_package() { } } -subpackages="maxima-src maxima-emacs xmaxima" - -if [ "$build_option_ecl" ]; then - subpackages+=" maxima-ecl" -fi - maxima-ecl_package() { short_desc+=" - compiled with ECL" depends="${sourcepkg}-${version}_${revision}" pkg_install() { - # this is /usr/lib/ecl-${ecl_version} - # ideally we would just place it in /usr/lib/ecl but this - # doesn't just work - # Maybe we can have the ecl package ship a symlink: - # /usr/lib/ecl -> /usr/lib/ecl-${ecl_version} - # and have this package just install in /usr/lib/ecl + BINARY_ECL=/usr/lib/maxima/${version}/binary-ecl + vmove ${BINARY_ECL} + vinstall src/binary-ecl/libmaxima-ecl.so 755 ${BINARY_ECL} + vinstall src/binary-ecl/maxima.fas 755 ${BINARY_ECL} + + # symlink maxima.fas in ECLDIR ECLDIR=$(ecl -eval "(princ (SI:GET-LIBRARY-PATHNAME))" -eval "(quit)") - vmkdir $ECLDIR - vinstall src/binary-ecl/maxima.fas 755 $ECLDIR - vmove usr/lib/maxima/${version}/binary-ecl + vmkdir ${ECLDIR} + ln -sr ${PKGDESTDIR}/${BINARY_ECL}/maxima.fas ${PKGDESTDIR}/${ECLDIR} } } + +subpackages="maxima-src maxima-emacs xmaxima $(vopt_if ecl maxima-ecl)"