git: 8f79c11c7171 - main - net/wifi-firmware-*: build framework and license hack cleanup
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 27 Aug 2024 17:42:37 UTC
The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/ports/commit/?id=8f79c11c717126a42a6f17f30a193cf1da866831 commit 8f79c11c717126a42a6f17f30a193cf1da866831 Author: Bjoern A. Zeeb <bz@FreeBSD.org> AuthorDate: 2024-08-27 17:41:52 +0000 Commit: Bjoern A. Zeeb <bz@FreeBSD.org> CommitDate: 2024-08-27 17:41:52 +0000 net/wifi-firmware-*: build framework and license hack cleanup Cleanup the extra layer of "flavour" that came into the build framework when flavours were introduced at a time when it was not planned. Make linters some more happy. [1] Remove the special license hack to install additional files. If DISABLE_LICENSES is set we still installed files making builds fail [2]. One would hope to always install the lincese files but simply disable any checking by the framework. Introduce a new way using LICENSE_COMB=multi to install the default license file, the extra WHENCE and any possible extra firmware license files. Technically this is an abuse of the system too but at least it should work and not break non default options. Based on: D45369 by jrm [1] Reported by: pi [2] Sponsored by: The FreeBSD Foundation Reviewed by: jrm Differential Revision: https://reviews.freebsd.org/D46124 --- net/wifi-firmware-ath10k-kmod/Makefile | 2 +- net/wifi-firmware-ath11k-kmod/Makefile | 2 +- net/wifi-firmware-ath12k-kmod/Makefile | 2 +- net/wifi-firmware-iwlwifi-kmod/Makefile | 2 +- net/wifi-firmware-kmod/Makefile.inc | 115 ++++++++++++++++---------------- net/wifi-firmware-mt76-kmod/Makefile | 2 +- net/wifi-firmware-rtw88-kmod/Makefile | 2 +- net/wifi-firmware-rtw89-kmod/Makefile | 2 +- 8 files changed, 64 insertions(+), 65 deletions(-) diff --git a/net/wifi-firmware-ath10k-kmod/Makefile b/net/wifi-firmware-ath10k-kmod/Makefile index e91f1cddc821..ea85ccf14259 100644 --- a/net/wifi-firmware-ath10k-kmod/Makefile +++ b/net/wifi-firmware-ath10k-kmod/Makefile @@ -4,7 +4,7 @@ FWDRV= ath10k FWSUBDIR= ath10k FWDRV_VERSION= 20240513 -LICENSE= LICENSE.QualcommAtheros_ath10k +LICENSE_FILE= LICENSE.QualcommAtheros_ath10k LICENSE_NAME= QCA firmware license (${FWDRV}) WHENCE_REGEX= ath10k -.* diff --git a/net/wifi-firmware-ath11k-kmod/Makefile b/net/wifi-firmware-ath11k-kmod/Makefile index 941cf0efa13a..dce7fbcba597 100644 --- a/net/wifi-firmware-ath11k-kmod/Makefile +++ b/net/wifi-firmware-ath11k-kmod/Makefile @@ -5,7 +5,7 @@ FWSUBDIR= ath11k FWDRV_VERSION= 20240513 # Yes, the license is the ath10k one; see WHENCE. -LICENSE= LICENSE.QualcommAtheros_ath10k +LICENSE_FILE= LICENSE.QualcommAtheros_ath10k LICENSE_NAME= QCA firmware license (${FWDRV}) WHENCE_REGEX= ath11k -.* diff --git a/net/wifi-firmware-ath12k-kmod/Makefile b/net/wifi-firmware-ath12k-kmod/Makefile index 9f1c7ea7f9b9..5aae94872338 100644 --- a/net/wifi-firmware-ath12k-kmod/Makefile +++ b/net/wifi-firmware-ath12k-kmod/Makefile @@ -5,7 +5,7 @@ FWSUBDIR= ath12k FWDRV_VERSION= 20240513 # Yes, the license is the ath10k one; see WHENCE. -LICENSE= LICENSE.QualcommAtheros_ath10k +LICENSE_FILE= LICENSE.QualcommAtheros_ath10k LICENSE_NAME= QCA firmware license (${FWDRV}) WHENCE_REGEX= ath12k -.* diff --git a/net/wifi-firmware-iwlwifi-kmod/Makefile b/net/wifi-firmware-iwlwifi-kmod/Makefile index 3cff195b89a7..e777c2de28e7 100644 --- a/net/wifi-firmware-iwlwifi-kmod/Makefile +++ b/net/wifi-firmware-iwlwifi-kmod/Makefile @@ -4,7 +4,7 @@ FWDRV= iwlwifi FWSUBDIR= FWDRV_VERSION= 20240513 -LICENSE= LICENCE.iwlwifi_firmware +LICENSE_FILE= LICENCE.iwlwifi_firmware LICENSE_NAME= Intel firmware license (${FWDRV}) WHENCE_REGEX= iwlwifi -.* diff --git a/net/wifi-firmware-kmod/Makefile.inc b/net/wifi-firmware-kmod/Makefile.inc index e6d57564f4f2..1fe3f8b3528f 100644 --- a/net/wifi-firmware-kmod/Makefile.inc +++ b/net/wifi-firmware-kmod/Makefile.inc @@ -11,7 +11,6 @@ FWDRV_VERSION?= 0 FWDRV?= base LICENSE_NAME?= firmware license (${FWDRV}) -LICENSE_FILE?= ${WRKSRC}/${FLAVOR}/${LICENSE} LICENSE_PERMS?= dist-mirror no-dist-sell pkg-mirror no-pkg-sell auto-accept EXTRACT_SUFX= @@ -19,7 +18,8 @@ DISTURL_SUFFIX?= ?h=${PORTVERSION} # Sanity checks .if !defined(FWDRV) || !defined(FWSUBDIR) || !defined(FWSUBS) || \ - !defined(FWDRV_VERSION) || !defined(LICENSE) || \ + !defined(FWDRV_VERSION) || \ + !defined(LICENSE_NAME) || !defined(LICENSE_FILE) || \ !defined(DISTFILES_${FWDRV}) || !defined(DISTFILES_${FWDRV}_lic) || \ !defined(BASEDIR) || !defined(WHENCE_REGEX) IGNORE= is a metaport or misconfigured child port; there is nothing to build @@ -27,13 +27,39 @@ IGNORE= is a metaport or misconfigured child port; there is nothing to build FILESDIR= ${BASEDIR}/files +LICENSE_COMB= multi +LICENSE= primary whence + +# Port primary license. +LICENSE_FILE_primary= ${WRKSRC}/${LICENSE_FILE} +LICENSE_NAME_primary= ${LICENSE_NAME} +LICENSE_PERMS_primary= ${LICENSE_PERMS} + +# Add WHENCE file next to license where it makes sense despite not being a license. +LICENSE_NAME_whence= Origin and licensing information for linux-firmware files +LICENSE_FILE_whence= ${WRKSRC}/WHENCE +LICENSE_PERMS_whence= ${LICENSE_PERMS} +#PLIST_FILES+= ${_LICENSE_DIR}/WHENCE + +# Add extra license files. +.if "${DISTFILES_${FLAVOR}_lic}" +.for _n in ${DISTFILES_${FLAVOR}_lic:range} +LICENSE+= extra${_n} +LICENSE_FILE_extra${_n}= ${WRKSRC}/fw/${DISTFILES_${FLAVOR}_lic:[${_n}]:C@(^[^?]*)${DISTURL_SUFFIX:Q}@\1@:S,/,_,g} +LICENSE_NAME_extra${_n}= ${LICENSE_NAME} (extra fw license) +LICENSE_PERMS_extra${_n}= ${LICENSE_PERMS} +.endfor +.endif + +# Add firmware files to plist. +.for _f in ${DISTFILES_${FLAVOR}} +PLIST_FILES+= ${KMODDIR}/${_f:C@(^[^?]*)${DISTURL_SUFFIX:Q}@\1@:S,.,_,g:S,-,_,g:S,/,_,g}.ko +.endfor + # Split things into the full package (driver name) and more specific flavors. FLAVORS= ${FWDRV} \ ${FWSUBS} -# What a kludge.... thanks https://docs.freebsd.org/en/books/porters-handbook/flavors/ ! -FLAVOR?= ${FLAVORS:[1]} - # Generate the conflicts list. .for f in ${FWSUBS} ${FWDRV}_CONFLICTS_INSTALL+= ${PORTNAME}-${f} @@ -41,14 +67,10 @@ ${f}_PKGNAMESUFFIX= -${f} ${f}_CONFLICTS_INSTALL= ${PORTNAME} .endfor -DISTFILES_FLAVOR:= ${DISTFILES_${FLAVOR}} -DISTFILES_FLAVOR_lic:= ${DISTFILES_${FLAVOR}_lic} - -DISTFILES= \ - ${DISTFILES_FLAVOR} \ - ${DISTFILES_FLAVOR_lic} \ - ${LICENSE}${DISTURL_SUFFIX} \ - WHENCE${DISTURL_SUFFIX} +DISTFILES= ${DISTFILES_${FLAVOR}} \ + ${DISTFILES_${FLAVOR}_lic} \ + ${LICENSE_FILE}${DISTURL_SUFFIX} \ + WHENCE${DISTURL_SUFFIX} DIST_SUBDIR= linux-firmware/${FWDRV}fw EXTRACT_ONLY= @@ -58,64 +80,41 @@ ONLY_FOR_ARCHS_REASON= LinuxKPI driver only available for these architectures USES= kmod uidfix +MAKE_ENV+= FWSRCDIR=${WRKSRC}/fw + post-extract: - @${MKDIR} ${WRKSRC}/${FLAVOR}/fw + @${MKDIR} ${WRKSRC}/fw # Deal with supplementary licenses files. - @${CP} ${DISTDIR}/${DIST_SUBDIR}/${LICENSE}${DISTURL_SUFFIX} ${WRKSRC}/${FLAVOR}/${LICENSE} - @${CP} ${DISTDIR}/${DIST_SUBDIR}/WHENCE${DISTURL_SUFFIX} ${WRKSRC}/${FLAVOR}/WHENCE.in - @${SED} -e "s@%%XXX%%@${WHENCE_REGEX:Q}@g" ${FILESDIR}/WHENCE.awk.in > ${WRKSRC}/${FLAVOR}/WHENCE.awk - @${AWK} -f ${WRKSRC}/${FLAVOR}/WHENCE.awk ${WRKSRC}/${FLAVOR}/WHENCE.in > ${WRKSRC}/${FLAVOR}/WHENCE + @${CP} ${DISTDIR}/${DIST_SUBDIR}/${LICENSE_FILE}${DISTURL_SUFFIX} ${WRKSRC}/${LICENSE_FILE} + @${CP} ${DISTDIR}/${DIST_SUBDIR}/WHENCE${DISTURL_SUFFIX} ${WRKSRC}/WHENCE.in + @${SED} -e "s@%%XXX%%@${WHENCE_REGEX:Q}@g" ${FILESDIR}/WHENCE.awk.in > ${WRKSRC}/WHENCE.awk + @${AWK} -f ${WRKSRC}/WHENCE.awk ${WRKSRC}/WHENCE.in > ${WRKSRC}/WHENCE # Prepare toplevel Makefile and Makefile.inc. - @${ECHO_CMD} "SUBDIR=" > ${WRKSRC}/${FLAVOR}/Makefile + @${ECHO_CMD} "SUBDIR=" > ${WRKSRC}/Makefile @${SED} -e "s@%%FWDRV%%@${FWDRV}@g" \ -e "s@%%FWSUBDIR%%@${FWSUBDIR}@g" \ - ${FILESDIR}/Makefile.inc.in > ${WRKSRC}/${FLAVOR}/Makefile.inc -.for _f in ${DISTFILES_FLAVOR} + ${FILESDIR}/Makefile.inc.in > ${WRKSRC}/Makefile.inc +.for _f in ${DISTFILES_${FLAVOR}} # We remove '.' and '-' as well as '/' as they don't work well in loader.conf. - @${MKDIR} ${WRKSRC}/${FLAVOR}/${_f:C@(^[^?]*)${DISTURL_SUFFIX:Q}@\1@:S,.,_,g:S,-,_,g:S,/,_,g} + @${MKDIR} ${WRKSRC}/${_f:C@(^[^?]*)${DISTURL_SUFFIX:Q}@\1@:S,.,_,g:S,-,_,g:S,/,_,g} # Create subdir (firmware file) Makefile. - @${ECHO_CMD} "FWNAME=${_f:C@(^[^?]*)${DISTURL_SUFFIX:Q}@\1@:T}" > ${WRKSRC}/${FLAVOR}/${_f:C@(^[^?]*)${DISTURL_SUFFIX:Q}@\1@:S,.,_,g:S,-,_,g:S,/,_,g}/Makefile + @${ECHO_CMD} "FWNAME=${_f:C@(^[^?]*)${DISTURL_SUFFIX:Q}@\1@:T}" > ${WRKSRC}/${_f:C@(^[^?]*)${DISTURL_SUFFIX:Q}@\1@:S,.,_,g:S,-,_,g:S,/,_,g}/Makefile .if (${_f:H:C,^[^/]*,,1:C,^/,,} != "") - @${ECHO_CMD} "FWSUBSUBDIR=${_f:H:C,^[^/]*,,1:C,^/,,}" >> ${WRKSRC}/${FLAVOR}/${_f:C@(^[^?]*)${DISTURL_SUFFIX:Q}@\1@:S,.,_,g:S,-,_,g:S,/,_,g}/Makefile + @${ECHO_CMD} "FWSUBSUBDIR=${_f:H:C,^[^/]*,,1:C,^/,,}" >> ${WRKSRC}/${_f:C@(^[^?]*)${DISTURL_SUFFIX:Q}@\1@:S,.,_,g:S,-,_,g:S,/,_,g}/Makefile .endif # XXX-BZ recover firmware versions later again from somewhere? Pain to keep track though, else use 0 or ${FWDRV_VERSION}? - @${ECHO_CMD} "VERSION=0" >> ${WRKSRC}/${FLAVOR}/${_f:C@(^[^?]*)${DISTURL_SUFFIX:Q}@\1@:S,.,_,g:S,-,_,g:S,/,_,g}/Makefile - @${ECHO_CMD} '.include <bsd.kmod.mk>' >> ${WRKSRC}/${FLAVOR}/${_f:C@(^[^?]*)${DISTURL_SUFFIX:Q}@\1@:S,.,_,g:S,-,_,g:S,/,_,g}/Makefile + @${ECHO_CMD} "VERSION=0" >> ${WRKSRC}/${_f:C@(^[^?]*)${DISTURL_SUFFIX:Q}@\1@:S,.,_,g:S,-,_,g:S,/,_,g}/Makefile + @${ECHO_CMD} '.include <bsd.kmod.mk>' >> ${WRKSRC}/${_f:C@(^[^?]*)${DISTURL_SUFFIX:Q}@\1@:S,.,_,g:S,-,_,g:S,/,_,g}/Makefile # Add subdir to top-level Makefile. - @${ECHO_CMD} "SUBDIR+=${_f:C@(^[^?]*)${DISTURL_SUFFIX:Q}@\1@:S,.,_,g:S,-,_,g:S,/,_,g}" >> ${WRKSRC}/${FLAVOR}/Makefile + @${ECHO_CMD} "SUBDIR+=${_f:C@(^[^?]*)${DISTURL_SUFFIX:Q}@\1@:S,.,_,g:S,-,_,g:S,/,_,g}" >> ${WRKSRC}/Makefile # Create firmware source directory and copy in distfile. - @${MKDIR} ${WRKSRC}/${FLAVOR}/fw/${_f:H} - ${CP} ${DISTDIR}/${DIST_SUBDIR}/${_f} ${WRKSRC}/${FLAVOR}/fw/${_f:C@(^[^?]*)${DISTURL_SUFFIX:Q}@\1@} + @${MKDIR} ${WRKSRC}/fw/${_f:H} + ${CP} ${DISTDIR}/${DIST_SUBDIR}/${_f} ${WRKSRC}/fw/${_f:C@(^[^?]*)${DISTURL_SUFFIX:Q}@\1@} .endfor - @${ECHO_CMD} '.include <bsd.subdir.mk>' >> ${WRKSRC}/${FLAVOR}/Makefile + @${ECHO_CMD} '.include <bsd.subdir.mk>' >> ${WRKSRC}/Makefile # Copy in additional licenses files. -.for _f in ${DISTFILES_FLAVOR_lic} - ${CP} ${DISTDIR}/${DIST_SUBDIR}/${_f} ${WRKSRC}/${FLAVOR}/fw/${_f:C@(^[^?]*)${DISTURL_SUFFIX:Q}@\1@:S,/,_,g} -.endfor - -# Internal hack we should probably upstream. -# Add WHENCE file next to license where it makes sense despite not being a license. -_USES_stage+= 881:post-install-license -post-install-license: - ${INSTALL_DATA} ${WRKSRC}/${FLAVOR}/WHENCE ${STAGEDIR}${_LICENSE_DIR}/ -.for _f in ${DISTFILES_FLAVOR_lic} - ${INSTALL_DATA} ${WRKSRC}/${FLAVOR}/fw/${_f:C@(^[^?]*)${DISTURL_SUFFIX:Q}@\1@:S,/,_,g} \ - ${STAGEDIR}${_LICENSE_DIR}/${_f:C@(^[^?]*)${DISTURL_SUFFIX:Q}@\1@:S,/,_,g} -.endfor - -.include <bsd.port.pre.mk> - -MAKE_ENV+= FWSRCDIR=${WRKSRC}/${FLAVOR}/fw -MAKE_FLAGS+= -C ${WRKSRC}/${FLAVOR} - -# Add firmware files to plist. -.for _f in ${DISTFILES_FLAVOR} -PLIST_FILES+= ${KMODDIR}/${_f:C@(^[^?]*)${DISTURL_SUFFIX:Q}@\1@:S,.,_,g:S,-,_,g:S,/,_,g}.ko -.endfor -# Record extra licenses files in plist. -PLIST_FILES+= ${_LICENSE_DIR}/WHENCE -.for _f in ${DISTFILES_FLAVOR_lic} -PLIST_FILES+= ${_LICENSE_DIR}/${_f:C@(^[^?]*)${DISTURL_SUFFIX:Q}@\1@:S,/,_,g} +.for _f in ${DISTFILES_${FLAVOR}_lic} + ${CP} ${DISTDIR}/${DIST_SUBDIR}/${_f} ${WRKSRC}/fw/${_f:C@(^[^?]*)${DISTURL_SUFFIX:Q}@\1@:S,/,_,g} .endfor -.include <bsd.port.post.mk> +.include <bsd.port.mk> diff --git a/net/wifi-firmware-mt76-kmod/Makefile b/net/wifi-firmware-mt76-kmod/Makefile index 55d6e23cfe70..2e13268c62b0 100644 --- a/net/wifi-firmware-mt76-kmod/Makefile +++ b/net/wifi-firmware-mt76-kmod/Makefile @@ -4,7 +4,7 @@ FWDRV= mt76 FWSUBDIR= mediatek FWDRV_VERSION= 20240513 -LICENSE= LICENCE.mediatek +LICENSE_FILE= LICENCE.mediatek LICENSE_NAME= Mediatek firmware license (${FWDRV}) WHENCE_REGEX= (mt7915e|mt7921|mt7922|mt7925|mt7996e) -.*ireless diff --git a/net/wifi-firmware-rtw88-kmod/Makefile b/net/wifi-firmware-rtw88-kmod/Makefile index 66324d9549cc..608a2752af52 100644 --- a/net/wifi-firmware-rtw88-kmod/Makefile +++ b/net/wifi-firmware-rtw88-kmod/Makefile @@ -7,7 +7,7 @@ FWSUBDIR= rtw88 #FWDRV_VERSION= 20220209 # Used for a long time FWDRV_VERSION= 20240513 -LICENSE= LICENCE.rtlwifi_firmware.txt +LICENSE_FILE= LICENCE.rtlwifi_firmware.txt LICENSE_NAME= Realtek firmware license (${FWDRV}) WHENCE_REGEX= rtw88 -.* diff --git a/net/wifi-firmware-rtw89-kmod/Makefile b/net/wifi-firmware-rtw89-kmod/Makefile index f42fd9359660..636dfb27c621 100644 --- a/net/wifi-firmware-rtw89-kmod/Makefile +++ b/net/wifi-firmware-rtw89-kmod/Makefile @@ -4,7 +4,7 @@ FWDRV= rtw89 FWSUBDIR= rtw89 FWDRV_VERSION= 20240513 -LICENSE= LICENCE.rtlwifi_firmware.txt +LICENSE_FILE= LICENCE.rtlwifi_firmware.txt LICENSE_NAME= Realtek firmware license (${FWDRV}) WHENCE_REGEX= rtw89 -.*