pkgbase: create source package

FreeBSD-src for all the sources but the kernel
FreeBSD-src-sys just for the kernel

MFC After:		3 days
Reviewed by:		manu
Differential Revision:	https://reviews.freebsd.org/D42651
This commit is contained in:
Baptiste Daroussin 2023-11-17 17:19:39 +01:00
parent 094abb6fb4
commit 99b8c0c35b
4 changed files with 87 additions and 5 deletions

View File

@ -175,8 +175,8 @@ TGTS= all all-man buildenv buildenvvars buildetc buildkernel buildworld \
_build-tools _build-metadata _cross-tools _includes _libraries \
builddtb xdev xdev-build xdev-install \
xdev-links native-xtools native-xtools-install stageworld stagekernel \
stage-packages stage-packages-kernel stage-packages-world \
create-packages-world create-packages-kernel create-packages \
stage-packages stage-packages-kernel stage-packages-world stage-packages-source \
create-packages-world create-packages-kernel create-packages-source create-packages \
update-packages packages installconfig real-packages real-update-packages \
sign-packages package-pkg print-dir test-system-compiler test-system-linker \
test-includes

View File

@ -1956,6 +1956,7 @@ stagekernel: .PHONY
PORTSDIR?= /usr/ports
WSTAGEDIR?= ${OBJTOP}/worldstage
KSTAGEDIR?= ${OBJTOP}/kernelstage
SSTAGEDIR?= ${OBJTOP}/sourcestage
REPODIR?= ${OBJROOT}repo
PKG_FORMAT?= tzst
PKG_REPO_SIGNING_KEY?= # empty
@ -1963,6 +1964,7 @@ PKG_OUTPUT_DIR?= ${PKG_VERSION}
.ORDER: stage-packages create-packages
.ORDER: create-packages create-world-packages
.ORDER: create-packages create-source-packages
.ORDER: create-packages create-kernel-packages
.ORDER: create-packages sign-packages
@ -1974,7 +1976,7 @@ _pkgbootstrap: .PHONY
#
# Determine PKG_ABI from newvers.sh if not already set.
#
.if !defined(PKG_ABI) && (make(create-world-packages-jobs) || make(create-kernel-packages*) || make(real-update-packages) || make(sign-packages))
.if !defined(PKG_ABI) && (make(create-world-packages-jobs) || make(create-kernel-packages*) || make(real-update-packages) || make (create-source-packages) || make(sign-packages))
PKG_ABI=${_TYPE}:${MAJOR_REVISION}:${TARGET_ARCH}
.endif
PKG_BIN_VERSION!=${PKG_CMD} --version </dev/null 2>/dev/null |\
@ -2051,7 +2053,10 @@ stage-packages-kernel: .PHONY
${_+_}@cd ${.CURDIR}; \
${MAKE} DESTDIR=${KSTAGEDIR} -DNO_ROOT stagekernel
stage-packages: .PHONY stage-packages-world stage-packages-kernel
stage-packages-source: .PHONY
@mkdir -p ${SSTAGEDIR};
stage-packages: .PHONY stage-packages-world stage-packages-kernel stage-packages-source
_repodir: .PHONY
@mkdir -p ${REPODIR}
@ -2070,7 +2075,50 @@ create-packages-kernel: _pkgbootstrap _repodir .PHONY
SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH} \
create-kernel-packages
create-packages: .PHONY create-packages-world create-packages-kernel
create-packages-source: _pkgbootstrap _repodir .PHONY
${_+_}@cd ${.CURDIR}; \
${MAKE} -f Makefile.inc1 \
DESTDIR=${SSTAGEDIR} \
PKG_VERSION=${PKG_VERSION} create-source-packages
create-packages: .PHONY create-packages-world create-packages-kernel create-packages-source
create-source-packages: _pkgbootstrap .PHONY
rm -f ${SSTAGEDIR}/*.plist 2>/dev/null || :
.if !empty(GIT_CMD) && exists(${GIT_CMD}) && exists(${SRCDIR}/.git)
@cd ${SRCDIR}; \
( echo "@override_prefix /usr/src" ; \
${GIT_CMD} ls-files ":!:sys/" ) > ${SSTAGEDIR}/src.plist
@cd ${SRCDIR}; \
( echo "@override_prefix /usr/src" ; \
${GIT_CMD} ls-files "sys/" ) > ${SSTAGEDIR}/src-sys.plist
sed -e "s/%VERSION%/${PKG_VERSION}/" \
-e "s/%DESC%/FreeBSD sources/" \
-e "s/ %VCS_REVISION%/${VCS_REVISION}/" \
-e "s/%PKG_NAME_PREFIX%/${PKG_NAME_PREFIX}/" \
-e "s/%PKG_MAINTAINER%/${PKG_MAINTAINER}/" \
-e "s|%PKG_WWW%|${PKG_WWW}|" \
${SRCDIR}/release/packages/src.ucl \
> ${SSTAGEDIR}/src.ucl
sed -e "s/%VERSION%/${PKG_VERSION}/" \
-e "s/%DESC%/FreeBSD Kernel sources/" \
-e "s/ %VCS_REVISION%/${VCS_REVISION}/" \
-e "s/%PKG_NAME_PREFIX%/${PKG_NAME_PREFIX}/" \
-e "s/%PKG_MAINTAINER%/${PKG_MAINTAINER}/" \
-e "s|%PKG_WWW%|${PKG_WWW}|" \
${SRCDIR}/release/packages/src-sys.ucl \
> ${SSTAGEDIR}/src-sys.ucl
${PKG_CMD} -o ABI=${PKG_ABI} create -f ${PKG_FORMAT} \
-M ${SSTAGEDIR}/src.ucl \
-p ${SSTAGEDIR}/src.plist \
-r ${SRCDIR} \
-o ${REPODIR}/${PKG_ABI}/${PKG_OUTPUT_DIR}
${PKG_CMD} -o ABI=${PKG_ABI} create -f ${PKG_FORMAT} \
-M ${SSTAGEDIR}/src-sys.ucl \
-p ${SSTAGEDIR}/src-sys.plist \
-r ${SRCDIR} \
-o ${REPODIR}/${PKG_ABI}/${PKG_OUTPUT_DIR}
.endif
create-world-packages: _pkgbootstrap .PHONY
@rm -f ${WSTAGEDIR}/*.plist 2>/dev/null || :

View File

@ -0,0 +1,17 @@
#
#
name = "%PKG_NAME_PREFIX%-src-sys"
origin = "base"
version = "%VERSION%"
comment = "FreeBSD Kernel Sources"
categories = [ base ]
maintainer = "%PKG_MAINTAINER%"
www = "%PKG_WWW%"
prefix = "/"
licenselogic = "single"
licenses = [ BSD2CLAUSE ]
desc = <<EOD
%DESC%
EOD

17
release/packages/src.ucl Normal file
View File

@ -0,0 +1,17 @@
#
#
name = "%PKG_NAME_PREFIX%-src"
origin = "base"
version = "%VERSION%"
comment = "FreeBSD userland sources"
categories = [ base ]
maintainer = "%PKG_MAINTAINER%"
www = "%PKG_WWW%"
prefix = "/"
licenselogic = "single"
licenses = [ BSD2CLAUSE ]
desc = <<EOD
%DESC%
EOD