2016-03-21 16:26:08 +01:00
|
|
|
|
#!/usr/bin/env bash
|
2016-03-18 15:11:16 +01:00
|
|
|
|
|
2016-03-21 18:24:55 +01:00
|
|
|
|
set -eu
|
|
|
|
|
|
2019-08-19 14:08:14 +02:00
|
|
|
|
prefix=/usr/local
|
|
|
|
|
|
|
|
|
|
usage() {
|
|
|
|
|
echo "Usage: ./configure [OPTION]"
|
|
|
|
|
echo
|
|
|
|
|
echo "Configuration:"
|
|
|
|
|
echo " -h, --help display this help and exit"
|
|
|
|
|
echo
|
|
|
|
|
echo "Installation directories:"
|
|
|
|
|
echo " --prefix=PREFIX install architecture-independent files in PREFIX [$prefix]"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# -allow a command to fail with !’s side effect on errexit
|
|
|
|
|
# -use return value from ${PIPESTATUS[0]}, because ! hosed $?
|
|
|
|
|
! getopt --test > /dev/null
|
|
|
|
|
if [[ ${PIPESTATUS[0]} -ne 4 ]]; then
|
|
|
|
|
echo 'getopt not available'
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
LONGOPTS=prefix:,help
|
|
|
|
|
OPTIONS=h
|
|
|
|
|
|
|
|
|
|
! PARSED=$(getopt --options=$OPTIONS --longoptions=$LONGOPTS --name "$0" -- "$@")
|
|
|
|
|
if [[ ${PIPESTATUS[0]} -ne 0 ]]; then
|
|
|
|
|
# e.g. return value is 1
|
|
|
|
|
# then getopt has complained about wrong arguments to stdout
|
|
|
|
|
exit 2
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# read getopt’s output this way to handle the quoting right:
|
|
|
|
|
eval set -- "$PARSED"
|
|
|
|
|
|
|
|
|
|
while true; do
|
|
|
|
|
case "$1" in
|
|
|
|
|
--prefix)
|
|
|
|
|
prefix="$2"
|
|
|
|
|
shift 2
|
|
|
|
|
;;
|
|
|
|
|
-h|--help)
|
|
|
|
|
usage
|
|
|
|
|
exit 1
|
|
|
|
|
;;
|
|
|
|
|
--)
|
|
|
|
|
shift
|
|
|
|
|
break
|
|
|
|
|
;;
|
|
|
|
|
*)
|
|
|
|
|
echo "Programming error"
|
|
|
|
|
exit 3
|
|
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
done
|
|
|
|
|
|
2019-08-19 14:20:32 +02:00
|
|
|
|
cat << EOF > config.mk
|
|
|
|
|
# this file is autogenerated by ./configure
|
|
|
|
|
prefix=$prefix
|
|
|
|
|
EOF
|
2019-08-19 14:08:14 +02:00
|
|
|
|
|
2016-03-21 18:24:55 +01:00
|
|
|
|
node_version=$(node --version)
|
|
|
|
|
if [ ! "$?" -eq 0 ]; then
|
|
|
|
|
echo 'Error: node executable not found.'
|
|
|
|
|
echo 'If you are using ubuntu or debian, try installing the'
|
|
|
|
|
echo 'node-legacy package or symlink node to nodejs.'
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
echo "Using node ${node_version}"
|
|
|
|
|
|
2016-11-03 04:15:29 +01:00
|
|
|
|
if ! node -p 'process.exit(!(/v([0-9]+)/.exec(process.version)[1] >= 4))'; then
|
2016-09-26 18:48:14 +02:00
|
|
|
|
echo 'Your node version is too old, use something >v4.x.x'
|
2016-11-03 04:15:29 +01:00
|
|
|
|
exit 1
|
2016-09-26 18:48:14 +02:00
|
|
|
|
fi
|
|
|
|
|
|
2017-05-23 13:16:41 +02:00
|
|
|
|
if ! yarn --version &>/dev/null; then
|
2017-05-23 13:18:23 +02:00
|
|
|
|
echo 'Error: yarn missing. See https://yarnpkg.com/en/docs/install'
|
2016-03-18 15:11:16 +01:00
|
|
|
|
exit 1
|
|
|
|
|
fi
|
2016-03-21 18:24:55 +01:00
|
|
|
|
|
2017-05-23 13:18:23 +02:00
|
|
|
|
if ! find --version &>/dev/null; then
|
2016-03-21 18:24:55 +01:00
|
|
|
|
echo 'Error: find missing'
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
2017-05-23 13:18:23 +02:00
|
|
|
|
if ! xargs --version &>/dev/null; then
|
2016-03-21 18:24:55 +01:00
|
|
|
|
echo 'Error: xargs missing'
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
2017-05-23 13:18:23 +02:00
|
|
|
|
if ! msgmerge --version &>/dev/null; then
|
2016-03-21 18:24:55 +01:00
|
|
|
|
echo "Warning: msgmerge missing, i18n won't work"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|