Skip to content

Commit 7182f5f

Browse files
author
Myles Borins
committed
tools: fix license builder to work with icu-small
Currently the license builder is expecting the ICU package to be found at `deps/icu`. ICU is now included by default and found at `deps/icu-small`. This commit adds logic to find the license at the new location. This could likely be done in a more elegant way, but it works! PR-URL: #7119 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Steven R Loomis <[email protected]>
1 parent 4a7e333 commit 7182f5f

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

tools/license-builder.sh

+11-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ $(echo -e "$3" | sed -e 's/^/ /' -e 's/^ $//' -e 's/ *$//' | sed -e '/./,$
2222
}
2323

2424

25-
if ! [ -d "${rootdir}/deps/icu/" ]; then
25+
if ! [ -d "${rootdir}/deps/icu/" ] && ! [ -d "${rootdir}/deps/icu-small/" ]; then
2626
echo "ICU not installed, run configure to download it, e.g. ./configure --with-intl=small-icu --download=icu"
2727
exit 1
2828
fi
@@ -42,6 +42,16 @@ elif [ -f "${rootdir}/deps/icu/license.html" ]; then
4242
addlicense "ICU" "deps/icu" \
4343
"$(sed -e '1,/ICU License - ICU 1\.8\.1 and later/d' -e :a \
4444
-e 's/<[^>]*>//g;s/ / /g;s/ +$//;/</N;//ba' ${rootdir}/deps/icu/license.html)"
45+
elif [ -f "${rootdir}/deps/icu-small/LICENSE" ]; then
46+
# ICU 57 and following. Drop the BOM
47+
addlicense "ICU" "deps/icu-small" \
48+
"$(sed -e '1s/^[^a-zA-Z ]*ICU/ICU/' -e :a \
49+
-e 's/<[^>]*>//g;s/ / /g;s/ +$//;/</N;//ba' ${rootdir}/deps/icu-small/LICENSE)"
50+
elif [ -f "${rootdir}/deps/icu-small/license.html" ]; then
51+
# ICU 56 and prior
52+
addlicense "ICU" "deps/icu-small" \
53+
"$(sed -e '1,/ICU License - ICU 1\.8\.1 and later/d' -e :a \
54+
-e 's/<[^>]*>//g;s/ / /g;s/ +$//;/</N;//ba' ${rootdir}/deps/icu-small/license.html)"
4555
else
4656
echo "Could not find an ICU license file."
4757
exit 1

0 commit comments

Comments
 (0)