aboutsummaryrefslogtreecommitdiff
path: root/licentia/source/program/licentia/license/distribution.lux
blob: d348a1a44796e618775667708c1864a900d0ffb1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
(.module:
  [library
   [lux "*"
    [data
     ["[0]" text
      ["%" format {"+" format}]]
     [collection
      ["[0]" list ("[1]#[0]" monoid)]]]]]
  ["[0]" // {"+" Distribution}
   ["_" term]
   [//
    ["$" document]]])

(def: notices
  (List Text)
  (let [notices (: (-> Text Text)
                   (function (_ what)
                     (format what " notices")))]
    (list (notices "copyright")
          (notices "patent")
          (notices "trademark")
          (notices "attribution")
          (notices "disclaimer of warranty")
          (notices "limitation of liability")
          (notices "other"))))

(def: .public source_code_form
  (let [on_license_propagation (let [coverage (format "All distribution of " _.licensed_work " in " _.source_code_form)
                                     with_contributions (format "including any " ($.plural _.contribution)
                                                                " that " _.recipient
                                                                " creates")
                                     same_license (format "must be under the terms of " _.license)]
                                 (format coverage ", " with_contributions ", " same_license))
        on_license_access (let [responsibility_to_inform (format _.recipient
                                                                 " must inform recipients that the " _.source_code_form
                                                                 " of " _.licensed_work
                                                                 " is governed by the terms of " _.license)
                                license_copy (format "and how they can obtain a copy of " _.license)]
                            (format responsibility_to_inform ", " license_copy))
        on_license_immutability (format _.recipient
                                        " may not attempt to alter or restrict the recipients’ rights in the " _.source_code_form
                                        ", as specified in " _.license)
        on_notice_retention (let [obligation (format _.recipient " must retain")
                                  location (format "in the " _.source_code_form
                                                   " of any " _.extension
                                                   " that " _.recipient
                                                   " distributes")
                                  what (format "all " ($.and notices) " from the " _.source_code_form " of " _.licensed_work)
                                  exclusion ($.or (list (format "those notices that do not pertain to any part of the " _.extension)
                                                        "those notices that contain known factual inaccuracies"))]
                              (format obligation ", " location ", " what ", excluding " exclusion))
        on_additional_notices (let [right (format _.recipient
                                                  " may add additional "($.and notices)
                                                  " within an " _.extension
                                                  " that " _.recipient
                                                  " distributes")
                                    constraint (format "such additional " ($.and notices) " cannot be construed as modifying " _.license)]
                                (format right ", provided that " constraint))]
    ($.paragraph (list on_license_propagation
                       on_license_access
                       on_license_immutability
                       on_notice_retention
                       on_additional_notices))))

(def: .public object_form
  (let [on_responsibility (let [condition (format "If " _.recipient
                                                  " distributes " _.licensed_work
                                                  " in " _.object_form)
                                responsibility (let [availability_responsibility (format _.licensed_work " must also be made available in " _.source_code_form)
                                                     source_code_responsibility (format _.recipient
                                                                                        " must inform recipients of the " _.object_form
                                                                                        " how they can obtain a copy of such " _.source_code_form)
                                                     constraints "by reasonable means in a timely manner, at a charge no more than the cost of distribution to the recipient"]
                                                 (format availability_responsibility ", and " source_code_responsibility " " constraints))]
                            (format condition " then " responsibility))
        on_licensing (format _.recipient
                             " may distribute such " _.object_form
                             " under the terms of "_.license)]
    ($.paragraph (list on_responsibility
                       on_licensing))))

(def: .public allow_re_licensing
  (let [can_license (format _.recipient
                            " may create and distribute an " _.extension
                            " under terms " _.recipient
                            " chooses")
        requirement (format _.recipient
                            " also comply with the requirements of " _.license
                            " for the " _.licensed_work)]
    (format can_license ", " "provided that " requirement)))

(def: .public allow_multi_licensing
  (let [condition (format "the " _.extension " is a combination of " _.licensed_work " with a work governed by one or more " ($.plural _.secondary_license))
        permission (let [relicensing (format _.license
                                             " permits " _.recipient
                                             " to additionally distribute " _.licensed_work
                                             " under the terms of such " ($.plural _.secondary_license))
                         distribution (format "so that the recipient of the " _.extension
                                              " may, at their option, further distribute " _.licensed_work
                                              " under the terms of either " _.license
                                              " or such " ($.plural _.secondary_license))]
                     (format relicensing ", " distribution))]
    (format "If " condition ", " permission)))

(def: .public (extension distribution)
  (-> Distribution Text)
  ($.paragraph ($_ list#composite
                   (if (value@ //.#can_re_license? distribution)
                     (list allow_re_licensing)
                     (list))
                   (if (value@ //.#can_multi_license? distribution)
                     (list allow_multi_licensing)
                     (list)))))