Skip to content

Commit 73dc6ea

Browse files
committed
Added arm64 targets for linux binaries
1 parent f69d0c8 commit 73dc6ea

File tree

2 files changed

+28
-5
lines changed

2 files changed

+28
-5
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ services:
1212
- docker
1313
before_install:
1414
- sudo apt-get -qq update
15-
- sudo apt-get install -y libsystemd-dev
15+
- sudo apt-get install -y libsystemd-dev gcc-aarch64-linux-gnu
1616
install:
1717
- mkdir -p $HOME/gopath/src/k8s.io
1818
- mv $TRAVIS_BUILD_DIR $HOME/gopath/src/k8s.io/node-problem-detector

Makefile

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
all: build
2323

2424
# PLATFORMS is the set of OS_ARCH that NPD can build against.
25-
PLATFORMS=linux_amd64 windows_amd64
25+
LINUX_PLATFORMS=linux_amd64 linux_arm64
26+
PLATFORMS=$(LINUX_PLATFORMS) windows_amd64
2627

2728
# VERSION is the version of the binary.
2829
VERSION?=$(shell if [ -d .git ]; then echo `git describe --tags --dirty`; else echo "UNKNOWN"; fi)
@@ -123,7 +124,9 @@ ifeq ($(ENABLE_JOURNALD), 1)
123124
BINARIES_LINUX_ONLY += bin/log-counter
124125
endif
125126

126-
ALL_BINARIES = $(foreach binary, $(BINARIES) $(BINARIES_LINUX_ONLY), ./$(binary)) $(foreach binary, $(BINARIES) $(BINARIES_LINUX_ONLY), output/linux_amd64/$(binary)) $(foreach binary, $(BINARIES), output/windows_amd64/$(binary).exe)
127+
ALL_BINARIES = $(foreach binary, $(BINARIES) $(BINARIES_LINUX_ONLY), ./$(binary)) \
128+
$(foreach platform, $(LINUX_PLATFORMS), $(foreach binary, $(BINARIES) $(BINARIES_LINUX_ONLY), output/$(platform)/$(binary))) \
129+
$(foreach binary, $(BINARIES), output/windows_amd64/$(binary).exe)
127130
ALL_TARBALLS = $(foreach platform, $(PLATFORMS), $(NPD_NAME_VERSION)-$(platform).tar.gz)
128131

129132
output/windows_amd64/bin/%.exe: $(PKG_SOURCES)
@@ -143,7 +146,8 @@ output/windows_amd64/test/bin/%.exe: $(PKG_SOURCES)
143146
./test/e2e/$(subst -,,$*)
144147

145148
output/linux_amd64/bin/%: $(PKG_SOURCES)
146-
GOOS=linux GOARCH=amd64 CGO_ENABLED=$(CGO_ENABLED) GO111MODULE=on go build \
149+
GOOS=linux GOARCH=amd64 CGO_ENABLED=$(CGO_ENABLED) GO111MODULE=on \
150+
CC=x86_64-linux-gnu-gcc go build \
147151
-mod vendor \
148152
-o $@ \
149153
-ldflags '-X $(PKG)/pkg/version.version=$(VERSION)' \
@@ -152,7 +156,26 @@ output/linux_amd64/bin/%: $(PKG_SOURCES)
152156
touch $@
153157

154158
output/linux_amd64/test/bin/%: $(PKG_SOURCES)
155-
GOOS=linux GOARCH=amd64 CGO_ENABLED=$(CGO_ENABLED) GO111MODULE=on go build \
159+
GOOS=linux GOARCH=amd64 CGO_ENABLED=$(CGO_ENABLED) GO111MODULE=on \
160+
CC=x86_64-linux-gnu-gcc go build \
161+
-mod vendor \
162+
-o $@ \
163+
-tags "$(LINUX_BUILD_TAGS)" \
164+
./test/e2e/$(subst -,,$*)
165+
166+
output/linux_arm64/bin/%: $(PKG_SOURCES)
167+
GOOS=linux GOARCH=arm64 CGO_ENABLED=$(CGO_ENABLED) GO111MODULE=on \
168+
CC=aarch64-linux-gnu-gcc go build \
169+
-mod vendor \
170+
-o $@ \
171+
-ldflags '-X $(PKG)/pkg/version.version=$(VERSION)' \
172+
-tags "$(LINUX_BUILD_TAGS)" \
173+
./cmd/$(subst -,,$*)
174+
touch $@
175+
176+
output/linux_arm64/test/bin/%: $(PKG_SOURCES)
177+
GOOS=linux GOARCH=arm64 CGO_ENABLED=$(CGO_ENABLED) GO111MODULE=on \
178+
CC=aarch64-linux-gnu-gcc go build \
156179
-mod vendor \
157180
-o $@ \
158181
-tags "$(LINUX_BUILD_TAGS)" \

0 commit comments

Comments
 (0)