gnu: mozjs-60: Fix cross-compilation build errors.

Presumably the other versions of mozjs need some changes
as well, but for now only fix mozjs@60, which is a dependency
of polkit.

* gnu/packages/gnuzilla.scm
  (mozjs-60)[arguments]<#:configure-flags>: Set --with-nspr-prefix
  and set --host and --target inappropriately when cross-compiling.
  (mozjs-60)[arguments]<#:phases>{set-PKG_CONFIG}: New phase
  when cross-compiling.
This commit is contained in:
Maxime Devos 2021-08-24 10:36:08 +02:00 committed by Mathieu Othacehe
parent cd4c6f9979
commit d09822c394
No known key found for this signature in database
GPG key ID: 8354763531769CA6

View file

@ -16,6 +16,7 @@
;;; Copyright © 2020 Jonathan Brielmaier <jonathan.brielmaier@web.de>
;;; Copyright © 2020 Marius Bakke <marius@gnu.org>
;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re>
;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
;;;
;;; This file is part of GNU Guix.
;;;
@ -368,22 +369,44 @@ (define-public mozjs-60
`(#:tests? #f ; FIXME: all tests pass, but then the check phase fails anyway.
#:test-target "check-jstests"
#:configure-flags
'("--enable-ctypes"
"--enable-optimize"
"--enable-pie"
"--enable-readline"
"--enable-shared-js"
"--enable-system-ffi"
"--with-system-nspr"
"--with-system-zlib"
"--with-system-icu"
"--with-intl-api"
;; This is important because without it gjs will segfault during the
;; configure phase. With jemalloc only the standalone mozjs console
;; will work.
"--disable-jemalloc")
;; TODO(core-updates): unconditionally use 'quasiquote
,#~(#$(if (%current-target-system)
#~quasiquote
#~quote)
("--enable-ctypes"
"--enable-optimize"
"--enable-pie"
"--enable-readline"
"--enable-shared-js"
"--enable-system-ffi"
"--with-system-nspr"
#$@(if (%current-target-system)
#~(,(string-append "--with-nspr-prefix="
#$(this-package-input "nspr")))
#~())
"--with-system-zlib"
"--with-system-icu"
"--with-intl-api"
;; This is important because without it gjs will segfault during the
;; configure phase. With jemalloc only the standalone mozjs console
;; will work.
"--disable-jemalloc"
;; Mozilla deviates from Autotools conventions due to historical
;; reasons.
#$@(if (%current-target-system)
#~(#$(string-append
"--host="
(nix-system->gnu-triplet (%current-system)))
#$(string-append "--target=" (%current-target-system)))
#~())))
#:phases
(modify-phases %standard-phases
;; Make sure pkg-config will be found.
,@(if (%current-target-system)
`((add-before 'configure 'set-PKG-CONFIG
(lambda _
(setenv "PKG_CONFIG" ,(pkg-config-for-target)))))
'())
(replace 'configure
(lambda* (#:key inputs outputs configure-flags #:allow-other-keys)
;; The configure script does not accept environment variables as