Skip to content

Commit

Permalink
tools: fix license builder to work with icu-small
Browse files Browse the repository at this point in the history
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 <jasnell@gmail.com>
Reviewed-By: Steven R Loomis <srloomis@us.ibm.com>
  • Loading branch information
Myles Borins committed Jun 13, 2016
1 parent 6626919 commit 5fd6d75
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion tools/license-builder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ $(echo -e "$3" | sed -e 's/^/ /' -e 's/^ $//' -e 's/ *$//' | sed -e '/./,$
}


if ! [ -d "${rootdir}/deps/icu/" ]; then
if ! [ -d "${rootdir}/deps/icu/" ] && ! [ -d "${rootdir}/deps/icu-small/" ]; then
echo "ICU not installed, run configure to download it, e.g. ./configure --with-intl=small-icu --download=icu"
exit 1
fi
Expand All @@ -42,6 +42,16 @@ elif [ -f "${rootdir}/deps/icu/license.html" ]; then
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)"
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)"
else
echo "Could not find an ICU license file."
exit 1
Expand Down

0 comments on commit 5fd6d75

Please sign in to comment.