summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorRod Vagg <rod@vagg.org>2015-12-03 22:13:00 +1100
committerRod Vagg <rod@vagg.org>2016-01-14 22:07:27 +1100
commit031b87d42da26dfdf2ba6202decfbcfc8b3aedc9 (patch)
tree3bf4bca94378ad0809eec3668e9427a11bae5c87 /tools
parent3727ae0d7dc940ee3b2bc238fc80cd3605954715 (diff)
downloadandroid-node-v8-031b87d42da26dfdf2ba6202decfbcfc8b3aedc9.tar.gz
android-node-v8-031b87d42da26dfdf2ba6202decfbcfc8b3aedc9.tar.bz2
android-node-v8-031b87d42da26dfdf2ba6202decfbcfc8b3aedc9.zip
tools: add license-builder.sh to construct LICENSE
PR-URL: https://github.com/nodejs/node/pull/4194 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/license-builder.sh63
1 files changed, 63 insertions, 0 deletions
diff --git a/tools/license-builder.sh b/tools/license-builder.sh
new file mode 100755
index 0000000000..bb350e5a8b
--- /dev/null
+++ b/tools/license-builder.sh
@@ -0,0 +1,63 @@
+#!/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
+
+}
+
+
+if ! [ -f "${rootdir}/deps/icu/license.html" ]; then
+ 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
+addlicense "c-ares" "deps/cares" \
+ "$(sed -e '/^ \*\/$/,$d' -e '/^$/d' -e 's/^[/ ]\* *//' ${rootdir}/deps/cares/src/ares_init.c)"
+addlicense "HTTP Parser" "deps/http_parser" "$(cat deps/http_parser/LICENSE-MIT)"
+addlicense "ICU" "deps/icu" \
+ "$(sed -e '1,/COPYRIGHT AND PERMISSION NOTICE/d' -e '/^<hr/,$d' -e 's/^<\/*p>$//' ${rootdir}/deps/icu/license.html)"
+addlicense "libuv" "deps/uv" "$(cat ${rootdir}/deps/uv/LICENSE)"
+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)"
+addlicense "marked" "tools/doc/node_modules/marked" \
+ "$(cat ${rootdir}/tools/doc/node_modules/marked/LICENSE)"
+
+# Testing tools
+addlicense "cpplint.py" "tools/cpplint.py" \
+ "$(sed -e '/^$/,$d' -e 's/^#$//' -e 's/^# //' ${rootdir}/tools/cpplint.py | tail +3)"
+addlicense "ESLint" "tools/eslint" "$(cat ${rootdir}/tools/eslint/LICENSE)"
+addlicense "gtest" "deps/gtest" "$(cat ${rootdir}/deps/gtest/LICENSE)"
+addlicense "node-weak" "test/gc/node_modules/weak" \
+ "$(cat ${rootdir}/test/gc/node_modules/weak/LICENSE)"
+
+
+mv $tmplicense $licensefile