[snappy-java] 49/51: Build and install the JNI bindings in libsnappy-jni (Closes: #734599)

Emmanuel Bourg ebourg-guest at moszumanska.debian.org
Tue Nov 25 17:16:47 GMT 2014


This is an automated email from the git hooks/post-receive script.

ebourg-guest pushed a commit to branch master
in repository snappy-java.

commit dc47d4e4a365e87324c0b0dc0ecc82fbdb55e6ae
Author: Emmanuel Bourg <ebourg at apache.org>
Date:   Tue Nov 25 17:48:17 2014 +0100

    Build and install the JNI bindings in libsnappy-jni (Closes: #734599)
---
 debian/changelog                                   | 12 +++++--
 debian/control                                     | 20 +++++++++---
 debian/libsnappy-java.poms                         |  2 +-
 debian/links                                       |  2 --
 debian/patches/01-load-library.patch               | 19 +++++++++++
 .../replace_OSInfo_by_dpkg-architecture.patch      | 38 ----------------------
 .../patches/replace_silk-weaver_by_xml_grep.patch  | 18 ----------
 debian/patches/series                              |  4 +--
 debian/patches/use_debian_packaged_libsnappy.patch | 17 ----------
 debian/rules                                       | 25 ++++++++++++--
 10 files changed, 68 insertions(+), 89 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 500d80a..0e26235 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,8 +1,14 @@
 snappy-java (1.0.4.1~dfsg-2) UNRELEASED; urgency=low
 
-  * Standards-Version updated to 3.9.6 (no changes)
-  * Use canonical URLs for the Vcs-* fields
-  * Updated the project URL
+  * Team upload.
+  * Build and install the JNI bindings in libsnappy-jni (Closes: #734599)
+    - Removed the patches modifying the unused Makefile
+    - Removed the unused build dependency on xml-twig-tools
+  * Build with DH instead of CDBS
+  * debian/control:
+    - Standards-Version updated to 3.9.6 (no changes)
+    - Use canonical URLs for the Vcs-* fields
+    - Updated the project URL
   * debian/watch: Watch the release tags on Github
   * Switch to debhelper level 9
 
diff --git a/debian/control b/debian/control
index 793b399..8e5353c 100644
--- a/debian/control
+++ b/debian/control
@@ -4,8 +4,7 @@ Priority: optional
 Maintainer: Debian Java Maintainers <pkg-java-maintainers at lists.alioth.debian.org>
 Uploaders: Charles Plessy <plessy at debian.org>,
  Andreas Tille <tille at debian.org>,
-Build-Depends: debhelper (>= 9), cdbs, default-jdk, maven-debian-helper (>= 1.4),
- xml-twig-tools, libsnappy-dev
+Build-Depends: debhelper (>= 9), default-jdk, maven-debian-helper (>= 1.4), libsnappy-dev
 Build-Depends-Indep: libmaven-bundle-plugin-java
 Standards-Version: 3.9.6
 Vcs-Git: git://anonscm.debian.org/debian-med/snappy-java.git
@@ -14,8 +13,7 @@ Homepage: https://github.com/xerial/snappy-java
 
 Package: libsnappy-java
 Architecture: all
-Depends: ${misc:Depends}, ${maven:Depends}, ${shlib:Depends}, libsnappy1
-Recommends: ${maven:OptionalDepends}
+Depends: ${misc:Depends}, ${maven:Depends}, libsnappy-jni
 Description: Snappy for Java, a fast compressor/decompresser
  Java port of Snappy, a fast compresser/decompresser written in C++,
  originally developed by Google. 
@@ -24,3 +22,17 @@ Description: Snappy for Java, a fast compressor/decompresser
  reasonable compression size. So the compression ratio of snappy-java is
  modest and about the same as LZF (ranging 20%-100% according to the
  dataset). 
+
+Package: libsnappy-jni
+Architecture: any
+Depends: ${misc:Depends}, ${shlibs:Depends}
+Description: Snappy for Java, a fast compressor/decompresser (JNI library)
+ Java port of Snappy, a fast compresser/decompresser written in C++,
+ originally developed by Google.
+ .
+ Snappy's main target is very high-speed compression/decompression with
+ reasonable compression size. So the compression ratio of snappy-java is
+ modest and about the same as LZF (ranging 20%-100% according to the
+ dataset).
+ .
+ This package contains the architecture specific Java native interface part.
diff --git a/debian/libsnappy-java.poms b/debian/libsnappy-java.poms
index 4c16dce..1d885c3 100644
--- a/debian/libsnappy-java.poms
+++ b/debian/libsnappy-java.poms
@@ -25,4 +25,4 @@
 #   --site-xml=<location>: Optional, the location for site.xml if it needs to be installed.
 #     Empty by default. [mh_install]
 #
-pom.xml
+pom.xml --has-package-version --java-lib
diff --git a/debian/links b/debian/links
deleted file mode 100644
index 733ce07..0000000
--- a/debian/links
+++ /dev/null
@@ -1,2 +0,0 @@
-/usr/share/maven-repo/org/xerial/snappy/snappy-java/debian/snappy-java-debian.jar	/usr/share/java/snappy-java.jar
-/usr/share/maven-repo/org/xerial/snappy/snappy-java/1.0.4.1/snappy-java-1.0.4.1.jar	/usr/share/java/snappy-java-1.0.4.1.jar
diff --git a/debian/patches/01-load-library.patch b/debian/patches/01-load-library.patch
new file mode 100644
index 0000000..6829bde
--- /dev/null
+++ b/debian/patches/01-load-library.patch
@@ -0,0 +1,19 @@
+Description: Load the native library from the library path
+Author: Emmanuel Bourg <ebourg at apache.org>
+Forwarded: not-needed
+--- a/src/main/java/org/xerial/snappy/SnappyLoader.java
++++ b/src/main/java/org/xerial/snappy/SnappyLoader.java
+@@ -212,12 +212,7 @@
+             return api;
+ 
+         try {
+-            if (!hasInjectedNativeLoader()) {
+-                // Inject SnappyNativeLoader (src/main/resources/org/xerial/snappy/SnappyNativeLoader.bytecode) to the root class loader  
+-                Class< ? > nativeLoader = injectSnappyNativeLoader();
+-                // Load the JNI code using the injected loader
+-                loadNativeLibrary(nativeLoader);
+-            }
++            System.loadLibrary("snappyjava");
+ 
+             isLoaded = true;
+             // Look up SnappyNative, injected to the root classloder, using reflection in order to avoid the initialization of SnappyNative class in this context class loader.
diff --git a/debian/patches/replace_OSInfo_by_dpkg-architecture.patch b/debian/patches/replace_OSInfo_by_dpkg-architecture.patch
deleted file mode 100644
index 285ed6a..0000000
--- a/debian/patches/replace_OSInfo_by_dpkg-architecture.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-Description: replace calls to OSInfo.class by calls to dpkg-architecture.
- The ‘lib’ directory is removed from this package, see ‘debian/README.source’.
-Author: Charles Plessy <plessy at debian.org>
-Forwarded: not-needed
-diff --git a/Makefile.common b/Makefile.common
-index f4a3fdd..991c5e0 100644
---- a/Makefile.common
-+++ b/Makefile.common
-@@ -11,17 +11,9 @@ JAVA  := "$$JAVA_HOME/bin/java"
- JAVAC := "$$JAVA_HOME/bin/javac" 
- JAVAH := "$$JAVA_HOME/bin/javah"
- 
--OSINFO_CLASS := org.xerial.snappy.OSInfo
--OSINFO_PROG := lib/org/xerial/snappy/OSInfo.class
--
--## building OSInfo.java 
--#$(info compiling OSInfo.java)
--#$(shell mkdir -p lib)
--#$(shell $(JAVAC) src/main/java/org/sqlite/OSInfo.java -d lib)
--
--OS_NAME := $(shell $(JAVA) -cp lib $(OSINFO_CLASS) --os)
--OS_ARCH := $(shell $(JAVA) -cp lib $(OSINFO_CLASS) --arch)
--LIB_FOLDER := $(shell $(JAVA) -cp lib $(OSINFO_CLASS))
-+OS_NAME := $(shell dpkg-architecture -qDEB_BUILD_ARCH_OS)
-+OS_ARCH := $(shell dpkg-architecture -qDEB_BUILD_ARCH)
-+LIB_FOLDER := $(OS_NAME)/$(OS_ARCH)
- 
- # Windows uses different path separators
- ifeq ($(OS_NAME),Windows)
-@@ -41,7 +33,7 @@ endif
- 
- # os=Default is meant to be generic unix/linux
- 
--known_os_archs := Linux-i386 Linux-amd64 Mac-i386 Mac-x86_64 Windows-x86 Windows-amd64
-+known_os_archs := linux-i386 linux-amd64 Mac-i386 Mac-x86_64 Windows-x86 Windows-amd64
- os_arch := $(OS_NAME)-$(OS_ARCH)
- 
- ifeq (,$(findstring $(strip $(os_arch)),$(known_os_archs)))
diff --git a/debian/patches/replace_silk-weaver_by_xml_grep.patch b/debian/patches/replace_silk-weaver_by_xml_grep.patch
deleted file mode 100644
index 2226097..0000000
--- a/debian/patches/replace_silk-weaver_by_xml_grep.patch
+++ /dev/null
@@ -1,18 +0,0 @@
-Description: Replace silk-weaver.jar by xml_grep from the xml-twig-tools package.
- No sources are included for silk-weaver.jar, it is therefore deleted from the
- Debian source package.
-Author: Charles Plessy <plessy at debian.org>
-Forwarded: why not ?
-diff --git a/Makefile b/Makefile
-index 7ad5cc6..2c65c55 100644
---- a/Makefile
-+++ b/Makefile
-@@ -62,7 +62,7 @@ NATIVE_DIR:=src/main/resources/org/xerial/snappy/native/$(OS_NAME)/$(OS_ARCH)
- NATIVE_TARGET_DIR:=$(TARGET)/classes/org/xerial/snappy/native/$(OS_NAME)/$(OS_ARCH)
- NATIVE_DLL:=$(NATIVE_DIR)/$(LIBNAME)
- 
--snappy-jar-version:=snappy-java-$(shell $(JAVA) -jar lib/silk-weaver.jar find 'project(artifactId, version)' pom.xml | grep snappy-java | awk '{ print $$2; }')
-+snappy-jar-version:=snappy-java-$(shell xml_grep --text_only "/project/version" pom.xml)
- 
- native: $(SNAPPY_UNPACKED) $(NATIVE_DLL) 
- snappy: native $(TARGET)/$(snappy-jar-version).jar
diff --git a/debian/patches/series b/debian/patches/series
index b9d996f..9016fc9 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1 @@
-replace_silk-weaver_by_xml_grep.patch
-replace_OSInfo_by_dpkg-architecture.patch
-use_debian_packaged_libsnappy.patch
+01-load-library.patch
diff --git a/debian/patches/use_debian_packaged_libsnappy.patch b/debian/patches/use_debian_packaged_libsnappy.patch
deleted file mode 100644
index 95c76d4..0000000
--- a/debian/patches/use_debian_packaged_libsnappy.patch
+++ /dev/null
@@ -1,17 +0,0 @@
-Author: Andreas Tille <tille at debian.org>
-Date: Sat, 28 Jan 2012 14:14:01 +0100
-Description: Use Debian packaged libsnappy (hopefully)
-
---- snappy-java-1.0.4.1.orig/Makefile
-+++ snappy-java-1.0.4.1/Makefile
-@@ -58,8 +58,8 @@
- clean:
- 	rm -rf $(TARGET)
- 
--NATIVE_DIR:=src/main/resources/org/xerial/snappy/native/$(OS_NAME)/$(OS_ARCH)
--NATIVE_TARGET_DIR:=$(TARGET)/classes/org/xerial/snappy/native/$(OS_NAME)/$(OS_ARCH)
-+NATIVE_DIR:=/usr/lib
-+NATIVE_TARGET_DIR:=$(TARGET)/usr/lib
- NATIVE_DLL:=$(NATIVE_DIR)/$(LIBNAME)
- 
- snappy-jar-version:=snappy-java-$(shell xml_grep --text_only "/project/version" pom.xml)
diff --git a/debian/rules b/debian/rules
index 6038731..7212f42 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,9 +1,28 @@
 #!/usr/bin/make -f
 
-include /usr/share/cdbs/1/rules/debhelper.mk
-include /usr/share/cdbs/1/class/maven.mk
+export JAVA_HOME := /usr/lib/jvm/default-java
+DEB_HOST_MULTIARCH = $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
 
-JAVA_HOME := /usr/lib/jvm/default-java
+DPKG_EXPORT_BUILDFLAGS = 1
+include /usr/share/dpkg/buildflags.mk
+
+%:
+	dh $@ --buildsystem=maven
+
+override_dh_auto_build:
+	dh_auto_build
+
+	# Build the JNI bindings
+	gcc $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) \
+	    -I$(JAVA_HOME)/include/ \
+	    -I$(JAVA_HOME)/include/linux \
+	    -lsnappy -fPIC -shared -Wall -g \
+	    -o target/libsnappyjava.so \
+	    src/main/java/org/xerial/snappy/SnappyNative.cpp
+
+override_dh_auto_install:
+	dh_auto_install
+	dh_install -plibsnappy-jni target/*.so usr/lib/$(DEB_HOST_MULTIARCH)/jni
 
 get-orig-source:
 	uscan --verbose --force-download

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/snappy-java.git



More information about the pkg-java-commits mailing list