Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F153364645
D56474.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D56474.diff
View Options
Index: Makefile.inc1
===================================================================
--- Makefile.inc1
+++ Makefile.inc1
@@ -774,6 +774,7 @@
MK_HTML=no \
MK_MAN=no \
MK_RETPOLINE=no \
+ MK_SBOM=no \
MK_SSP=no \
MK_TESTS=no \
MK_UBSAN=no \
@@ -3086,6 +3087,12 @@
_ar=usr.bin/ar
.endif
+.if ${MK_PKGCONF} != "no"
+_sbom= lib/libpkgconf \
+ usr.bin/bomtool \
+ usr.bin/spdxtool
+.endif
+
cross-tools: .MAKE .PHONY
.for _tool in \
${LOCAL_XTOOL_DIRS} \
@@ -3978,7 +3985,7 @@
NOFUN=-DNO_FSCHG MK_HTML=no \
MK_MAN=no MK_NLS=no \
- MK_KERBEROS=no MK_RESCUE=no MK_TESTS=no MK_WERROR=no \
+ MK_KERBEROS=no MK_RESCUE=no MK_SBOM=no MK_TESTS=no MK_WERROR=no \
TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
CPUTYPE=${XDEV_CPUTYPE}
Index: etc/mtree/BSD.usr.dist
===================================================================
--- etc/mtree/BSD.usr.dist
+++ etc/mtree/BSD.usr.dist
@@ -847,6 +847,10 @@
triggers
..
..
+ sbom
+ spdx
+ ..
+ ..
security
..
sendmail
Index: share/mk/bsd.README
===================================================================
--- share/mk/bsd.README
+++ share/mk/bsd.README
@@ -43,6 +43,7 @@
bsd.port.subdir.mk - targets for building subdirectories for ports
bsd.prog.mk - building programs from source files
bsd.progs.mk - build multiple programs from sources
+bsd.sbom.mk - generate SBOM artefacts from pkg-config definitions
bsd.snmpmod.mk - building modules for the SNMP daemon bsnmpd
bsd.subdir.mk - targets for building subdirectories
bsd.sys.mk - common settings used for building FreeBSD sources
Index: share/mk/bsd.lib.mk
===================================================================
--- share/mk/bsd.lib.mk
+++ share/mk/bsd.lib.mk
@@ -527,3 +527,4 @@
.include <bsd.clang-analyze.mk>
.include <bsd.obj.mk>
.include <bsd.sys.mk>
+.include <bsd.sbom.mk>
Index: share/mk/bsd.prog.mk
===================================================================
--- share/mk/bsd.prog.mk
+++ share/mk/bsd.prog.mk
@@ -364,3 +364,4 @@
.include <bsd.clang-analyze.mk>
.include <bsd.obj.mk>
.include <bsd.sys.mk>
+.include <bsd.sbom.mk>
Index: share/mk/bsd.sbom.mk
===================================================================
--- /dev/null
+++ share/mk/bsd.sbom.mk
@@ -0,0 +1,40 @@
+# Generate SBOM files from definitions in the pkg-config format
+#
+# +++ variables +++
+#
+# BOMTOOL Tool converting pkg-config files into SPDX version 2 files
+# SBOMDIR Source directory for the pkg-config files
+# SPDXDIR Destination directory for the SPDX version 2 files
+
+.if ${MK_SBOM} != "no"
+
+BOMTOOL?= bomtool
+SBOMDIR?= ${SRCTOP}/release/sbom/pkgconfig
+SPDXDIR?= /usr/share/sbom/spdx
+
+.if defined(LIB)
+PCFILE?= lib${LIB}.pc
+.endif
+
+.if defined(PROG)
+PCFILE?= ${PROG}.pc
+.endif
+
+.if !empty(PCFILE) && exists(${SBOMDIR}/${PCFILE})
+
+${PCFILE:R}.spdx: ${SBOMDIR}/${PCFILE}
+ ${BOMTOOL} ${SBOMDIR}/${PCFILE} > ${.TARGET}
+
+spdxinstall: .PHONY ${PCFILE:R}.spdx
+ ${INSTALL} -m 0644 ${PCFILE:R}.spdx ${DESTDIR}${SPDXDIR}/${PCFILE:R}.spdx
+
+.if !defined(NO_SPDX_SBOM)
+all: ${PCFILE:R}.spdx
+
+realinstall: spdxinstall
+.ORDER: beforeinstall spdxinstall
+.endif
+
+.endif # exists(${SBOMDIR}/${PCFILE})
+
+.endif # ${MK_SBOM}
Index: share/mk/src.opts.mk
===================================================================
--- share/mk/src.opts.mk
+++ share/mk/src.opts.mk
@@ -166,6 +166,7 @@
RBOOTD \
RESCUE \
ROUTED \
+ SBOM \
SENDMAIL \
SERVICESDB \
SETUID_LOGIN \
Index: usr.bin/bomtool/Makefile
===================================================================
--- usr.bin/bomtool/Makefile
+++ usr.bin/bomtool/Makefile
@@ -6,6 +6,10 @@
LIBADD= pkgconf
+.if defined(TOOLS_PREFIX)
+NO_SHARED= yes
+.endif
+
PKGCONFDIR= ${SRCTOP}/contrib/pkgconf
CFLAGS+= -Wno-error=missing-variable-declarations
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Apr 21, 5:49 PM (4 h, 24 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31741240
Default Alt Text
D56474.diff (3 KB)
Attached To
Mode
D56474: Generate SBOM files as part of the build
Attached
Detach File
Event Timeline
Log In to Comment