| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 |
|
| 23 | (define-module (gnu packages pkg-config)
|
| 24 | #:use-module (guix licenses)
|
| 25 | #:use-module (guix packages)
|
| 26 | #:use-module (guix download)
|
| 27 | #:use-module (guix gexp)
|
| 28 | #:use-module (guix utils)
|
| 29 | #:use-module (guix search-paths)
|
| 30 | #:use-module (guix build-system gnu)
|
| 31 | #:use-module (guix build-system trivial)
|
| 32 | #:use-module (gnu packages bash)
|
| 33 | #:use-module (guix memoization)
|
| 34 | #:export (pkg-config))
|
| 35 |
|
| 36 | |
| 37 | |
| 38 | |
| 39 | (define-public %pkg-config
|
| 40 | (package
|
| 41 | (name "pkg-config")
|
| 42 | (version "0.29.2")
|
| 43 | (source (origin
|
| 44 | (method url-fetch)
|
| 45 | (uri (list
|
| 46 | (string-append
|
| 47 | "http://fossies.org/linux/misc/pkg-config-" version
|
| 48 | ".tar.gz")
|
| 49 |
|
| 50 | |
| 51 | |
| 52 | |
| 53 | (string-append
|
| 54 | "http://pkgconfig.freedesktop.org/releases/pkg-config-"
|
| 55 | version ".tar.gz")))
|
| 56 | (sha256
|
| 57 | (base32
|
| 58 | "14fmwzki1rlz8bs2p810lk6jqdxsk966d8drgsjmi54cd00rrikg"))))
|
| 59 | (build-system gnu-build-system)
|
| 60 | (arguments
|
| 61 | `(#:configure-flags
|
| 62 | '("--with-internal-glib"
|
| 63 | |
| 64 | |
| 65 | ,@(if (%current-target-system)
|
| 66 | '("glib_cv_stack_grows=no"
|
| 67 | "glib_cv_uscore=no"
|
| 68 | "ac_cv_func_posix_getpwuid_r=yes"
|
| 69 | "ac_cv_func_posix_getgrgid_r=yes")
|
| 70 | '()))))
|
| 71 | (native-search-paths
|
| 72 | (list $PKG_CONFIG_PATH))
|
| 73 | (home-page "https://www.freedesktop.org/wiki/Software/pkg-config")
|
| 74 | (license gpl2+)
|
| 75 | (synopsis "Helper tool used when compiling applications and libraries")
|
| 76 | (description
|
| 77 | "pkg-config is a helper tool used when compiling applications and
|
| 78 | libraries. It helps you insert the correct compiler options on the
|
| 79 | command line so an application can use gcc -o test test.c `pkg-config
|
| 80 | --libs --cflags glib-2.0` for instance, rather than hard-coding values
|
| 81 | on where to find glib (or other libraries). It is language-agnostic, so
|
| 82 | it can be used for defining the location of documentation tools, for
|
| 83 | instance.")))
|
| 84 |
|
| 85 | (define cross-pkg-config
|
| 86 | (mlambda (target)
|
| 87 | "Return a pkg-config for TARGET, essentially just a wrapper called
|
| 88 | `TARGET-pkg-config', as `configure' scripts like it."
|
| 89 | |
| 90 | |
| 91 | (package
|
| 92 | (inherit %pkg-config)
|
| 93 | (name (string-append (package-name %pkg-config) "-" target))
|
| 94 | (build-system trivial-build-system)
|
| 95 | (arguments
|
| 96 | `(#:modules ((guix build utils))
|
| 97 | #:builder (begin
|
| 98 | (use-modules (guix build utils))
|
| 99 |
|
| 100 | (let* ((in (assoc-ref %build-inputs "pkg-config"))
|
| 101 | (out (assoc-ref %outputs "out"))
|
| 102 | (bin (string-append out "/bin"))
|
| 103 | (prog (string-append ,target "-pkg-config"))
|
| 104 | (native (string-append in "/bin/pkg-config")))
|
| 105 |
|
| 106 | (mkdir-p bin)
|
| 107 |
|
| 108 | |
| 109 | |
| 110 | |
| 111 | |
| 112 | (symlink native (string-append bin "/" prog))
|
| 113 |
|
| 114 | |
| 115 | |
| 116 | (mkdir-p (string-append out "/share"))
|
| 117 | (symlink (string-append in "/share/aclocal")
|
| 118 | (string-append out "/share/aclocal"))
|
| 119 | #t))))
|
| 120 | (native-inputs `(("pkg-config" ,%pkg-config)))
|
| 121 |
|
| 122 | |
| 123 | (native-search-paths '())
|
| 124 | (search-paths (package-native-search-paths %pkg-config)))))
|
| 125 |
|
| 126 | (define (pkg-config-for-target target)
|
| 127 | "Return a pkg-config package for TARGET, which may be either #f for a native
|
| 128 | build, or a GNU triplet."
|
| 129 | (if target
|
| 130 | (cross-pkg-config target)
|
| 131 | %pkg-config))
|
| 132 |
|
| 133 | |
| 134 | |
| 135 | |
| 136 | (define-syntax pkg-config
|
| 137 | (identifier-syntax (pkg-config-for-target (%current-target-system))))
|
| 138 |
|
| 139 | |
| 140 | |
| 141 | |
| 142 | (define-public pkg-config-for-build
|
| 143 | (package
|
| 144 | (inherit (hidden-package %pkg-config))
|
| 145 | (name "pkg-config-for-build")
|
| 146 | (version "0")
|
| 147 | (source #f)
|
| 148 | (build-system trivial-build-system)
|
| 149 | (inputs
|
| 150 | (list bash-minimal %pkg-config))
|
| 151 | (arguments
|
| 152 | `(#:modules ((guix build utils))
|
| 153 | #:builder
|
| 154 | ,#~(begin
|
| 155 | (use-modules (guix build utils))
|
| 156 | (define where (string-append #$output "/bin/pkg-config"))
|
| 157 | (mkdir-p (dirname where))
|
| 158 | (call-with-output-file where
|
| 159 | (lambda (port)
|
| 160 | (format port "#!~a
|
| 161 | export PKG_CONFIG_PATH=\"$PKG_CONFIG_PATH_FOR_BUILD\"
|
| 162 | exec ~a \"$@\""
|
| 163 | (search-input-file %build-inputs "bin/bash")
|
| 164 | (search-input-file %build-inputs "bin/pkg-config"))))
|
| 165 | (chmod where #o500))))
|
| 166 | (native-search-paths
|
| 167 | (map (lambda (original)
|
| 168 | (search-path-specification
|
| 169 | (inherit original)
|
| 170 | (variable "PKG_CONFIG_PATH_FOR_BUILD")))
|
| 171 | (package-native-search-paths %pkg-config)))))
|
| 172 |
|
| 173 | (define-public pkgconf
|
| 174 | (package
|
| 175 | (name "pkgconf")
|
| 176 | (version "3.0.7")
|
| 177 | (source (origin
|
| 178 | (method url-fetch)
|
| 179 | (uri (string-append "https://distfiles.ariadne.space/"
|
| 180 | name "/" name "-" version ".tar.xz"))
|
| 181 | (sha256
|
| 182 | (base32
|
| 183 | "02llwsmxyb4g6ccsb62i9ndp9cbsv4dq2q4ib0d376mx3i4zy9n9"))))
|
| 184 | (build-system gnu-build-system)
|
| 185 | (arguments
|
| 186 | (list
|
| 187 | #:phases
|
| 188 | #~(modify-phases %standard-phases
|
| 189 | (add-after 'unpack 'fix-makefile
|
| 190 | (lambda _
|
| 191 | (substitute* "Makefile.in"
|
| 192 | (("PWD") "CURDIR")))))))
|
| 193 | (native-search-paths (list $PKG_CONFIG_PATH))
|
| 194 | (home-page "https://github.com/pkgconf/pkgconf")
|
| 195 | (synopsis "Package compiler and linker metadata toolkit")
|
| 196 | (description "@command{pkgconf} is a program which helps to configure
|
| 197 | compiler and linker flags for development libraries. It is similar to
|
| 198 | pkg-config from freedesktop.org. @code{libpkgconf} is a library which
|
| 199 | provides access to most of pkgconf's functionality, to allow other tooling
|
| 200 | such as compilers and IDEs to discover and use libraries configured by
|
| 201 | pkgconf.")
|
| 202 | (license isc)))
|
| 203 |
|
| 204 | (define-public pkgconf-as-pkg-config
|
| 205 | (package/inherit pkgconf
|
| 206 | (name "pkgconf-as-pkg-config")
|
| 207 | (build-system gnu-build-system)
|
| 208 | (arguments
|
| 209 | (list
|
| 210 | #:tests? #f
|
| 211 | #:phases
|
| 212 | #~(modify-phases %standard-phases
|
| 213 | (delete 'configure)
|
| 214 | (delete 'build)
|
| 215 | (replace 'install
|
| 216 | (lambda* (#:key inputs #:allow-other-keys)
|
| 217 | (let ((pkgconf (search-input-file inputs "bin/pkgconf")))
|
| 218 | (mkdir-p (string-append #$output "/bin"))
|
| 219 | (symlink pkgconf (string-append #$output "/bin/pkg-config"))
|
| 220 | |
| 221 | (mkdir-p (string-append #$output "/share"))
|
| 222 | (symlink (string-append (dirname (dirname pkgconf))
|
| 223 | "/share/aclocal")
|
| 224 | (string-append #$output "/share/aclocal"))))))))
|
| 225 | (native-inputs '())
|
| 226 | (inputs (list pkgconf))
|
| 227 | (propagated-inputs '())))
|