From a4284cf8542a33699343256370ee6a0a8c82a6d3 Mon Sep 17 00:00:00 2001 From: HappyHakunaMatata <122421848+HappyHakunaMatata@users.noreply.github.com> Date: Sat, 27 Jul 2024 00:10:05 +0200 Subject: [PATCH] docker build fix --- build | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/build b/build index bd131867..ec18eb52 100755 --- a/build +++ b/build @@ -28,14 +28,20 @@ if [ -z $TABLES ] && [ -z $DEBUG ]; then LDFLAGS="$LDFLAGS -s -w" fi -LIBNAME="yggdrasillib" -if [[ "$OSTYPE" == "linux-gnu"* ]]; then - LIBNAME="$LIBNAME.so" -elif [[ "$OSTYPE" == "darwin"* ]]; then - LIBNAME="$LIBNAME.dylib" -elif [[ "$OSTYPE" == "win32" ]]; then - LIBNAME="$LIBNAME.dll" +if [[ "$CGO_ENABLED" == "1" ]]; then + LIBNAME="yggdrasillib" + if [[ "$OSTYPE" == "linux-gnu"* ]]; then + LIBNAME="$LIBNAME.so" + echo "Building: $LIBNAME" + elif [[ "$OSTYPE" == "darwin"* ]]; then + LIBNAME="$LIBNAME.dylib" + echo "Building: $LIBNAME" + elif [[ "$OSTYPE" == "win32" ]]; then + LIBNAME="$LIBNAME.dll" + echo "Building: $LIBNAME" + fi + go build -ldflags="$LDFLAGS" -buildmode=c-shared -o="$LIBNAME" ./cmd/yggdrasillib fi for CMD in yggdrasil yggdrasilctl; do @@ -48,4 +54,4 @@ for CMD in yggdrasil yggdrasilctl; do fi done -go build -ldflags="$LDFLAGS" -buildmode=c-shared -o="$LIBNAME" ./cmd/yggdrasillib +