From 06be6812a674e23abc9e24fa2fbd7a7c20684c74 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Mon, 3 Jun 2024 14:08:37 -0400 Subject: [PATCH] Create and install a `nix-util.pc` Before, `-lnixutil` was just stuck in `nix-store.pc`, but that doesn't seem so nice. This prepares us to distribute `libnixutil` in a separate package if we want, but it should be a good change either way. I suspect it wasn't done before because libutil was an extra unstable interface, but I don't think we need worry about that. *All* the C++ is less stable than the C (or that's the goal at least). For what it's worth, Lix also created this pkg-config file *en passant* during their rename: https://git.lix.systems/lix-project/lix/commit/c97e17144e0d0b666d7b79d8b4b0d581bfdf373b#diff-3c4f60cc44a0e35444c7f45331cfa50f76637118 --- src/libstore/nix-store.pc.in | 3 ++- src/libutil/local.mk | 2 ++ src/libutil/nix-util.pc.in | 9 +++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 src/libutil/nix-util.pc.in diff --git a/src/libstore/nix-store.pc.in b/src/libstore/nix-store.pc.in index dc42d0bca..cd3f2b8da 100644 --- a/src/libstore/nix-store.pc.in +++ b/src/libstore/nix-store.pc.in @@ -5,5 +5,6 @@ includedir=@includedir@ Name: Nix Description: Nix Package Manager Version: @PACKAGE_VERSION@ -Libs: -L${libdir} -lnixstore -lnixutil +Requires: nix-util +Libs: -L${libdir} -lnixstore Cflags: -I${includedir}/nix -std=c++2a diff --git a/src/libutil/local.mk b/src/libutil/local.mk index 5cd8d4ac8..e9b498e65 100644 --- a/src/libutil/local.mk +++ b/src/libutil/local.mk @@ -40,3 +40,5 @@ $(foreach i, $(wildcard $(d)/signature/*.hh), \ ifeq ($(HAVE_LIBCPUID), 1) libutil_LDFLAGS += -lcpuid endif + +$(eval $(call install-file-in, $(buildprefix)$(d)/nix-util.pc, $(libdir)/pkgconfig, 0644)) diff --git a/src/libutil/nix-util.pc.in b/src/libutil/nix-util.pc.in new file mode 100644 index 000000000..85bb1e70e --- /dev/null +++ b/src/libutil/nix-util.pc.in @@ -0,0 +1,9 @@ +prefix=@prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: Nix +Description: Nix Package Manager +Version: @PACKAGE_VERSION@ +Libs: -L${libdir} -lnixutil +Cflags: -I${includedir}/nix -std=c++2a