1{ lib, stdenv, fetchurl, libiconv, vanilla ? false }:
2
3stdenv.mkDerivation rec {
4 pname = "pkg-config";
5 version = "0.29.2";
6
7 src = fetchurl {
8 url = "https://pkg-config.freedesktop.org/releases/${pname}-${version}.tar.gz";
9 sha256 = "14fmwzki1rlz8bs2p810lk6jqdxsk966d8drgsjmi54cd00rrikg";
10 };
11
12 outputs = [ "out" "man" "doc" ];
13 strictDeps = true;
14
15 # Process Requires.private properly, see
16 # http://bugs.freedesktop.org/show_bug.cgi?id=4738, migrated to
17 # https://gitlab.freedesktop.org/pkg-config/pkg-config/issues/28
18 patches = lib.optional (!vanilla) ./requires-private.patch
19 ++ lib.optional stdenv.isCygwin ./2.36.3-not-win32.patch;
20
21 # These three tests fail due to a (desired) behavior change from our ./requires-private.patch
22 postPatch = if vanilla then null else ''
23 rm -f check/check-requires-private check/check-gtk check/missing
24 '';
25
26 buildInputs = [ libiconv ];
27
28 configureFlags = [ "--with-internal-glib" ]
29 ++ lib.optionals (stdenv.isSunOS) [ "--with-libiconv=gnu" "--with-system-library-path" "--with-system-include-path" "CFLAGS=-DENABLE_NLS" ]
30 # Can't run these tests while cross-compiling
31 ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform)
32 [ "glib_cv_stack_grows=no"
33 "glib_cv_uscore=no"
34 "ac_cv_func_posix_getpwuid_r=yes"
35 "ac_cv_func_posix_getgrgid_r=yes"
36 ];
37
38 # Silence "incompatible integer to pointer conversion passing 'gsize'" when building with Clang.
39 env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang "-Wno-int-conversion";
40
41 enableParallelBuilding = true;
42 doCheck = true;
43
44 postInstall = ''rm -f "$out"/bin/*-pkg-config''; # clean the duplicate file
45
46 meta = with lib; {
47 description = "A tool that allows packages to find out information about other packages";
48 homepage = "http://pkg-config.freedesktop.org/wiki/";
49 platforms = platforms.all;
50 license = licenses.gpl2Plus;
51 mainProgram = "pkg-config";
52 };
53}