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
Changes from 2 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
61 changes: 55 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 @@ -104,7 +106,12 @@ cover:
xbuild: clean generate
@CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o $(NAME) cmd/faktory/daemon.go
# brew install upx
upx -qq ./faktory
upx -qq ./$(NAME)

xbuild_arm64: clean generate
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be a separate target. xbuild should build both.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but they have the same name...
I can put them in a separte folder, perhaps a subfolder in the output folder?
Is cleaning between arch builds required?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Arch subfolders seems fine.

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

build: clean generate
go build -o $(NAME) cmd/faktory/daemon.go
Expand Down Expand Up @@ -133,14 +140,20 @@ 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: ## Clean the project, set it up for a new build
clean_project: ## Clean the project, set it up for a new build
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs a better name, clean and clean_project is just confusing.

@rm -rf tmp
@rm -f main faktory templates.go
@mkdir -p tmp/linux
@go clean -testcache

clean:
@rm -rf tmp
@rm -f main faktory templates.go
@rm -f main faktory 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 +166,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 clean_project deb_arm64 rpm_arm64

package_base_name:
@echo $(BASENAME)

version_check:
@grep -q $(VERSION) client/faktory.go || (echo VERSIONS OUT OF SYNC && false)
Expand Down Expand Up @@ -183,6 +200,22 @@ rpm: xbuild
faktory=/usr/bin/faktory \
packaging/root/=/

rpm_arm64: xbuild_arm64
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be part of rpm, not a separate target.

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 <[email protected]>" \
--iteration $(ITERATION) --license "GPL 3.0" \
--vendor "Contributed Systems" -a arm64 \
faktory=/usr/bin/faktory \
packaging/root/=/

deb: xbuild
fpm -s dir -t deb -n $(NAME) -v $(VERSION) -p packaging/output/systemd \
--depends redis-server \
Expand All @@ -199,6 +232,22 @@ deb: xbuild
faktory=/usr/bin/faktory \
packaging/root/=/

deb_arm64: xbuild_arm64
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto.

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 <[email protected]>" \
--iteration $(ITERATION) --license "GPL 3.0" \
--vendor "Contributed Systems" -a arm64 \
faktory=/usr/bin/faktory \
packaging/root/=/

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

Expand Down