diff --git a/tools/license-builder.sh b/tools/license-builder.sh index 1fd1dd599e9309..31c525c0ec4a64 100755 --- a/tools/license-builder.sh +++ b/tools/license-builder.sh @@ -11,11 +11,12 @@ echo "$licensehead" > "$tmplicense" # addlicense addlicense() { + licenseTextTrimmed=$(echo "$3" | sed -e 's/^/ /' -e 's/^ $//' -e 's/ *$//' | sed -e '/./,$!d' | sed -e '/^$/N;/^\n$/D') echo " - ${1}, located at ${2}, is licensed as follows: \"\"\" -$(echo "$3" | sed -e 's/^/ /' -e 's/^ $//' -e 's/ *$//' | sed -e '/./,$!d' | sed -e '/^$/N;/^\n$/D') +${licenseTextTrimmed} \"\"\"\ " >> "$tmplicense" @@ -29,89 +30,108 @@ fi # Dependencies bundled in distributions -addlicense "Acorn" "deps/acorn" "$(cat "${rootdir}"/deps/acorn/acorn/LICENSE)" -addlicense "c-ares" "deps/cares" "$(tail -n +3 "${rootdir}"/deps/cares/LICENSE.md)" -addlicense "cjs-module-lexer" "deps/cjs-module-lexer" "$(cat "${rootdir}"/deps/cjs-module-lexer/LICENSE)" +licenseText="$(cat "${rootdir}"/deps/acorn/acorn/LICENSE)" +addlicense "Acorn" "deps/acorn" "$licenseText" +licenseText="$(tail -n +3 "${rootdir}"/deps/cares/LICENSE.md)" +addlicense "c-ares" "deps/cares" "$licenseText" +licenseText="$(cat "${rootdir}"/deps/cjs-module-lexer/LICENSE)" +addlicense "cjs-module-lexer" "deps/cjs-module-lexer" "$licenseText" 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/ +$//;/]*>//g;s/ / /g;s/ +$//;/]*>//g;s/ / /g;s/ +$//;/]*>//g;s/ / /g;s/ +$//;/