Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions pkgs/applications/graphics/ImageMagick/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
stdenv,
fetchFromGitHub,
pkg-config,
autoPatchPcHook,
libtool,
bzip2Support ? true,
bzip2,
Expand Down Expand Up @@ -126,6 +127,7 @@ stdenv.mkDerivation (finalAttrs: {

nativeBuildInputs = [
pkg-config
autoPatchPcHook
libtool
];

Expand Down
2 changes: 2 additions & 0 deletions pkgs/applications/graphics/gimp/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
replaceVars,
autoreconfHook,
pkg-config,
autoPatchPcHook,
intltool,
babl,
gegl,
Expand Down Expand Up @@ -95,6 +96,7 @@ stdenv.mkDerivation (finalAttrs: {
[
autoreconfHook # hardcode-plugin-interpreters.patch changes Makefile.am
pkg-config
autoPatchPcHook
intltool
gettext
makeWrapper
Expand Down
2 changes: 2 additions & 0 deletions pkgs/applications/graphics/tesseract/tesseract3.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
fetchFromGitHub,
autoreconfHook,
pkg-config,
autoPatchPcHook,
leptonica,
libpng,
libtiff,
Expand Down Expand Up @@ -35,6 +36,7 @@ stdenv.mkDerivation rec {

nativeBuildInputs = [
pkg-config
autoPatchPcHook
autoreconfHook
];

Expand Down
2 changes: 2 additions & 0 deletions pkgs/applications/graphics/tesseract/tesseract4.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
autoreconfHook,
autoconf-archive,
pkg-config,
autoPatchPcHook,
leptonica,
libpng,
libtiff,
Expand Down Expand Up @@ -42,6 +43,7 @@ stdenv.mkDerivation rec {

nativeBuildInputs = [
pkg-config
autoPatchPcHook
autoreconfHook
autoconf-archive
];
Expand Down
2 changes: 2 additions & 0 deletions pkgs/applications/graphics/tesseract/tesseract5.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
nix-update-script,
autoreconfHook,
pkg-config,
autoPatchPcHook,
curl,
leptonica,
libarchive,
Expand Down Expand Up @@ -32,6 +33,7 @@ stdenv.mkDerivation rec {

nativeBuildInputs = [
pkg-config
autoPatchPcHook
autoreconfHook
];

Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/office/libreoffice/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ stdenv.mkDerivation (finalAttrs: {
# (see above), make sure these don't leak again by accident.
# FIXME: disabled for kdeIntegration builds because the weird symlinkJoin setup
# leaks all the -dev dependencies :(
disallowedRequisites = lib.optionals (!kdeIntegration) (
disallowedReferences = lib.optionals (!kdeIntegration) (
lib.concatMap (x: lib.optional (x ? dev) x.dev) finalAttrs.buildInputs
);

Expand Down
2 changes: 2 additions & 0 deletions pkgs/applications/video/mpv/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
openalSoft,
pipewire,
pkg-config,
autoPatchPcHook,
python3,
rubberband,
shaderc, # instead of spirv-cross
Expand Down Expand Up @@ -156,6 +157,7 @@ stdenv.mkDerivation (finalAttrs: {
meson
ninja
pkg-config
autoPatchPcHook
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
buildPackages.darwin.sigtool
Expand Down
52 changes: 52 additions & 0 deletions pkgs/build-support/setup-hooks/patch-pc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Replaces dependencies in pc files with their absolute paths
#
# Usage: python patch-pc.py /path/to/pkgconf libfoo.pc
# The tool writes patched .pc file to the stdout

from subprocess import run
import sys
import re

LINE_SEP = re.compile(r"(?<!\\)\n")

pkgconf_bin = sys.argv[1]
pc_file = sys.argv[2]


def run_pkgconf(*args: str) -> str:
result = run([pkgconf_bin, *args], capture_output=True, check=True)
return result.stdout.decode().rstrip()


def get_path(name: str) -> str:
return run_pkgconf("--path", name)


def list_requires(file: str, private: bool) -> list[str]:
return run_pkgconf(
f"--print-requires{"-private" if private else ""}", file
).splitlines()


def transform_dep_spec(dep_spec: str) -> str:
def escape(s: str) -> str:
return s.replace("#", "\\#")

[name, *version_spec] = dep_spec.split(" ")
return " ".join(escape(s) for s in [get_path(name), *version_spec])


def print_requires(file: str, private: bool):
requires = (transform_dep_spec(dep) for dep in list_requires(file, private))
print(f"Requires{".private" if private else ""}:", ", ".join(requires))


with open(pc_file, "r") as f:
for line in LINE_SEP.split(f.read()):
if line.lstrip().startswith("Requires:"):
print_requires(pc_file, private=False)
elif line.lstrip().startswith("Requires.private:"):
print_requires(pc_file, private=True)
else:
print(line)

2 changes: 2 additions & 0 deletions pkgs/by-name/ac/accountsservice/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
fetchurl,
replaceVars,
pkg-config,
autoPatchPcHook,
glib,
shadow,
gobject-introspection,
Expand Down Expand Up @@ -62,6 +63,7 @@ stdenv.mkDerivation rec {
meson
ninja
pkg-config
autoPatchPcHook
python3
vala
]
Expand Down
3 changes: 3 additions & 0 deletions pkgs/by-name/al/alsa-lib/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
fetchurl,
alsa-topology-conf,
alsa-ucm-conf,
autoPatchPcHook,
testers,
}:

Expand All @@ -16,6 +17,8 @@ stdenv.mkDerivation (finalAttrs: {
hash = "sha256-jE/zdVPL6JYY4Yfkx3n3GpuyqLJ7kfh+1AmHzJIz2PY=";
};

nativeBuildInputs = [ autoPatchPcHook ];

patches =
[
# Add a "libs" field to the syntax recognized in the /etc/asound.conf file.
Expand Down
2 changes: 2 additions & 0 deletions pkgs/by-name/ap/aprutil/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
libxcrypt,
cyrus_sasl,
autoreconfHook,
autoPatchPcHook,
}:

assert sslSupport -> openssl != null;
Expand Down Expand Up @@ -48,6 +49,7 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [
makeWrapper
autoreconfHook
autoPatchPcHook
];

configureFlags =
Expand Down
2 changes: 2 additions & 0 deletions pkgs/by-name/at/at-spi2-core/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
meson,
ninja,
pkg-config,
autoPatchPcHook,
gobject-introspection,
buildPackages,
withIntrospection ?
Expand Down Expand Up @@ -47,6 +48,7 @@ stdenv.mkDerivation rec {
ninja
pkg-config
makeWrapper
autoPatchPcHook
]
++ lib.optionals withIntrospection [
gobject-introspection
Expand Down
2 changes: 2 additions & 0 deletions pkgs/by-name/ay/ayatana-ido/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
gtk3,
lib,
pkg-config,
autoPatchPcHook,
stdenv,
}:

Expand All @@ -23,6 +24,7 @@ stdenv.mkDerivation rec {
cmake
glib # for glib-mkenums
pkg-config
autoPatchPcHook
];

buildInputs = [ gtk3 ];
Expand Down
2 changes: 2 additions & 0 deletions pkgs/by-name/ba/babl/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
meson,
ninja,
pkg-config,
autoPatchPcHook,
gi-docgen,
gobject-introspection,
lcms2,
Expand Down Expand Up @@ -35,6 +36,7 @@ stdenv.mkDerivation (finalAttrs: {
meson
ninja
pkg-config
autoPatchPcHook
gi-docgen
gobject-introspection
vala
Expand Down
6 changes: 5 additions & 1 deletion pkgs/by-name/br/brotli/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
fetchFromGitHub,
fetchpatch,
cmake,
autoPatchPcHook,
staticOnly ? stdenv.hostPlatform.isStatic,
testers,
}:
Expand Down Expand Up @@ -32,7 +33,10 @@ stdenv.mkDerivation (finalAttrs: {
})
];

nativeBuildInputs = [ cmake ];
nativeBuildInputs = [
cmake
autoPatchPcHook
];

cmakeFlags = lib.optional staticOnly "-DBUILD_SHARED_LIBS=OFF";

Expand Down
2 changes: 2 additions & 0 deletions pkgs/by-name/ca/cairo/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
meson,
ninja,
pkg-config,
autoPatchPcHook,
python3,
docbook_xsl,
fontconfig,
Expand Down Expand Up @@ -57,6 +58,7 @@ stdenv.mkDerivation (
meson
ninja
pkg-config
autoPatchPcHook
python3
];

Expand Down
4 changes: 3 additions & 1 deletion pkgs/by-name/cc/cctools/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ let
stdenv.targetPlatform != stdenv.hostPlatform
) "${stdenv.targetPlatform.config}-";

openssl' = openssl.override { patchPcFiles = false; };

# First version with all the required files
xnu = fetchFromGitHub {
name = "xnu-src";
Expand Down Expand Up @@ -117,7 +119,7 @@ stdenv.mkDerivation (finalAttrs: {
nativeBuildInputs = [
meson
ninja
openssl
openssl'
];

buildInputs = [
Expand Down
2 changes: 2 additions & 0 deletions pkgs/by-name/co/colord/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
glib,
polkit,
pkg-config,
autoPatchPcHook,
gettext,
gusb,
lcms2,
Expand Down Expand Up @@ -88,6 +89,7 @@ stdenv.mkDerivation rec {
meson
ninja
pkg-config
autoPatchPcHook
shared-mime-info
vala
wrapGAppsNoGuiHook
Expand Down
6 changes: 5 additions & 1 deletion pkgs/by-name/cr/cryptsetup/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
openssl,
libuuid,
pkg-config,
autoPatchPcHook,
popt,
nixosTests,
libargon2,
Expand Down Expand Up @@ -76,7 +77,10 @@ stdenv.mkDerivation rec {
]
++ (lib.mapAttrsToList (lib.flip lib.enableFeature)) programs;

nativeBuildInputs = [ pkg-config ] ++ lib.optionals rebuildMan [ asciidoctor ];
nativeBuildInputs = [
pkg-config
autoPatchPcHook
] ++ lib.optionals rebuildMan [ asciidoctor ];
propagatedBuildInputs = [
lvm2
json_c
Expand Down
13 changes: 9 additions & 4 deletions pkgs/by-name/cu/curlMinimal/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@
zlib,
zstdSupport ? false,
zstd,
patchPcFiles ? false,
autoPatchPcHook,

# for passthru.tests
coeurl,
Expand Down Expand Up @@ -130,10 +132,13 @@ stdenv.mkDerivation (finalAttrs: {
NIX_LDFLAGS = "-liconv";
};

nativeBuildInputs = [
pkg-config
perl
] ++ lib.optionals stdenv.hostPlatform.isOpenBSD [ autoreconfHook ];
nativeBuildInputs =
[
pkg-config
perl
]
++ lib.optionals stdenv.hostPlatform.isOpenBSD [ autoreconfHook ]
++ lib.optional patchPcFiles [ autoPatchPcHook ];

# Zlib and OpenSSL must be propagated because `libcurl.la' contains
# "-lz -lssl", which aren't necessary direct build inputs of
Expand Down
2 changes: 2 additions & 0 deletions pkgs/by-name/db/dbus-glib/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
fetchurl,
buildPackages,
pkg-config,
autoPatchPcHook,
expat,
gettext,
libiconv,
Expand All @@ -29,6 +30,7 @@ stdenv.mkDerivation rec {

nativeBuildInputs = [
pkg-config
autoPatchPcHook
gettext
glib
];
Expand Down
Loading