Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Apr 2026 13:45:26 +0000
From:      Pierre Pronchery <khorben@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: b8352da33f34 - main - pkgconf: import into the base system
Message-ID:  <69e8d0f6.216cd.2cf09725@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by khorben:

URL: https://cgit.FreeBSD.org/src/commit/?id=b8352da33f3434f0ba6093df361261d1b1f973a1

commit b8352da33f3434f0ba6093df361261d1b1f973a1
Author:     Pierre Pronchery <khorben@FreeBSD.org>
AuthorDate: 2026-04-08 16:52:29 +0000
Commit:     Pierre Pronchery <khorben@FreeBSD.org>
CommitDate: 2026-04-22 13:42:56 +0000

    pkgconf: import into the base system
    
    This introduces the following option:
    
    * MK_PKGCONF: determines if pkgconf and bomtool should be built
    
    The objective is to allow the creation of SBOM information while
    building FreeBSD's src tree. The build system cannot rely on the
    presence of bomtool (and eventually also spdxtool) in the build
    environment, except for having it as part of the src tree directly.
    
    The framework implementing the generation of SBOM files is under review
    in D56474.
    
    This will also help simplifying the build, with the introduction of
    another framework relying on the availability of pkgconf.
    
    Sponsored by:           Alpha-Omega, The FreeBSD Foundation
    Reviewed by:            bapt, philip
    Approved by:            philip (mentor)
    Differential Revision:  https://reviews.freebsd.org/D56404
---
 etc/mtree/BSD.usr.dist                   |  2 +
 lib/Makefile                             |  1 +
 lib/libpkgconf/Makefile                  | 27 +++++++++++
 lib/libpkgconf/libpkgconf/config.h       | 77 ++++++++++++++++++++++++++++++++
 share/mk/bsd.libnames.mk                 |  1 +
 share/mk/src.libnames.mk                 |  1 +
 share/mk/src.opts.mk                     |  1 +
 tools/build/mk/OptionalObsoleteFiles.inc | 18 ++++++++
 tools/build/options/WITHOUT_PKGCONF      |  1 +
 tools/build/options/WITH_PKGCONF         |  5 +++
 usr.bin/Makefile                         |  2 +
 usr.bin/bomtool/Makefile                 | 20 +++++++++
 usr.bin/pkgconf/Makefile                 | 23 ++++++++++
 13 files changed, 179 insertions(+)

diff --git a/etc/mtree/BSD.usr.dist b/etc/mtree/BSD.usr.dist
index f9577e3c8085..b281a368861d 100644
--- a/etc/mtree/BSD.usr.dist
+++ b/etc/mtree/BSD.usr.dist
@@ -26,6 +26,8 @@
                     ..
                 ..
             ..
+            pkgconf           tags=package=pkgconf-dev
+            ..
             samplerate        tags=package=sound-dev
             ..
             sqlite3           tags=package=libsqlite3-dev
diff --git a/lib/Makefile b/lib/Makefile
index 1cb2d1d89e39..3faaea355ad0 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -188,6 +188,7 @@ SUBDIR.${MK_ICONV}+=	libiconv_modules
 SUBDIR.${MK_KERBEROS}+=	libcom_err
 .endif
 SUBDIR.${MK_LDNS}+=	libldns
+SUBDIR.${MK_PKGCONF}+=	libpkgconf
 SUBDIR.${MK_STATS}+=	libstats
 
 # The libraries under libclang_rt can only be built by clang.
diff --git a/lib/libpkgconf/Makefile b/lib/libpkgconf/Makefile
new file mode 100644
index 000000000000..8686103aa826
--- /dev/null
+++ b/lib/libpkgconf/Makefile
@@ -0,0 +1,27 @@
+PKGCONFDIR=	${SRCTOP}/contrib/pkgconf
+
+PACKAGE=	pkgconf
+PRIVATELIB=	yes
+LIB=		pkgconf
+MAN=		pkg.m4.7
+MANNODEV=	pc.5
+MANNODEV+=	pkgconf-personality.5
+
+SRCS=		audit.c buffer.c cache.c client.c pkg.c bsdstubs.c fragment.c
+SRCS+=		argvsplit.c fileio.c tuple.c dependency.c queue.c
+SRCS+=		path.c personality.c parser.c
+INCS=		bsdstubs.h iter.h libpkgconf-api.h libpkgconf.h stdinc.h
+
+CFLAGS+=	-Wno-error=cast-align
+CFLAGS+=	-Wno-error=cast-qual
+CFLAGS+=	-Wno-error=incompatible-pointer-types-discards-qualifiers
+CFLAGS+=	-DPERSONALITY_PATH=\"/usr/share/pkgconfig/personality.d:/etc/pkgconfig/personality.d:${LOCALBASE:U}/etc/pkgconfig/personality.d\"
+CFLAGS+=	-DPKG_DEFAULT_PATH=\"${LOCALBASE:U}/libdata/pkgconfig:/usr/libdata/pkgconfig:${LOCALBASE:U}/share/pkgconfig\"
+CFLAGS+=	-DSYSTEM_INCLUDEDIR=\"/usr/include\"
+CFLAGS+=	-DSYSTEM_LIBDIR=\"/usr/lib\"
+CFLAGS+=	-I${SRCTOP}/lib/libpkgconf -I${PKGCONFDIR}
+
+.PATH:		${PKGCONFDIR}/libpkgconf
+.PATH:		${PKGCONFDIR}/man
+
+.include <bsd.lib.mk>
diff --git a/lib/libpkgconf/libpkgconf/config.h b/lib/libpkgconf/libpkgconf/config.h
new file mode 100644
index 000000000000..49ae4a195137
--- /dev/null
+++ b/lib/libpkgconf/libpkgconf/config.h
@@ -0,0 +1,77 @@
+/* libpkgconf/config.h.in.  Generated from configure.ac by autoheader.  */
+
+/* Define to 1 if you have the `strlcat' function. */
+#define HAVE_STRLCAT 1
+
+/* Define to 1 if you have the `strlcpy' function. */
+#define HAVE_STRLCPY 1
+
+/* Define to 1 if you have the `strndup' function. */
+#define HAVE_STRNDUP 1
+
+/* Define to 1 if you have the `reallocarray' function. */
+#define HAVE_REALLOCARRAY 1
+
+/* Define to 1 if you have the `strlcat' function. */
+#define HAVE_DECL_STRLCAT 1
+
+/* Define to 1 if you have the `strlcpy' function. */
+#define HAVE_DECL_STRLCPY 1
+
+/* Define to 1 if you have the `strndup' function. */
+#define HAVE_DECL_STRNDUP 1
+
+/* Define to 1 if you have the `reallocarray' function. */
+#define HAVE_DECL_REALLOCARRAY 1
+
+/* Define to 1 if you have the `pledge' function. */
+/* #undef HAVE_DECL_PLEDGE */
+
+/* Define to 1 if you have the `unveil' function. */
+/* #undef HAVE_DECL_UNVEIL */
+
+/* Name of package */
+#define PACKAGE "pkgconf"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "https://github.com/pkgconf/pkgconf/issues/new"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "pkgconf"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "pkgconf 2.5.1"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "pkgconf"
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "2.5.1"
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Version number of package */
+#define VERSION "2.5.1"
+
+/* Enable large inode numbers on Mac OS X 10.5.  */
+#ifndef _DARWIN_USE_64_BIT_INODE
+# define _DARWIN_USE_64_BIT_INODE 1
+#endif
+
+/* Number of bits in a file offset, on hosts where this is settable. */
+/* #undef _FILE_OFFSET_BITS */
+
+/* Define for large files, on AIX-style hosts. */
+/* #undef _LARGE_FILES */
+
+/* Number of bits in time_t, on hosts where this is settable. */
+/* #undef _TIME_BITS */
+
+/* Enable Solaris extensions. */
+#ifndef __EXTENSIONS__
+# define __EXTENSIONS__ 1
+#endif
diff --git a/share/mk/bsd.libnames.mk b/share/mk/bsd.libnames.mk
index 9470e95c3036..bf6564afee38 100644
--- a/share/mk/bsd.libnames.mk
+++ b/share/mk/bsd.libnames.mk
@@ -137,6 +137,7 @@ LIBPANEL?=	${LIBDESTDIR}${LIBDIR_BASE}/libpanel.a
 LIBPANELW?=	${LIBDESTDIR}${LIBDIR_BASE}/libpanelw.a
 LIBPCAP?=	${LIBDESTDIR}${LIBDIR_BASE}/libpcap.a
 LIBPJDLOG?=	${LIBDESTDIR}${LIBDIR_BASE}/libpjdlog.a
+LIBPKGCONF?=	${LIBDESTDIR}${LIBDIR_BASE}/libpkgconf.a
 LIBPMC?=	${LIBDESTDIR}${LIBDIR_BASE}/libpmc.a
 LIBPROC?=	${LIBDESTDIR}${LIBDIR_BASE}/libproc.a
 LIBPROCSTAT?=	${LIBDESTDIR}${LIBDIR_BASE}/libprocstat.a
diff --git a/share/mk/src.libnames.mk b/share/mk/src.libnames.mk
index 388f9372abb0..aa3069b038f7 100644
--- a/share/mk/src.libnames.mk
+++ b/share/mk/src.libnames.mk
@@ -30,6 +30,7 @@ _PRIVATELIBS=	\
 		kldelf \
 		ldns \
 		opencsd \
+		pkgconf \
 		samplerate \
 		sqlite3 \
 		ssh \
diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk
index 7230f729b3e3..506b36b3d4b0 100644
--- a/share/mk/src.opts.mk
+++ b/share/mk/src.opts.mk
@@ -157,6 +157,7 @@ __DEFAULT_YES_OPTIONS = \
     PAM \
     PF \
     PKGBOOTSTRAP \
+    PKGCONF \
     PKGSERVE \
     PMC \
     PPP \
diff --git a/tools/build/mk/OptionalObsoleteFiles.inc b/tools/build/mk/OptionalObsoleteFiles.inc
index 3a45c7c9a01c..79d415163c87 100644
--- a/tools/build/mk/OptionalObsoleteFiles.inc
+++ b/tools/build/mk/OptionalObsoleteFiles.inc
@@ -6911,6 +6911,24 @@ OLD_FILES+=usr/share/snmp/defs/pf_tree.def
 OLD_FILES+=usr/share/snmp/mibs/BEGEMOT-PF-MIB.txt
 .endif
 
+.if ${MK_PKGCONF} == no
+OLD_FILES+=usr/bin/bomtool
+OLD_FILES+=usr/bin/pkgconf
+OLD_FILES+=usr/include/pkgconf/bsdstubs.h
+OLD_FILES+=usr/include/pkgconf/iter.h
+OLD_FILES+=usr/include/pkgconf/libpkgconf-api.h
+OLD_FILES+=usr/include/pkgconf/libpkgconf.h
+OLD_FILES+=usr/include/pkgconf/stdinc.h
+OLD_DIRS+=usr/include/pkgconf
+OLD_LIBS+=usr/lib/libprivatepkgconf.so
+OLD_LIBS+=usr/lib/libprivatepkgconf.so.5
+OLD_FILES+=usr/share/man/man1/bomtool.1.gz
+OLD_FILES+=usr/share/man/man1/pkgconf.1.gz
+OLD_FILES+=usr/share/man/man5/pc.5.gz
+OLD_FILES+=usr/share/man/man5/pkgconf-personality.5.gz
+OLD_FILES+=usr/share/man/man7/pkg.m4.7.gz
+.endif
+
 .if ${MK_PKGSERVE} == no
 OLD_FILES+=usr/libexec/pkg-serve
 OLD_FILES+=usr/share/man/man8/pkg-serve.8.gz
diff --git a/tools/build/options/WITHOUT_PKGCONF b/tools/build/options/WITHOUT_PKGCONF
new file mode 100644
index 000000000000..dcf9e0821329
--- /dev/null
+++ b/tools/build/options/WITHOUT_PKGCONF
@@ -0,0 +1 @@
+Do not build the pkgconf binaries nor the libpkgconf library.
diff --git a/tools/build/options/WITH_PKGCONF b/tools/build/options/WITH_PKGCONF
new file mode 100644
index 000000000000..f34431bd04c6
--- /dev/null
+++ b/tools/build/options/WITH_PKGCONF
@@ -0,0 +1,5 @@
+Build the pkgconf binaries,
+.Xr pkgconf 1 ,
+and
+.Xr bomtool 1 ,
+and libpkgconf library (private).
diff --git a/usr.bin/Makefile b/usr.bin/Makefile
index 6ca784ef6cb6..6718286e7ddb 100644
--- a/usr.bin/Makefile
+++ b/usr.bin/Makefile
@@ -234,6 +234,8 @@ SUBDIR.${MK_NIS}+=	ypcat
 SUBDIR.${MK_NIS}+=	ypmatch
 SUBDIR.${MK_NIS}+=	ypwhich
 SUBDIR.${MK_OPENSSH}+=	ssh-copy-id
+SUBDIR.${MK_PKGCONF}+=	bomtool
+SUBDIR.${MK_PKGCONF}+=	pkgconf
 SUBDIR.${MK_QUOTAS}+=	quota
 SUBDIR.${MK_SENDMAIL}+=	vacation
 SUBDIR.${MK_SOUND}+=	beep
diff --git a/usr.bin/bomtool/Makefile b/usr.bin/bomtool/Makefile
new file mode 100644
index 000000000000..f9471f35801b
--- /dev/null
+++ b/usr.bin/bomtool/Makefile
@@ -0,0 +1,20 @@
+PACKAGE=	pkgconf
+
+PROG=		bomtool
+SRCS=		main.c
+SRCS+=		getopt_long.c
+
+LIBADD=		pkgconf
+
+PKGCONFDIR=	${SRCTOP}/contrib/pkgconf
+
+CFLAGS+=	-Wno-error=missing-variable-declarations
+CFLAGS+=	-Wno-error=incompatible-pointer-types-discards-qualifiers
+CFLAGS+=	-Wno-error=cast-qual
+CFLAGS+=	-I${SRCTOP}/lib/libpkgconf -I${PKGCONFDIR} -I${PKGCONFDIR}/cli
+
+.PATH:		${PKGCONFDIR}/cli/bomtool
+.PATH:		${PKGCONFDIR}/cli
+.PATH:		${PKGCONFDIR}/man
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/pkgconf/Makefile b/usr.bin/pkgconf/Makefile
new file mode 100644
index 000000000000..2155201ac883
--- /dev/null
+++ b/usr.bin/pkgconf/Makefile
@@ -0,0 +1,23 @@
+PACKAGE=	pkgconf
+
+PROG=		pkgconf
+SRCS=		main.c
+SRCS+=		getopt_long.c
+SRCS+=		renderer-msvc.c
+
+LIBADD=		pkgconf
+
+SYMLINKS=	pkgconf ${BINDIR}/pkg-config
+
+PKGCONFDIR=	${SRCTOP}/contrib/pkgconf
+
+CFLAGS+=	-Wno-error=missing-variable-declarations
+CFLAGS+=	-Wno-error=incompatible-pointer-types-discards-qualifiers
+CFLAGS+=	-Wno-error=cast-qual
+CFLAGS+=	-DSYSTEM_INCLUDEDIR=\"/usr/include\" -DSYSTEM_LIBDIR=\"/usr/lib\"
+CFLAGS+=	-I${SRCTOP}/lib/libpkgconf -I${PKGCONFDIR}
+
+.PATH:		${PKGCONFDIR}/cli
+.PATH:		${PKGCONFDIR}/man
+
+.include <bsd.prog.mk>


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69e8d0f6.216cd.2cf09725>