2015-12-03 11:13:00 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
rootdir="$(CDPATH= cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
|
|
licensefile="${rootdir}/LICENSE"
|
|
|
|
licensehead="$(sed '/^- /,$d' ${licensefile})"
|
|
|
|
tmplicense="${rootdir}/~LICENSE.$$"
|
|
|
|
echo -e "$licensehead" > $tmplicense
|
|
|
|
|
|
|
|
|
|
|
|
# addlicense <library> <location> <license text>
|
|
|
|
function addlicense {
|
|
|
|
|
|
|
|
echo "
|
|
|
|
- ${1}, located at ${2}, is licensed as follows:
|
|
|
|
\"\"\"
|
|
|
|
$(echo -e "$3" | sed -e 's/^/ /' -e 's/^ $//' -e 's/ *$//' | sed -e '/./,$!d' | sed -e '/^$/N;/^\n$/D')
|
|
|
|
\"\"\"\
|
|
|
|
" >> $tmplicense
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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
|
2019-01-31 07:36:48 +00:00
|
|
|
addlicense "Acorn" "deps/acorn" "$(cat ${rootdir}/deps/acorn/acorn/LICENSE)"
|
2016-10-29 03:33:15 +00:00
|
|
|
addlicense "c-ares" "deps/cares" "$(tail -n +3 ${rootdir}/deps/cares/LICENSE.md)"
|
2015-12-03 11:13:00 +00:00
|
|
|
addlicense "HTTP Parser" "deps/http_parser" "$(cat deps/http_parser/LICENSE-MIT)"
|
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 \
|
|
|
|
-e 's/<[^>]*>//g;s/ / /g;s/ +$//;/</N;//ba' ${rootdir}/deps/icu/LICENSE)"
|
|
|
|
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 \
|
|
|
|
-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 \
|
|
|
|
-e 's/<[^>]*>//g;s/ / /g;s/ +$//;/</N;//ba' ${rootdir}/deps/icu-small/LICENSE)"
|
|
|
|
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 \
|
|
|
|
-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
|
|
|
|
|
2015-12-03 11:13:00 +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" \
|
|
|
|
"$(sed -e '/^ \*\/$/,$d' -e '/^ [^*].*$/d' -e '/\/\*.*$/d' -e '/^$/d' -e 's/^[/ ]\* *//' ${rootdir}/deps/openssl/openssl/LICENSE)"
|
|
|
|
addlicense "Punycode.js" "lib/punycode.js" \
|
|
|
|
"$(curl -sL https://raw.githubusercontent.com/bestiejs/punycode.js/master/LICENSE-MIT.txt)"
|
|
|
|
addlicense "V8" "deps/v8" "$(cat ${rootdir}/deps/v8/LICENSE)"
|
|
|
|
addlicense "zlib" "deps/zlib" \
|
|
|
|
"$(sed -e '/The data format used by the zlib library/,$d' -e 's/^\/\* *//' -e 's/^ *//' ${rootdir}/deps/zlib/zlib.h)"
|
|
|
|
|
|
|
|
# npm
|
|
|
|
addlicense "npm" "deps/npm" "$(cat ${rootdir}/deps/npm/LICENSE)"
|
|
|
|
|
|
|
|
# Build tools
|
|
|
|
addlicense "GYP" "tools/gyp" "$(cat ${rootdir}/tools/gyp/LICENSE)"
|
2018-07-25 20:48:47 +00:00
|
|
|
addlicense "inspector_protocol" "tools/inspector_protocol" "$(cat ${rootdir}/tools/inspector_protocol/LICENSE)"
|
|
|
|
addlicense "jinja2" "tools/jinja2" "$(cat ${rootdir}/tools/jinja2/LICENSE)"
|
|
|
|
addlicense "markupsafe" "tools/markupsafe" "$(cat ${rootdir}/tools/markupsafe/LICENSE)"
|
2015-12-03 11:13:00 +00:00
|
|
|
|
|
|
|
# Testing tools
|
|
|
|
addlicense "cpplint.py" "tools/cpplint.py" \
|
2016-01-19 15:41:23 +00:00
|
|
|
"$(sed -e '/^$/,$d' -e 's/^#$//' -e 's/^# //' ${rootdir}/tools/cpplint.py | tail -n +3)"
|
2017-12-22 15:53:42 +00:00
|
|
|
addlicense "ESLint" "tools/node_modules/eslint" "$(cat ${rootdir}/tools/node_modules/eslint/LICENSE)"
|
2017-12-22 16:00:24 +00:00
|
|
|
addlicense "babel-eslint" "tools/node_modules/babel-eslint" "$(cat ${rootdir}/tools/node_modules/babel-eslint/LICENSE)"
|
2015-12-03 11:13:00 +00:00
|
|
|
addlicense "gtest" "deps/gtest" "$(cat ${rootdir}/deps/gtest/LICENSE)"
|
|
|
|
|
2017-08-13 13:42:18 +00:00
|
|
|
# nghttp2
|
|
|
|
addlicense "nghttp2" "deps/nghttp2" "$(cat ${rootdir}/deps/nghttp2/COPYING)"
|
2016-07-20 22:39:48 +00:00
|
|
|
|
2017-11-01 00:56:44 +00:00
|
|
|
# node-inspect
|
|
|
|
addlicense "node-inspect" "deps/node-inspect" "$(cat ${rootdir}/deps/node-inspect/LICENSE)"
|
|
|
|
|
2018-12-28 07:21:15 +00:00
|
|
|
# large_pages
|
|
|
|
addlicense "large_pages" "src/large_pages" "$(sed -e '/SPDX-License-Identifier/,$d' -e 's/^\/\///' ${rootdir}/src/large_pages/node_large_page.h)"
|
|
|
|
|
2018-05-02 20:48:43 +00:00
|
|
|
# brotli
|
|
|
|
addlicense "brotli" "deps/brotli" "$(cat ${rootdir}/deps/brotli/LICENSE)"
|
|
|
|
|
2019-01-07 19:36:35 +00:00
|
|
|
addlicense "HdrHistogram" "deps/histogram" "$(cat ${rootdir}/deps/histogram/LICENSE.txt)"
|
|
|
|
|
2015-12-03 11:13:00 +00:00
|
|
|
mv $tmplicense $licensefile
|