Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkg-config, pkgconf: Misc fixes #88518

Merged
merged 7 commits into from May 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
49 changes: 29 additions & 20 deletions pkgs/build-support/pkg-config-wrapper/default.nix
Expand Up @@ -4,6 +4,7 @@
{ stdenvNoCC
, buildPackages
, pkg-config
, baseBinName ? "pkg-config"
, propagateDoc ? pkg-config != null && pkg-config ? man
, extraPackages ? [], extraBuildCommands ? ""
}:
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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 =
Expand Down
2 changes: 1 addition & 1 deletion pkgs/build-support/pkg-config-wrapper/setup-hook.sh
Expand Up @@ -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
7 changes: 5 additions & 2 deletions pkgs/development/tools/misc/pkg-config/default.nix
Expand Up @@ -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
'';

Expand Down
29 changes: 28 additions & 1 deletion 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";
Expand Down
6 changes: 5 additions & 1 deletion pkgs/top-level/all-packages.nix
Expand Up @@ -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 {
Expand Down