Page MenuHomeFreeBSD

D47380.id146260.diff
No OneTemporary

D47380.id146260.diff

diff --git a/Mk/bsd.licenses.mk b/Mk/bsd.licenses.mk
--- a/Mk/bsd.licenses.mk
+++ b/Mk/bsd.licenses.mk
@@ -69,6 +69,8 @@
# LICENSE_GROUPS - Groups the license belongs.
# LICENSE_NAME - Full license name (for the reports).
# LICENSE_FILE - Full path to license (or use LICENSE_TEXT).
+# LICENSE_FILENAME - Name of the license file to install (e.g., if multiple
+# licenses are called 'License')
# LICENSE_TEXT - Text to use as a license, useful when referencing to
# another place if it's not in the distfile.
# LICENSE_DISTFILES - Name of licensed files (defaults to ${_DISTFILES}).
@@ -86,8 +88,8 @@
# Case 2: license only known by the port (aka "unknown").
#
# In this case LICENSE_{PERMS,NAME} are mandatory, in addition to
-# either LICENSE_FILE or LICENSE_TEXT. Optional variable is
-# LICENSE_GROUPS.
+# either LICENSE_FILE or LICENSE_TEXT. Optional variables are
+# LICENSE_GROUPS and LICENSE_FILENAME.
#
# Available components for LICENSE_PERMS:
# dist-mirror - Redistribution of distfile is permitted
@@ -236,16 +238,19 @@
. if !defined(LICENSE_TEXT)
. if exists(${_LICENSE_STORE}/${lic})
_LICENSE_FILE= ${_LICENSE_STORE}/${lic}
+_LICENSE_FILENAME= ${lic}
. else
# No license file in /usr/ports/Templates/Licenses
_LICENSE_TEXT= The license: ${_LICENSE} (${_LICENSE_NAME}) is standard, please read from the web.
_LICENSE_FILE= ${WRKDIR}/${lic}
+_LICENSE_FILENAME= ${lic}
. endif
. else
_LICENSE_ERROR?= defining LICENSE_TEXT is not allowed for known licenses
. endif
. else
_LICENSE_FILE= ${LICENSE_FILE}
+_LICENSE_FILENAME= ${LICENSE_FILE:T}
. endif
. else
@@ -277,9 +282,11 @@
. else
_LICENSE_TEXT= ${LICENSE_TEXT}
_LICENSE_FILE= ${WRKDIR}/${lic}
+_LICENSE_FILENAME= ${lic}
. endif
. else
_LICENSE_FILE= ${LICENSE_FILE}
+_LICENSE_FILENAME= ${LICENSE_FILE:T}
. endif
. endif
@@ -299,7 +306,8 @@
. if defined(LICENSE_FILE)
. for lic in ${_LICENSE}
-LICENSE_FILE_${lic}?= ${LICENSE_FILE}
+LICENSE_FILE_${lic}?= ${LICENSE_FILE}
+LICENSE_FILENAME_${lic}?= ${LICENSE_FILE_${lic}:T}
. endfor
. endif
@@ -322,16 +330,25 @@
. if !defined(LICENSE_TEXT_${lic})
. if exists(${_LICENSE_STORE}/${lic})
_LICENSE_FILE_${lic}= ${_LICENSE_STORE}/${lic}
+_LICENSE_FILENAME_${lic}= ${lic}
. else
# No license file in /usr/ports/Templates/Licenses
_LICENSE_TEXT_${lic}= The license: ${lic} (${_LICENSE_NAME_${lic}}) is standard, please read from the web.
_LICENSE_FILE_${lic}= ${WRKDIR}/${lic}
+_LICENSE_FILENAME_${lic}= ${lic}
. endif
. else
_LICENSE_ERROR?= defining LICENSE_TEXT_${lic} is not allowed for known licenses
. endif
. else
_LICENSE_FILE_${lic}= ${LICENSE_FILE_${lic}}
+_LICENSE_FILENAME_${lic}= ${LICENSE_FILENAME_${lic}:T:U_LICENSE_FILE_${lic}:T:U${lic}}
+. for _l in ${_LICENSE}
+. if "${lic}" != ${_l} && "${_LICENSE_FILENAME_${lic}}" == "${_LICENSE_FILENAME_${_l}}" && \
+ "${_LICENSE_FILE_${lic}}" != "${_LICENSE_FILE_${_l}}"
+_LICENSE_ERROR?= ERROR: duplicate LICENSE_FILENAME for ${lic} and ${_l}: '${LICENSE_FILENAME_${lic}:T}' and '${_LICENSE_FILENAME_${_l}}'
+. endif
+. endfor
. endif
. else
@@ -363,9 +380,17 @@
. else
_LICENSE_TEXT_${lic}= ${LICENSE_TEXT_${lic}}
_LICENSE_FILE_${lic}= ${WRKDIR}/${lic}
+_LICENSE_FILENAME_${lic}= ${lic}
. endif
. else
_LICENSE_FILE_${lic}= ${LICENSE_FILE_${lic}}
+_LICENSE_FILENAME_${lic}= ${LICENSE_FILENAME_${lic}:T:U_LICENSE_FILE_${lic}:T:U${lic}}
+. for _l in ${_LICENSE}
+. if "${lic}" != ${_l} && "${_LICENSE_FILENAME_${lic}}" == "${_LICENSE_FILENAME_${_l}}" && \
+ "${_LICENSE_FILE_${lic}}" != "${_LICENSE_FILE_${_l}}"
+_LICENSE_ERROR?= ERROR: duplicate LICENSE_FILENAME for ${lic} and ${_l}: '${LICENSE_FILENAME_${lic}:T}' and '${_LICENSE_FILENAME_${lic}}'
+. endif
+. endfor
. endif
. endif
@@ -681,13 +706,13 @@
. elif ${_LICENSE_COMB} == "multi"
@${RM} ${_LICENSE_ASK_DATA}
. for lic in ${_LICENSE_TO_ASK}
- @${ECHO_CMD} "${lic}:${_LICENSE_FILE_${lic}}" >> ${_LICENSE_ASK_DATA}
+ @${ECHO_CMD} "${_LICENSE_FILENAME_${lic}}:${_LICENSE_FILE_${lic}}" >> ${_LICENSE_ASK_DATA}
. endfor
@menu_cmd="${SETENV} LC_ALL=C.UTF-8 ${DIALOG} --hline \"This port requires you to accept all mentioned licenses\" --menu \"License for ${PKGNAME} (multi)\" 21 70 15"; \
trap '${RM} $$tmpfile' EXIT INT TERM; \
tmpfile=$$(mktemp -t portlicenses); \
for lic in ${_LICENSE_TO_ASK}; do \
- menu_cmd="$${menu_cmd} VIEW_$${lic} \"View the license $${lic}\""; \
+ menu_cmd="$${menu_cmd} VIEW_$${lic} \"View the license $${_LICENSE_FILENAME_${lic}}\""; \
done; \
menu_cmd="$${menu_cmd} ACCEPT \"Accept the licenses (all)\" REJECT \"Reject the licenses (all)\""; \
while true; do \
@@ -719,9 +744,9 @@
. if ${_LICENSE_COMB} != "single"
. for lic in ${_LICENSE_TO_ASK}
. if defined(WRKDIRPREFIX)
- @${ECHO_MSG} "- ${lic} (${_LICENSE_NAME_${lic}}), available at ${_LICENSE_FILE_${lic}}"
+ @${ECHO_MSG} "- ${_LICENSE_FILENAME_${lic}} (${_LICENSE_NAME_${lic}}), available at ${_LICENSE_FILE_${lic}}"
. else
- @${ECHO_MSG} "- ${lic} (${_LICENSE_NAME_${lic}}), available at ${_LICENSE_FILE_${lic}:S/${WRKDIR}\//${WRKDIR:T}\//}"
+ @${ECHO_MSG} "- ${_LICENSE_FILENAME_${lic}} (${_LICENSE_NAME_${lic}}), available at ${_LICENSE_FILE_${lic}:S/${WRKDIR}\//${WRKDIR:T}\//}"
. endif
. endfor
@${ECHO_MSG}
@@ -763,7 +788,7 @@
@${ECHO_CMD} "This package has multiple licenses (all of):" >> ${_LICENSE_REPORT_TMP}
. endif
. for lic in ${_LICENSE}
- @${ECHO_CMD} "- ${lic} (${_LICENSE_NAME_${lic}})" >> ${_LICENSE_REPORT_TMP}
+ @${ECHO_CMD} "- ${_LICENSE_FILENAME_${lic}} (${_LICENSE_NAME_${lic}})" >> ${_LICENSE_REPORT_TMP}
. endfor
. endif
. endif
@@ -775,6 +800,15 @@
. if !defined(NO_LICENSES_INSTALL)
. for sp in ${_PKGS}
+# "LICENSE" (default _LICENSE_REPORT.${sp}) is a too generic name and colides
+# with license file names. Append .${lic} in case of collision.
+# while here also check for catalog.mk( default _LICENSE_CATALOG.${sp}).
+. for _l in ${_LICENSE}
+. if "${_LICENSE_FILENAME_${_l}}" == "${_LICENSE_REPORT.${sp}:T}" || \
+ "${_LICENSE_FILENAME_${_l}}" == "${_LICENSE_CATALOG.${sp}:T}"
+_LICENSE_FILENAME_${_l}:= ${_LICENSE_FILENAME_${_l}}.${_l}
+. endif
+. endfor
. if ${sp} == ${PKGBASE}
PLIST_FILES+= ${_LICENSE_CATALOG.${sp}} \
${_LICENSE_REPORT.${sp}}
@@ -782,8 +816,15 @@
PLIST_FILES+= ${_LICENSE_DIR.${sp}}/${_LICENSE}
. else
. for lic in ${_LICENSE}
-. if defined(_LICENSE_FILE_${lic})
-PLIST_FILES+= ${_LICENSE_DIR.${sp}}/${lic}
+. if defined(_LICENSE_FILENAME_${lic})
+_PLF_${lic}:= ${_LICENSE_DIR.${sp}}/${_LICENSE_FILENAME_${lic}}
+. for _plf in ${PLIST_FILES}
+. if "${_plf}" == "${_PLF_${lic}}"
+_PLF_${lic}=
+. break
+. endif
+. endfor
+PLIST_FILES+= ${_PLF_${lic}}
. endif
. endfor
. endif
@@ -795,7 +836,14 @@
. else
. for lic in ${_LICENSE}
. if defined(_LICENSE_FILE_${lic})
-PLIST_FILES${_SP.${sp}}+= ${_LICENSE_DIR.${sp}}/${lic}
+_PLF_${lic}:= ${_LICENSE_DIR.${sp}}/${_LICENSE_FILENAME_${lic}}
+. for _plf in ${PLIST_FILES${_SP.${sp}}}
+. if "${_plf}" == "${_PLF_${lic}}"
+_PLF_${lic}=
+. break
+. endif
+. endfor
+PLIST_FILES${_SP.${sp}}+= ${_PLF_${lic}}
. endif
. endfor
. endif
@@ -811,7 +859,17 @@
@${INSTALL_DATA} ${_LICENSE_FILE} ${STAGEDIR}${_LICENSE_DIR.${sp}}/${_LICENSE}
. else
. for lic in ${_LICENSE}
- @${INSTALL_DATA} ${_LICENSE_FILE_${lic}} ${STAGEDIR}${_LICENSE_DIR.${sp}}/${lic}
+ @${INSTALL_DATA} ${_LICENSE_FILE_${lic}} ${STAGEDIR}${_LICENSE_DIR.${sp}}/${_LICENSE_FILENAME_${lic}}
+. endfor
+. endif
+
+list-license: list-license.${sp}
+list-license.${sp}:
+. if ${_LICENSE_COMB} == "single"
+ @${ECHO_CMD} "${_LICENSE_FILE} will be installed to ${_LICENSE_DIR.${sp}}/ as ${_LICENSE}"
+. else
+. for lic in ${_LICENSE}
+ @${ECHO_CMD} "${lic} : ${_LICENSE_FILE_${lic}:C@^${WRKDIR}/@@} will be installed to ${_LICENSE_DIR.${sp}}/ as ${_LICENSE_FILENAME_${lic}}"
. endfor
. endif
. endfor
@@ -829,6 +887,11 @@
@${ECHO_MSG} "===> License check disabled, port has not defined LICENSE"
. endif
+list-license:
+. if defined(LICENSE_VERBOSE)
+ @${ECHO_MSG} "===> License list empty, port has not defined LICENSE"
+. endif
+
. endif # LICENSE
.endif

File Metadata

Mime Type
text/plain
Expires
Wed, Jan 15, 4:59 AM (10 h, 37 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14597231
Default Alt Text
D47380.id146260.diff (8 KB)

Event Timeline