Skip to content

Commit

Permalink
test build arm64 darwin (m1)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidnewhall committed Mar 15, 2022
1 parent daf9ffa commit 6d6ff3a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
5 changes: 2 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ env:
- MAKEBUILD=deb
jobs:
include:
- if: tag IS present
os: osx
osx_image: xcode12
- os: osx
osx_image: xcode13.2
language: go
go: 1.17.x
- if: tag IS NOT present
Expand Down
26 changes: 18 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -87,21 +87,23 @@ release: clean linux_packages freebsd_packages windows
# Generating File Hashes
openssl dgst -r -sha256 $@/* | sed 's#release/##' | tee $@/checksums.sha256.txt

# DMG only makes a DMG file is MACAPP is set. Otherwise, it makes a gzipped binary for macOS.
# DMG only makes a DMG file if MACAPP is set. Otherwise, it makes a gzipped binary for macOS.
dmg: clean macapp
mkdir -p release
[ "$(MACAPP)" = "" ] || hdiutil create release/$(MACAPP).dmg -srcfolder $(MACAPP).app -ov
[ "$(MACAPP)" = "" ] || hdiutil create release/$(MACAPP).amd64.dmg -srcfolder $(MACAPP).amd64.app -ov
[ "$(MACAPP)" = "" ] || hdiutil create release/$(MACAPP).arm64.dmg -srcfolder $(MACAPP).arm64.app -ov
[ "$(MACAPP)" != "" ] || mv $(BINARY).*.macos release/
[ "$(MACAPP)" != "" ] || gzip -9r release/
openssl dgst -r -sha256 release/* | sed 's#release/##' | tee release/macos_checksum.sha256.txt


# Delete all build assets.
clean:
rm -f $(BINARY) $(BINARY).*.{macos,freebsd,linux,exe,upx}{,.gz,.zip} $(BINARY).1{,.gz} $(BINARY).rb
rm -f $(BINARY){_,-}*.{deb,rpm,txz} v*.tar.gz.sha256 examples/MANUAL .metadata.make rsrc_*.syso
rm -f cmd/$(BINARY)/README{,.html} README{,.html} ./$(BINARY)_manual.html rsrc.syso $(MACAPP).app.zip
rm -f cmd/$(BINARY)/README{,.html} README{,.html} ./$(BINARY)_manual.html rsrc.syso $(MACAPP).*.app.zip
rm -f $(BINARY).aur.install PKGBUILD $(BINARY).service pkg/bindata/bindata.go
rm -rf aur package_build_* release after-install-rendered.sh before-remove-rendered.sh $(MACAPP).app
rm -rf aur package_build_* release after-install-rendered.sh before-remove-rendered.sh $(MACAPP).*.app

####################
##### Sidecars #####
Expand Down Expand Up @@ -168,11 +170,15 @@ $(BINARY).armhf.linux: generate main.go
GOOS=linux GOARCH=arm GOARM=6 go build -o $@ -ldflags "-w -s $(VERSION_LDFLAGS) $(EXTRA_LDFLAGS) "
[ -z "$(UPXPATH)" ] || $(UPXPATH) -q9 $@

macos: $(BINARY).amd64.macos
macos: $(BINARY).amd64.macos $(BINARY).arm64.macos
$(BINARY).amd64.macos: generate main.go
# Building darwin 64-bit x86 binary.
GOOS=darwin GOARCH=amd64 go build -o $@ -ldflags "-w -s $(VERSION_LDFLAGS) $(EXTRA_LDFLAGS) "
[ -z "$(UPXPATH)" ] || $(UPXPATH) -q9 $@
$(BINARY).arm64.macos: generate main.go
# Building darwin 64-bit arm binary.
GOOS=darwin GOARCH=arm64 go build -o $@ -ldflags "-w -s $(VERSION_LDFLAGS) $(EXTRA_LDFLAGS) "
[ -z "$(UPXPATH)" ] || $(UPXPATH) -q9 $@

freebsd: $(BINARY).amd64.freebsd
$(BINARY).amd64.freebsd: generate main.go
Expand Down Expand Up @@ -202,11 +208,15 @@ linux_packages: rpm deb rpm386 deb386 debarm rpmarm debarmhf rpmarmhf

freebsd_packages: freebsd_pkg freebsd386_pkg freebsdarm_pkg

macapp: $(MACAPP).app
$(MACAPP).app: macos
macapp: $(MACAPP).arm64.app $(MACAPP).amd64.app
$(MACAPP).amd64.app: macos
[ -z "$(MACAPP)" ] || mkdir -p init/macos/$(MACAPP).app/Contents/MacOS
[ -z "$(MACAPP)" ] || cp $(BINARY).amd64.macos init/macos/$(MACAPP).app/Contents/MacOS/$(MACAPP)
[ -z "$(MACAPP)" ] || cp -rp init/macos/$(MACAPP).app $(MACAPP).app
[ -z "$(MACAPP)" ] || cp -rp init/macos/$(MACAPP).app $(MACAPP).amd64.app
$(MACAPP).arm64.app: macos
[ -z "$(MACAPP)" ] || mkdir -p init/macos/$(MACAPP).app/Contents/MacOS
[ -z "$(MACAPP)" ] || cp $(BINARY).arm64.macos init/macos/$(MACAPP).app/Contents/MacOS/$(MACAPP)
[ -z "$(MACAPP)" ] || cp -rp init/macos/$(MACAPP).app $(MACAPP).arm64.app

aur: PKGBUILD SRCINFO $(BINARY).aur.install
mkdir -p $@
Expand Down

0 comments on commit 6d6ff3a

Please sign in to comment.