From 07157ec0e407736f76f42a96baf43128da9d2e1c Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Thu, 24 Apr 2014 11:32:33 +0200 Subject: [PATCH] Close #476. update makefile to add support for arm builds --- CHANGELOG.md | 6 +++++- Makefile.in | 43 +++++++++++++++++++++++++++++++++++-------- release.sh | 1 + 3 files changed, 41 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f650a7a72c..b7073babc1a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ### Bugfixes +### Features + +- [Issue #476](https://github.com/influxdb/influxdb/issues/476). Support ARM architecture + ## v0.7.0 [2014-05-23] ### Bugfixes @@ -15,7 +19,7 @@ - [Issue #537](https://github.com/influxdb/influxdb/issues/537). Incorrect query syntax causes internal error - [Issue #565](https://github.com/influxdb/influxdb/issues/565). Empty series names shouldn't cause a panic - [Issue #575](https://github.com/influxdb/influxdb/issues/575). Single point select doesn't interpret timestamps correctly -g- [Issue #576](https://github.com/influxdb/influxdb/issues/576). We shouldn't set timestamps and sequence numbers when listing cq +- [Issue #576](https://github.com/influxdb/influxdb/issues/576). We shouldn't set timestamps and sequence numbers when listing cq - [Issue #560](https://github.com/influxdb/influxdb/issues/560). Use /dev/urandom instead of /dev/random - [Issue #502](https://github.com/influxdb/influxdb/issues/502). Fix a race condition in assigning id to db+series+field (Thanks @ohurvitz diff --git a/Makefile.in b/Makefile.in index 5f4a2d168cc..5be4322a584 100644 --- a/Makefile.in +++ b/Makefile.in @@ -3,7 +3,7 @@ SHELL = /bin/bash PROTOC = @PROTOC@ GO = @GO@ GOROOT = @GOROOT@ -# or 386 +# or 386, arm arch = amd64 CGO_ENABLED = 1 @@ -14,9 +14,33 @@ endif cflags = ifeq ($(arch),386) cflags = -m32 +else +ifeq ($(arch),arm) + cflags = -fpic +endif +endif + +ifneq ($(arch),) 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 @@ -55,7 +79,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 @@ -81,7 +105,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 @@ -183,9 +207,12 @@ source_package = packages/influxdb-$(version).src.tar.gz binary_package = packages/influxdb-$(version).$(arch).tar.gz ifeq ($(arch),386) rpm_package = packages/influxdb-$(package_version)-1.i686.rpm - debian_package = packages/influxdb_$(version)_i386.deb - rpm_args = setarch i386 - deb_args = -a i386 + debian_package = packages/influxdb_$(version)_i686.deb + arch_args = -a i686 +else ifeq ($(arch),arm) + rpm_package = packages/influxdb-$(package_version)-1.armhf.rpm + debian_package = packages/influxdb_$(version)_armhf.deb + arch_args = -a armhf else rpm_package = packages/influxdb-$(package_version)-1.x86_64.rpm debian_package = packages/influxdb_$(version)_amd64.deb @@ -212,14 +239,14 @@ $(rpm_package): $(admin_dir)/build build rm -rf out_rpm mkdir -p out_rpm/opt/influxdb/versions/$(version) cp -r build/* out_rpm/opt/influxdb/versions/$(version) - rvm 1.9.3@influxdb do bash -c "pushd out_rpm; $(rpm_args) fpm -s dir -t rpm --after-install ../scripts/post_install.sh -n influxdb -v $(version) .; popd" + rvm 1.9.3@influxdb do bash -c "pushd out_rpm; fpm -s dir -t rpm $(arch_args) --after-install ../scripts/post_install.sh -n influxdb -v $(version) .; popd" mv out_rpm/$(shell basename $(rpm_package)) packages/ $(debian_package): $(admin_dir)/build build rm -rf out_rpm mkdir -p out_rpm/opt/influxdb/versions/$(version) cp -r build/* out_rpm/opt/influxdb/versions/$(version) - rvm 1.9.3@influxdb do bash -c "pushd out_rpm; fpm -s dir -t deb $(deb_args) --after-install ../scripts/post_install.sh -n influxdb -v $(version) .; popd" + rvm 1.9.3@influxdb do bash -c "pushd out_rpm; fpm -s dir -t deb $(arch_args) --after-install ../scripts/post_install.sh -n influxdb -v $(version) .; popd" mv out_rpm/$(shell basename $(debian_package)) packages/ $(source_package): dependencies diff --git a/release.sh b/release.sh index fdf0506e573..f528a3e13d9 100755 --- a/release.sh +++ b/release.sh @@ -45,6 +45,7 @@ fi make clean make package version=$version make package version=$version arch=386 +make arch=arm CROSS_COMPILE=arm-linux-gnueabihf package version=$version # rpm convention is not to have dashes in the package, or at least # that's what fpm is claiming rpm_version=${version/-/_}