mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-24 21:38:07 -05:00
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:
parent
537b2daba9
commit
7de9471707
1 changed files with 35 additions and 32 deletions
|
@ -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,44 +66,46 @@ (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
|
||||||
"Return a pkg-config for TARGET, essentially just a wrapper called
|
(mlambda (target)
|
||||||
|
"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
|
||||||
(name (string-append (package-name %pkg-config) "-" target))
|
(inherit %pkg-config)
|
||||||
(build-system trivial-build-system)
|
(name (string-append (package-name %pkg-config) "-" target))
|
||||||
(arguments
|
(build-system trivial-build-system)
|
||||||
`(#:modules ((guix build utils))
|
(arguments
|
||||||
#:builder (begin
|
`(#:modules ((guix build utils))
|
||||||
(use-modules (guix build utils))
|
#:builder (begin
|
||||||
|
(use-modules (guix build utils))
|
||||||
|
|
||||||
(let* ((in (assoc-ref %build-inputs "pkg-config"))
|
(let* ((in (assoc-ref %build-inputs "pkg-config"))
|
||||||
(out (assoc-ref %outputs "out"))
|
(out (assoc-ref %outputs "out"))
|
||||||
(bin (string-append out "/bin"))
|
(bin (string-append out "/bin"))
|
||||||
(prog (string-append ,target "-pkg-config"))
|
(prog (string-append ,target "-pkg-config"))
|
||||||
(native (string-append in "/bin/pkg-config")))
|
(native (string-append in "/bin/pkg-config")))
|
||||||
|
|
||||||
(mkdir-p bin)
|
(mkdir-p bin)
|
||||||
|
|
||||||
;; Create a `TARGET-pkg-config' -> `pkg-config' symlink.
|
;; Create a `TARGET-pkg-config' -> `pkg-config' symlink.
|
||||||
;; This satisfies the pkg.m4 macros, which use
|
;; This satisfies the pkg.m4 macros, which use
|
||||||
;; AC_PROG_TOOL to determine the `pkg-config' program
|
;; AC_PROG_TOOL to determine the `pkg-config' program
|
||||||
;; name.
|
;; name.
|
||||||
(symlink native (string-append bin "/" prog))
|
(symlink native (string-append bin "/" prog))
|
||||||
|
|
||||||
;; Also make 'pkg.m4' available, some packages might
|
;; Also make 'pkg.m4' available, some packages might
|
||||||
;; expect it.
|
;; expect it.
|
||||||
(mkdir-p (string-append out "/share"))
|
(mkdir-p (string-append out "/share"))
|
||||||
(symlink (string-append in "/share/aclocal")
|
(symlink (string-append in "/share/aclocal")
|
||||||
(string-append out "/share/aclocal"))
|
(string-append out "/share/aclocal"))
|
||||||
#t))))
|
#t))))
|
||||||
(native-inputs `(("pkg-config" ,%pkg-config)))
|
(native-inputs `(("pkg-config" ,%pkg-config)))
|
||||||
|
|
||||||
;; 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
|
||||||
|
|
Loading…
Reference in a new issue