Merge pull request #88518 from Ericson2314/fix-pkg-config

pkg-config, pkgconf: Misc fixes

Changed files
+68 -25
pkgs
build-support
pkg-config-wrapper
development
tools
misc
pkg-config
pkgconf
top-level
+29 -20
pkgs/build-support/pkg-config-wrapper/default.nix
···
{ stdenvNoCC
, buildPackages
, pkg-config
+
, baseBinName ? "pkg-config"
, propagateDoc ? pkg-config != null && pkg-config ? man
, extraPackages ? [], extraBuildCommands ? ""
}:
···
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;
···
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;
···
];
postFixup =
+
##
+
## User env support
+
##
+
+
# Propagate the underling unwrapped pkg-config so that if you
+
# install the wrapper, you get anything else it might provide.
''
-
-
##
-
## User env support
-
##
-
-
# 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 =
+1 -1
pkgs/build-support/pkg-config-wrapper/setup-hook.sh
···
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
+5 -2
pkgs/development/tools/misc/pkg-config/default.nix
···
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
'';
+28 -1
pkgs/development/tools/misc/pkgconf/default.nix
···
-
{ 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";
+5 -1
pkgs/top-level/all-packages.nix
···
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 {