mirror of
https://github.com/facebook/rocksdb.git
synced 2024-11-30 04:41:49 +00:00
Merge pull request #764 from dmittendorf/fix-java-static-packaging
Fix crossbuild jar packaging
This commit is contained in:
commit
385b416008
26
Makefile
26
Makefile
|
@ -1035,19 +1035,22 @@ liblz4.a:
|
||||||
cd lz4-r127/lib && make CFLAGS='-fPIC' all
|
cd lz4-r127/lib && make CFLAGS='-fPIC' all
|
||||||
cp lz4-r127/lib/liblz4.a .
|
cp lz4-r127/lib/liblz4.a .
|
||||||
|
|
||||||
# A version of each $(LIBOBJECTS) compiled with -fPIC
|
# A version of each $(LIBOBJECTS) compiled with -fPIC and a fixed set of static compression libraries
|
||||||
java_libobjects = $(patsubst %,jl/%,$(LIBOBJECTS))
|
java_static_libobjects = $(patsubst %,jls/%,$(LIBOBJECTS))
|
||||||
CLEAN_FILES += jl
|
CLEAN_FILES += jls
|
||||||
|
|
||||||
$(java_libobjects): jl/%.o: %.cc
|
JAVA_STATIC_FLAGS = -DZLIB -DBZIP2 -DSNAPPY -DLZ4
|
||||||
$(AM_V_CC)mkdir -p $(@D) && $(CXX) $(CXXFLAGS) -fPIC -c $< -o $@ $(COVERAGEFLAGS)
|
JAVA_STATIC_INCLUDES = -I./zlib-1.2.8 -I./bzip2-1.0.6 -I./snappy-1.1.1 -I./lz4-r127/lib
|
||||||
|
|
||||||
rocksdbjavastatic: $(java_libobjects) libz.a libbz2.a libsnappy.a liblz4.a
|
$(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_static_libobjects)
|
||||||
cd java;$(MAKE) javalib;
|
cd java;$(MAKE) javalib;
|
||||||
rm -f ./java/target/$(ROCKSDBJNILIB)
|
rm -f ./java/target/$(ROCKSDBJNILIB)
|
||||||
$(CXX) $(CXXFLAGS) -I./java/. $(JAVA_INCLUDE) -shared -fPIC \
|
$(CXX) $(CXXFLAGS) -I./java/. $(JAVA_INCLUDE) -shared -fPIC \
|
||||||
-o ./java/target/$(ROCKSDBJNILIB) $(JNI_NATIVE_SOURCES) \
|
-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)
|
libz.a libbz2.a libsnappy.a liblz4.a $(JAVA_STATIC_LDFLAGS)
|
||||||
cd java/target;strip -S -x $(ROCKSDBJNILIB)
|
cd java/target;strip -S -x $(ROCKSDBJNILIB)
|
||||||
cd java;jar -cf target/$(ROCKSDB_JAR) HISTORY*.md
|
cd java;jar -cf target/$(ROCKSDB_JAR) HISTORY*.md
|
||||||
|
@ -1059,7 +1062,7 @@ rocksdbjavastatic: $(java_libobjects) libz.a libbz2.a libsnappy.a liblz4.a
|
||||||
rocksdbjavastaticrelease: rocksdbjavastatic
|
rocksdbjavastaticrelease: rocksdbjavastatic
|
||||||
cd java/crossbuild && vagrant destroy -f && vagrant up linux32 && vagrant halt linux32 && vagrant up linux64 && vagrant halt linux64
|
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 -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
|
cd java/target/classes;jar -uf ../$(ROCKSDB_JAR_ALL) org/rocksdb/*.class org/rocksdb/util/*.class
|
||||||
|
|
||||||
rocksdbjavastaticpublish: rocksdbjavastaticrelease
|
rocksdbjavastaticpublish: rocksdbjavastaticrelease
|
||||||
|
@ -1070,6 +1073,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)-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
|
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)
|
rocksdbjava: $(java_libobjects)
|
||||||
$(AM_V_GEN)cd java;$(MAKE) javalib;
|
$(AM_V_GEN)cd java;$(MAKE) javalib;
|
||||||
$(AM_V_at)rm -f ./java/target/$(ROCKSDBJNILIB)
|
$(AM_V_at)rm -f ./java/target/$(ROCKSDBJNILIB)
|
||||||
|
|
|
@ -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.
|
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-linux32.so
|
||||||
librocksdbjni-linux64.so
|
librocksdbjni-linux64.so
|
||||||
|
|
2
java/crossbuild/Vagrantfile
vendored
2
java/crossbuild/Vagrantfile
vendored
|
@ -20,7 +20,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
||||||
end
|
end
|
||||||
|
|
||||||
config.vm.provision :shell, path: "build-linux-centos.sh"
|
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.synced_folder "../..", "/rocksdb", type: "rsync"
|
||||||
config.vm.boot_timeout = 1200
|
config.vm.boot_timeout = 1200
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# install all required packages for rocksdb that are available through yum
|
# install all required packages for rocksdb that are available through yum
|
||||||
ARCH=$(uname -i)
|
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
|
||||||
sudo yum -y install epel-release-5-4.noarch
|
|
||||||
sudo yum -y install snappy snappy-devel
|
|
||||||
|
|
||||||
# install gcc/g++ 4.8.2 via CERN (http://linux.web.cern.ch/linux/devtoolset/)
|
# 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
|
sudo wget -O /etc/yum.repos.d/slc5-devtoolset.repo http://linuxsoft.cern.ch/cern/devtoolset/slc5-devtoolset.repo
|
||||||
|
|
Loading…
Reference in a new issue