-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbake
executable file
·50 lines (40 loc) · 1.07 KB
/
bake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env bash
# TODO: support windows builds/installs
# copy dlls
# nsfu
cd "$(dirname "$0")"
if [ -f ".env" ]; then
export $(grep -v '^#' .env | xargs -d '\n')
fi
HOST=$(go env | grep GOHOSTOS | cut -d'=' -f2)
ARCH=$(go env | grep GOARCH | cut -d'=' -f2)
INSTALL_DIR=`eval echo $INSTALL_DIR`
set -x
if [ "$1" = "run" ]; then
go run cmd/yams/yams.go
elif [ "$1" = "dev" ]; then
export DEV=1
go run cmd/yams/yams.go
elif [ "$1" = "install" ]; then
mkdir -p $INSTALL_DIR
go build -o $INSTALL_DIR/ cmd/yams/yams.go
if [ $? -ne 0 ]; then
exit 1
fi
if [ "$HOST" = "windows" ]; then
dllmod=$(echo "$(grep 'github.*tags' go.mod)" | sed -E 's/^[^a-zA-Z]*//; s/[[:space:]]+/@/')
modcache=$(go env GOMODCACHE)
cp "$(go env GOMODCACHE)/$dllmod/lib/$HOST/$ARCH/bin/"* $INSTALL_DIR/
fi
elif [ "$1" = "uninstall" ]; then
rm $INSTALL_DIR/yams
elif [ "$1" = "build" ]; then
mkdir -p build
go build -o build/ cmd/yams/yams.go
elif [ "$1" = "clean" ]; then
rm -rf build/
else
set +x
echo "Shiver me timbers!!.. Invalid arrghh - $1"
exit 1
fi