summaryrefslogtreecommitdiff
path: root/tools/license-builder.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tools/license-builder.sh')
-rwxr-xr-xtools/license-builder.sh20
1 files changed, 16 insertions, 4 deletions
diff --git a/tools/license-builder.sh b/tools/license-builder.sh
index 5d6b810e12..3d587227b4 100755
--- a/tools/license-builder.sh
+++ b/tools/license-builder.sh
@@ -22,7 +22,7 @@ $(echo -e "$3" | sed -e 's/^/ /' -e 's/^ $//' -e 's/ *$//' | sed -e '/./,$
}
-if ! [ -f "${rootdir}/deps/icu/license.html" ]; then
+if ! [ -d "${rootdir}/deps/icu/" ]; then
echo "ICU not installed, run configure to download it, e.g. ./configure --with-intl=small-icu --download=icu"
exit 1
fi
@@ -32,9 +32,21 @@ fi
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,/ICU License - ICU 1\.8\.1 and later/d' -e :a \
- -e 's/<[^>]*>//g;s/ / /g;s/ +$//;/</N;//ba' ${rootdir}/deps/icu/license.html)"
+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)"
+else
+ echo "Could not find an ICU license file."
+ exit 1
+fi
+
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)"