Pullup ticket #2800.
[pkgsrc.git] / mk / license.mk
1 # $NetBSD: license.mk,v 1.10 2008/01/09 14:38:05 gdt Exp $
2 #
3 # Note: This file is in draft state and not yet included in default
4 # pkgsrc operations.
5 #
6 # This file handles everything about the LICENSE variable. It is
7 # included automatically by bsd.pkg.mk.
8 #
9 # XXX: Some of this content arguably belongs in the pkgsrc guide
10 # instead.
11 #
12 # === User-settable variables ===
13 #
14 # ACCEPTABLE_LICENSES
15 #       If a package declares a license and that license is not a
16 #       member of the list defined by this variable, pkgsrc will
17 #       refuse to build the package.
18 #
19 #       XXX: pkg_install should also check LICENSE and decline to
20 #       install if it is not in ACCEPTABLE_LICENSES.
21 #
22 #       XXX: Perhaps there should be some mechanism to prevent running
23 #       programs that are part of packages that declare LICENSEs that
24 #       are not in ACCEPTABLE_LICENSES or some per-user variable.
25 #       This is surely controversial and requires discussion.
26 #
27 #       To include the default licenses, you can use the += operator
28 #       in mk.conf. To override it, use the plain = operator.
29 #
30 #       Default value: ${DEFAULT_ACCEPTABLE_LICENSES}
31 #
32 # === Package-settable variables ===
33 #
34 # LICENSE
35 #       The license of the package.
36 #
37 #       Sometimes licensing is other than a single text file.  See
38 #       doc/TODO for discussion of how to handle packages with dual
39 #       licensing (a choice) or where multiple licenses apply
40 #       simultaneously.
41
42 #       Every package should specify its license.  (Prior to July 2007,
43 #       Open Source and Free software did not have license tags.)
44 #
45 #       As of 2008-01, we are adding #LICENSE=; until this file is
46 #       included from bsd.pkg.mk such tags will cause failure because
47 #       DEFAULT_ACCEPTABLE_LICENSES is not yet implemented.
48 #
49 #       Licenses are collected in the licenses/ subdirectory of
50 #       pkgsrc.  For open source license, we generally use the same
51 #       names as either the Open Source Initiative or the Free
52 #       Software Foundation, choosing a name to reduce confusion.
53 #       Open source and free licenses do not have a -license suffix,
54 #       and non-free licenses do.
55 #
56 #       http://opensource.org/licenses/category
57 #       http://www.fsf.org/licensing/licenses/index_html
58 #
59 # === Predefined variables ===
60 #
61 # DEFAULT_ACCEPTABLE_LICENSES
62 #       The list of licenses that will be the default value of
63 #       ACCEPTABLE_LICENSES.  Adapting the longstanding policy of Open
64 #       Source or Free licenses not requiring tags, it should contain
65 #       all licenses that are Open Source or Free, so as to provide
66 #       the most expansive default that almost all people find
67 #       acceptable.  (Many people will want to add more licenses to
68 #       ACCEPTABLE_LICENSES; the point is to have a default that very
69 #       few people want to shrink.)
70 #
71 # === See also ===
72 #
73 #       ../doc/TODO, section "Licenses of packages"
74 #
75 # Keywords: licence
76 #
77
78 # This list is not complete.  Free and Open Source licenses should be
79 # added to the list as they are added to pkgsrc.
80
81 # The convention is that Free or Open Source licenses do not have a
82 # -license suffix, and nonfree licenses end in -license.
83
84 # XXX open-font-license should perhaps be changed to open-font
85
86 # XXX Surely we will encounter licenses that clearly are Free, but
87 # which have not been formally approved.  These licenses, if added,
88 # should be somehow marked.
89
90 DEFAULT_ACCEPTABLE_LICENSES= \
91         public-domain \
92         gnu-gpl-v2 gnu-lgpl-v2 \
93         gnu-gpl-v3 gnu-lgpl-v3 \
94         original-bsd modified-bsd \
95         x11 \
96         apache-2.0 \
97         cddl-1.0 \
98         open-font-license
99
100 .if !defined(LICENSE)
101 # XXX Revisit date.
102 .  if defined(AFTER_2007Q3)
103 LICENSE?=               unknown
104 PKG_FAIL_REASON+=       "[license.mk] Every package must define a LICENSE."
105 .  else
106 WARNINGS+=              "[license.mk] Every package should define a LICENSE."
107 .  endif
108
109 .else
110
111 # Note: some bulk builders rely on the fact that they can set
112 # _ACCEPTABLE to bypass license checks.  Inform them when you intend to
113 # remove this variable.
114 .  if defined(ACCEPTABLE_LICENSES) && !empty(ACCEPTABLE_LICENSES:M${LICENSE})
115 _ACCEPTABLE=    yes
116 .  endif
117
118 .  if !defined(_ACCEPTABLE)
119 PKG_FAIL_REASON+= "${PKGNAME} has an unacceptable license: ${LICENSE}." \
120          "    To view the license, enter \"${MAKE} show-license\"." \
121          "    To indicate acceptance, add this line to your mk.conf:" \
122          "    ACCEPTABLE_LICENSES+=${LICENSE}"
123 .  endif
124 .endif