public inbox for bzip2-devel@sourceware.org
 help / color / mirror / Atom feed
From: ~eschwartz <eschwartz@git.sr.ht>
To: bzip2-devel@sourceware.org
Cc: eschwartz93@gmail.com
Subject: [PATCH bzip2 6/6] install a pkg-config file with instructions for linking to libbz2
Date: Fri, 03 Jun 2022 01:09:12 -0400	[thread overview]
Message-ID: <165475384722.17277.18269615533597437835-5@git.sr.ht> (raw)
In-Reply-To: <165475384722.17277.18269615533597437835-0@git.sr.ht>

From: Eli Schwartz <eschwartz93@gmail.com>

A pkg-config file is necessary in order to robustly communicate across
build systems that bz2 is installed, *where* it is installed, and the
correct CFLAGS / LDFLAGS to use in order to compile and link against it.
---
 Makefile.in  |  3 +++
 bzip2.pc.in  | 11 +++++++++++
 configure.ac |  2 +-
 3 files changed, 15 insertions(+), 1 deletion(-)
 create mode 100644 bzip2.pc.in

diff --git a/Makefile.in b/Makefile.in
index dff9422..86f1bdc 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -78,6 +78,7 @@ test: bzip2
 install: bzip2 bzip2recover
 	if ( test ! -d $(DESTDIR)$(bindir) ) ; then mkdir -p $(DESTDIR)$(bindir) ; fi
 	if ( test ! -d $(DESTDIR)$(libdir) ) ; then mkdir -p $(DESTDIR)$(libdir) ; fi
+	if ( test ! -d $(DESTDIR)$(libdir)/pkgconfig ) ; then mkdir -p $(DESTDIR)$(libdir)/pkgconfig ; fi
 	if ( test ! -d $(DESTDIR)$(mandir) ) ; then mkdir -p $(DESTDIR)$(mandir) ; fi
 	if ( test ! -d $(DESTDIR)$(mandir)/man1 ) ; then mkdir -p $(DESTDIR)$(mandir)/man1 ; fi
 	if ( test ! -d $(DESTDIR)$(includedir) ) ; then mkdir -p $(DESTDIR)$(includedir) ; fi
@@ -116,6 +117,7 @@ install: bzip2 bzip2recover
 	echo ".so man1/bzgrep.1" > $(DESTDIR)$(mandir)/man1/bzfgrep.1
 	echo ".so man1/bzmore.1" > $(DESTDIR)$(mandir)/man1/bzless.1
 	echo ".so man1/bzdiff.1" > $(DESTDIR)$(mandir)/man1/bzcmp.1
+	cp -f bzip2.pc $(DESTDIR)$(libdir)/pkgconfig/bzip2.pc
 
 clean:
 	rm -f *.o libbz2.a bzip2 bzip2recover \
@@ -165,6 +167,7 @@ dist: check manual
 	   $(DISTNAME)/configure.ac \
 	   $(DISTNAME)/configure \
 	   $(DISTNAME)/Makefile.in \
+	   $(DISTNAME)/bzip2.pc.in \
 	   $(DISTNAME)/LICENSE \
 	   $(DISTNAME)/bzip2.1 \
 	   $(DISTNAME)/bzip2.1.preformatted \
diff --git a/bzip2.pc.in b/bzip2.pc.in
new file mode 100644
index 0000000..11c14e1
--- /dev/null
+++ b/bzip2.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+includedir=@includedir@
+libdir=@libdir@
+
+Name: bzip2
+URL: https://sourceware.org/bzip2/
+Description: A file compression library
+Version: @PACKAGE_VERSION@
+Libs: -L${libdir} -lbz2
+Cflags: -I${includedir}
diff --git a/configure.ac b/configure.ac
index 8f26062..5936b5c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5,6 +5,6 @@ AC_PROG_CC
 AC_CHECK_TOOL([AR], [ar])
 AC_CHECK_TOOL([RANLIB], [ranlib])
 
-AC_CONFIG_FILES([Makefile Makefile-libbz2_so])
+AC_CONFIG_FILES([Makefile Makefile-libbz2_so bzip2.pc])
 
 AC_OUTPUT
-- 
2.34.2

  parent reply	other threads:[~2022-06-09  5:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-03  3:45 [PATCH bzip2 1/6] install relative symlinks ~eschwartz
2022-06-03  4:20 ` [PATCH bzip2 2/6] port the build configuration to autoconf ~eschwartz
2022-06-09  5:56   ` Eli Schwartz
2022-06-03  4:48 ` [PATCH bzip2 4/6] make a couple program aliases symlinks instead of copies ~eschwartz
2022-06-03  4:54 ` [PATCH bzip2 5/6] install man page symlinks for a couple more symlinked commands ~eschwartz
2022-06-03  5:09 ` ~eschwartz [this message]
2022-06-09  5:52   ` [PATCH bzip2 6/6] install a pkg-config file with instructions for linking to libbz2 Eli Schwartz
2022-10-23 16:03     ` Sam James
2022-06-09  4:50 ` [PATCH bzip2 3/6] shared Makefile: add install rule ~eschwartz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=165475384722.17277.18269615533597437835-5@git.sr.ht \
    --to=eschwartz@git.sr.ht \
    --cc=bzip2-devel@sourceware.org \
    --cc=eschwartz93@gmail.com \
    --cc=eschwartz@archlinux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).