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() {
|
2015-12-03 11:13:00 +00:00
|
|
|
|
|
|
|
echo "
|
|
|
|
- ${1}, located at ${2}, is licensed as follows:
|
|
|
|
\"\"\"
|
2020-11-14 17:37:50 +00:00
|
|
|
$(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
|
|
|
\"\"\"\
|
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
|
2015-12-03 11:13:00 +00:00
|
|
|
echo "ICU not installed, run configure to download it, e.g. ./configure --with-intl=small-icu --download=icu"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Dependencies bundled in distributions
|
2020-11-14 17:37:50 +00:00
|
|
|
addlicense "Acorn" "deps/acorn" "$(cat "${rootdir}"/deps/acorn/acorn/LICENSE)"
|
|
|
|
addlicense "c-ares" "deps/cares" "$(tail -n +3 "${rootdir}"/deps/cares/LICENSE.md)"
|
|
|
|
addlicense "cjs-module-lexer" "deps/cjs-module-lexer" "$(cat "${rootdir}"/deps/cjs-module-lexer/LICENSE)"
|
2016-04-05 22:19:35 +00:00
|
|
|
if [ -f "${rootdir}/deps/icu/LICENSE" ]; then
|
|
|
|
# ICU 57 and following. Drop the BOM
|
|
|
|
addlicense "ICU" "deps/icu" \
|
|
|
|
"$(sed -e '1s/^[^a-zA-Z ]*ICU/ICU/' -e :a \
|
2020-11-14 17:37:50 +00:00
|
|
|
-e 's/<[^>]*>//g;s/ / /g;s/ +$//;/</N;//ba' "${rootdir}"/deps/icu/LICENSE)"
|
2016-04-05 22:19:35 +00:00
|
|
|
elif [ -f "${rootdir}/deps/icu/license.html" ]; then
|
|
|
|
# ICU 56 and prior
|
|
|
|
addlicense "ICU" "deps/icu" \
|
|
|
|
"$(sed -e '1,/ICU License - ICU 1\.8\.1 and later/d' -e :a \
|
2020-11-14 17:37:50 +00:00
|
|
|
-e 's/<[^>]*>//g;s/ / /g;s/ +$//;/</N;//ba' "${rootdir}"/deps/icu/license.html)"
|
2016-06-03 00:14:37 +00:00
|
|
|
elif [ -f "${rootdir}/deps/icu-small/LICENSE" ]; then
|
|
|
|
# ICU 57 and following. Drop the BOM
|
|
|
|
addlicense "ICU" "deps/icu-small" \
|
|
|
|
"$(sed -e '1s/^[^a-zA-Z ]*ICU/ICU/' -e :a \
|
2020-11-14 17:37:50 +00:00
|
|
|
-e 's/<[^>]*>//g;s/ / /g;s/ +$//;/</N;//ba' "${rootdir}"/deps/icu-small/LICENSE)"
|
2016-06-03 00:14:37 +00:00
|
|
|
elif [ -f "${rootdir}/deps/icu-small/license.html" ]; then
|
|
|
|
# ICU 56 and prior
|
|
|
|
addlicense "ICU" "deps/icu-small" \
|
|
|
|
"$(sed -e '1,/ICU License - ICU 1\.8\.1 and later/d' -e :a \
|
2020-11-14 17:37:50 +00:00
|
|
|
-e 's/<[^>]*>//g;s/ / /g;s/ +$//;/</N;//ba' "${rootdir}"/deps/icu-small/license.html)"
|
2016-04-05 22:19:35 +00:00
|
|
|
else
|
|
|
|
echo "Could not find an ICU license file."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2020-11-14 17:37:50 +00:00
|
|
|
addlicense "libuv" "deps/uv" "$(cat "${rootdir}"/deps/uv/LICENSE)"
|
2018-10-30 02:06:09 +00:00
|
|
|
addlicense "llhttp" "deps/llhttp" "$(cat deps/llhttp/LICENSE-MIT)"
|
2015-12-03 11:13:00 +00:00
|
|
|
addlicense "OpenSSL" "deps/openssl" \
|
2020-11-14 17:37:50 +00:00
|
|
|
"$(sed -e '/^ \*\/$/,$d' -e '/^ [^*].*$/d' -e '/\/\*.*$/d' -e '/^$/d' -e 's/^[/ ]\* *//' "${rootdir}"/deps/openssl/openssl/LICENSE)"
|
2015-12-03 11:13:00 +00:00
|
|
|
addlicense "Punycode.js" "lib/punycode.js" \
|
2021-05-03 09:15:35 +00:00
|
|
|
"$(curl -sL https://raw.githubusercontent.com/bestiejs/punycode.js/HEAD/LICENSE-MIT.txt)"
|
2020-11-14 17:37:50 +00:00
|
|
|
addlicense "V8" "deps/v8" "$(cat "${rootdir}"/deps/v8/LICENSE)"
|
2019-03-01 11:30:36 +00:00
|
|
|
addlicense "SipHash" "deps/v8/src/third_party/siphash" \
|
|
|
|
"$(sed -e '/You should have received a copy of the CC0/,$d' -e 's/^\/\* *//' -e 's/^ \* *//' deps/v8/src/third_party/siphash/halfsiphash.cc)"
|
2015-12-03 11:13:00 +00:00
|
|
|
addlicense "zlib" "deps/zlib" \
|
2020-11-14 17:37:50 +00:00
|
|
|
"$(sed -e '/The data format used by the zlib library/,$d' -e 's/^\/\* *//' -e 's/^ *//' "${rootdir}"/deps/zlib/zlib.h)"
|
2015-12-03 11:13:00 +00:00
|
|
|
|
|
|
|
# npm
|
2020-11-14 17:37:50 +00:00
|
|
|
addlicense "npm" "deps/npm" "$(cat "${rootdir}"/deps/npm/LICENSE)"
|
2015-12-03 11:13:00 +00:00
|
|
|
|
|
|
|
# Build tools
|
2020-11-14 17:37:50 +00:00
|
|
|
addlicense "GYP" "tools/gyp" "$(cat "${rootdir}"/tools/gyp/LICENSE)"
|
|
|
|
addlicense "inspector_protocol" "tools/inspector_protocol" "$(cat "${rootdir}"/tools/inspector_protocol/LICENSE)"
|
|
|
|
addlicense "jinja2" "tools/inspector_protocol/jinja2" "$(cat "${rootdir}"/tools/inspector_protocol/jinja2/LICENSE)"
|
|
|
|
addlicense "markupsafe" "tools/inspector_protocol/markupsafe" "$(cat "${rootdir}"/tools/inspector_protocol/markupsafe/LICENSE)"
|
2015-12-03 11:13:00 +00:00
|
|
|
|
|
|
|
# Testing tools
|
|
|
|
addlicense "cpplint.py" "tools/cpplint.py" \
|
2020-11-14 17:37:50 +00:00
|
|
|
"$(sed -e '/^$/,$d' -e 's/^#$//' -e 's/^# //' "${rootdir}"/tools/cpplint.py | tail -n +3)"
|
|
|
|
addlicense "ESLint" "tools/node_modules/eslint" "$(cat "${rootdir}"/tools/node_modules/eslint/LICENSE)"
|
2020-12-14 07:21:17 +00:00
|
|
|
addlicense "Babel" "tools/node_modules/@babel" "$(cat "${rootdir}"/tools/node_modules/@babel/core/LICENSE)"
|
2021-07-14 15:20:27 +00:00
|
|
|
addlicense "gtest" "deps/googletest" "$(cat "${rootdir}"/deps/googletest/LICENSE)"
|
2015-12-03 11:13:00 +00:00
|
|
|
|
2017-08-13 13:42:18 +00:00
|
|
|
# nghttp2
|
2020-11-14 17:37:50 +00:00
|
|
|
addlicense "nghttp2" "deps/nghttp2" "$(cat "${rootdir}"/deps/nghttp2/COPYING)"
|
2016-07-20 22:39:48 +00:00
|
|
|
|
2018-12-28 07:21:15 +00:00
|
|
|
# large_pages
|
2020-11-14 17:37:50 +00:00
|
|
|
addlicense "large_pages" "src/large_pages" "$(sed -e '/SPDX-License-Identifier/,$d' -e 's/^\/\///' "${rootdir}"/src/large_pages/node_large_page.h)"
|
2018-12-28 07:21:15 +00:00
|
|
|
|
2019-01-24 18:56:33 +00:00
|
|
|
# deep_freeze
|
2020-11-14 17:37:50 +00:00
|
|
|
addlicense "caja" "lib/internal/freeze_intrinsics.js" "$(sed -e '/SPDX-License-Identifier/,$d' -e 's/^\/\///' "${rootdir}"/lib/internal/freeze_intrinsics.js)"
|
2019-01-24 18:56:33 +00:00
|
|
|
|
2018-05-02 20:48:43 +00:00
|
|
|
# brotli
|
2020-11-14 17:37:50 +00:00
|
|
|
addlicense "brotli" "deps/brotli" "$(cat "${rootdir}"/deps/brotli/LICENSE)"
|
2018-05-02 20:48:43 +00:00
|
|
|
|
2020-11-14 17:37:50 +00:00
|
|
|
addlicense "HdrHistogram" "deps/histogram" "$(cat "${rootdir}"/deps/histogram/LICENSE.txt)"
|
2019-01-07 19:36:35 +00:00
|
|
|
|
2020-05-16 19:54:24 +00:00
|
|
|
addlicense "highlight.js" "doc/api_assets/highlight.pack.js" \
|
|
|
|
"$(curl -sL https://raw.githubusercontent.com/highlightjs/highlight.js/63f367c46f2eeb6f9b7a3545e325eeeb917f9942/LICENSE)"
|
|
|
|
|
2019-03-07 16:51:36 +00:00
|
|
|
addlicense "node-heapdump" "src/heap_utils.cc" \
|
|
|
|
"$(curl -sL https://raw.githubusercontent.com/bnoordhuis/node-heapdump/0ca52441e46241ffbea56a389e2856ec01c48c97/LICENSE)"
|
|
|
|
|
2019-08-16 17:17:21 +00:00
|
|
|
addlicense "rimraf" "lib/internal/fs/rimraf.js" \
|
|
|
|
"$(curl -sL https://raw.githubusercontent.com/isaacs/rimraf/0e365ac4e4d64a25aa2a3cc026348f13410210e1/LICENSE)"
|
|
|
|
|
2020-11-14 17:37:50 +00:00
|
|
|
addlicense "uvwasi" "deps/uvwasi" "$(cat "${rootdir}"/deps/uvwasi/LICENSE)"
|
2021-03-09 21:50:08 +00:00
|
|
|
addlicense "ngtcp2" "deps/ngtcp2/ngtcp2/" "$(cat "${rootdir}"/deps/ngtcp2/LICENSE_ngtcp2)"
|
|
|
|
addlicense "nghttp3" "deps/ngtcp2/nghttp3/" "$(cat "${rootdir}"/deps/ngtcp2/LICENSE_nghttp3)"
|
2019-09-04 21:56:51 +00:00
|
|
|
|
2020-11-14 17:37:50 +00:00
|
|
|
mv "$tmplicense" "$licensefile"
|