diff --git a/pkgs/build-support/pkg-config-wrapper/default.nix b/pkgs/build-support/pkg-config-wrapper/default.nix index 87efc3b18aa84b..e01df107dd17f2 100644 --- a/pkgs/build-support/pkg-config-wrapper/default.nix +++ b/pkgs/build-support/pkg-config-wrapper/default.nix @@ -4,6 +4,7 @@ { stdenvNoCC , buildPackages , pkg-config +, baseBinName ? "pkg-config" , propagateDoc ? pkg-config != null && pkg-config ? man , extraPackages ? [], extraBuildCommands ? "" }: @@ -34,9 +35,9 @@ stdenv.mkDerivation { shell = getBin stdenvNoCC.shell + stdenvNoCC.shell.shellPath or ""; - inherit targetPrefix suffixSalt; + inherit targetPrefix suffixSalt baseBinName; - outputs = [ "out" ] ++ optionals propagateDoc [ "man" ]; + outputs = [ "out" ] ++ optionals propagateDoc ([ "man" ] ++ optional (pkg-config ? doc) "doc"); passthru = { inherit pkg-config; @@ -63,7 +64,16 @@ stdenv.mkDerivation { echo $pkg-config > $out/nix-support/orig-pkg-config - wrap ${targetPrefix}pkg-config ${./pkg-config-wrapper.sh} "${getBin pkg-config}/bin/pkg-config" + wrap ${targetPrefix}${baseBinName} ${./pkg-config-wrapper.sh} "${getBin pkg-config}/bin/${baseBinName}" + '' + # symlink in share for autoconf to find macros + + # TODO(@Ericson2314): in the future just make the unwrapped pkg-config a + # propagated dep once we can rely on downstream deps comming first in + # search paths. (https://github.com/NixOS/nixpkgs/pull/31414 took a crack + # at this.) + + '' + ln -s ${pkg-config}/share $out/share ''; strictDeps = true; @@ -76,34 +86,33 @@ stdenv.mkDerivation { ]; postFixup = - '' - - ## - ## User env support - ## + ## + ## User env support + ## - # Propagate the underling unwrapped pkg-config so that if you - # install the wrapper, you get anything else it might provide. + # Propagate the underling unwrapped pkg-config so that if you + # install the wrapper, you get anything else it might provide. + '' printWords ${pkg-config} > $out/nix-support/propagated-user-env-packages '' - + optionalString propagateDoc '' - ## - ## Man page and info support - ## - + ## + ## Man page and doc support + ## + + optionalString propagateDoc ('' ln -s ${pkg-config.man} $man - '' + '' + optionalString (pkg-config ? doc) '' + ln -s ${pkg-config.doc} $doc + '') + '' substituteAll ${./add-flags.sh} $out/nix-support/add-flags.sh substituteAll ${../wrapper-common/utils.bash} $out/nix-support/utils.bash - - ## - ## Extra custom steps - ## '' + ## + ## Extra custom steps + ## + extraBuildCommands; meta = diff --git a/pkgs/build-support/pkg-config-wrapper/setup-hook.sh b/pkgs/build-support/pkg-config-wrapper/setup-hook.sh index 12b9af5e583753..34f1a999a82ee6 100644 --- a/pkgs/build-support/pkg-config-wrapper/setup-hook.sh +++ b/pkgs/build-support/pkg-config-wrapper/setup-hook.sh @@ -23,7 +23,7 @@ getTargetRoleWrapper addEnvHooks "$targetOffset" pkgConfigWrapper_addPkgConfigPath -export PKG_CONFIG${role_post}=@targetPrefix@pkg-config +export PKG_CONFIG${role_post}=@targetPrefix@@baseBinName@ # No local scope in sourced file unset -v role_post diff --git a/pkgs/development/tools/misc/pkg-config/default.nix b/pkgs/development/tools/misc/pkg-config/default.nix index d5e766283ce604..84f6c330f8c56f 100644 --- a/pkgs/development/tools/misc/pkg-config/default.nix +++ b/pkgs/development/tools/misc/pkg-config/default.nix @@ -11,13 +11,16 @@ stdenv.mkDerivation rec { sha256 = "14fmwzki1rlz8bs2p810lk6jqdxsk966d8drgsjmi54cd00rrikg"; }; + outputs = [ "out" "man" "doc" ]; + # Process Requires.private properly, see - # http://bugs.freedesktop.org/show_bug.cgi?id=4738. + # http://bugs.freedesktop.org/show_bug.cgi?id=4738, migrated to + # https://gitlab.freedesktop.org/pkg-config/pkg-config/issues/28 patches = optional (!vanilla) ./requires-private.patch ++ optional stdenv.isCygwin ./2.36.3-not-win32.patch; # These three tests fail due to a (desired) behavior change from our ./requires-private.patch - postPatch = '' + postPatch = if vanilla then null else '' rm -f check/check-requires-private check/check-gtk check/missing ''; diff --git a/pkgs/development/tools/misc/pkgconf/default.nix b/pkgs/development/tools/misc/pkgconf/default.nix index 02b7ff5fcd3d7f..fb8281ff98c436 100644 --- a/pkgs/development/tools/misc/pkgconf/default.nix +++ b/pkgs/development/tools/misc/pkgconf/default.nix @@ -1,14 +1,41 @@ -{ stdenv, fetchurl }: +{ stdenv, fetchurl, removeReferencesTo }: stdenv.mkDerivation rec { pname = "pkgconf"; version = "1.6.3"; + nativeBuildInputs = [ removeReferencesTo ]; + + outputs = [ "out" "lib" "dev" "man" "doc" ]; + + enableParallelBuilding = true; + src = fetchurl { url = "https://distfiles.dereferenced.org/${pname}/${pname}-${version}.tar.xz"; sha256 = "04525vv0y849vvc2pi60g5wd9fjp1wbhra2lniifi82y1ldv7w31"; }; + # Debian has outputs like these too: + # https://packages.debian.org/source/buster/pkgconf, so take it this + # reference removing is safe. + postFixup = '' + remove-references-to \ + -t "${placeholder "dev"}" \ + "${placeholder "lib"}"/lib/* \ + "${placeholder "out"}"/bin/* + remove-references-to \ + -t "${placeholder "out"}" \ + "${placeholder "lib"}"/lib/* + '' + # Move back share/aclocal. Yes, this normally goes in the dev output for good + # reason, but in this case the dev output is for the `libpkgconf` library, + # while the aclocal stuff is for the tool. The tool is already for use during + # development, so there is no reason to have separate "dev-bin" and "dev-lib" + # outputs or someting. + + '' + mv ${placeholder "dev"}/share ${placeholder "out"} + ''; + meta = with stdenv.lib; { description = "Package compiler and linker metadata toolkit"; homepage = "https://git.dereferenced.org/pkgconf/pkgconf"; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 680177a2610acd..228af7e55a53fb 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -10739,7 +10739,11 @@ in pmccabe = callPackage ../development/tools/misc/pmccabe { }; - pkgconf = callPackage ../development/tools/misc/pkgconf {}; + pkgconf-unwrapped = callPackage ../development/tools/misc/pkgconf {}; + pkgconf = callPackage ../build-support/pkg-config-wrapper { + pkg-config = pkgconf-unwrapped; + baseBinName = "pkgconf"; + }; pkg-config-unwrapped = callPackage ../development/tools/misc/pkg-config { }; pkg-config = callPackage ../build-support/pkg-config-wrapper {