git: 573cb59c35de - releng/15.0 - MFC: libbz2: add pkg-config file (bzip2.pc)
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 13 Oct 2025 15:28:54 UTC
The branch releng/15.0 has been updated by cperciva:
URL: https://cgit.FreeBSD.org/src/commit/?id=573cb59c35deb4e9dd720c736d7984773fd1068d
commit 573cb59c35deb4e9dd720c736d7984773fd1068d
Author: Xin LI <delphij@FreeBSD.org>
AuthorDate: 2025-10-10 05:35:54 +0000
Commit: Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2025-10-13 15:28:24 +0000
MFC: libbz2: add pkg-config file (bzip2.pc)
Add generation of a bzip2.pc file for use with pkg-config and create
a basic template as bzip2.pc.in.
This allows other software to easily locate and link against libbz2
using standard pkg-config mechanisms instead of manual compiler and
linker flags.
The version number is extracted automatically from bzlib.h to keep
it consistent with the library sources.
Approved by: re (cperciva)
Tested: pkg-config --exists --print-errors "bzip2 >= 1.0.9" (fail, expected)
pkg-config --exists --print-errors "bzip2 >= 1.0" (succeeded)
pkg-config --libs bzip2 (-lbz2)
pkg-config --cflags bzip2 ()
(cherry picked from commit 586319793368cbc664b48187bda60d27e171753a)
(cherry picked from commit f139a644d3ee01667480ff6d698757d3e3689794)
---
lib/libbz2/Makefile | 13 +++++++++++++
lib/libbz2/bzip2.pc.in | 11 +++++++++++
2 files changed, 24 insertions(+)
diff --git a/lib/libbz2/Makefile b/lib/libbz2/Makefile
index d773f202dd67..2aedbaed4328 100644
--- a/lib/libbz2/Makefile
+++ b/lib/libbz2/Makefile
@@ -13,4 +13,17 @@ CFLAGS+= -I${BZ2DIR}
WARNS?= 3
+BZIP2_VERSION!= sed -n '/bzip2\/libbzip2 version /{s/.*version //;s/ of.*//p;q;}' ${BZ2DIR}/bzlib.h
+
+bzip2.pc: bzip2.pc.in
+ sed -e 's,@prefix@,/usr,g ; \
+ s,@exec_prefix@,$${prefix},g ; \
+ s,@libdir@,${LIBDIR},g ; \
+ s,@sharedlibdir@,${SHLIBDIR},g ; \
+ s,@includedir@,${INCLUDEDIR},g ; \
+ s,@VERSION@,${BZIP2_VERSION},g ;' \
+ ${.ALLSRC} > ${.TARGET}
+
+PCFILES= bzip2.pc
+
.include <bsd.lib.mk>
diff --git a/lib/libbz2/bzip2.pc.in b/lib/libbz2/bzip2.pc.in
new file mode 100644
index 000000000000..d91c9931a58a
--- /dev/null
+++ b/lib/libbz2/bzip2.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+sharedlibdir=@sharedlibdir@
+includedir=@includedir@
+
+Name: bzip2
+Description: bzip2 compression library
+Version: @VERSION@
+Libs: -L${libdir} -lbz2
+Cflags: -I${includedir}