62 lines
1.6 KiB
Bash
Executable File
62 lines
1.6 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
# Test
|
|
if [ "$1" = "test" ]; then
|
|
# Configure Git
|
|
git config --global --add safe.directory '*'
|
|
|
|
# Generate dependencies
|
|
make depend
|
|
|
|
# Run tests
|
|
make test
|
|
|
|
exit 0
|
|
fi
|
|
|
|
# Go
|
|
if [ "$1" = "go" ]; then
|
|
# Install native dependencies
|
|
apt update
|
|
apt install -y curl make
|
|
|
|
# Install bagop
|
|
curl -L -o /tmp/bagop "https://github.com/pojntfx/bagop/releases/latest/download/bagop.linux-$(uname -m)"
|
|
install /tmp/bagop /usr/local/bin
|
|
|
|
# Configure Git
|
|
git config --global --add safe.directory '*'
|
|
|
|
# Generate dependencies
|
|
make depend
|
|
|
|
# Build
|
|
CGO_ENABLED=0 bagop -j "$(nproc)" -b "$2" -x '(android/*|ios/*|aix/*|plan9/*|illumos/*|dragonfly/*|netbsd/*|openbsd/*|solaris/*|freebsd/(386|arm|riscv64)|js/wasm|linux/(mips|ppc64|riscv64|loong64)|windows/(arm|386)|wasip1/wasm)' -p 'make build/stfs DST=$DST' -d out
|
|
|
|
exit 0
|
|
fi
|
|
|
|
# gccgo
|
|
if [ "$1" = "gccgo" ]; then
|
|
# Install native dependencies
|
|
apt update
|
|
apt install -y curl
|
|
|
|
# Install bagccgop
|
|
curl -L -o /tmp/bagccgop "https://github.com/pojntfx/bagccgop/releases/latest/download/bagccgop.linux-$(uname -m)"
|
|
install /tmp/bagccgop /usr/local/bin
|
|
|
|
# Configure Git
|
|
git config --global --add safe.directory '*'
|
|
|
|
# Generate dependencies
|
|
make depend
|
|
|
|
# Build
|
|
GOFLAGS='-gccgoflags=-static' bagccgop -x '(linux/alpha|linux/mipsle|linux/arm$|linux/arm64|linux/386|linux/amd64|linux/s390x)' -j1 -b "$1" -n -r 'make depend' -s 'build-essential,automake' -m 'libsqlite3-dev' -p 'make build/stfs DST=$DST' -d out
|
|
|
|
exit 0
|
|
fi
|