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
This commit is contained in:
Pierre Pronchery
2026-04-08 18:52:29 +02:00
parent a3cefe7f2b
commit b8352da33f
13 changed files with 179 additions and 0 deletions
+2
View File
@@ -26,6 +26,8 @@
..
..
..
pkgconf tags=package=pkgconf-dev
..
samplerate tags=package=sound-dev
..
sqlite3 tags=package=libsqlite3-dev
+1
View File
@@ -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.
+27
View File
@@ -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>
+77
View File
@@ -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
+1
View File
@@ -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
+1
View File
@@ -30,6 +30,7 @@ _PRIVATELIBS= \
kldelf \
ldns \
opencsd \
pkgconf \
samplerate \
sqlite3 \
ssh \
+1
View File
@@ -157,6 +157,7 @@ __DEFAULT_YES_OPTIONS = \
PAM \
PF \
PKGBOOTSTRAP \
PKGCONF \
PKGSERVE \
PMC \
PPP \
+18
View File
@@ -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
+1
View File
@@ -0,0 +1 @@
Do not build the pkgconf binaries nor the libpkgconf library.
+5
View File
@@ -0,0 +1,5 @@
Build the pkgconf binaries,
.Xr pkgconf 1 ,
and
.Xr bomtool 1 ,
and libpkgconf library (private).
+2
View File
@@ -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
+20
View File
@@ -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>
+23
View File
@@ -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>