forked from kaack/elrs-joystick-control
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-raspbian32-linux-armhf.sh
executable file
·55 lines (39 loc) · 1.45 KB
/
build-raspbian32-linux-armhf.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
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env bash
set -e
echo " *** Install git ***"
sudo apt install -y git
echo " *** Install SDL2 dev library *** "
sudo apt install -y libsdl2-dev
echo " *** Download, compile, and install iconv library ***"
curl -sfL -o libiconv.tar.gz https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.17.tar.gz
mkdir iconv
tar -xzvf libiconv.tar.gz -C iconv --strip-components=1
pushd iconv
./configure --enable-static --disable-shared --prefix=/usr
sudo make install
popd
echo " *** Download and install Go ***"
curl -sfL -o go.tar.gz https://dl.google.com/go/go1.20.7.linux-armv6l.tar.gz
tar -xzvf go.tar.gz
mv go go-sdk
mkdir go
export CC=gcc
export CGO_ENABLED=1
export GOPATH="${PWD}/go"
export GOROOT="${PWD}/go-sdk"
export GOARCH arm
export OOS=linux
export PATH="${PATH}:${PWD}/go-sdk/bin:${PWD}/go/bin"
echo "*** Grab latest webapp from github-page branch ***"
git checkout -b github-page origin/github-page
tar -czvf dist.tar.gz --transform 's/^docs/dist/' docs
echo "*** Switch back to main branch ***"
git checkout main
echo "*** Extract the webapp dist ***"
tar -xzvf dist.tar.gz -C webapp
echo "*** Generate version file ***"
go generate pkg/server/version.go
echo "*** Compile binary ***"
go build -tags static -trimpath --ldflags '-s -w' -o elrs-joystick-control ./cmd/elrs-joystick-control/.
echo "*** Create distribution zip file ***"
go run scripts/cmd/build-release-zip/build-release-zip.go --location . --prefix elrs-joystick-control --files *-control,LICENSE*