libgpg-error: Prevent silent miscompilation some systems.
* gnu/packages/gpg.scm (libgpgerror)[arguments]<#:phases>{cross-symlinks}: Only link to src/syscfg/lock-obj-pub.linux-gnu.h if the package is being compiled for a Linux target. Do not link either if the architecture is unknown, as the headers vary with the architecture. Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>master
parent
e444cf3ef4
commit
deb4f0a595
|
@ -18,6 +18,7 @@
|
||||||
;;; Copyright © 2018 Björn Höfling <bjoern.hoefling@bjoernhoefling.de>
|
;;; Copyright © 2018 Björn Höfling <bjoern.hoefling@bjoernhoefling.de>
|
||||||
;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
|
;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
|
||||||
;;; Copyright © 2020 Fredrik Salomonsson <plattfot@posteo.net>
|
;;; Copyright © 2020 Fredrik Salomonsson <plattfot@posteo.net>
|
||||||
|
;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
|
||||||
;;;
|
;;;
|
||||||
;;; This file is part of GNU Guix.
|
;;; This file is part of GNU Guix.
|
||||||
;;;
|
;;;
|
||||||
|
@ -77,6 +78,7 @@
|
||||||
#:use-module (guix build-system gnu)
|
#:use-module (guix build-system gnu)
|
||||||
#:use-module (guix build-system perl)
|
#:use-module (guix build-system perl)
|
||||||
#:use-module (guix build-system python)
|
#:use-module (guix build-system python)
|
||||||
|
#:use-module (ice-9 match)
|
||||||
#:use-module (srfi srfi-1))
|
#:use-module (srfi srfi-1))
|
||||||
|
|
||||||
(define-public libgpg-error
|
(define-public libgpg-error
|
||||||
|
@ -94,27 +96,37 @@
|
||||||
(build-system gnu-build-system)
|
(build-system gnu-build-system)
|
||||||
(arguments
|
(arguments
|
||||||
(if (%current-target-system)
|
(if (%current-target-system)
|
||||||
`(#:modules ((ice-9 match)
|
`(#:modules ((guix build gnu-build-system)
|
||||||
(guix build gnu-build-system)
|
|
||||||
(guix build utils))
|
(guix build utils))
|
||||||
#:phases
|
#:phases
|
||||||
(modify-phases %standard-phases
|
(modify-phases %standard-phases
|
||||||
;; When cross-compiling, some platform specific properties cannot
|
;; When cross-compiling, some platform specific properties cannot
|
||||||
;; be detected. Create a symlink to the appropriate platform
|
;; be detected. Create a symlink to the appropriate platform
|
||||||
;; file. See Cross-Compiling section at:
|
;; 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
|
;; https://github.com/gpg/libgpg-error/blob/master/README
|
||||||
(add-after 'unpack 'cross-symlinks
|
(add-after 'unpack 'cross-symlinks
|
||||||
(lambda* (#:key target inputs #:allow-other-keys)
|
(lambda _
|
||||||
(let ((triplet
|
(define (link triplet source)
|
||||||
(match (string-take target
|
(symlink (string-append "lock-obj-pub." triplet ".h")
|
||||||
(string-index target #\-))
|
(string-append "src/syscfg/lock-obj-pub."
|
||||||
("armhf" "arm-unknown-linux-gnueabi")
|
source ".h")))
|
||||||
("mips64el" "mips-unknown-linux-gnu")
|
,(let* ((target (%current-target-system))
|
||||||
(x
|
(architecture
|
||||||
(string-append x "-unknown-linux-gnu")))))
|
(string-take target (string-index target #\-))))
|
||||||
(symlink
|
(cond ((target-linux? target)
|
||||||
(string-append "lock-obj-pub." triplet ".h")
|
(match architecture
|
||||||
"src/syscfg/lock-obj-pub.linux-gnu.h"))))))
|
("armhf"
|
||||||
|
`(link "arm-unknown-linux-gnueabi" "linux-gnu"))
|
||||||
|
("mips64el"
|
||||||
|
`(link "mips-unknown-linux-gnu" "linux-gnu"))
|
||||||
|
;; Don't always link to the "linux-gnu"
|
||||||
|
;; configuration, as this is not correct for
|
||||||
|
;; all architectures.
|
||||||
|
(_ #t)))
|
||||||
|
(#t #t)))))))
|
||||||
'()))
|
'()))
|
||||||
(native-inputs `(("gettext" ,gettext-minimal)))
|
(native-inputs `(("gettext" ,gettext-minimal)))
|
||||||
(home-page "https://gnupg.org")
|
(home-page "https://gnupg.org")
|
||||||
|
|
Reference in New Issue