#!/usr/bin/env bash set -e rootdir="$(CDPATH= cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" licensefile="${rootdir}/LICENSE" licensehead="$(sed '/^- /,$d' ${licensefile})" tmplicense="${rootdir}/~LICENSE.$$" echo -e "$licensehead" > $tmplicense # addlicense function addlicense { echo " - ${1}, located at ${2}, is licensed as follows: \"\"\" $(echo -e "$3" | sed -e 's/^/ /' -e 's/^ $//' -e 's/ *$//' | sed -e '/./,$!d' | sed -e '/^$/N;/^\n$/D') \"\"\"\ " >> $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 addlicense "Acorn" "deps/acorn" "$(cat ${rootdir}/deps/acorn/acorn/LICENSE)" addlicense "c-ares" "deps/cares" "$(tail -n +3 ${rootdir}/deps/cares/LICENSE.md)" addlicense "HTTP Parser" "deps/http_parser" "$(cat deps/http_parser/LICENSE-MIT)" 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/ +$//;/