gnu: gts: Fix cross-compiling.

* gnu/packages/graphviz.scm (gts)[arguments]<#:configure-flags>: When
cross-compiling, set PKG_CONFIG.
<#:phases>: When cross-compiling, add update-config and fix-predicates_init
phase.
[native-inputs]: When cross-compiling, add config.

Change-Id: I26b760d56512db4298cc1509345c2193a80bc70f
This commit is contained in:
Zheng Junjie 2025-04-01 16:18:11 +08:00
parent b66f952001
commit a9530d181d
No known key found for this signature in database
GPG key ID: 3B5AA993E1A2DFF0

View file

@ -14,6 +14,7 @@
;;; Copyright © 2021 Justin Veilleux <terramorpha@cock.li> ;;; Copyright © 2021 Justin Veilleux <terramorpha@cock.li>
;;; Copyright © 2021 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org> ;;; Copyright © 2021 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
;;; Copyright © 2024 Artyom V. Poptsov <poptsov.artyom@gmail.com> ;;; Copyright © 2024 Artyom V. Poptsov <poptsov.artyom@gmail.com>
;;; Copyright © 2025 Zheng Junjie <z572@z572.online>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
;;; ;;;
@ -258,18 +259,47 @@ Graphviz and LaTeX.")
"07mqx09jxh8cv9753y2d2jsv7wp8vjmrd7zcfpbrddz3wc9kx705")))) "07mqx09jxh8cv9753y2d2jsv7wp8vjmrd7zcfpbrddz3wc9kx705"))))
(build-system gnu-build-system) (build-system gnu-build-system)
(arguments (arguments
'(#:phases `(,@(if (%current-target-system)
`(#:configure-flags
(list (string-append
"PKG_CONFIG="
(search-input-file
%build-inputs
(string-append "/bin/" ,(pkg-config-for-target))))))
'())
#:phases
(modify-phases %standard-phases (modify-phases %standard-phases
(add-before 'check 'pre-check (add-before 'check 'pre-check
(lambda _ (lambda _
(chmod "test/boolean/test.sh" #o777) (chmod "test/boolean/test.sh" #o777)
#t))) #t))
,@(if (%current-target-system)
`((add-after 'unpack 'update-config
(lambda* (#:key native-inputs inputs #:allow-other-keys)
(for-each (lambda (file)
(install-file
(search-input-file
(or native-inputs inputs)
(string-append "/bin/" file)) "."))
'("config.guess" "config.sub"))))
(add-after 'unpack 'fix-predicates_init
(lambda _
(substitute* "src/Makefile.in"
(("\\$[(]COMPILE[)] \\$[(]srcdir[)]/predicates_init\\.c\
-o \\$[(]srcdir[)]/predicates_init")
"gcc $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) $(srcdir)/predicates_init.c \
-o $(srcdir)/predicates_init")))))
'()))
;; Some data files used by the test suite are missing. ;; Some data files used by the test suite are missing.
;; See <http://sourceforge.net/p/gts/bugs/41/>. ;; See <http://sourceforge.net/p/gts/bugs/41/>.
#:tests? #f)) #:tests? #f))
(native-inputs (native-inputs
(list pkg-config)) (append (if (%current-target-system)
(list config)
'())
(list pkg-config)))
(propagated-inputs (propagated-inputs
;; The gts.pc file has glib-2.0 as required. ;; The gts.pc file has glib-2.0 as required.
(list glib)) (list glib))