gnu: gap: Enable xgap package.

* gnu/packages/algebra.scm (gap)[inputs]: Add libx11, libxaw, and libxt.
[arguments]<phases>{prepare-package-source}: Substitute paths and modify
configuration.
{remove-packages}: Do not remove xgap.
{install-packages}: Add a symlink from bin/ to xgap.sh.

Change-Id: I9466fdb3f469325f7229de210b88d371c2839504
This commit is contained in:
Andreas Enge 2025-02-20 15:49:19 +01:00
parent 90aa90eb05
commit 82be68a42b
No known key found for this signature in database
GPG key ID: F7D5C9BF765C61E3

View file

@ -1362,6 +1362,7 @@ xtensor provides:
(list gmp readline zlib (list gmp readline zlib
cddlib ; for the cddinterface package cddlib ; for the cddinterface package
curl ; for the curlinterface package curl ; for the curlinterface package
libx11 libxaw libxt ; for the xgap package
zeromq ; for the zeromqinterface package zeromq ; for the zeromqinterface package
)) ))
(arguments (arguments
@ -1374,8 +1375,23 @@ xtensor provides:
(with-directory-excursion "pkg" (with-directory-excursion "pkg"
;; Unpack package tarball, so that shebangs can be modified. ;; Unpack package tarball, so that shebangs can be modified.
(with-directory-excursion "caratinterface" (with-directory-excursion "caratinterface"
(invoke "tar" "xvf" "carat.tgz"))))) (invoke "tar" "xvf" "carat.tgz"))
;; The following phases are added after 'build, apparently in ;; Replace paths and adapt configuration.
(with-directory-excursion "xgap"
(substitute* '("Makefile.in" "cnf/Makegap.in")
(("/bin/sh")
(string-append
(assoc-ref %build-inputs "bash") "/bin/bash")))
(substitute* "xgap.sh.in"
(("\"@gapdir@\"")
(string-append %output "/share/gap"))
(("^XGAP=.*$")
(string-append "XGAP=" %output
"/share/gap/pkg/xgap/bin/$XGAP_PRG\n"))
(("^GAP=.*$")
(string-append "GAP=" %output "/bin/gap\n"))
(("VERBOSE=\"NO\"") "VERBOSE=\"YES\""))))))
;; The following phases are executed after 'build, apparently in
;; reverse order. So we carry out 'build, then 'build-doc, then ;; reverse order. So we carry out 'build, then 'build-doc, then
;; 'remove-packages, then 'build-packages. ;; 'remove-packages, then 'build-packages.
(add-after 'build 'build-packages (add-after 'build 'build-packages
@ -1391,8 +1407,7 @@ xtensor provides:
(with-directory-excursion "pkg" (with-directory-excursion "pkg"
(for-each delete-file-recursively (for-each delete-file-recursively
'("normalizinterface" ; tries to download normaliz even when it is available '("normalizinterface" ; tries to download normaliz even when it is available
"semigroups" ; bundled dependencies "semigroups" ; bundled dependency libsemigroups
"xgap" ; make: /bin/sh: No such file or directory
))))) )))))
(add-after 'build 'build-doc (add-after 'build 'build-doc
;; The documentation is bundled, but we create it from source. ;; The documentation is bundled, but we create it from source.
@ -1407,8 +1422,13 @@ xtensor provides:
(add-after 'install 'install-packages (add-after 'install 'install-packages
(lambda* (#:key outputs #:allow-other-keys) (lambda* (#:key outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out")) (let* ((out (assoc-ref outputs "out"))
(share (string-append out "/share/gap"))) (bin (string-append out "/bin"))
(copy-recursively "pkg" (string-append share "/pkg")))))))) (share (string-append out "/share/gap"))
(xgap-sh (string-append share "/pkg/xgap/xgap.sh"))
(xgap (string-append bin "/xgap")))
(copy-recursively "pkg" (string-append share "/pkg"))
(chmod xgap-sh #o744)
(symlink xgap-sh xgap)))))))
(home-page "https://www.gap-system.org/") (home-page "https://www.gap-system.org/")
(synopsis (synopsis
"System for computational group theory") "System for computational group theory")