Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

makefile support for arm64 packaging #481

Merged
merged 3 commits into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
55 changes: 49 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ release:
@echo Releasing $(NAME) $(VERSION)
hub release create v$(VERSION) \
-a packaging/output/systemd/faktory_$(VERSION)-$(ITERATION)_amd64.deb \
-a packaging/output/systemd/faktory_$(VERSION)-$(ITERATION)_arm64.deb \
-a packaging/output/systemd/faktory-$(VERSION)-$(ITERATION).x86_64.rpm \
-a packaging/output/systemd/faktory-$(VERSION)-$(ITERATION).aarch64.rpm \
-a packaging/output/systemd/faktory-ent_$(VERSION).macos.arm64.tbz \
-a packaging/output/systemd/faktory-ent_$(VERSION).macos.amd64.tbz \
-F /tmp/release-notes.md -e -o || :
Expand Down Expand Up @@ -102,9 +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 ./faktory
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)_arm64

build: clean generate
go build -o $(NAME) cmd/faktory/daemon.go
Expand Down Expand Up @@ -135,12 +140,12 @@ work: ## Run a simple Ruby worker, see also "make run"

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
@mkdir -p packaging/output/upstart
@mkdir -p packaging/output/systemd
@mkdir -p tmp/linux
@go clean -testcache

run: clean generate ## Run Faktory daemon locally
FAKTORY_PASSWORD=${PASSWORD} go run cmd/faktory/daemon.go -l debug -e development
Expand All @@ -153,7 +158,11 @@ ussh:

# gem install fpm
# Packaging uses Go's cross compile + fpm so we can build Linux packages on macOS.
package: clean xbuild deb rpm

package: clean deb rpm

package_base_name:
@echo $(BASENAME)

version_check:
@grep -q $(VERSION) client/faktory.go || (echo VERSIONS OUT OF SYNC && false)
Expand All @@ -168,6 +177,22 @@ 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 \
--rpm-os linux \
--after-install packaging/scripts/postinst.rpm.systemd \
--before-remove packaging/scripts/prerm.rpm.systemd \
--after-remove packaging/scripts/postrm.rpm.systemd \
--url https://contribsys.com/faktory \
--description "Background job server" \
-m "Contributed Systems LLC <info@contribsys.com>" \
--iteration $(ITERATION) --license "GPL 3.0" \
--vendor "Contributed Systems" -a arm64 \
faktory=/usr/bin/faktory \
packaging/root/=/
@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 @@ -182,8 +207,25 @@ rpm: xbuild
--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 \
--no-deb-no-default-config-files \
--after-install packaging/scripts/postinst.deb.systemd \
--before-remove packaging/scripts/prerm.deb.systemd \
--after-remove packaging/scripts/postrm.deb.systemd \
--url https://contribsys.com/faktory \
--description "Background job server" \
-m "Contributed Systems LLC <info@contribsys.com>" \
--iteration $(ITERATION) --license "GPL 3.0" \
--vendor "Contributed Systems" -a arm64 \
faktory=/usr/bin/faktory \
packaging/root/=/
@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 @@ -198,6 +240,7 @@ deb: xbuild
--vendor "Contributed Systems" -a amd64 \
faktory=/usr/bin/faktory \
packaging/root/=/
# @rm $(NAME)

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