gnu: pkg-config: Memoize 'cross-pkg-config'.

When running:

  guix build --target=arm-linux-gnueabihf gdb -nd

this reduces the number of hits in the 'add-data-to-store' cache from
205 (25%) to 163 (21%).

* gnu/packages/pkg-config.scm (cross-pkg-config): Turn into an 'mlambda'.
This commit is contained in:
Ludovic Courtès 2019-11-07 10:30:41 +01:00
parent 537b2daba9
commit 7de9471707
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -22,6 +22,7 @@ (define-module (gnu packages pkg-config)
#:use-module (guix download) #:use-module (guix download)
#:use-module (guix build-system gnu) #:use-module (guix build-system gnu)
#:use-module (guix build-system trivial) #:use-module (guix build-system trivial)
#:use-module (guix memoization)
#:export (pkg-config)) #:export (pkg-config))
;; This is the "primitive" pkg-config package. People should use `pkg-config' ;; This is the "primitive" pkg-config package. People should use `pkg-config'
@ -65,12 +66,14 @@ (define-public %pkg-config
it can be used for defining the location of documentation tools, for it can be used for defining the location of documentation tools, for
instance."))) instance.")))
(define (cross-pkg-config target) (define cross-pkg-config
(mlambda (target)
"Return a pkg-config for TARGET, essentially just a wrapper called "Return a pkg-config for TARGET, essentially just a wrapper called
`TARGET-pkg-config', as `configure' scripts like it." `TARGET-pkg-config', as `configure' scripts like it."
;; See <http://www.flameeyes.eu/autotools-mythbuster/pkgconfig/cross-compiling.html> ;; See <http://www.flameeyes.eu/autotools-mythbuster/pkgconfig/cross-compiling.html>
;; for details. ;; for details.
(package (inherit %pkg-config) (package
(inherit %pkg-config)
(name (string-append (package-name %pkg-config) "-" target)) (name (string-append (package-name %pkg-config) "-" target))
(build-system trivial-build-system) (build-system trivial-build-system)
(arguments (arguments
@ -102,7 +105,7 @@ (define (cross-pkg-config target)
;; Ignore native inputs, and set `PKG_CONFIG_PATH' for target inputs. ;; Ignore native inputs, and set `PKG_CONFIG_PATH' for target inputs.
(native-search-paths '()) (native-search-paths '())
(search-paths (package-native-search-paths %pkg-config)))) (search-paths (package-native-search-paths %pkg-config)))))
(define (pkg-config-for-target target) (define (pkg-config-for-target target)
"Return a pkg-config package for TARGET, which may be either #f for a native "Return a pkg-config package for TARGET, which may be either #f for a native