master
1#!/bin/bash
2
3# build static lib
4if [[ $(uname -s) == 'Linux' ]]; then
5 TARGET="x86_64-unknown-linux-gnu"
6elif [[ $(uname -s) == 'Darwin' ]]; then
7 TARGET="aarch64-apple-darwin"
8fi
9
10cd lib/system || exit
11cross build --release --target "$TARGET"
12
13cd ../..
14cp "lib/system/target/$TARGET/release/libsystem.a" lib/
15
16# build go binary
17if [[ $(uname -s) == 'Linux' ]]; then
18 go build -ldflags="-extldflags=-static"
19elif [[ $(uname -s) == 'Darwin' ]]; then
20 CGO_ENABLED=1 go build -ldflags="-s -w -linkmode 'external'" .
21fi