From da9f02a381cdf35c9d801175909c4d6ac1b87abb Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Mon, 6 Jan 2020 19:34:03 +0000 Subject: [PATCH] Add -p for PIE builds, preserve environment LDFLAGS --- build | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/build b/build index 68dac037..6b355c00 100755 --- a/build +++ b/build @@ -6,10 +6,10 @@ PKGSRC=${PKGSRC:-github.com/yggdrasil-network/yggdrasil-go/src/version} PKGNAME=${PKGNAME:-$(sh contrib/semver/name.sh)} PKGVER=${PKGVER:-$(sh contrib/semver/version.sh --bare)} -LDFLAGS="-X $PKGSRC.buildName=$PKGNAME -X $PKGSRC.buildVersion=$PKGVER" +LDFLAGS="$LDFLAGS -X $PKGSRC.buildName=$PKGNAME -X $PKGSRC.buildVersion=$PKGVER" ARGS="-v" -while getopts "uaitc:l:dro:" option +while getopts "uaitc:l:dro:p" option do case "$option" in @@ -22,6 +22,7 @@ do d) ARGS="$ARGS -tags debug" DEBUG=true;; r) ARGS="$ARGS -race";; o) ARGS="$ARGS -o $OPTARG";; + p) ARGS="$ARGS -buildmode=pie";; esac done