@@ -11,11 +11,12 @@ echo "$licensehead" > "$tmplicense"
1111
1212# addlicense <library> <location> <license text>
1313addlicense () {
14+ licenseTextTrimmed=$( echo " $3 " | sed -e ' s/^/ /' -e ' s/^ $//' -e ' s/ *$//' | sed -e ' /./,$!d' | sed -e ' /^$/N;/^\n$/D' )
1415
1516 echo "
1617- ${1} , located at ${2} , is licensed as follows:
1718 \"\"\"
18- $( echo " $3 " | sed -e ' s/^/ / ' -e ' s/^ $// ' -e ' s/ *$// ' | sed -e ' /./,$!d ' | sed -e ' /^$/N;/^\n$/D ' )
19+ ${licenseTextTrimmed}
1920 \"\"\"\
2021" >> " $tmplicense "
2122
2930
3031
3132# Dependencies bundled in distributions
32- addlicense " Acorn" " deps/acorn" " $( cat " ${rootdir} " /deps/acorn/acorn/LICENSE) "
33- addlicense " c-ares" " deps/cares" " $( tail -n +3 " ${rootdir} " /deps/cares/LICENSE.md) "
34- addlicense " cjs-module-lexer" " deps/cjs-module-lexer" " $( cat " ${rootdir} " /deps/cjs-module-lexer/LICENSE) "
33+ licenseText=" $( cat " ${rootdir} " /deps/acorn/acorn/LICENSE) "
34+ addlicense " Acorn" " deps/acorn" " $licenseText "
35+ licenseText=" $( tail -n +3 " ${rootdir} " /deps/cares/LICENSE.md) "
36+ addlicense " c-ares" " deps/cares" " $licenseText "
37+ licenseText=" $( cat " ${rootdir} " /deps/cjs-module-lexer/LICENSE) "
38+ addlicense " cjs-module-lexer" " deps/cjs-module-lexer" " $licenseText "
3539if [ -f " ${rootdir} /deps/icu/LICENSE" ]; then
3640 # ICU 57 and following. Drop the BOM
37- addlicense " ICU" " deps/icu" \
38- " $( sed -e ' 1s/^[^a-zA-Z ]*ICU/ICU/' -e :a \
39- -e ' s/<[^>]*>//g;s/ / /g;s/ +$//;/</N;//ba' " ${rootdir} " /deps/icu/LICENSE) "
41+ licenseText=" $( sed -e ' 1s/^[^a-zA-Z ]*ICU/ICU/' -e :a -e ' s/<[^>]*>//g;s/ / /g;s/ +$//;/</N;//ba' " ${rootdir} " /deps/icu/LICENSE) "
42+ addlicense " ICU" " deps/icu" " $licenseText "
4043elif [ -f " ${rootdir} /deps/icu/license.html" ]; then
4144 # ICU 56 and prior
42- addlicense " ICU" " deps/icu" \
43- " $( sed -e ' 1,/ICU License - ICU 1\.8\.1 and later/d' -e :a \
44- -e ' s/<[^>]*>//g;s/ / /g;s/ +$//;/</N;//ba' " ${rootdir} " /deps/icu/license.html) "
45+ licenseText=" $( sed -e ' 1,/ICU License - ICU 1\.8\.1 and later/d' -e :a -e ' s/<[^>]*>//g;s/ / /g;s/ +$//;/</N;//ba' " ${rootdir} " /deps/icu/license.html) "
46+ addlicense " ICU" " deps/icu" " $licenseText "
4547elif [ -f " ${rootdir} /deps/icu-small/LICENSE" ]; then
4648 # ICU 57 and following. Drop the BOM
47- addlicense " ICU" " deps/icu-small" \
48- " $( sed -e ' 1s/^[^a-zA-Z ]*ICU/ICU/' -e :a \
49- -e ' s/<[^>]*>//g;s/ / /g;s/ +$//;/</N;//ba' " ${rootdir} " /deps/icu-small/LICENSE) "
49+ licenseText=" $( sed -e ' 1s/^[^a-zA-Z ]*ICU/ICU/' -e :a -e ' s/<[^>]*>//g;s/ / /g;s/ +$//;/</N;//ba' " ${rootdir} " /deps/icu-small/LICENSE) "
50+ addlicense " ICU" " deps/icu-small" " $licenseText "
5051elif [ -f " ${rootdir} /deps/icu-small/license.html" ]; then
5152 # ICU 56 and prior
52- addlicense " ICU" " deps/icu-small" \
53- " $( sed -e ' 1,/ICU License - ICU 1\.8\.1 and later/d' -e :a \
54- -e ' s/<[^>]*>//g;s/ / /g;s/ +$//;/</N;//ba' " ${rootdir} " /deps/icu-small/license.html) "
53+ licenseText=" $( sed -e ' 1,/ICU License - ICU 1\.8\.1 and later/d' -e :a -e ' s/<[^>]*>//g;s/ / /g;s/ +$//;/</N;//ba' " ${rootdir} " /deps/icu-small/license.html) "
54+ addlicense " ICU" " deps/icu-small" " $licenseText "
5555else
5656 echo " Could not find an ICU license file."
5757 exit 1
5858fi
5959
60- addlicense " libuv" " deps/uv" " $( cat " ${rootdir} " /deps/uv/LICENSE) "
61- addlicense " llhttp" " deps/llhttp" " $( cat deps/llhttp/LICENSE-MIT) "
62- addlicense " corepack" " deps/corepack" " $( cat " ${rootdir} " /deps/corepack/LICENSE.md) "
63- addlicense " OpenSSL" " deps/openssl" \
64- " $( sed -e ' /^ \*\/$/,$d' -e ' /^ [^*].*$/d' -e ' /\/\*.*$/d' -e ' /^$/d' -e ' s/^[/ ]\* *//' " ${rootdir} " /deps/openssl/openssl/LICENSE) "
65- addlicense " Punycode.js" " lib/punycode.js" \
66- " $( curl -sL https://raw.githubusercontent.com/bestiejs/punycode.js/HEAD/LICENSE-MIT.txt) "
67- addlicense " V8" " deps/v8" " $( cat " ${rootdir} " /deps/v8/LICENSE) "
68- addlicense " SipHash" " deps/v8/src/third_party/siphash" \
69- " $( sed -e ' /You should have received a copy of the CC0/,$d' -e ' s/^\/\* *//' -e ' s/^ \* *//' deps/v8/src/third_party/siphash/halfsiphash.cc) "
70- addlicense " zlib" " deps/zlib" \
71- " $( sed -e ' /The data format used by the zlib library/,$d' -e ' s/^\/\* *//' -e ' s/^ *//' " ${rootdir} " /deps/zlib/zlib.h) "
60+ licenseText=" $( cat " ${rootdir} " /deps/uv/LICENSE) "
61+ addlicense " libuv" " deps/uv" " $licenseText "
62+ licenseText=" $( cat deps/llhttp/LICENSE-MIT) "
63+ addlicense " llhttp" " deps/llhttp" " $licenseText "
64+ licenseText=" $( cat " ${rootdir} " /deps/corepack/LICENSE.md) "
65+ addlicense " corepack" " deps/corepack" " $licenseText "
66+ licenseText=" $( cat " ${rootdir} " /deps/openssl/openssl/LICENSE.txt) "
67+ addlicense " OpenSSL" " deps/openssl" " $licenseText "
68+ licenseText=" $( curl -sL https://raw.githubusercontent.com/bestiejs/punycode.js/HEAD/LICENSE-MIT.txt) "
69+ addlicense " Punycode.js" " lib/punycode.js" " $licenseText "
70+ licenseText=" $( cat " ${rootdir} " /deps/v8/LICENSE) "
71+ addlicense " V8" " deps/v8" " $licenseText "
72+ licenseText=" $( sed -e ' /You should have received a copy of the CC0/,$d' -e ' s/^\/\* *//' -e ' s/^ \* *//' deps/v8/src/third_party/siphash/halfsiphash.cc) "
73+ addlicense " SipHash" " deps/v8/src/third_party/siphash" " $licenseText "
74+ licenseText=" $( sed -e ' /The data format used by the zlib library/,$d' -e ' s/^\/\* *//' -e ' s/^ *//' " ${rootdir} " /deps/zlib/zlib.h) "
75+ addlicense " zlib" " deps/zlib" " $licenseText "
7276
7377# npm
74- addlicense " npm" " deps/npm" " $( cat " ${rootdir} " /deps/npm/LICENSE) "
78+ licenseText=" $( cat " ${rootdir} " /deps/npm/LICENSE) "
79+ addlicense " npm" " deps/npm" " $licenseText "
7580
7681# Build tools
77- addlicense " GYP" " tools/gyp" " $( cat " ${rootdir} " /tools/gyp/LICENSE) "
78- addlicense " inspector_protocol" " tools/inspector_protocol" " $( cat " ${rootdir} " /tools/inspector_protocol/LICENSE) "
79- addlicense " jinja2" " tools/inspector_protocol/jinja2" " $( cat " ${rootdir} " /tools/inspector_protocol/jinja2/LICENSE) "
80- addlicense " markupsafe" " tools/inspector_protocol/markupsafe" " $( cat " ${rootdir} " /tools/inspector_protocol/markupsafe/LICENSE) "
82+ licenseText=" $( cat " ${rootdir} " /tools/gyp/LICENSE) "
83+ addlicense " GYP" " tools/gyp" " $licenseText "
84+ licenseText=" $( cat " ${rootdir} " /tools/inspector_protocol/LICENSE) "
85+ addlicense " inspector_protocol" " tools/inspector_protocol" " $licenseText "
86+ licenseText=" $( cat " ${rootdir} " /tools/inspector_protocol/jinja2/LICENSE) "
87+ addlicense " jinja2" " tools/inspector_protocol/jinja2" " $licenseText "
88+ licenseText=" $( cat " ${rootdir} " /tools/inspector_protocol/markupsafe/LICENSE) "
89+ addlicense " markupsafe" " tools/inspector_protocol/markupsafe" " $licenseText "
8190
8291# Testing tools
83- addlicense " cpplint.py" " tools/cpplint.py" \
84- " $( sed -e ' /^$/,$d' -e ' s/^#$//' -e ' s/^# //' " ${rootdir} " /tools/cpplint.py | tail -n +3) "
85- addlicense " ESLint" " tools/node_modules/eslint" " $( cat " ${rootdir} " /tools/node_modules/eslint/LICENSE) "
86- addlicense " gtest" " deps/googletest" " $( cat " ${rootdir} " /deps/googletest/LICENSE) "
92+ licenseText=" $( sed -e ' /^$/,$d' -e ' s/^#$//' -e ' s/^# //' " ${rootdir} " /tools/cpplint.py | tail -n +3) "
93+ addlicense " cpplint.py" " tools/cpplint.py" " $licenseText "
94+ licenseText=" $( cat " ${rootdir} " /tools/node_modules/eslint/LICENSE) "
95+ addlicense " ESLint" " tools/node_modules/eslint" " $licenseText "
96+ licenseText=" $( cat " ${rootdir} " /deps/googletest/LICENSE) "
97+ addlicense " gtest" " deps/googletest" " $licenseText "
8798
8899# nghttp2
89- addlicense " nghttp2" " deps/nghttp2" " $( cat " ${rootdir} " /deps/nghttp2/COPYING) "
100+ licenseText=" $( cat " ${rootdir} " /deps/nghttp2/COPYING) "
101+ addlicense " nghttp2" " deps/nghttp2" " $licenseText "
90102
91103# large_pages
92- addlicense " large_pages" " src/large_pages" " $( sed -e ' /SPDX-License-Identifier/,$d' -e ' s/^\/\///' " ${rootdir} " /src/large_pages/node_large_page.h) "
104+ licenseText=" $( sed -e ' /SPDX-License-Identifier/,$d' -e ' s/^\/\///' " ${rootdir} " /src/large_pages/node_large_page.h) "
105+ addlicense " large_pages" " src/large_pages" " $licenseText "
93106
94107# deep_freeze
95- addlicense " caja" " lib/internal/freeze_intrinsics.js" " $( sed -e ' /SPDX-License-Identifier/,$d' -e ' s/^\/\///' " ${rootdir} " /lib/internal/freeze_intrinsics.js) "
108+ licenseText=" $( sed -e ' /SPDX-License-Identifier/,$d' -e ' s/^\/\///' " ${rootdir} " /lib/internal/freeze_intrinsics.js) "
109+ addlicense " caja" " lib/internal/freeze_intrinsics.js" " $licenseText "
96110
97111# brotli
98- addlicense " brotli" " deps/brotli" " $( cat " ${rootdir} " /deps/brotli/LICENSE) "
112+ licenseText=" $( cat " ${rootdir} " /deps/brotli/LICENSE) "
113+ addlicense " brotli" " deps/brotli" " $licenseText "
99114
100- addlicense " HdrHistogram" " deps/histogram" " $( cat " ${rootdir} " /deps/histogram/LICENSE.txt) "
115+ licenseText=" $( cat " ${rootdir} " /deps/histogram/LICENSE.txt) "
116+ addlicense " HdrHistogram" " deps/histogram" " $licenseText "
101117
102- addlicense " highlight.js " " doc/api_assets/highlight.pack.js " \
103- " $( curl -sL https://raw.githubusercontent.com/highlightjs/ highlight.js/63f367c46f2eeb6f9b7a3545e325eeeb917f9942/LICENSE ) "
118+ licenseText= " $( curl -sL https://raw.githubusercontent.com/highlightjs/highlight.js/63f367c46f2eeb6f9b7a3545e325eeeb917f9942/LICENSE ) "
119+ addlicense " highlight.js " " doc/api_assets/ highlight.pack.js " " $licenseText "
104120
105- addlicense " node-heapdump " " src/heap_utils.cc " \
106- " $( curl -sL https://raw.githubusercontent.com/bnoordhuis/ node-heapdump/0ca52441e46241ffbea56a389e2856ec01c48c97/LICENSE ) "
121+ licenseText= " $( curl -sL https://raw.githubusercontent.com/bnoordhuis/node-heapdump/0ca52441e46241ffbea56a389e2856ec01c48c97/LICENSE ) "
122+ addlicense " node-heapdump" " src/heap_utils.cc " " $licenseText "
107123
108- addlicense " rimraf " " lib/internal/fs/ rimraf.js " \
109- " $( curl -sL https://raw.githubusercontent.com/isaacs/ rimraf/0e365ac4e4d64a25aa2a3cc026348f13410210e1/LICENSE ) "
124+ licenseText= " $( curl -sL https://raw.githubusercontent.com/isaacs/ rimraf/0e365ac4e4d64a25aa2a3cc026348f13410210e1/LICENSE ) "
125+ addlicense " rimraf " " lib/internal/fs/ rimraf.js " " $licenseText "
110126
111- addlicense " uvwasi" " deps/uvwasi" " $( cat " ${rootdir} " /deps/uvwasi/LICENSE) "
112- addlicense " ngtcp2" " deps/ngtcp2/ngtcp2/" " $( cat " ${rootdir} " /deps/ngtcp2/LICENSE_ngtcp2) "
113- addlicense " nghttp3" " deps/ngtcp2/nghttp3/" " $( cat " ${rootdir} " /deps/ngtcp2/LICENSE_nghttp3) "
127+ licenseText=" $( cat " ${rootdir} " /deps/uvwasi/LICENSE) "
128+ addlicense " uvwasi" " deps/uvwasi" " $licenseText "
129+ licenseText=" $( cat " ${rootdir} " /deps/ngtcp2/LICENSE_ngtcp2) "
130+ addlicense " ngtcp2" " deps/ngtcp2/ngtcp2/" " $licenseText "
131+ licenseText=" $( cat " ${rootdir} " /deps/ngtcp2/LICENSE_nghttp3) "
132+ addlicense " nghttp3" " deps/ngtcp2/nghttp3/" " $licenseText "
114133
115- addlicense " node-fs-extra" " lib/internal/fs/cp " \
116- " $( curl -sL https://raw.githubusercontent.com/jprichardson/ node-fs-extra/b34da2762a4865b025cac06d02d6a2f1f1027b65/LICENSE ) "
134+ licenseText= " $( curl -sL https://raw.githubusercontent.com/jprichardson/ node-fs-extra/b34da2762a4865b025cac06d02d6a2f1f1027b65/LICENSE ) "
135+ addlicense " node-fs-extra" " lib/internal/fs/cp " " $licenseText "
117136
118137mv " $tmplicense " " $licensefile "
0 commit comments