Skip to content

Commit

Permalink
add build tags for apk build.
Browse files Browse the repository at this point in the history
  • Loading branch information
ericwq committed Apr 30, 2024
1 parent 7aef0c3 commit 6e1115c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion build/APKBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@ build() {
_module_name=$(head ./go.mod | grep '^module' | awk '{print $2}')
_go_version=$(go version | grep 'version' | awk '{print $3}')

# set build tags based on glibc or musl
_musl=$(ldd /bin/ls | grep 'musl'|head -n 1| awk '{print $1}')
if [ "$_musl" == "" ]
then
_build_tag="-tags utmp"
else
_build_tag="-tags utmps"
fi

# set ldflags
local ldflags="-s -w \
-X $_module_name/frontend.BuildTime=$(date -u +%Y-%m-%dT%H:%M:%S) \
Expand All @@ -44,7 +53,7 @@ build() {
-X $_module_name/frontend.GoVersion=$_go_version \
"
echo "build server start: $(date)"
go build -ldflags="$ldflags" -o "$builddir/bin/apshd" ./frontend/server
go build $_build_tag -ldflags="$ldflags" -o "$builddir/bin/apshd" ./frontend/server
echo "build server end : $(date)"
echo "output server to : $builddir/bin/apshd"

Expand Down

0 comments on commit 6e1115c

Please sign in to comment.