2018-08-07 17:43:41 +02:00
|
|
|
# $NetBSD: license.mk,v 1.87 2018/08/07 15:43:41 nia Exp $
|
2007-07-03 07:08:12 +02:00
|
|
|
#
|
|
|
|
# This file handles everything about the LICENSE variable. It is
|
|
|
|
# included automatically by bsd.pkg.mk.
|
|
|
|
#
|
2009-04-30 14:27:16 +02:00
|
|
|
# XXX There should be one place to set the default list and for users
|
|
|
|
# to set the ACCEPTABLE_LICENSES list, used by both source builds and
|
|
|
|
# binary installs#
|
|
|
|
#
|
2007-07-05 20:16:47 +02:00
|
|
|
# XXX: Some of this content arguably belongs in the pkgsrc guide
|
|
|
|
# instead.
|
|
|
|
#
|
2007-07-03 07:08:12 +02:00
|
|
|
# === User-settable variables ===
|
|
|
|
#
|
|
|
|
# ACCEPTABLE_LICENSES
|
2007-07-05 20:16:47 +02:00
|
|
|
#
|
2009-04-30 14:27:16 +02:00
|
|
|
# If a package declares a license and that license is not a
|
|
|
|
# member of the list defined by this variable, pkgsrc will not
|
|
|
|
# build the package and instead print an error message.
|
|
|
|
# (pkg_install has code to behave the same way, but it is not
|
|
|
|
# yet turned on.)
|
2007-07-03 07:08:12 +02:00
|
|
|
#
|
2007-07-05 20:16:47 +02:00
|
|
|
# XXX: Perhaps there should be some mechanism to prevent running
|
|
|
|
# programs that are part of packages that declare LICENSEs that
|
|
|
|
# are not in ACCEPTABLE_LICENSES or some per-user variable.
|
|
|
|
# This is surely controversial and requires discussion.
|
2007-07-03 07:08:12 +02:00
|
|
|
#
|
2007-07-06 03:22:40 +02:00
|
|
|
# To include the default licenses, you can use the += operator
|
|
|
|
# in mk.conf. To override it, use the plain = operator.
|
|
|
|
#
|
|
|
|
# Default value: ${DEFAULT_ACCEPTABLE_LICENSES}
|
|
|
|
#
|
2007-07-03 07:08:12 +02:00
|
|
|
# === Package-settable variables ===
|
|
|
|
#
|
|
|
|
# LICENSE
|
2009-04-30 14:27:16 +02:00
|
|
|
#
|
2007-07-03 07:08:12 +02:00
|
|
|
# The license of the package.
|
|
|
|
#
|
2009-07-15 11:31:20 +02:00
|
|
|
# Dual licenses can be specified with OR expressions:
|
|
|
|
# LICENSE= license1 OR license2
|
|
|
|
#
|
|
|
|
# If more than one license applies at the same time, AND expressions
|
|
|
|
# can be used:
|
|
|
|
# LICENSE= license1 AND license2
|
|
|
|
#
|
|
|
|
# Expressions can be nested if necessary:
|
|
|
|
# LICENSE= (license1 AND license2) OR license3
|
|
|
|
# Parenthesis are required when mixing AND and OR.
|
|
|
|
#
|
2009-04-23 14:10:15 +02:00
|
|
|
# Every package should specify its license. (Prior to early 2009,
|
2007-07-05 20:16:47 +02:00
|
|
|
# Open Source and Free software did not have license tags.)
|
2007-07-03 07:08:12 +02:00
|
|
|
#
|
2007-07-20 15:05:28 +02:00
|
|
|
# Licenses are collected in the licenses/ subdirectory of
|
|
|
|
# pkgsrc. For open source license, we generally use the same
|
|
|
|
# names as either the Open Source Initiative or the Free
|
|
|
|
# Software Foundation, choosing a name to reduce confusion.
|
|
|
|
# Open source and free licenses do not have a -license suffix,
|
|
|
|
# and non-free licenses do.
|
2007-07-03 07:08:12 +02:00
|
|
|
#
|
2007-07-20 15:05:28 +02:00
|
|
|
# http://opensource.org/licenses/category
|
2015-01-08 12:12:29 +01:00
|
|
|
# http://www.gnu.org/licenses/license-list.html
|
2007-07-03 07:08:12 +02:00
|
|
|
#
|
|
|
|
# === Predefined variables ===
|
|
|
|
#
|
|
|
|
# DEFAULT_ACCEPTABLE_LICENSES
|
2007-08-22 18:29:15 +02:00
|
|
|
# The list of licenses that will be the default value of
|
|
|
|
# ACCEPTABLE_LICENSES. Adapting the longstanding policy of Open
|
|
|
|
# Source or Free licenses not requiring tags, it should contain
|
2011-12-01 00:55:33 +01:00
|
|
|
# almost all licenses that are Open Source or Free, so as to provide
|
2007-08-22 18:29:15 +02:00
|
|
|
# the most expansive default that almost all people find
|
|
|
|
# acceptable. (Many people will want to add more licenses to
|
|
|
|
# ACCEPTABLE_LICENSES; the point is to have a default that very
|
|
|
|
# few people want to shrink.)
|
2007-07-05 20:16:47 +02:00
|
|
|
#
|
2011-12-01 00:55:33 +01:00
|
|
|
# As an exception to the Open Source or Free policy, the board
|
|
|
|
# of The NetBSD Foundation has decided that licenses that
|
|
|
|
# trigger obligations from use (rather than redistribution),
|
|
|
|
# such as the Affero GPL, should not be in
|
|
|
|
# DEFAULT_ACCEPTABLE_LICENSES.
|
|
|
|
#
|
2009-04-23 14:10:15 +02:00
|
|
|
# Licenses not formally approved as Free or Open Source may be
|
|
|
|
# added if they have terms that would obviously be approved if
|
|
|
|
# the effort were made. Such license names will have a comment
|
|
|
|
# near them in the assignment to DEFAULT_ACCEPTABLE_LICENSES.
|
|
|
|
#
|
2009-04-30 14:27:16 +02:00
|
|
|
# The pkg_install sources also have a
|
|
|
|
# DEFAULT_ACCEPTABLE_LICENSES list, and that should be updated
|
|
|
|
# to match the list here. See
|
|
|
|
# pkgsrc/pkgtools/pkg_install/files/lib/license.c
|
|
|
|
#
|
2007-07-03 07:08:12 +02:00
|
|
|
# === See also ===
|
|
|
|
#
|
|
|
|
# ../doc/TODO, section "Licenses of packages"
|
|
|
|
#
|
2009-04-08 16:47:26 +02:00
|
|
|
# Keywords: licence license
|
2009-03-25 14:50:44 +01:00
|
|
|
#
|
2007-07-03 07:08:12 +02:00
|
|
|
|
2007-07-20 15:05:28 +02:00
|
|
|
# This list is not complete. Free and Open Source licenses should be
|
|
|
|
# added to the list as they are added to pkgsrc.
|
2018-01-02 23:40:32 +01:00
|
|
|
#
|
2008-01-09 15:38:05 +01:00
|
|
|
# The convention is that Free or Open Source licenses do not have a
|
|
|
|
# -license suffix, and nonfree licenses end in -license.
|
2018-01-02 23:40:32 +01:00
|
|
|
#
|
2007-07-20 15:05:28 +02:00
|
|
|
DEFAULT_ACCEPTABLE_LICENSES= \
|
2009-04-30 01:50:07 +02:00
|
|
|
apache-1.1 apache-2.0 \
|
2013-04-19 13:25:26 +02:00
|
|
|
arphic-public \
|
2009-04-25 15:15:43 +02:00
|
|
|
artistic artistic-2.0 \
|
2013-03-14 17:18:54 +01:00
|
|
|
boost-license \
|
|
|
|
cc-by-sa-v3.0 \
|
2018-08-07 17:43:41 +02:00
|
|
|
cc-by-sa-v4.0 \
|
|
|
|
cc-by-sa-v4.0 \
|
|
|
|
cc-by-v4.0 \
|
2013-07-09 21:15:57 +02:00
|
|
|
cc0-1.0-universal \
|
2007-11-08 20:31:05 +01:00
|
|
|
cddl-1.0 \
|
2014-04-16 16:41:21 +02:00
|
|
|
cecill-2.1 \
|
2009-05-14 08:01:00 +02:00
|
|
|
cpl-1.0 \
|
2013-03-14 17:18:54 +01:00
|
|
|
epl-v1.0 \
|
2014-03-19 22:45:12 +01:00
|
|
|
eupl-v1.1 \
|
2015-05-02 15:21:37 +02:00
|
|
|
gfsl \
|
2013-03-14 17:18:54 +01:00
|
|
|
gnu-fdl-v1.1 gnu-fdl-v1.2 gnu-fdl-v1.3 \
|
|
|
|
gnu-gpl-v1 \
|
|
|
|
gnu-gpl-v2 gnu-lgpl-v2 gnu-lgpl-v2.1 \
|
|
|
|
gnu-gpl-v3 gnu-lgpl-v3 \
|
2016-04-21 09:51:51 +02:00
|
|
|
hpnd \
|
2013-03-14 17:18:54 +01:00
|
|
|
ipafont \
|
2016-10-03 10:30:20 +02:00
|
|
|
ipl-1.0 \
|
2011-02-06 19:54:49 +01:00
|
|
|
isc \
|
2015-08-02 04:12:33 +02:00
|
|
|
lppl-1.0 lppl-1.2 lppl-1.3c \
|
2012-04-15 22:52:28 +02:00
|
|
|
lucent \
|
2013-03-14 17:18:54 +01:00
|
|
|
miros \
|
|
|
|
mit \
|
|
|
|
mpl-1.0 mpl-1.1 mpl-2.0 \
|
|
|
|
mplusfont \
|
2013-04-08 04:24:14 +02:00
|
|
|
ofl-v1.0 ofl-v1.1 \
|
2014-05-15 11:59:09 +02:00
|
|
|
openssl \
|
2013-03-14 17:18:54 +01:00
|
|
|
original-bsd modified-bsd 2-clause-bsd \
|
2015-03-22 04:43:11 +01:00
|
|
|
osl \
|
2016-02-10 11:50:18 +01:00
|
|
|
paratype \
|
2013-03-14 17:18:54 +01:00
|
|
|
php \
|
|
|
|
png-license \
|
|
|
|
postgresql-license \
|
|
|
|
public-domain \
|
|
|
|
python-software-foundation \
|
2013-03-14 17:19:30 +01:00
|
|
|
qpl-v1.0 \
|
2013-05-05 23:09:59 +02:00
|
|
|
sgi-free-software-b-v2.0 \
|
2013-03-14 17:18:54 +01:00
|
|
|
sleepycat-public \
|
2016-10-03 13:49:31 +02:00
|
|
|
sissl-1.1 \
|
2016-11-18 10:43:39 +01:00
|
|
|
unicode \
|
2013-03-14 17:18:54 +01:00
|
|
|
unlicense \
|
2015-04-20 00:18:19 +02:00
|
|
|
w3c \
|
2013-03-14 17:18:54 +01:00
|
|
|
x11 \
|
|
|
|
zlib \
|
2015-07-17 08:45:22 +02:00
|
|
|
zpl-2.0 \
|
2017-05-11 14:56:21 +02:00
|
|
|
zpl-2.1 \
|
|
|
|
zsh
|
2007-07-20 16:21:26 +02:00
|
|
|
|
2010-01-21 17:32:21 +01:00
|
|
|
# not approved by OSI, derived from BSD
|
|
|
|
DEFAULT_ACCEPTABLE_LICENSES+= info-zip
|
|
|
|
|
2015-09-13 13:22:22 +02:00
|
|
|
# not approved by OSI, in line with Free Software principles but with rename
|
|
|
|
# restrictions and typefaces can not be sold by itself.
|
|
|
|
DEFAULT_ACCEPTABLE_LICENSES+= vera-ttf-license
|
|
|
|
|
2018-02-03 18:38:13 +01:00
|
|
|
# DFSG, not evaluated by OSI/FSF
|
|
|
|
DEFAULT_ACCEPTABLE_LICENSES+= happy
|
|
|
|
|
2009-04-08 16:47:26 +02:00
|
|
|
##### Variant spellings
|
|
|
|
|
|
|
|
.if defined(ACCEPTABLE_LICENCES) && !defined(ACCEPTABLE_LICENSES)
|
|
|
|
ACCEPTABLE_LICENSES= ${ACCEPTABLE_LICENCES}
|
|
|
|
.endif
|
|
|
|
|
2007-07-20 16:21:26 +02:00
|
|
|
.if !defined(LICENSE)
|
2014-10-13 01:39:17 +02:00
|
|
|
. if ${PKG_DEVELOPER:Uno} != "no"
|
2007-07-20 16:21:26 +02:00
|
|
|
WARNINGS+= "[license.mk] Every package should define a LICENSE."
|
|
|
|
. endif
|
|
|
|
|
|
|
|
.else
|
|
|
|
|
2009-06-14 17:15:24 +02:00
|
|
|
.if defined(_ACCEPTABLE)
|
|
|
|
WARNINGS+= "Deprecated variable _ACCEPTABLE found, use SKIP_LICENSE_CHECK=yes"
|
|
|
|
SKIP_LICENSE_CHECK= yes
|
|
|
|
.endif
|
|
|
|
|
|
|
|
SKIP_LICENSE_CHECK?= no
|
|
|
|
|
|
|
|
.if !empty(SKIP_LICENSE_CHECK:M[Yy][Ee][Ss])
|
|
|
|
_ACCEPTABLE_LICENSE= skipped
|
|
|
|
.else
|
2009-06-29 16:49:57 +02:00
|
|
|
_ACCEPTABLE_LICENSE!= \
|
|
|
|
if test `${PKG_ADMIN} -V` -lt 20090528; then \
|
|
|
|
echo outdated; \
|
|
|
|
else \
|
2011-09-08 22:17:15 +02:00
|
|
|
${PKGSRC_SETENV} PKGSRC_ACCEPTABLE_LICENSES=${ACCEPTABLE_LICENSES:Q} \
|
2009-06-29 16:49:57 +02:00
|
|
|
PKGSRC_DEFAULT_ACCEPTABLE_LICENSES=${DEFAULT_ACCEPTABLE_LICENSES:Q} \
|
|
|
|
${PKG_ADMIN} check-license ${LICENSE:Q} || echo failure; \
|
|
|
|
fi
|
2009-06-14 17:15:24 +02:00
|
|
|
.endif
|
2007-07-20 16:21:26 +02:00
|
|
|
|
2009-06-14 17:15:24 +02:00
|
|
|
.if ${_ACCEPTABLE_LICENSE} == "no"
|
|
|
|
. if defined(MAKECONF)
|
|
|
|
_MAKE_CONF?= ${MAKECONF}
|
|
|
|
. elif ${OPSYS} == "NetBSD" && ${MAKE} == "/usr/bin/make"
|
|
|
|
_MAKE_CONF?= /etc/mk.conf
|
|
|
|
. else
|
|
|
|
_MAKE_CONF?= ${PREFIX}/etc/mk.conf
|
|
|
|
.endif
|
|
|
|
. if ${OPSYS} == "NetBSD" && ${PKG_TOOLS_BIN} == "/usr/sbin"
|
|
|
|
_PKG_INSTALL_CONF?= /etc/pkg_install.conf
|
|
|
|
. else
|
|
|
|
_PKG_INSTALL_CONF?= ${PREFIX}/etc/pkg_install.conf
|
|
|
|
.endif
|
|
|
|
|
2009-06-29 16:49:57 +02:00
|
|
|
. if empty(LICENSE:MAND) && empty(LICENSE:MOR) && empty(LICENSE:M*[()]*)
|
2009-06-14 17:15:24 +02:00
|
|
|
PKG_FAIL_REASON+= "${PKGNAME} has an unacceptable license condition: " \
|
|
|
|
" "${LICENSE:Q} \
|
2011-01-16 14:13:14 +01:00
|
|
|
"You can mark the license \`\`${LICENSE}'' as acceptable by adding" \
|
2009-06-29 16:49:57 +02:00
|
|
|
" ACCEPTABLE_LICENSES+= ${LICENSE}" \
|
2009-06-14 17:15:24 +02:00
|
|
|
"to ${_MAKE_CONF} or by adding" \
|
2009-06-29 16:49:57 +02:00
|
|
|
" ACCEPTABLE_LICENSES= ${LICENSE}" \
|
2009-06-14 17:15:24 +02:00
|
|
|
"to ${_PKG_INSTALL_CONF}."
|
|
|
|
PKG_FAIL_REASON+= "The following command will show you the license text:" \
|
|
|
|
" ${MAKE} show-license"
|
2009-06-29 16:49:57 +02:00
|
|
|
. else
|
|
|
|
PKG_FAIL_REASON+= "${PKGNAME} has an unacceptable license condition: " \
|
|
|
|
" "${LICENSE:Q} \
|
2011-01-16 14:13:14 +01:00
|
|
|
"" \
|
|
|
|
"Check that you have accepted all necessary licenses." \
|
|
|
|
"You can mark a particular license \`\`foo'' as acceptable by adding" \
|
|
|
|
" ACCEPTABLE_LICENSES+= foo" \
|
2009-06-29 16:49:57 +02:00
|
|
|
"to ${_MAKE_CONF} or by adding" \
|
2011-01-16 14:13:14 +01:00
|
|
|
" ACCEPTABLE_LICENSES= foo" \
|
2009-06-29 16:49:57 +02:00
|
|
|
"to ${_PKG_INSTALL_CONF}."
|
2007-07-20 16:21:26 +02:00
|
|
|
. endif
|
2009-06-14 17:15:24 +02:00
|
|
|
|
|
|
|
.elif ${_ACCEPTABLE_LICENSE} == "failure"
|
|
|
|
PKG_FAIL_REASON+= "License conditions for ${PKGNAME} could not be evaluated"
|
2009-06-29 16:49:57 +02:00
|
|
|
.elif ${_ACCEPTABLE_LICENSE} == "outdated"
|
|
|
|
PKG_FAIL_REASON+= \
|
|
|
|
"Your pkg_install is too old to evaluate license conditions" \
|
|
|
|
"You can bypass this check by setting SKIP_LICENSE_CHECK=yes"
|
2009-06-14 17:15:24 +02:00
|
|
|
.endif
|
|
|
|
|
2007-07-20 16:21:26 +02:00
|
|
|
.endif
|
2018-01-02 23:40:32 +01:00
|
|
|
|
|
|
|
# guess-license:
|
|
|
|
# Extracts the current package and tries to guess its license.
|
|
|
|
# This is useful for package developers.
|
|
|
|
#
|
|
|
|
# Keywords: license
|
2018-01-07 20:44:31 +01:00
|
|
|
guess-license: .PHONY
|
2018-02-19 13:58:51 +01:00
|
|
|
@# Running "make extract" would fetch and build the dependencies
|
|
|
|
${RUN} [ -d ${WRKSRC} ] \
|
|
|
|
|| ALLOW_VULNERABLE_PACKAGES=yes ${MAKE} makedirs fetch pre-extract do-extract
|
|
|
|
|
2018-01-02 23:40:32 +01:00
|
|
|
${RUN} \
|
|
|
|
\
|
2018-02-19 13:58:51 +01:00
|
|
|
type ninka > /dev/null 2>&1 || ${FAIL_MSG} "To guess the license, wip/ninka must be installed."; \
|
2018-01-05 08:54:39 +01:00
|
|
|
\
|
2018-02-19 13:58:51 +01:00
|
|
|
${PHASE_MSG} "Guessing licenses for ${PKGNAME}"; \
|
2018-01-02 23:40:32 +01:00
|
|
|
\
|
2018-02-19 13:58:51 +01:00
|
|
|
: "Note that ninka can only handle one file at a time; therefore the slow loop below."; \
|
|
|
|
cd ${WRKDIR} \
|
|
|
|
&& ${FIND} ./* -type f -print \
|
|
|
|
| while read fname; do ninka "$$fname"; done \
|
|
|
|
| ${AWK} -F ';' '{ print $$2 }' \
|
|
|
|
| LC_ALL=C ${SORT} | uniq -c | LC_ALL=C ${SORT} -nr \
|
|
|
|
| ${AWK} 'BEGIN { printf("%5s %s\n", "Files", "License") } { printf("%5d %s\n", $$1, $$2); }'
|