#!/bin/sh set -e rootdir="$(CDPATH='' cd "$(dirname "$0")/.." && pwd)" licensefile="${rootdir}/LICENSE" licensehead="$(sed '/^- /,$d' "${licensefile}")" tmplicense="${rootdir}/~LICENSE.$$" 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: \"\"\" ${licenseTextTrimmed} \"\"\"\ " >> "$tmplicense" } if ! [ -d "${rootdir}/deps/icu/" ] && ! [ -d "${rootdir}/deps/icu-small/" ]; then echo "ICU not installed, run \`./configure --with-intl=small-icu --download=icu\` to download it." exit 1 fi # Dependencies bundled in distributions licenseText="$(cat "${rootdir}/deps/acorn/acorn/LICENSE")" addlicense "Acorn" "deps/acorn" "$licenseText" licenseText="$(cat "${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" licenseText="$(cat "${rootdir}/deps/v8/third_party/ittapi/LICENSES/BSD-3-Clause.txt")" addlicense "ittapi" "deps/v8/third_party/ittapi" "$licenseText" licenseText="$(cat "${rootdir}/deps/amaro/LICENSE.md")" addlicense "amaro" "deps/amaro" "$licenseText" licenseText="$(cat "${rootdir}/deps/amaro/dist/LICENSE")" addlicense "swc" "deps/amaro/dist" "$licenseText" if [ -f "${rootdir}/deps/icu/LICENSE" ]; then # ICU 57 and following. Drop the BOM licenseText="$(sed -e '1s/^[^a-zA-Z ]*ICU/ICU/' -e :a -e 's/<[^>]*>//g;s/ / /g;s/ +$//;/