2015-08-08 15:26:36 +02:00
|
|
|
#! /usr/bin/env sh
|
2015-07-02 17:16:59 +02:00
|
|
|
|
2016-07-11 02:12:48 +02:00
|
|
|
LOCAL_SUFFIX="breminale"
|
2015-07-02 17:16:59 +02:00
|
|
|
GLUON_DIR="gluon/"
|
|
|
|
KEYFILE="$HOME/.ecdsakey"
|
2016-07-11 02:12:48 +02:00
|
|
|
local_version=1
|
2015-07-02 17:16:59 +02:00
|
|
|
|
|
|
|
set -eu
|
|
|
|
|
2015-11-07 20:55:30 +01:00
|
|
|
if which realpath > /dev/null; then
|
|
|
|
GLUON_SITEDIR="$(dirname "$(realpath "$0")")"
|
|
|
|
else
|
|
|
|
GLUON_SITEDIR="$(dirname "$(readlink -f "$0")")"
|
|
|
|
fi
|
|
|
|
export GLUON_SITEDIR
|
2015-07-02 17:16:59 +02:00
|
|
|
|
2015-08-30 16:44:44 +02:00
|
|
|
get_GLUON_TAG() {
|
2015-07-02 17:16:59 +02:00
|
|
|
if ! git --git-dir="${GLUON_DIR}/.git" describe --exact-match; then
|
|
|
|
echo 'The gluon tree is not checked out at a tag.'
|
|
|
|
echo 'Please use `git checkout <tagname>` to use an official gluon release'
|
|
|
|
echo 'or build it manually. Only with at a tag we can autogenerate the'
|
|
|
|
echo 'release string!'
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-08-04 10:04:42 +02:00
|
|
|
debug=
|
2016-02-11 22:36:54 +01:00
|
|
|
if [ "$#" -gt 0 ]; then
|
|
|
|
if [ "$1" = '-h' -o "$1" = '--help' ]; then
|
|
|
|
cat <<USAGE
|
|
|
|
Usage: $(basename $0) [--debug]
|
|
|
|
|
|
|
|
This script tries to autodetermine the correct release name, builds gluon for
|
|
|
|
all supported platforms (excluding x86*), and optionally signs it if an
|
|
|
|
ecdsutils keyfile is found (standard path: ~/.ecdsakey)
|
|
|
|
USAGE
|
|
|
|
exit 1
|
|
|
|
fi
|
2015-08-30 16:44:44 +02:00
|
|
|
|
2016-02-11 22:36:54 +01:00
|
|
|
if [ "$1" = "--debug" ]; then
|
|
|
|
debug=1
|
|
|
|
shift
|
|
|
|
fi
|
2015-08-30 16:44:44 +02:00
|
|
|
fi
|
|
|
|
|
2016-02-11 22:36:54 +01:00
|
|
|
GLUON_BRANCH="stable"
|
2015-08-30 16:44:44 +02:00
|
|
|
GLUON_TAG="$(get_GLUON_TAG)"
|
|
|
|
# remove prefixed "v"
|
|
|
|
GLUON_TAG="${GLUON_TAG#v}"
|
|
|
|
|
2016-07-11 02:12:48 +02:00
|
|
|
echo "Building Gluon ${GLUON_TAG} as ${GLUON_BRANCH}"
|
|
|
|
auto_determined_release="${GLUON_TAG}+${LOCAL_SUFFIX}${local_version}"
|
|
|
|
read -p "Release name for this build [default: ${auto_determined_release}]: " GLUON_RELEASE
|
|
|
|
GLUON_RELEASE="${GLUON_RELEASE:-$auto_determined_release}"
|
2015-08-30 16:44:44 +02:00
|
|
|
|
2015-08-26 21:54:01 +02:00
|
|
|
|
2015-08-04 10:04:42 +02:00
|
|
|
# calculate number of threads
|
|
|
|
if [ -z "$debug" ]; then
|
|
|
|
proc_num="$(($(grep -c '^processor\s' /proc/cpuinfo) + 1))"
|
|
|
|
else
|
|
|
|
proc_num=1
|
|
|
|
fi
|
|
|
|
|
2015-07-02 17:16:59 +02:00
|
|
|
cd "$GLUON_DIR"
|
2015-08-30 16:44:44 +02:00
|
|
|
export GLUON_BRANCH GLUON_RELEASE
|
2016-07-11 02:12:48 +02:00
|
|
|
make update ${debug:+V=s}
|
2015-08-30 16:44:44 +02:00
|
|
|
|
2016-07-08 15:39:14 +02:00
|
|
|
for target in ar71xx-generic; do
|
2016-07-11 02:12:48 +02:00
|
|
|
#make clean GLUON_TARGET="$target" ${debug:+V=s}
|
2015-08-04 10:04:42 +02:00
|
|
|
make -j${proc_num} GLUON_TARGET="$target" ${debug:+V=s}
|
2015-07-02 17:16:59 +02:00
|
|
|
done
|