diff --git a/Makefile b/Makefile index 19d05838782..beb033e8c4b 100644 --- a/Makefile +++ b/Makefile @@ -1021,20 +1021,22 @@ liblz4.a: cd lz4-r127/lib && make CFLAGS='-fPIC' all cp lz4-r127/lib/liblz4.a . -# A version of each $(LIBOBJECTS) compiled with -fPIC -java_libobjects = $(patsubst %,jl/%,$(LIBOBJECTS)) -CLEAN_FILES += jl +# A version of each $(LIBOBJECTS) compiled with -fPIC and a fixed set of static compression libraries +java_static_libobjects = $(patsubst %,jls/%,$(LIBOBJECTS)) +CLEAN_FILES += jls -$(java_libobjects): jl/%.o: %.cc - $(AM_V_CC)mkdir -p $(@D) - @$(CXX) $(CXXFLAGS) -fPIC -c $< -o $@ $(COVERAGEFLAGS) +JAVA_STATIC_FLAGS = -DZLIB -DBZIP2 -DSNAPPY -DLZ4 +JAVA_STATIC_INCLUDES = -I./zlib-1.2.8 -I./bzip2-1.0.6 -I./snappy-1.1.1 -I./lz4-r127/lib + +$(java_static_libobjects): jls/%.o: %.cc libz.a libbz2.a libsnappy.a liblz4.a + $(AM_V_CC)mkdir -p $(@D) && $(CXX) $(CXXFLAGS) $(JAVA_STATIC_FLAGS) $(JAVA_STATIC_INCLUDES) -fPIC -c $< -o $@ $(COVERAGEFLAGS) -rocksdbjavastatic: $(java_libobjects) libz.a libbz2.a libsnappy.a liblz4.a +rocksdbjavastatic: $(java_static_libobjects) cd java;$(MAKE) javalib; rm -f ./java/target/$(ROCKSDBJNILIB) $(CXX) $(CXXFLAGS) -I./java/. $(JAVA_INCLUDE) -shared -fPIC \ -o ./java/target/$(ROCKSDBJNILIB) $(JNI_NATIVE_SOURCES) \ - $(java_libobjects) $(COVERAGEFLAGS) \ + $(java_static_libobjects) $(COVERAGEFLAGS) \ libz.a libbz2.a libsnappy.a liblz4.a $(JAVA_STATIC_LDFLAGS) cd java/target;strip -S -x $(ROCKSDBJNILIB) cd java;jar -cf target/$(ROCKSDB_JAR) HISTORY*.md @@ -1046,7 +1048,7 @@ rocksdbjavastatic: $(java_libobjects) libz.a libbz2.a libsnappy.a liblz4.a rocksdbjavastaticrelease: rocksdbjavastatic cd java/crossbuild && vagrant destroy -f && vagrant up linux32 && vagrant halt linux32 && vagrant up linux64 && vagrant halt linux64 cd java;jar -cf target/$(ROCKSDB_JAR_ALL) HISTORY*.md - cd java;jar -uf target/$(ROCKSDB_JAR_ALL) librocksdbjni-*.so librocksdbjni-*.jnilib + 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 rocksdbjavastaticpublish: rocksdbjavastaticrelease @@ -1057,6 +1059,13 @@ rocksdbjavastaticpublish: rocksdbjavastaticrelease mvn gpg:sign-and-deploy-file -Durl=https://oss.sonatype.org/service/local/staging/deploy/maven2/ -DrepositoryId=sonatype-nexus-staging -DpomFile=java/rocksjni.pom -Dfile=java/target/rocksdbjni-$(ROCKSDB_MAJOR).$(ROCKSDB_MINOR).$(ROCKSDB_PATCH)-osx.jar -Dclassifier=osx mvn gpg:sign-and-deploy-file -Durl=https://oss.sonatype.org/service/local/staging/deploy/maven2/ -DrepositoryId=sonatype-nexus-staging -DpomFile=java/rocksjni.pom -Dfile=java/target/rocksdbjni-$(ROCKSDB_MAJOR).$(ROCKSDB_MINOR).$(ROCKSDB_PATCH).jar +# A version of each $(LIBOBJECTS) compiled with -fPIC +java_libobjects = $(patsubst %,jl/%,$(LIBOBJECTS)) +CLEAN_FILES += jl + +$(java_libobjects): jl/%.o: %.cc + $(AM_V_CC)mkdir -p $(@D) && $(CXX) $(CXXFLAGS) -fPIC -c $< -o $@ $(COVERAGEFLAGS) + rocksdbjava: $(java_libobjects) cd java;$(MAKE) javalib; rm -f ./java/target/$(ROCKSDBJNILIB) diff --git a/java/RELEASE.md b/java/RELEASE.md index 084460c8888..cb9aaf987b4 100644 --- a/java/RELEASE.md +++ b/java/RELEASE.md @@ -15,7 +15,7 @@ Once you have these items, run this make command from RocksDB's root source dire This command will build RocksDB natively on OSX, and will then spin up two Vagrant Virtualbox Ubuntu images to build RocksDB for both 32-bit and 64-bit Linux. -You can find all native binaries and JARs in the java directory upon completion: +You can find all native binaries and JARs in the java/target directory upon completion: librocksdbjni-linux32.so librocksdbjni-linux64.so diff --git a/java/crossbuild/Vagrantfile b/java/crossbuild/Vagrantfile index 8a52b926122..21cce1201a7 100644 --- a/java/crossbuild/Vagrantfile +++ b/java/crossbuild/Vagrantfile @@ -20,7 +20,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| end config.vm.provision :shell, path: "build-linux-centos.sh" - config.vm.synced_folder "../", "/rocksdb-build" + config.vm.synced_folder "../target", "/rocksdb-build" config.vm.synced_folder "../..", "/rocksdb", type: "rsync" config.vm.boot_timeout = 1200 end diff --git a/java/crossbuild/build-linux-centos.sh b/java/crossbuild/build-linux-centos.sh index 1e37fa9d418..2e8f81d94b9 100755 --- a/java/crossbuild/build-linux-centos.sh +++ b/java/crossbuild/build-linux-centos.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # install all required packages for rocksdb that are available through yum ARCH=$(uname -i) -sudo yum -y install openssl java-1.7.0-openjdk-devel.$ARCH zlib zlib-devel bzip2 bzip2-devel +sudo yum -y install openssl java-1.7.0-openjdk-devel.$ARCH # install gcc/g++ 4.8.2 via CERN (http://linux.web.cern.ch/linux/devtoolset/) sudo wget -O /etc/yum.repos.d/slc5-devtoolset.repo http://linuxsoft.cern.ch/cern/devtoolset/slc5-devtoolset.repo