Skip to content

Commit

Permalink
make package builds amd64 & arm64 archs
Browse files Browse the repository at this point in the history
  • Loading branch information
Zambiorix authored and mperham committed Jun 28, 2024
1 parent f63d55e commit 7e87525
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 23 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ vendor/
.DS_Store

/faktory
/faktory_amd64
/faktory_arm64
/faktory-cli
/loadtest
/coverage.html
Expand Down
40 changes: 17 additions & 23 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,12 @@ cover:
open coverage.html

xbuild: clean generate
@CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o $(NAME) cmd/faktory/daemon.go
@CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o $(NAME)_amd64 cmd/faktory/daemon.go
# brew install upx
upx -qq ./$(NAME)

xbuild_arm64: clean generate
@CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o $(NAME) cmd/faktory/daemon.go
upx -qq ./$(NAME)_amd64
@CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o $(NAME)_arm64 cmd/faktory/daemon.go
# brew install upx
upx -qq ./$(NAME)
upx -qq ./$(NAME)_arm64

build: clean generate
go build -o $(NAME) cmd/faktory/daemon.go
Expand Down Expand Up @@ -140,15 +138,9 @@ fmt: ## Format the code
work: ## Run a simple Ruby worker, see also "make run"
cd test/ruby && bundle exec faktory-worker -v -r ./app.rb -q critical -q default -q bulk

clean_project: ## Clean the project, set it up for a new build
@rm -rf tmp
@rm -f main faktory templates.go
@mkdir -p tmp/linux
@go clean -testcache

clean:
clean: ## Clean the project, set it up for a new build
@rm -rf tmp
@rm -f main faktory templates.go
@rm -f main $(NAME) $(NAME)_amd64 $(NAME)_arm64 templates.go
@mkdir -p tmp/linux
@go clean -testcache
@rm -rf packaging/output
Expand All @@ -167,7 +159,7 @@ ussh:
# gem install fpm
# Packaging uses Go's cross compile + fpm so we can build Linux packages on macOS.

package: clean deb rpm clean_project deb_arm64 rpm_arm64
package: clean deb rpm

package_base_name:
@echo $(BASENAME)
Expand All @@ -185,6 +177,7 @@ reload_deb:
sudo dpkg -i packaging/output/systemd/$(NAME)_$(VERSION)-$(ITERATION)_amd64.deb

rpm: xbuild
@cp $(NAME)_arm64 $(NAME)
fpm -s dir -t rpm -n $(NAME) -v $(VERSION) -p packaging/output/systemd \
--depends redis \
--rpm-compression bzip2 \
Expand All @@ -196,11 +189,10 @@ rpm: xbuild
--description "Background job server" \
-m "Contributed Systems LLC <info@contribsys.com>" \
--iteration $(ITERATION) --license "GPL 3.0" \
--vendor "Contributed Systems" -a amd64 \
--vendor "Contributed Systems" -a arm64 \
faktory=/usr/bin/faktory \
packaging/root/=/

rpm_arm64: xbuild_arm64
@cp -f $(NAME)_amd64 $(NAME)
fpm -s dir -t rpm -n $(NAME) -v $(VERSION) -p packaging/output/systemd \
--depends redis \
--rpm-compression bzip2 \
Expand All @@ -212,11 +204,13 @@ rpm_arm64: xbuild_arm64
--description "Background job server" \
-m "Contributed Systems LLC <info@contribsys.com>" \
--iteration $(ITERATION) --license "GPL 3.0" \
--vendor "Contributed Systems" -a arm64 \
--vendor "Contributed Systems" -a amd64 \
faktory=/usr/bin/faktory \
packaging/root/=/
# @rm $(NAME)

deb: xbuild
@cp $(NAME)_arm64 $(NAME)
fpm -s dir -t deb -n $(NAME) -v $(VERSION) -p packaging/output/systemd \
--depends redis-server \
--deb-priority optional --category admin \
Expand All @@ -228,11 +222,10 @@ deb: xbuild
--description "Background job server" \
-m "Contributed Systems LLC <info@contribsys.com>" \
--iteration $(ITERATION) --license "GPL 3.0" \
--vendor "Contributed Systems" -a amd64 \
--vendor "Contributed Systems" -a arm64 \
faktory=/usr/bin/faktory \
packaging/root/=/

deb_arm64: xbuild_arm64
@cp -f $(NAME)_amd64 $(NAME)
fpm -s dir -t deb -n $(NAME) -v $(VERSION) -p packaging/output/systemd \
--depends redis-server \
--deb-priority optional --category admin \
Expand All @@ -244,9 +237,10 @@ deb_arm64: xbuild_arm64
--description "Background job server" \
-m "Contributed Systems LLC <info@contribsys.com>" \
--iteration $(ITERATION) --license "GPL 3.0" \
--vendor "Contributed Systems" -a arm64 \
--vendor "Contributed Systems" -a amd64 \
faktory=/usr/bin/faktory \
packaging/root/=/
# @rm $(NAME)

tag:
git tag v$(VERSION) && git push --tags || :
Expand Down

0 comments on commit 7e87525

Please sign in to comment.