Index: Mk/Scripts/functions.sh =================================================================== --- Mk/Scripts/functions.sh +++ Mk/Scripts/functions.sh @@ -7,7 +7,8 @@ _strip_perms() { sed -Ee 's/^@\([^)]*\)[[:space:]]+//' \ -e 's/^(@[[:alpha:]]+)\([^)]*\)[[:space:]]+/\1 /' \ - -e 's/^@@[[:alnum:]]+@@//' + -e 's/^@@[[:alnum:]]+@@//' \ + -e 's/@@[[:alnum:]]+@@$//' } # Expand TMPPLIST to absolute paths, splitting files and dirs into separate Index: Mk/bsd.licenses.mk =================================================================== --- Mk/bsd.licenses.mk +++ Mk/bsd.licenses.mk @@ -152,11 +152,13 @@ # bsd.port.mk to avoid creating LICENSE_{REQ,SEQ} for a # few more targets only. -_LICENSE_DIR?= ${PREFIX}/share/licenses/${PKGNAME} +. for sp in ${_PKGS} +_LICENSE_DIR.${sp}?= ${PREFIX}/share/licenses/${PKGNAME${_SP.${sp}}} +_LICENSE_CATALOG.${sp}?= ${_LICENSE_DIR.${sp}}/catalog.mk +_LICENSE_REPORT.${sp}?= ${_LICENSE_DIR.${sp}}/LICENSE +. endfor _LICENSE_STORE?= ${PORTSDIR}/Templates/Licenses -_LICENSE_CATALOG?= ${_LICENSE_DIR}/catalog.mk _LICENSE_CATALOG_TMP?= ${WRKDIR}/.license-catalog.mk -_LICENSE_REPORT?= ${_LICENSE_DIR}/LICENSE _LICENSE_REPORT_TMP?= ${WRKDIR}/.license-report _LICENSE_COOKIE?= ${WRKDIR}/.license_done.${PORTNAME}.${PREFIX:S/\//_/g} @@ -771,30 +773,47 @@ # Package list entries, and installation . if !defined(NO_LICENSES_INSTALL) -PLIST_FILES+= ${_LICENSE_CATALOG} \ - ${_LICENSE_REPORT} - -. if ${_LICENSE_COMB} == "single" -PLIST_FILES+= ${_LICENSE_DIR}/${_LICENSE} -. else -. for lic in ${_LICENSE} -. if defined(_LICENSE_FILE_${lic}) -PLIST_FILES+= ${_LICENSE_DIR}/${lic} +. for sp in ${_PKGS} +. if ${sp} == ${PKGBASE} +PLIST_FILES+= ${_LICENSE_CATALOG.${sp}} \ + ${_LICENSE_REPORT.${sp}} +. if ${_LICENSE_COMB} == "single" +PLIST_FILES+= ${_LICENSE_DIR.${sp}}/${_LICENSE} +. else +. for lic in ${_LICENSE} +. if defined(_LICENSE_FILE_${lic}) +PLIST_FILES+= ${_LICENSE_DIR.${sp}}/${lic} +. endif +. endfor . endif -. endfor -. endif +. else +PLIST_FILES${_SP.${sp}}+= ${_LICENSE_CATALOG.${sp}} \ + ${_LICENSE_REPORT.${sp}} +. if ${_LICENSE_COMB} == "single" +PLIST_FILES${_SP.${sp}}+= ${_LICENSE_DIR.${sp}}/${_LICENSE} +. else +. for lic in ${_LICENSE} +. if defined(_LICENSE_FILE_${lic}) +PLIST_FILES${_SP.${sp}}+= ${_LICENSE_DIR.${sp}}/${lic} +. endif +. endfor +. endif +. endif -install-license: - @${MKDIR} ${STAGEDIR}${_LICENSE_DIR} - @${INSTALL_DATA} ${_LICENSE_CATALOG_TMP} ${STAGEDIR}${_LICENSE_CATALOG} - @${INSTALL_DATA} ${_LICENSE_REPORT_TMP} ${STAGEDIR}${_LICENSE_REPORT} -. if ${_LICENSE_COMB} == "single" - @${INSTALL_DATA} ${_LICENSE_FILE} ${STAGEDIR}${_LICENSE_DIR}/${_LICENSE} -. else -. for lic in ${_LICENSE} + +install-license: install-license.${sp} +install-license.${sp}: + @${MKDIR} ${STAGEDIR}${_LICENSE_DIR.${sp}} + @${INSTALL_DATA} ${_LICENSE_CATALOG_TMP} ${STAGEDIR}${_LICENSE_CATALOG.${sp}} + @${INSTALL_DATA} ${_LICENSE_REPORT_TMP} ${STAGEDIR}${_LICENSE_REPORT.${sp}} +. if ${_LICENSE_COMB} == "single" + @${INSTALL_DATA} ${_LICENSE_FILE} ${STAGEDIR}${_LICENSE_DIR.${sp}}/${_LICENSE} +. else +. for lic in ${_LICENSE} @${INSTALL_DATA} ${_LICENSE_FILE_${lic}} ${STAGEDIR}${_LICENSE_DIR}/${lic} -. endfor -. endif +. endfor +. endif +. endfor . endif . else # !LICENSE Index: Mk/bsd.port.mk =================================================================== --- Mk/bsd.port.mk +++ Mk/bsd.port.mk @@ -2209,11 +2209,6 @@ INSTALL_TARGET?= install INSTALL_TARGET+= ${LATE_INSTALL_ARGS} -# Integrate with the license auditing framework -. if !defined (DISABLE_LICENSES) -.include "${PORTSDIR}/Mk/bsd.licenses.mk" -. endif - # Popular master sites .include "${PORTSDIR}/Mk/bsd.sites.mk" @@ -2662,6 +2657,11 @@ WRKDIR_PKGFILE${_SP.${sp}}= ${WRKDIR}/pkg/${PKGNAME${_SP.${sp}}}${PKG_SUFX} . endfor +# Integrate with the license auditing framework +. if !defined (DISABLE_LICENSES) +.include "${PORTSDIR}/Mk/bsd.licenses.mk" +. endif + CONFIGURE_SCRIPT?= configure CONFIGURE_CMD?= ./${CONFIGURE_SCRIPT} CONFIGURE_TARGET?= ${HOSTARCH}-portbld-${OPSYS:tl}${OSREL} @@ -4590,15 +4590,21 @@ . if !empty(_REALLY_ALL_POSSIBLE_OPTIONS:M${_type}) . if !target(add-plist-${_type:tl}) . if defined(PORT${_type}) && !empty(PORT_OPTIONS:M${_type}) +. if defined(${_type}_SUBPACKAGES) +SP_${_type}= @@${${_type}_SUBPACKAGES}@@ +. else +SP_${_type}= +. endif add-plist-${_type:tl}: . for x in ${PORT${_type}} @if ${ECHO_CMD} "${x}"| ${AWK} '$$1 ~ /(\*|\||\[|\]|\?|\{|\}|\$$)/ { exit 1};'; then \ if [ ! -e ${STAGEDIR}${${_type}DIR}/${x} ]; then \ - ${ECHO_CMD} ${${_type}DIR}/${x} >> ${TMPPLIST}; \ - fi;fi + ${ECHO_CMD} ${SP_${_type}}${${_type}DIR}/${x} >> ${TMPPLIST}; \ + fi \ + fi . endfor @${FIND} -P ${PORT${_type}:S/^/${STAGEDIR}${${_type}DIR}\//} ! -type d 2>/dev/null | \ - ${SED} -ne 's,^${STAGEDIR},,p' >> ${TMPPLIST} + ${SED} -ne 's,^${STAGEDIR},${SP_${_type}},p' >> ${TMPPLIST} . endif . endif . endif Index: ports-mgmt/Makefile =================================================================== --- ports-mgmt/Makefile +++ ports-mgmt/Makefile @@ -77,6 +77,7 @@ SUBDIR += reprise SUBDIR += sccache-overlay SUBDIR += submodules2tuple + SUBDIR += subpkgtest SUBDIR += synth SUBDIR += wanted-ports Index: ports-mgmt/subpkgtest/Makefile =================================================================== --- /dev/null +++ ports-mgmt/subpkgtest/Makefile @@ -0,0 +1,49 @@ +PORTNAME= port-test +PORTVERSION= 0.0.2 +DISTVERSIONPREFIX= v +CATEGORIES= ports-mgmt + +MAINTAINER= pizzamig@FreeBSD.org +COMMENT= Small C project to be used as test +WWW= https://github.com/pizzamig/port-test + +LICENSE= BSD3CLAUSE +LICENSE_FILE= ${WRKSRC}/LICENSE + +USE_GITHUB= yes +GH_ACCOUNT= pizzamig + +OPTIONS_DEFINE= DATA DOCS EXAMPLES +OPTIONS_SUB= yes +OPTIONS_DEFAULT= DATA + +DATA_DESC= Install additional data files + +SUBPACKAGES= cmd2 +SELF_DEPENDS.cmd2= main + +DATA_SUBPACKAGES= data1 data2 +DOCS_SUBPACKAGES= docs +EXAMPLES_SUBPACKAGES= examples + +PORTDOCS= README.md +PORTEXAMPLES= EXAMPLES.md + +do-install: + ${INSTALL_PROGRAM} ${WRKSRC}/cmd1 ${STAGEDIR}${PREFIX}/bin + ${INSTALL_PROGRAM} ${WRKSRC}/cmd2 ${STAGEDIR}${PREFIX}/bin + +post-install-DATA-on: + ${MKDIR} ${STAGEDIR}${DATADIR} + ${INSTALL_DATA} ${WRKSRC}/data1.txt ${STAGEDIR}${DATADIR} + ${INSTALL_DATA} ${WRKSRC}/data2.txt ${STAGEDIR}${DATADIR} + +post-install-DOCS-on: + ${MKDIR} ${STAGEDIR}${DOCSDIR} + ${INSTALL_DATA} ${WRKSRC}/README.md ${STAGEDIR}${DOCSDIR} + +post-install-EXAMPLES-on: + ${MKDIR} ${STAGEDIR}${EXAMPLESDIR} + ${INSTALL_DATA} ${WRKSRC}/EXAMPLES.md ${STAGEDIR}${EXAMPLESDIR} + +.include Index: ports-mgmt/subpkgtest/distinfo =================================================================== --- /dev/null +++ ports-mgmt/subpkgtest/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1686490183 +SHA256 (pizzamig-port-test-v0.0.2_GH0.tar.gz) = 3845e74e7963712d22bd8219b91914fc217e59bf63e180ccfc7f2aaaf1f2c569 +SIZE (pizzamig-port-test-v0.0.2_GH0.tar.gz) = 2203 Index: ports-mgmt/subpkgtest/pkg-descr =================================================================== --- /dev/null +++ ports-mgmt/subpkgtest/pkg-descr @@ -0,0 +1,2 @@ +port-test is just a test. +The code is only a bunch of hello worlds written in C Index: ports-mgmt/subpkgtest/pkg-descr.cmd2 =================================================================== --- /dev/null +++ ports-mgmt/subpkgtest/pkg-descr.cmd2 @@ -0,0 +1,2 @@ +port-test-cmd2 only contains cmd2 +The code is only a hello world written in C echoing 'cmd2' Index: ports-mgmt/subpkgtest/pkg-descr.data1 =================================================================== --- /dev/null +++ ports-mgmt/subpkgtest/pkg-descr.data1 @@ -0,0 +1 @@ +port-test-data1 only contains data1.txt file Index: ports-mgmt/subpkgtest/pkg-descr.data2 =================================================================== --- /dev/null +++ ports-mgmt/subpkgtest/pkg-descr.data2 @@ -0,0 +1 @@ +port-test-data2 only contains data2.txt file Index: ports-mgmt/subpkgtest/pkg-descr.docs =================================================================== --- /dev/null +++ ports-mgmt/subpkgtest/pkg-descr.docs @@ -0,0 +1 @@ +port-test-docs only contains documentation Index: ports-mgmt/subpkgtest/pkg-descr.examples =================================================================== --- /dev/null +++ ports-mgmt/subpkgtest/pkg-descr.examples @@ -0,0 +1 @@ +port-test-examples only contains examples Index: ports-mgmt/subpkgtest/pkg-plist =================================================================== --- /dev/null +++ ports-mgmt/subpkgtest/pkg-plist @@ -0,0 +1,4 @@ +bin/cmd1 +@@cmd2@@bin/cmd2 +@@data1@@%%DATA%%%%DATADIR%%/data1.txt +@@data2@@%%DATA%%%%DATADIR%%/data2.txt