gnu: libgpg-error: Refactor package arguments.

* gnu/packages/gnupg.scm (libgpg-error)[arguments]: Move the
configure-flags to be always applied and make the adjustments to the
build phases be the only conditional part.  Remove unneeded module
imports.

Change-Id: I7eb3950e00e78071a148569cb3705e8a2866d0b6
This commit is contained in:
Efraim Flashner 2024-01-24 11:50:43 +02:00 committed by Ludovic Courtès
parent 70e8752020
commit 7990d6db4d
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -105,61 +105,52 @@ (define-public libgpg-error
"1nwvpg5inpjzbq7r6wqsgmwcnfqyahcw9hi8discqvmrcq4nfg4y")))) "1nwvpg5inpjzbq7r6wqsgmwcnfqyahcw9hi8discqvmrcq4nfg4y"))))
(build-system gnu-build-system) (build-system gnu-build-system)
(arguments (arguments
(cond (list
((%current-target-system) #:configure-flags #~(list "--enable-install-gpg-error-config")
(list #:phases
#:modules '((guix build gnu-build-system) #~(modify-phases %standard-phases
(guix build utils)) #$@(cond
#:configure-flags #~(list "--enable-install-gpg-error-config") ((%current-target-system)
#:phases ;; If this is left out, some generated header
#~(modify-phases %standard-phases ;; files will be sprinkled with \c, which
;; If this is left out, some generated header ;; the compiler won't like.
;; files will be sprinkled with \c, which #~((add-after 'unpack 'fix-gen-lock-obj.sh
;; the compiler won't like. (lambda _
(add-after 'unpack 'fix-gen-lock-obj.sh (substitute* "src/gen-lock-obj.sh"
(lambda _ (("if test -n `echo -n`") "if ! test -n `echo -n`"))))
(substitute* "src/gen-lock-obj.sh" ;; When cross-compiling, some platform specific properties cannot
(("if test -n `echo -n`") "if ! test -n `echo -n`")))) ;; be detected. Create a symlink to the appropriate platform
;; When cross-compiling, some platform specific properties cannot ;; file if required. Note that these platform files depend on
;; be detected. Create a symlink to the appropriate platform ;; both the operating system and architecture!
;; file if required. Note that these platform files depend on ;;
;; both the operating system and architecture! ;; See Cross-Compiling section at:
;; ;; https://github.com/gpg/libgpg-error/blob/master/README
;; See Cross-Compiling section at: (add-after 'unpack 'cross-symlinks
;; https://github.com/gpg/libgpg-error/blob/master/README (lambda _
(add-after 'unpack 'cross-symlinks (define (link triplet source)
(lambda _ (symlink (string-append "lock-obj-pub." triplet ".h")
(define (link triplet source) (string-append "src/syscfg/lock-obj-pub."
(symlink (string-append "lock-obj-pub." triplet ".h") source ".h")))
(string-append "src/syscfg/lock-obj-pub." #$(let ((target (%current-target-system)))
source ".h"))) (cond ((target-linux? target)
#$(let ((target (%current-target-system))) (match (string-take target
(cond ((target-linux? target) (string-index target #\-))
(match (string-take target ("armhf"
(string-index target #\-)) `(link "arm-unknown-linux-gnueabi" "linux-gnu"))
("armhf" ("mips64el"
`(link "arm-unknown-linux-gnueabi" "linux-gnu")) `(link "mips-unknown-linux-gnu" "linux-gnu"))
("mips64el" ;; Don't always link to the "linux-gnu"
`(link "mips-unknown-linux-gnu" "linux-gnu")) ;; configuration, as this is not correct for
;; Don't always link to the "linux-gnu" ;; all architectures.
;; configuration, as this is not correct for (_ #t)))
;; all architectures. (#t #t)))))))
(_ #t))) ((system-hurd?)
(#t #t)))))))) #~((add-after 'unpack 'skip-tests
((system-hurd?) (lambda _
(list (substitute* "tests/t-syserror.c"
#:configure-flags #~(list "--enable-install-gpg-error-config") (("(^| )main *\\(.*" all)
#:phases (string-append all "{\n exit (77);//")))))))
#~(modify-phases %standard-phases (else #~())))))
(add-after 'unpack 'skip-tests
(lambda _
(substitute*
"tests/t-syserror.c"
(("(^| )main *\\(.*" all)
(string-append all "{\n exit (77);//"))))))))
(else
(list
#:configure-flags #~(list "--enable-install-gpg-error-config")))))
(native-inputs (list gettext-minimal)) (native-inputs (list gettext-minimal))
(home-page "https://gnupg.org") (home-page "https://gnupg.org")
(synopsis "Library of error values for GnuPG components") (synopsis "Library of error values for GnuPG components")