summaryrefslogtreecommitdiffstats
path: root/src/rocksdb/java/crossbuild
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 18:24:20 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 18:24:20 +0000
commit483eb2f56657e8e7f419ab1a4fab8dce9ade8609 (patch)
treee5d88d25d870d5dedacb6bbdbe2a966086a0a5cf /src/rocksdb/java/crossbuild
parentInitial commit. (diff)
downloadceph-483eb2f56657e8e7f419ab1a4fab8dce9ade8609.tar.xz
ceph-483eb2f56657e8e7f419ab1a4fab8dce9ade8609.zip
Adding upstream version 14.2.21.upstream/14.2.21upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/rocksdb/java/crossbuild')
-rw-r--r--src/rocksdb/java/crossbuild/Vagrantfile27
-rwxr-xr-xsrc/rocksdb/java/crossbuild/build-linux-centos.sh31
-rwxr-xr-xsrc/rocksdb/java/crossbuild/build-linux.sh14
-rwxr-xr-xsrc/rocksdb/java/crossbuild/docker-build-linux-centos.sh28
4 files changed, 100 insertions, 0 deletions
diff --git a/src/rocksdb/java/crossbuild/Vagrantfile b/src/rocksdb/java/crossbuild/Vagrantfile
new file mode 100644
index 00000000..4a321774
--- /dev/null
+++ b/src/rocksdb/java/crossbuild/Vagrantfile
@@ -0,0 +1,27 @@
+# -*- mode: ruby -*-
+# vi: set ft=ruby :
+
+# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
+VAGRANTFILE_API_VERSION = "2"
+
+Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
+
+ config.vm.define "linux32" do |linux32|
+ linux32.vm.box = "hansode/centos-6.7-i386"
+ end
+
+ config.vm.define "linux64" do |linux64|
+ linux64.vm.box = "hansode/centos-6.7-x86_64"
+ end
+
+ config.vm.provider "virtualbox" do |v|
+ v.memory = 2048
+ v.cpus = 4
+ v.customize ["modifyvm", :id, "--nictype1", "virtio" ]
+ end
+
+ config.vm.provision :shell, path: "build-linux-centos.sh"
+ config.vm.synced_folder "../target", "/rocksdb-build"
+ config.vm.synced_folder "../..", "/rocksdb", type: "rsync"
+ config.vm.boot_timeout = 1200
+end
diff --git a/src/rocksdb/java/crossbuild/build-linux-centos.sh b/src/rocksdb/java/crossbuild/build-linux-centos.sh
new file mode 100755
index 00000000..c532398f
--- /dev/null
+++ b/src/rocksdb/java/crossbuild/build-linux-centos.sh
@@ -0,0 +1,31 @@
+#!/usr/bin/env bash
+
+set -e
+
+# remove fixed relesever variable present in the hanscode boxes
+sudo rm -f /etc/yum/vars/releasever
+
+# enable EPEL
+sudo yum -y install epel-release
+
+# install all required packages for rocksdb that are available through yum
+sudo yum -y install openssl java-1.7.0-openjdk-devel zlib-devel bzip2-devel lz4-devel snappy-devel libzstd-devel jemalloc-devel
+
+# install gcc/g++ 4.8.2 from tru/devtools-2
+sudo wget -O /etc/yum.repos.d/devtools-2.repo https://people.centos.org/tru/devtools-2/devtools-2.repo
+sudo yum -y install devtoolset-2-binutils devtoolset-2-gcc devtoolset-2-gcc-c++
+
+# install gflags
+wget https://github.com/gflags/gflags/archive/v2.0.tar.gz -O gflags-2.0.tar.gz
+tar xvfz gflags-2.0.tar.gz; cd gflags-2.0; scl enable devtoolset-2 ./configure; scl enable devtoolset-2 make; sudo make install
+export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
+
+# set java home so we can build rocksdb jars
+export JAVA_HOME=/usr/lib/jvm/java-1.7.0
+
+# build rocksdb
+cd /rocksdb
+scl enable devtoolset-2 'make jclean clean'
+scl enable devtoolset-2 'PORTABLE=1 make -j8 rocksdbjavastatic'
+cp /rocksdb/java/target/librocksdbjni-* /rocksdb-build
+cp /rocksdb/java/target/rocksdbjni-* /rocksdb-build
diff --git a/src/rocksdb/java/crossbuild/build-linux.sh b/src/rocksdb/java/crossbuild/build-linux.sh
new file mode 100755
index 00000000..48d1c28d
--- /dev/null
+++ b/src/rocksdb/java/crossbuild/build-linux.sh
@@ -0,0 +1,14 @@
+#!/usr/bin/env bash
+# install all required packages for rocksdb
+sudo apt-get update
+sudo apt-get -y install git make gcc g++ libgflags-dev libsnappy-dev zlib1g-dev libbz2-dev default-jdk
+
+# set java home so we can build rocksdb jars
+export JAVA_HOME=$(echo /usr/lib/jvm/java-7-openjdk*)
+cd /rocksdb
+make jclean clean
+make -j 4 rocksdbjavastatic
+cp /rocksdb/java/target/librocksdbjni-* /rocksdb-build
+cp /rocksdb/java/target/rocksdbjni-* /rocksdb-build
+sudo shutdown -h now
+
diff --git a/src/rocksdb/java/crossbuild/docker-build-linux-centos.sh b/src/rocksdb/java/crossbuild/docker-build-linux-centos.sh
new file mode 100755
index 00000000..d894b14a
--- /dev/null
+++ b/src/rocksdb/java/crossbuild/docker-build-linux-centos.sh
@@ -0,0 +1,28 @@
+#!/usr/bin/env bash
+
+set -e
+#set -x
+
+rm -rf /rocksdb-local
+cp -r /rocksdb-host /rocksdb-local
+cd /rocksdb-local
+
+# Use scl devtoolset if available (i.e. CentOS <7)
+if hash scl 2>/dev/null; then
+ if scl --list | grep -q 'devtoolset-7'; then
+ scl enable devtoolset-7 'make jclean clean'
+ scl enable devtoolset-7 'PORTABLE=1 make -j6 rocksdbjavastatic'
+ elif scl --list | grep -q 'devtoolset-2'; then
+ scl enable devtoolset-2 'make jclean clean'
+ scl enable devtoolset-2 'PORTABLE=1 make -j6 rocksdbjavastatic'
+ else
+ echo "Could not find devtoolset"
+ exit 1;
+ fi
+else
+ make jclean clean
+ PORTABLE=1 make -j6 rocksdbjavastatic
+fi
+
+cp java/target/librocksdbjni-linux*.so java/target/rocksdbjni-*-linux*.jar /rocksdb-host/java/target
+