@ -9,6 +9,8 @@ if [ -n "${ZSH_VERSION:-}" ]; then
emulate sh -o err_exit -o no_unset
fi
export LC_ALL=C
usage="$(command cat <<\END
Usage: build [-m ARCH] [-c CPU] [-d CMD] [-i IMAGE] [-s] [-w]
@ -52,7 +54,7 @@ if [ "$(narg $workdir)" != 1 -o -z "${workdir##*:*}" ]; then
exit 1
fi
appname=gitstatusd-"$gitstatus_kernel"-"$gitstatus_arch"
appname=gitstatusd
libgit2_tmp="$outdir"/deps/"$appname".libgit2.tmp
cleanup() {
@ -68,8 +70,16 @@ trap cleanup INT QUIT TERM ILL PIPE
if [ -n "$gitstatus_install_tools" ]; then
case "$gitstatus_kernel" in
linux)
command apk update
command apk add binutils cmake gcc g++ git make musl-dev perl-utils
if command -v apk >/dev/null 2>&1; then
command apk update
command apk add binutils cmake gcc g++ git make musl-dev perl-utils
elif command -v apt-get >/dev/null 2>&1; then
apt-get update
apt-get install -y binutils cmake gcc g++ make wget
else
>&2 echo "[error] -s is not supported on this system"
exit 1
fi
;;
freebsd)
command pkg install -y cmake gmake binutils gcc git perl5
@ -110,8 +120,8 @@ cpus="$(command getconf _NPROCESSORS_ONLN 2>/dev/null)" ||
cpus=8
case "$gitstatus_cpu" in
ppc64le) archflag="-mcpu";;
*) archflag="-march";;
power pc64le) archflag="-mcpu";;
*) archflag="-march";;
esac
cflags="$archflag=$gitstatus_cpu -fno-plt"
@ -131,9 +141,7 @@ gitstatus_make=make
case "$gitstatus_kernel" in
linux)
if [ -n "$docker_cmd" ]; then
gitstatus_ldflags="$gitstatus_ldflags -static"
fi
gitstatus_ldflags="$gitstatus_ldflags -static"
gitstatus_ldflags="$gitstatus_ldflags -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now"
libgit2_cmake_flags="$libgit2_cmake_flags -DENABLE_REPRODUCIBLE_BUILDS=ON"
;;
@ -446,9 +454,6 @@ case "$gitstatus_kernel" in
;;
esac
fi
elif [ -n "$gitstatus_install_tools" ]; then
>&2 echo '[error] -s without -d is not supported on linux'
exit 1
fi
;;
freebsd|netbsd|darwin)