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

update makefile to add support for arm builds #476

Closed
wants to merge 1 commit into from
Closed
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
28 changes: 25 additions & 3 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ SHELL = /bin/bash
PROTOC = @PROTOC@
GO = @GO@
GOROOT = @GOROOT@
# or 386
# or 386, arm
arch = amd64
CGO_ENABLED = 1

Expand All @@ -17,6 +17,23 @@ ifeq ($(arch),386)
GOARCH = $(arch)
endif

ifneq ($(CROSS_COMPILE),)
export CXX=$(CROSS_COMPILE)-g++
export CC=$(CROSS_COMPILE)-gcc
export AS=$(CROSS_COMPILE)-as
export AR=$(CROSS_COMPILE)-ar
export NM=$(CROSS_COMPILE)-nm
export LD=$(CROSS_COMPILE)-ld
export OBJDUMP=$(CROSS_COMPILE)-objdump
export OBJCOPY=$(CROSS_COMPILE)-objcopy
export RANLIB=$(CROSS_COMPILE)-ranlib
export STRIP=$(CROSS_COMPILE)-strip
export CXX_FOR_TARGET=$(CROSS_COMPILE)-g++
export CC_FOR_TARGET=$(CROSS_COMPILE)-gcc
GO_BUILD_OPTIONS += -ldflags="-extld=$(CC)"
cross_flags = --host=$(arch)
endif

export GOARCH
export CGO_ENABLED

Expand Down Expand Up @@ -55,7 +72,7 @@ leveldb_deps = $(leveldb_dir)/libleveldb.a
profile=off
ifneq ($(profile),off)
CGO_LDFLAGS += -ltcmalloc -lprofiler
GO_BUILD_OPTIONS = -tags profile
GO_BUILD_OPTIONS += -tags profile
endif

# levigo flags
Expand All @@ -81,7 +98,7 @@ ifeq ($(uname_S),Linux)
bash -c "cd $(snappy_dir); \
wget https://snappy.googlecode.com/files/$(snappy_file); \
tar --strip-components=1 -xvzf $(snappy_file); \
CFLAGS=$(cflags) CXXFLAGS=$(cflags) ./configure; \
CFLAGS=$(cflags) CXXFLAGS=$(cflags) ./configure $(cross_flags); \
$(MAKE)"
endif

Expand Down Expand Up @@ -186,6 +203,11 @@ ifeq ($(arch),386)
debian_package = packages/influxdb_$(version)_i386.deb
rpm_args = setarch i386
deb_args = -a i386
else ifeq ($(arch),arm)
rpm_package = packages/influxdb-$(package_version)-1.armv6hl.rpm
debian_package = packages/influxdb_$(version)_armhf.deb
rpm_args = setarch armv6hl
deb_args = -a armhf
else
rpm_package = packages/influxdb-$(package_version)-1.x86_64.rpm
debian_package = packages/influxdb_$(version)_amd64.deb
Expand Down