Skip to content

Commit 5aed389

Browse files
authored
Merge pull request #26 from Shopify/add_universal_build
Add universal Darwin binary
2 parents d65ccd3 + 7319c20 commit 5aed389

4 files changed

Lines changed: 15 additions & 6 deletions

File tree

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ $ git push -u <your username> <the name of your branch>
5757
The release process is somewhat awkward right now. `ejson2env` is released in
5858
four ways:
5959

60-
* `linux-amd64` and `darwin-amd64`
60+
* `linux-amd64`, `darwin-amd64`, `darwin-arm64`
6161
* rubygem;
6262
* `.deb` package; and
6363
* homebrew formula

Makefile

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ BUNDLE_EXEC=bundle exec
1414

1515
default: all
1616
all: gem deb
17-
binaries: build/bin/linux-amd64 build/bin/darwin-amd64 build/bin/freebsd-amd64
17+
binaries: build/bin/linux-amd64 build/bin/darwin-universal build/bin/freebsd-amd64
1818
gem: $(GEM)
1919
deb: $(DEB)
2020
man: $(MANFILES)
@@ -36,6 +36,15 @@ build/bin/darwin-amd64: $(GOFILES)
3636
-o "$@" \
3737
"$(PACKAGE)/cmd/$(NAME)"
3838

39+
build/bin/darwin-arm64: $(GOFILES)
40+
GOOS=darwin GOARCH=arm64 go build \
41+
-ldflags '-s -w -X main.version="$(VERSION)"' \
42+
-o "$@" \
43+
"$(PACKAGE)/cmd/$(NAME)"
44+
45+
build/bin/darwin-universal: build/bin/darwin-amd64 build/bin/darwin-arm64
46+
$(V)lipo -create -output "$@" $^
47+
3948
build/bin/freebsd-amd64: $(GOFILES)
4049
GOOS=freebsd GOARCH=amd64 go build \
4150
-ldflags '-s -w -X main.version="$(VERSION)"' \
@@ -50,7 +59,7 @@ rubygem/$(NAME)-$(VERSION).gem: \
5059
rubygem/lib/$(NAME)/version.rb \
5160
rubygem/build/linux-amd64/ejson2env \
5261
rubygem/LICENSE.txt \
53-
rubygem/build/darwin-amd64/ejson2env \
62+
rubygem/build/darwin-universal/ejson2env \
5463
rubygem/build/freebsd-amd64/ejson2env \
5564
rubygem/man
5665
cd rubygem && gem build ejson2env.gemspec
@@ -61,7 +70,7 @@ rubygem/LICENSE.txt: LICENSE.txt
6170
rubygem/man: man
6271
cp -a build/man $@
6372

64-
rubygem/build/darwin-amd64/ejson2env: build/bin/darwin-amd64
73+
rubygem/build/darwin-universal/ejson2env: build/bin/darwin-universal
6574
mkdir -p $(@D)
6675
cp -a "$<" "$@"
6776

rubygem/MANIFEST

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
bin/ejson2env
2-
build/darwin-amd64/ejson2env
2+
build/darwin-universal/ejson2env
33
build/linux-amd64/ejson2env
44
build/freebsd-amd64/ejson2env
55
man/ejson2env.1.gz

rubygem/bin/ejson2env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
platform = `uname -sm`
33

44
dir = case platform
5-
when /^Darwin/ ; "darwin-amd64"
5+
when /^Darwin/ ; "darwin-universal"
66
when /^Linux.*64/ ; "linux-amd64"
77
when /^FreeBSD.*64/ ; "freebsd-amd64"
88
else

0 commit comments

Comments
 (0)