Skip to content

Commit 76a3a44

Browse files
committedSep 22, 2018
Build for arm too!
Resolves #95
1 parent 3ee4110 commit 76a3a44

File tree

3 files changed

+46
-11
lines changed

3 files changed

+46
-11
lines changed
 

‎CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
Please upgrade :)
1010
* Support for this older encryption mechism will be removed in the
1111
future
12+
* Add builds for Arm7 [#95](https://github.com/jmcfarlane/notable/issues/95)
1213

1314
## v0.1.3 / 2018-09-18
1415

‎scripts/build.sh

+29-9
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,33 @@
11
#!/bin/bash -eux
22

3-
export GOARCH=amd64
43
export buildArch="-X main.buildArch"
54

5+
arms=(7)
66
systems=(darwin freebsd linux windows)
77

8-
# Compile binaries for the desired operating systems
9-
for goos in ${systems[@]}; do
10-
mkdir -p target/notable-${TAG}.${goos}-amd64
11-
cp LICENSE target/notable-${TAG}.${goos}-amd64
12-
GOOS=$goos CGO_ENABLED=$CGO_ENABLED go build \
13-
-ldflags "$FLAGS $buildArch=${goos}-${GOARCH}" \
14-
-o target/notable-${TAG}.${goos}-amd64/notable
8+
function build () {
9+
arch=$1
10+
goos=$2
11+
label=$3
12+
13+
mkdir -p target/notable-${TAG}.${goos}-${label}
14+
cp LICENSE target/notable-${TAG}.${goos}-${label}
15+
GOARCH=$arch GOOS=$goos CGO_ENABLED=$CGO_ENABLED go build \
16+
-ldflags "$FLAGS $buildArch=${goos}-${label}" \
17+
-o target/notable-${TAG}.${goos}-${label}/notable
1518
if [ "$goos" == "windows" ]; then
16-
mv target/notable-${TAG}.${goos}-amd64/{notable,notable.exe}
19+
mv target/notable-${TAG}.${goos}-${label}/{notable,notable.exe}
1720
fi
21+
}
22+
23+
# Compile for amd64
24+
for goos in ${systems[@]}; do
25+
build amd64 $goos amd64
26+
done
27+
28+
# Compile for arm
29+
for v in ${arms[@]}; do
30+
GOARM=$v build arm linux arm${v}
1831
done
1932

2033
# Macos: create a macos app bundle
@@ -24,9 +37,16 @@ cp target/notable-${TAG}.darwin-amd64/notable \
2437

2538
# Package up the Github release zip files
2639
pushd target
40+
41+
# Zip amd64
2742
for goos in ${systems[@]}; do
2843
zip -r notable-${TAG}.${goos}-amd64.zip notable-${TAG}.${goos}-amd64
2944
done
45+
46+
# Zip arm
47+
for v in ${arms[@]}; do
48+
zip -r notable-${TAG}.linux-arm${v}.zip notable-${TAG}.linux-arm${v}
49+
done
3050
popd
3151

3252
# Change ownership inside the container to the user who ~ran the container

‎scripts/release.sh

+16-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ source /keybase/private/jmcfarlane/env/github.sh
44

55
cd $(dirname $0)/..
66

7+
arms=(7)
8+
systems=(darwin freebsd linux windows)
9+
710
# The date is something like: 2017-01-20
811
export DATE="$(head -n1 CHANGELOG.md | grep -E -o '[0-9]{4}-[0-9]{2}-[0-9]{2}')"
912

@@ -29,8 +32,8 @@ github-release release \
2932
--description "$DESC" \
3033
--pre-release
3134

32-
# Upload zip files
33-
for goos in darwin freebsd linux windows; do
35+
# Uploads for amd64
36+
for goos in ${systems[@]}; do
3437
github-release upload \
3538
--user jmcfarlane \
3639
--repo notable \
@@ -40,6 +43,17 @@ for goos in darwin freebsd linux windows; do
4043
echo "Uploaded: target/notable-${TAG}.${goos}-amd64.zip"
4144
done
4245

46+
# Uploads for arm
47+
for v in ${arms[@]}; do
48+
github-release upload \
49+
--user jmcfarlane \
50+
--repo notable \
51+
--tag $TAG \
52+
--name "notable-${TAG}.linux-arm${v}.zip" \
53+
--file target/notable-${TAG}.linux-arm${v}.zip
54+
echo "Uploaded: target/notable-${TAG}.linux-arm${v}.zip"
55+
done
56+
4357
# Tag for release
4458
docker tag github.com/jmcfarlane/notable:latest jmcfarlane/notable:latest
4559
docker tag github.com/jmcfarlane/notable:$TAG jmcfarlane/notable:$TAG

0 commit comments

Comments
 (0)