2020-11-14 17:37:50 +00:00
#!/bin/sh
2015-12-03 11:13:00 +00:00
set -e
2020-11-14 17:37:50 +00:00
rootdir = " $( CDPATH = '' cd " $( dirname " $0 " ) /.. " && pwd ) "
2015-12-03 11:13:00 +00:00
licensefile = " ${ rootdir } /LICENSE "
2020-11-14 17:37:50 +00:00
licensehead = " $( sed '/^- /,$d' " ${ licensefile } " ) "
2015-12-03 11:13:00 +00:00
tmplicense = " ${ rootdir } /~LICENSE. $$ "
2020-11-14 17:37:50 +00:00
echo " $licensehead " > " $tmplicense "
2015-12-03 11:13:00 +00:00
# addlicense <library> <location> <license text>
2020-11-14 17:37:50 +00:00
addlicense( ) {
2021-12-22 14:38:13 +00:00
licenseTextTrimmed = $( echo " $3 " | sed -e 's/^/ /' -e 's/^ $//' -e 's/ *$//' | sed -e '/./,$!d' | sed -e '/^$/N;/^\n$/D' )
2015-12-03 11:13:00 +00:00
echo "
- ${ 1 } , located at ${ 2 } , is licensed as follows:
\" \" \"
2021-12-22 14:38:13 +00:00
${ licenseTextTrimmed }
2015-12-03 11:13:00 +00:00
\" \" \" \
2020-11-14 17:37:50 +00:00
" >> " $tmplicense "
2015-12-03 11:13:00 +00:00
}
2016-06-03 00:14:37 +00:00
if ! [ -d " ${ rootdir } /deps/icu/ " ] && ! [ -d " ${ rootdir } /deps/icu-small/ " ] ; then
2024-09-03 17:25:55 +00:00
echo "ICU not installed, run \`./configure --with-intl=small-icu --download=icu\` to download it."
2015-12-03 11:13:00 +00:00
exit 1
fi
# Dependencies bundled in distributions
2022-11-01 12:36:44 +00:00
licenseText = " $( cat " ${ rootdir } /deps/acorn/acorn/LICENSE " ) "
2021-12-22 14:38:13 +00:00
addlicense "Acorn" "deps/acorn" " $licenseText "
2024-08-14 15:43:24 +00:00
licenseText = " $( cat " ${ rootdir } /deps/cares/LICENSE.md " ) "
2021-12-22 14:38:13 +00:00
addlicense "c-ares" "deps/cares" " $licenseText "
2022-11-01 12:36:44 +00:00
licenseText = " $( cat " ${ rootdir } /deps/cjs-module-lexer/LICENSE " ) "
2021-12-22 14:38:13 +00:00
addlicense "cjs-module-lexer" "deps/cjs-module-lexer" " $licenseText "
2022-11-22 08:28:19 +00:00
licenseText = " $( cat " ${ rootdir } /deps/v8/third_party/ittapi/LICENSES/BSD-3-Clause.txt " ) "
addlicense "ittapi" "deps/v8/third_party/ittapi" " $licenseText "
2024-07-24 16:30:06 +00:00
licenseText = " $( cat " ${ rootdir } /deps/amaro/LICENSE.md " ) "
addlicense "amaro" "deps/amaro" " $licenseText "
2024-08-22 08:48:47 +00:00
licenseText = " $( cat " ${ rootdir } /deps/amaro/dist/LICENSE " ) "
addlicense "swc" "deps/amaro/dist" " $licenseText "
2016-04-05 22:19:35 +00:00
if [ -f " ${ rootdir } /deps/icu/LICENSE " ] ; then
# ICU 57 and following. Drop the BOM
2022-11-01 12:36:44 +00:00
licenseText = " $( sed -e '1s/^[^a-zA-Z ]*ICU/ICU/' -e :a -e 's/<[^>]*>//g;s/ / /g;s/ +$//;/</N;//ba' " ${ rootdir } /deps/icu/LICENSE " ) "
2021-12-22 14:38:13 +00:00
addlicense "ICU" "deps/icu" " $licenseText "
2016-04-05 22:19:35 +00:00
elif [ -f " ${ rootdir } /deps/icu/license.html " ] ; then
# ICU 56 and prior
2022-11-01 12:36:44 +00:00
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 " ) "
2021-12-22 14:38:13 +00:00
addlicense "ICU" "deps/icu" " $licenseText "
2016-06-03 00:14:37 +00:00
elif [ -f " ${ rootdir } /deps/icu-small/LICENSE " ] ; then
# ICU 57 and following. Drop the BOM
2022-11-01 12:36:44 +00:00
licenseText = " $( sed -e '1s/^[^a-zA-Z ]*ICU/ICU/' -e :a -e 's/<[^>]*>//g;s/ / /g;s/ +$//;/</N;//ba' " ${ rootdir } /deps/icu-small/LICENSE " ) "
2021-12-22 14:38:13 +00:00
addlicense "ICU" "deps/icu-small" " $licenseText "
2016-06-03 00:14:37 +00:00
elif [ -f " ${ rootdir } /deps/icu-small/license.html " ] ; then
# ICU 56 and prior
2022-11-01 12:36:44 +00:00
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 " ) "
2021-12-22 14:38:13 +00:00
addlicense "ICU" "deps/icu-small" " $licenseText "
2016-04-05 22:19:35 +00:00
else
echo "Could not find an ICU license file."
exit 1
fi
2023-05-24 05:47:22 +00:00
licenseText = " $( cat " ${ rootdir } /deps/uv/LICENSE " " ${ rootdir } /deps/uv/LICENSE-extra " ) "
2021-12-22 14:38:13 +00:00
addlicense "libuv" "deps/uv" " $licenseText "
licenseText = " $( cat deps/llhttp/LICENSE-MIT) "
addlicense "llhttp" "deps/llhttp" " $licenseText "
2022-11-01 12:36:44 +00:00
licenseText = " $( cat " ${ rootdir } /deps/corepack/LICENSE.md " ) "
2021-12-22 14:38:13 +00:00
addlicense "corepack" "deps/corepack" " $licenseText "
2022-11-01 12:36:44 +00:00
licenseText = " $( cat " ${ rootdir } /deps/undici/LICENSE " ) "
2022-02-01 08:17:50 +00:00
addlicense "undici" "deps/undici" " $licenseText "
2022-12-15 05:37:27 +00:00
licenseText = " $( cat " ${ rootdir } /test/fixtures/postject-copy/node_modules/postject/LICENSE " ) "
addlicense "postject" "test/fixtures/postject-copy" " $licenseText "
2022-11-01 12:36:44 +00:00
licenseText = " $( cat " ${ rootdir } /deps/openssl/openssl/LICENSE.txt " ) "
2021-12-22 14:38:13 +00:00
addlicense "OpenSSL" "deps/openssl" " $licenseText "
licenseText = " $( curl -sL https://raw.githubusercontent.com/bestiejs/punycode.js/HEAD/LICENSE-MIT.txt) "
addlicense "Punycode.js" "lib/punycode.js" " $licenseText "
2022-11-01 12:36:44 +00:00
licenseText = " $( cat " ${ rootdir } /deps/v8/LICENSE " ) "
2021-12-22 14:38:13 +00:00
addlicense "V8" "deps/v8" " $licenseText "
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) "
addlicense "SipHash" "deps/v8/src/third_party/siphash" " $licenseText "
2022-11-01 12:36:44 +00:00
licenseText = " $( sed -e '/The data format used by the zlib library/,$d' -e 's/^\/\* *//' -e 's/^ *//' " ${ rootdir } /deps/zlib/zlib.h " ) "
2021-12-22 14:38:13 +00:00
addlicense "zlib" "deps/zlib" " $licenseText "
2023-10-21 21:44:41 +00:00
licenseText = " $( cat " ${ rootdir } /deps/simdjson/LICENSE " ) "
addlicense "simdjson" "deps/simdjson" " $licenseText "
2022-11-30 16:05:17 +00:00
licenseText = " $( cat " ${ rootdir } /deps/simdutf/LICENSE-MIT " ) "
addlicense "simdutf" "deps/simdutf" " $licenseText "
2023-01-27 20:49:13 +00:00
licenseText = " $( curl -sL https://raw.githubusercontent.com/ada-url/ada/HEAD/LICENSE-MIT) "
addlicense "ada" "deps/ada" " $licenseText "
2023-04-08 21:16:13 +00:00
licenseText = " $( cat " ${ rootdir } /deps/minimatch/LICENSE " ) "
addlicense "minimatch" "deps/minimatch" " $licenseText "
2015-12-03 11:13:00 +00:00
# npm
2022-11-01 12:36:44 +00:00
licenseText = " $( cat " ${ rootdir } /deps/npm/LICENSE " ) "
2021-12-22 14:38:13 +00:00
addlicense "npm" "deps/npm" " $licenseText "
2015-12-03 11:13:00 +00:00
# Build tools
2022-11-01 12:36:44 +00:00
licenseText = " $( cat " ${ rootdir } /tools/gyp/LICENSE " ) "
2021-12-22 14:38:13 +00:00
addlicense "GYP" "tools/gyp" " $licenseText "
2022-11-01 12:36:44 +00:00
licenseText = " $( cat " ${ rootdir } /tools/inspector_protocol/LICENSE " ) "
2021-12-22 14:38:13 +00:00
addlicense "inspector_protocol" "tools/inspector_protocol" " $licenseText "
2022-11-01 12:36:44 +00:00
licenseText = " $( cat " ${ rootdir } /tools/inspector_protocol/jinja2/LICENSE " ) "
2021-12-22 14:38:13 +00:00
addlicense "jinja2" "tools/inspector_protocol/jinja2" " $licenseText "
2022-11-01 12:36:44 +00:00
licenseText = " $( cat " ${ rootdir } /tools/inspector_protocol/markupsafe/LICENSE " ) "
2021-12-22 14:38:13 +00:00
addlicense "markupsafe" "tools/inspector_protocol/markupsafe" " $licenseText "
2015-12-03 11:13:00 +00:00
# Testing tools
2022-11-01 12:36:44 +00:00
licenseText = " $( sed -e '/^$/,$d' -e 's/^#$//' -e 's/^# //' " ${ rootdir } /tools/cpplint.py " | tail -n +3) "
2021-12-22 14:38:13 +00:00
addlicense "cpplint.py" "tools/cpplint.py" " $licenseText "
2023-12-28 20:27:05 +00:00
licenseText = " $( sed -e '/^$/,$d' -e 's/^#$//' -e 's/^# //' " ${ rootdir } /tools/gypi_to_gn.py " | tail -n +3) "
addlicense "gypi_to_gn.py" "tools/gypi_to_gn.py" " $licenseText "
2022-11-01 12:36:44 +00:00
licenseText = " $( cat " ${ rootdir } /deps/googletest/LICENSE " ) "
2021-12-22 14:38:13 +00:00
addlicense "gtest" "deps/googletest" " $licenseText "
2015-12-03 11:13:00 +00:00
2017-08-13 13:42:18 +00:00
# nghttp2
2022-11-01 12:36:44 +00:00
licenseText = " $( cat " ${ rootdir } /deps/nghttp2/COPYING " ) "
2021-12-22 14:38:13 +00:00
addlicense "nghttp2" "deps/nghttp2" " $licenseText "
2016-07-20 22:39:48 +00:00
2018-12-28 07:21:15 +00:00
# large_pages
2022-11-01 12:36:44 +00:00
licenseText = " $( sed -e '/SPDX-License-Identifier/,$d' -e 's/^\/\///' " ${ rootdir } /src/large_pages/node_large_page.h " ) "
2021-12-22 14:38:13 +00:00
addlicense "large_pages" "src/large_pages" " $licenseText "
2018-12-28 07:21:15 +00:00
2019-01-24 18:56:33 +00:00
# deep_freeze
2022-11-01 12:36:44 +00:00
licenseText = " $( sed -e '/SPDX-License-Identifier/,$d' -e 's/^\/\///' " ${ rootdir } /lib/internal/freeze_intrinsics.js " ) "
2021-12-22 14:38:13 +00:00
addlicense "caja" "lib/internal/freeze_intrinsics.js" " $licenseText "
2019-01-24 18:56:33 +00:00
2018-05-02 20:48:43 +00:00
# brotli
2022-11-01 12:36:44 +00:00
licenseText = " $( cat " ${ rootdir } /deps/brotli/LICENSE " ) "
2021-12-22 14:38:13 +00:00
addlicense "brotli" "deps/brotli" " $licenseText "
2018-05-02 20:48:43 +00:00
2022-11-01 12:36:44 +00:00
licenseText = " $( cat " ${ rootdir } /deps/histogram/LICENSE.txt " ) "
2021-12-22 14:38:13 +00:00
addlicense "HdrHistogram" "deps/histogram" " $licenseText "
2019-01-07 19:36:35 +00:00
2021-12-22 14:38:13 +00:00
licenseText = " $( curl -sL https://raw.githubusercontent.com/bnoordhuis/node-heapdump/0ca52441e46241ffbea56a389e2856ec01c48c97/LICENSE) "
addlicense "node-heapdump" "src/heap_utils.cc" " $licenseText "
2019-03-07 16:51:36 +00:00
2021-12-22 14:38:13 +00:00
licenseText = " $( curl -sL https://raw.githubusercontent.com/isaacs/rimraf/0e365ac4e4d64a25aa2a3cc026348f13410210e1/LICENSE) "
addlicense "rimraf" "lib/internal/fs/rimraf.js" " $licenseText "
2019-08-16 17:17:21 +00:00
2022-11-01 12:36:44 +00:00
licenseText = " $( cat " ${ rootdir } /deps/uvwasi/LICENSE " ) "
2021-12-22 14:38:13 +00:00
addlicense "uvwasi" "deps/uvwasi" " $licenseText "
2022-11-01 12:36:44 +00:00
licenseText = " $( cat " ${ rootdir } /deps/ngtcp2/LICENSE_ngtcp2 " ) "
2021-12-22 14:38:13 +00:00
addlicense "ngtcp2" "deps/ngtcp2/ngtcp2/" " $licenseText "
2022-11-01 12:36:44 +00:00
licenseText = " $( cat " ${ rootdir } /deps/ngtcp2/LICENSE_nghttp3 " ) "
2021-12-22 14:38:13 +00:00
addlicense "nghttp3" "deps/ngtcp2/nghttp3/" " $licenseText "
2019-09-04 21:56:51 +00:00
2021-12-22 14:38:13 +00:00
licenseText = " $( curl -sL https://raw.githubusercontent.com/jprichardson/node-fs-extra/b34da2762a4865b025cac06d02d6a2f1f1027b65/LICENSE) "
addlicense "node-fs-extra" "lib/internal/fs/cp" " $licenseText "
2021-08-08 20:48:01 +00:00
2024-07-11 17:57:20 +00:00
licenseText = " $( curl -sL https://raw.githubusercontent.com/mcollina/on-exit-leak-free/2a01c7e66c690aca17187b10b0cecbe43e083eb2/LICENSE) "
addlicense "on-exit-leak-free" "lib/internal/process/finalization" " $licenseText "
2020-11-14 17:37:50 +00:00
mv " $tmplicense " " $licensefile "