[pacman-dev] [PATCH] libmakepkg: install pkg-config file

Eli Schwartz eschwartz at archlinux.org
Wed Apr 24 06:28:20 UTC 2019


Since makepkg exports a public library of functions, other projects may
wish to use these functions. Highlights include parseopts or our
messaging functions.

Install a pkg-config file in order to let downstream users detect where
they can source the libmakepkg functionality. This is useful e.g. to
gracefully handle the case where a thirdparty project is configured and
installed into a different datarootdir from pacman, but still wants to
use the installed pacman's version of libmakepkg.

Signed-off-by: Eli Schwartz <eschwartz at archlinux.org>
---

pkgconfig.generate is bloat for this and results in useless keys
cluttering up the generated .pc -- there is no advantage of generating
it over configuring it, if we're not benefiting from library
autodetection.

 scripts/.gitignore       | 1 +
 scripts/Makefile.am      | 5 ++++-
 scripts/libmakepkg.pc.in | 6 ++++++
 scripts/meson.build      | 6 ++++++
 4 files changed, 17 insertions(+), 1 deletion(-)
 create mode 100644 scripts/libmakepkg.pc.in

diff --git a/scripts/.gitignore b/scripts/.gitignore
index b8bb1f83..541fd18d 100644
--- a/scripts/.gitignore
+++ b/scripts/.gitignore
@@ -1,3 +1,4 @@
+libmakepkg.pc
 makepkg
 makepkg-template
 pacman-db-upgrade
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index 2c743e82..5cb8cf71 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -5,6 +5,9 @@ AM_INSTALLCHECK_STD_OPTIONS_EXEMPT = \
 
 SUBDIRS = po
 
+pkgconfigdir = $(datarootdir)/pkgconfig
+pkgconfig_DATA = libmakepkg.pc
+
 bin_SCRIPTS = \
 	$(OURSCRIPTS) \
 	makepkg-template \
@@ -195,7 +198,7 @@ $(LIBMAKEPKG_IN): %: %.in Makefile
 	$(AM_V_at)chmod a-w $@
 	@$(BASH_SHELL) -O extglob -n $@
 
-$(COMPLETION_IN): %: %.in Makefile
+$(COMPLETION_IN) libmakepkg.pc: %: %.in Makefile
 	$(AM_V_at)$(RM) $@
 	$(AM_V_at)$(MKDIR_P) $(dir $@)
 	$(AM_V_GEN)$(edit) $(srcdir)/$@.in >$@
diff --git a/scripts/libmakepkg.pc.in b/scripts/libmakepkg.pc.in
new file mode 100644
index 00000000..05e9566a
--- /dev/null
+++ b/scripts/libmakepkg.pc.in
@@ -0,0 +1,6 @@
+libmakepkgdir=@libmakepkgdir@
+
+Name: libmakepkg
+Description: Arch Linux package build utility
+URL: https://www.archlinux.org/pacman/
+Version: @PACKAGE_VERSION@
diff --git a/scripts/meson.build b/scripts/meson.build
index db442973..7d533f35 100644
--- a/scripts/meson.build
+++ b/scripts/meson.build
@@ -78,6 +78,12 @@ endforeach
 
 subdir('libmakepkg')
 
+configure_file(
+	configuration : { 'libmakepkgdir': LIBMAKEPKGDIR, 'PACKAGE_VERSION': PACKAGE_VERSION },
+	input : 'libmakepkg.pc.in',
+	output : '@BASENAME@',
+	install_dir : join_paths(DATAROOTDIR, 'pkgconfig'))
+
 custom_target(
   'bash_completion',
   command : [ SCRIPT_EDITOR, '@INPUT@', '@OUTPUT@' ],
-- 
2.21.0


More information about the pacman-dev mailing list