From 983028f09756c1b9d446cbe327317e0f9e47a199 Mon Sep 17 00:00:00 2001 From: Adam Retter Date: Mon, 2 Oct 2017 11:06:26 -0700 Subject: [PATCH] RocksJava build target for Docker on ppc64le Summary: This enables us to crossbuild pcc64le RocksJava binaries with a suitably old version of glibc (2.17) on CentOS 7. Closes https://github.com/facebook/rocksdb/pull/2491 Differential Revision: D5955301 Pulled By: sagar0 fbshipit-source-id: 69ef9746f1dc30ffde4063dc764583d8c7ae937e --- Makefile | 8 ++++++++ java/crossbuild/docker-build-linux-centos.sh | 12 ++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 12a25cf6a..4c464a15c 100644 --- a/Makefile +++ b/Makefile @@ -1690,6 +1690,14 @@ rocksdbjavastaticreleasedocker: rocksdbjavastatic cd java/target;jar -uf $(ROCKSDB_JAR_ALL) librocksdbjni-*.so librocksdbjni-*.jnilib cd java/target/classes;jar -uf ../$(ROCKSDB_JAR_ALL) org/rocksdb/*.class org/rocksdb/util/*.class +rocksdbjavastaticdockerppc64le: + mkdir -p java/target + DOCKER_LINUX_PPC64LE_CONTAINER=`docker ps -aqf name=rocksdb_linux_ppc64le-be`; \ + if [ -z "$$DOCKER_LINUX_PPC64LE_CONTAINER" ]; then \ + docker container create --attach stdin --attach stdout --attach stderr --volume `pwd`:/rocksdb-host --name rocksdb_linux_ppc64le-be evolvedbinary/rocksjava:centos7_ppc64le-be /rocksdb-host/java/crossbuild/docker-build-linux-centos.sh; \ + fi + docker start -a rocksdb_linux_ppc64le-be + rocksdbjavastaticpublish: rocksdbjavastaticrelease rocksdbjavastaticpublishcentral rocksdbjavastaticpublishdocker: rocksdbjavastaticreleasedocker rocksdbjavastaticpublishcentral diff --git a/java/crossbuild/docker-build-linux-centos.sh b/java/crossbuild/docker-build-linux-centos.sh index 44a8bfe06..be0999bc7 100755 --- a/java/crossbuild/docker-build-linux-centos.sh +++ b/java/crossbuild/docker-build-linux-centos.sh @@ -5,7 +5,15 @@ set -e rm -rf /rocksdb-local cp -r /rocksdb-host /rocksdb-local cd /rocksdb-local -scl enable devtoolset-2 'make jclean clean' -scl enable devtoolset-2 'PORTABLE=1 make rocksdbjavastatic' + +# Use scl devtoolset if available (i.e. CentOS <7) +if hash scl 2>/dev/null; then + scl enable devtoolset-2 'make jclean clean' + scl enable devtoolset-2 'PORTABLE=1 make rocksdbjavastatic' +else + make jclean clean + PORTABLE=1 make rocksdbjavastatic +fi + cp java/target/librocksdbjni-linux*.so java/target/rocksdbjni-*-linux*.jar /rocksdb-host/java/target