-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·45 lines (38 loc) · 988 Bytes
/
build.sh
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
#!/bin/bash
OS=`uname -s | tr '[:upper:]' '[:lower:]'`
ARCH=`arch`
if [ $OS == "darwin" ]
then
EXTENSION="dylib"
else
EXTENSION="so"
fi
if [[ $OS == mingw64* ]]
then
EXTENSION="dll"
fi
echo "Building on $OS for $ARCH"
if [ $OS == "darwin" ]
then
CGO_ENABLED=1 GOARCH=arm64 go build -buildmode=c-shared -o libgoast-arm64.${EXTENSION} lib.go
CGO_ENABLED=1 GOARCH=amd64 go build -buildmode=c-shared -o libgoast-amd64.${EXTENSION} lib.go
fi
if [ $OS == "linux" ]
then
if [ $ARCH == "aarch64" ]
then
CGO_ENABLED=1 GOARCH=arm64 go build -buildmode=c-shared -o libgoast-arm64.${EXTENSION} lib.go
fi
if [ $ARCH == "x86_64" ]
then
CGO_ENABLED=1 GOARCH=amd64 go build -buildmode=c-shared -o libgoast-amd64.${EXTENSION} lib.go
fi
fi
if [[ $OS == mingw64* ]]
then
CGO_ENABLED=1 GOARCH=amd64 go build -buildmode=c-shared -o libgoast-amd64.${EXTENSION} lib.go
ls -l
else
echo "Unsupported OS"
echo "Current OS: $OS"
fi