Skip to content

Commit

Permalink
Merge pull request #673 from mackerelio/add-arm
Browse files Browse the repository at this point in the history
add arm64 architecture packages, and fix Architecture field of deb
  • Loading branch information
lufia committed Sep 15, 2020
2 parents 1db4d56 + 6cf0f70 commit f1efdf4
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ env:
- secure: "V0XY5XWhVQuGsE35J5QqIKa77tgfIYIa6z6k1qgRjW+Wy7DDFhIsPRdziayZZJOhwBqQBsVikIP4rXgkByEVhkUv8oIfL/V0BLkHsuNUjJVtloOqe9mpDlWzeMyi3KUfBTb9IW0nrwcEwZF8/dtQEmSW62RbupO3F/lpVEbrxXY="
install:
- sudo apt-get update
- DEBIAN_FRONTEND=noninteractive sudo apt-get install -y rpm devscripts debhelper fakeroot
- DEBIAN_FRONTEND=noninteractive sudo apt-get install -y rpm devscripts debhelper fakeroot crossbuild-essential-arm64
- mkdir -p ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
script:
- make all
Expand Down
40 changes: 33 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,15 @@ build:
$(MAKE) $(BINDIR)/$$i; \
done

build/mackerel-plugin:
build/mackerel-plugin: $(patsubst %,depends_on,$(GOOS)$(GOARCH))
mkdir -p build
go build -ldflags="-s -w -X main.gitcommit=$(CURRENT_REVISION)" \
-o build/mackerel-plugin

.PHONY: depends_on
depends_on:
@:

.PHONY: test
test: testgo lint testconvention

Expand Down Expand Up @@ -75,21 +79,34 @@ rpm-v1:
$(MAKE) build GOOS=linux GOARCH=386
rpmbuild --define "_sourcedir `pwd`" --define "_bindir build/linux/386" \
--define "_version ${VERSION}" --define "buildarch noarch" \
-bb packaging/rpm/mackerel-agent-plugins.spec
--target noarch -bb packaging/rpm/mackerel-agent-plugins.spec
$(MAKE) build GOOS=linux GOARCH=amd64
rpmbuild --define "_sourcedir `pwd`" --define "_bindir build/linux/amd64" \
--define "_version ${VERSION}" --define "buildarch x86_64" \
-bb packaging/rpm/mackerel-agent-plugins.spec
--target x86_64 -bb packaging/rpm/mackerel-agent-plugins.spec

.PHONY: rpm-v2
rpm-v2:
rpm-v2: rpm-v2-x86 rpm-v2-arm

.PHONY: rpm-v2-x86
rpm-v2-x86:
$(MAKE) build/mackerel-plugin GOOS=linux GOARCH=amd64
rpmbuild --define "_sourcedir `pwd`" --define "_version ${VERSION}" \
--define "buildarch x86_64" --define "dist .el7.centos" \
-bb packaging/rpm/mackerel-agent-plugins-v2.spec
--target x86_64 -bb packaging/rpm/mackerel-agent-plugins-v2.spec
rpmbuild --define "_sourcedir `pwd`" --define "_version ${VERSION}" \
--define "buildarch x86_64" --define "dist .amzn2" \
-bb packaging/rpm/mackerel-agent-plugins-v2.spec
--target x86_64 -bb packaging/rpm/mackerel-agent-plugins-v2.spec

.PHONY: rpm-v2-arm
rpm-v2-arm:
$(MAKE) build/mackerel-plugin GOOS=linux GOARCH=amd64
rpmbuild --define "_sourcedir `pwd`" --define "_version ${VERSION}" \
--define "buildarch aarch64" --define "dist .el7.centos" \
--target aarch64 -bb packaging/rpm/mackerel-agent-plugins-v2.spec
rpmbuild --define "_sourcedir `pwd`" --define "_version ${VERSION}" \
--define "buildarch aarch64" --define "dist .amzn2" \
--target aarch64 -bb packaging/rpm/mackerel-agent-plugins-v2.spec

.PHONY: deb
deb: deb-v1 deb-v2
Expand All @@ -103,11 +120,20 @@ deb-v1:
cd packaging/deb && debuild --no-tgz-check -rfakeroot -uc -us

.PHONY: deb-v2
deb-v2:
deb-v2: deb-v2-x86 deb-v2-arm

.PHONY: deb-v2-x86
deb-v2-x86:
$(MAKE) build/mackerel-plugin GOOS=linux GOARCH=amd64
cp build/mackerel-plugin packaging/deb-v2/debian/
cd packaging/deb-v2 && debuild --no-tgz-check -rfakeroot -uc -us

.PHONY: deb-v2-arm
deb-v2-arm:
$(MAKE) build/mackerel-plugin GOOS=linux GOARCH=arm64
cp build/mackerel-plugin packaging/deb-v2/debian/
cd packaging/deb-v2 && debuild --no-tgz-check -rfakeroot -uc -us -aarm64

.PHONY: release
release: check-release-deps
(cd tool && cpanm -qn --installdeps .)
Expand Down
2 changes: 1 addition & 1 deletion packaging/deb-v2/debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ Standards-Version: 3.9.3

Package: mackerel-agent-plugins
Depends: ${shlibs:Depends}, ${misc:Depends}
Architecture: amd64
Architecture: any
Description: metric plugins for mackerel-agent
metric plugins for https://mackerel.io (Monitoring SaaS)
1 change: 0 additions & 1 deletion packaging/rpm/mackerel-agent-plugins-v2.spec
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ URL: https://mackerel.io/

Source0: README.md
Packager: Hatena
BuildArch: %{buildarch}
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root

%description
Expand Down
1 change: 0 additions & 1 deletion packaging/rpm/mackerel-agent-plugins.spec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ URL: https://mackerel.io/

Source0: README.md
Packager: Hatena
BuildArch: %{buildarch}
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root

%description
Expand Down

0 comments on commit f1efdf4

Please sign in to comment.