#!/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 to download it, e.g. ./configure --with-intl=small-icu --download=icu" exit 1 fi # Dependencies bundled in distributions 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 licenseText="$(sed -e '1s/^[^a-zA-Z ]*ICU/ICU/' -e :a -e 's/<[^>]*>//g;s/ / /g;s/ +$//;/