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

pkg-config, pkgconf: Misc fixes
This commit is contained in:
John Ericson 2020-05-21 16:05:42 -04:00 committed by GitHub
commit eae4f22176
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 68 additions and 25 deletions

View file

@ -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
##
# 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 =

View file

@ -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

View file

@ -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
'';

View file

@ -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";

View file

@ -10761,7 +10761,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 {