gnu: Add wl-clipboard.
[jackhill/guix/guix.git] / gnu / packages / pkg-config.scm
CommitLineData
233e7676 1;;; GNU Guix --- Functional package management for GNU
dd1937d7 2;;; Copyright © 2012, 2013, 2014, 2016 Ludovic Courtès <ludo@gnu.org>
c44899a2 3;;;
233e7676 4;;; This file is part of GNU Guix.
c44899a2 5;;;
233e7676 6;;; GNU Guix is free software; you can redistribute it and/or modify it
c44899a2
LC
7;;; under the terms of the GNU General Public License as published by
8;;; the Free Software Foundation; either version 3 of the License, or (at
9;;; your option) any later version.
10;;;
233e7676 11;;; GNU Guix is distributed in the hope that it will be useful, but
c44899a2
LC
12;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14;;; GNU General Public License for more details.
15;;;
16;;; You should have received a copy of the GNU General Public License
233e7676 17;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
c44899a2 18
1ffa7090 19(define-module (gnu packages pkg-config)
4a44e743 20 #:use-module (guix licenses)
c44899a2 21 #:use-module (guix packages)
87f5d366 22 #:use-module (guix download)
d581acee
LC
23 #:use-module (guix build-system gnu)
24 #:use-module (guix build-system trivial)
25 #:export (pkg-config))
c44899a2 26
82c865c4
LC
27;; This is the "primitive" pkg-config package. People should use `pkg-config'
28;; (see below) rather than `%pkg-config', but we export `%pkg-config' so that
29;; `fold-packages' finds it.
30(define-public %pkg-config
c44899a2
LC
31 (package
32 (name "pkg-config")
139272f4 33 (version "0.29.2")
c44899a2 34 (source (origin
87f5d366 35 (method url-fetch)
8b16a5e1
LC
36 (uri (list
37 (string-append
38 "http://fossies.org/linux/misc/pkg-config-" version
39 ".tar.gz")
40
41 ;; FIXME: The following URL redirects to HTTPS, which
42 ;; creates bootstrapping problems:
43 ;; <http://bugs.gnu.org/22774>.
44 (string-append
45 "http://pkgconfig.freedesktop.org/releases/pkg-config-"
46 version ".tar.gz")))
c44899a2
LC
47 (sha256
48 (base32
139272f4 49 "14fmwzki1rlz8bs2p810lk6jqdxsk966d8drgsjmi54cd00rrikg"))))
c44899a2
LC
50 (build-system gnu-build-system)
51 (arguments `(#:configure-flags '("--with-internal-glib")))
a18eda27
LC
52 (native-search-paths
53 (list (search-path-specification
54 (variable "PKG_CONFIG_PATH")
af070955 55 (files '("lib/pkgconfig" "lib64/pkgconfig" "share/pkgconfig")))))
14551e07 56 (home-page "https://www.freedesktop.org/wiki/Software/pkg-config")
4a44e743 57 (license gpl2+)
35b9e423 58 (synopsis "Helper tool used when compiling applications and libraries")
c44899a2
LC
59 (description
60 "pkg-config is a helper tool used when compiling applications and
61libraries. It helps you insert the correct compiler options on the
62command line so an application can use gcc -o test test.c `pkg-config
63--libs --cflags glib-2.0` for instance, rather than hard-coding values
35b9e423 64on where to find glib (or other libraries). It is language-agnostic, so
c44899a2
LC
65it can be used for defining the location of documentation tools, for
66instance.")))
d581acee
LC
67
68(define (cross-pkg-config target)
69 "Return a pkg-config for TARGET, essentially just a wrapper called
70`TARGET-pkg-config', as `configure' scripts like it."
71 ;; See <http://www.flameeyes.eu/autotools-mythbuster/pkgconfig/cross-compiling.html>
72 ;; for details.
73 (package (inherit %pkg-config)
74 (name (string-append (package-name %pkg-config) "-" target))
75 (build-system trivial-build-system)
76 (arguments
77 `(#:modules ((guix build utils))
78 #:builder (begin
79 (use-modules (guix build utils))
80
588a7813
LC
81 (let* ((in (assoc-ref %build-inputs "pkg-config"))
82 (out (assoc-ref %outputs "out"))
83 (bin (string-append out "/bin"))
84 (prog (string-append ,target "-pkg-config"))
85 (native (string-append in "/bin/pkg-config")))
d581acee
LC
86
87 (mkdir-p bin)
88
89 ;; Create a `TARGET-pkg-config' -> `pkg-config' symlink.
90 ;; This satisfies the pkg.m4 macros, which use
91 ;; AC_PROG_TOOL to determine the `pkg-config' program
92 ;; name.
588a7813
LC
93 (symlink native (string-append bin "/" prog))
94
95 ;; Also make 'pkg.m4' available, some packages might
96 ;; expect it.
97 (mkdir-p (string-append out "/share"))
98 (symlink (string-append in "/share/aclocal")
e3cfef22
MW
99 (string-append out "/share/aclocal"))
100 #t))))
d581acee
LC
101 (native-inputs `(("pkg-config" ,%pkg-config)))
102
103 ;; Ignore native inputs, and set `PKG_CONFIG_PATH' for target inputs.
104 (native-search-paths '())
105 (search-paths (package-native-search-paths %pkg-config))))
106
107(define (pkg-config-for-target target)
108 "Return a pkg-config package for TARGET, which may be either #f for a native
109build, or a GNU triplet."
110 (if target
111 (cross-pkg-config target)
112 %pkg-config))
113
114;; This hack allows us to automatically choose the native or the cross
115;; `pkg-config' depending on whether it's being used in a cross-build
116;; environment or not.
117(define-syntax pkg-config
118 (identifier-syntax (pkg-config-for-target (%current-target-system))))