Skip to content

Commit

Permalink
Merge 6f7dc0c into 4325570
Browse files Browse the repository at this point in the history
  • Loading branch information
lufia committed Sep 15, 2020
2 parents 4325570 + 6f7dc0c commit 967f7be
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 10 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ addons:
- devscripts
- debhelper
- fakeroot
- crossbuild-essential-arm64
install:
- mkdir -p ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
script:
Expand Down
45 changes: 38 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,30 +53,52 @@ build:
`pwd | sed -e "s|${GOPATH_ROOT}/src/||"`/$$i; \
done

build/mackerel-check:
# This recipe will be called from some other recipes.
# Though these other recipes expects this to build multi platform binaries
# using GOOS, GOARCH or both, "make" itself don't recognize switching of
# environment variables, this recipe will just say "mackerel-check is up to date."
# We need to force rebuild "mackerel-check" if GOOS or GOARCH are passed.
build/mackerel-check: $(patsubst %,depends_on,$(GOOS)$(GOARCH))
mkdir -p build
go build -ldflags="-s -w -X main.gitcommit=$(CURRENT_REVISION)" \
-o build/mackerel-check

.PHONY: depends_on
depends_on:
@:

.PHONY: rpm
rpm: rpm-v1 rpm-v2

.PHONY: rpm-v1
rpm-v1:
make build GOOS=linux GOARCH=386
rpmbuild --define "_sourcedir `pwd`" --define "_version ${VERSION}" --define "buildarch noarch" -bb packaging/rpm/mackerel-check-plugins.spec
rpmbuild --define "_sourcedir `pwd`" --define "_version ${VERSION}" --define "buildarch noarch" --target noarch -bb packaging/rpm/mackerel-check-plugins.spec
make build GOOS=linux GOARCH=amd64
rpmbuild --define "_sourcedir `pwd`" --define "_version ${VERSION}" --define "buildarch x86_64" -bb packaging/rpm/mackerel-check-plugins.spec
rpmbuild --define "_sourcedir `pwd`" --define "_version ${VERSION}" --define "buildarch x86_64" --target x86_64 -bb packaging/rpm/mackerel-check-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-check GOOS=linux GOARCH=amd64
rpmbuild --define "_sourcedir `pwd`" --define "_version ${VERSION}" \
--define "buildarch x86_64" --define "dist .el7.centos" \
-bb packaging/rpm/mackerel-check-plugins-v2.spec
--target x86_64 -bb packaging/rpm/mackerel-check-plugins-v2.spec
rpmbuild --define "_sourcedir `pwd`" --define "_version ${VERSION}" \
--define "buildarch x86_64" --define "dist .amzn2" \
-bb packaging/rpm/mackerel-check-plugins-v2.spec
--target x86_64 -bb packaging/rpm/mackerel-check-plugins-v2.spec

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

.PHONY: deb
deb: deb-v1 deb-v2
Expand All @@ -90,11 +112,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-check GOOS=linux GOARCH=amd64
cp build/mackerel-check 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-check GOOS=linux GOARCH=arm64
cp build/mackerel-check 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 @@ -6,7 +6,7 @@ Build-Depends: debhelper
Standards-Version: 3.9.3

Package: mackerel-check-plugins
Architecture: amd64
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: macekrel.io check plugins
monitoring check plugins for https://mackerel.io
1 change: 0 additions & 1 deletion packaging/rpm/mackerel-check-plugins-v2.spec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ Summary: macekrel.io check plugins
URL: https://mackerel.io
Group: Applications/System
Packager: Hatena
BuildArch: %{buildarch}
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root

%description
Expand Down
1 change: 0 additions & 1 deletion packaging/rpm/mackerel-check-plugins.spec
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ Summary: macekrel.io check plugins
URL: https://mackerel.io
Group: Hatena
Packager: Hatena
BuildArch: %{buildarch}
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root

%description
Expand Down

0 comments on commit 967f7be

Please sign in to comment.