Merge branch 'release/1.0.5-M4'
This commit is contained in:
commit
2e2261210c
|
@ -7,6 +7,8 @@
|
|||
.idea_modules
|
||||
*.iml
|
||||
|
||||
.DS_Store
|
||||
|
||||
# sbt specific
|
||||
bin/.lib
|
||||
dist/*
|
||||
|
|
3
Makefile
3
Makefile
|
@ -94,6 +94,9 @@ mac32:
|
|||
linux32:
|
||||
$(MAKE) native OS_NAME=Linux OS_ARCH=i386
|
||||
|
||||
freebsd64:
|
||||
$(MAKE) native OS_NAME=FreeBSD OS_ARCH=amd64
|
||||
|
||||
# for cross-compilation on Ubuntu, install the g++-arm-linux-gnueabi package
|
||||
linux-arm:
|
||||
$(MAKE) native CROSS_PREFIX=arm-linux-gnueabi- OS_NAME=Linux OS_ARCH=arm
|
||||
|
|
|
@ -41,7 +41,7 @@ endif
|
|||
|
||||
# os=Default is meant to be generic unix/linux
|
||||
|
||||
known_os_archs := Linux-i386 Linux-amd64 Linux-arm Linux-armhf Mac-i386 Mac-x86_64 Windows-x86 Windows-amd64
|
||||
known_os_archs := Linux-i386 Linux-amd64 Linux-arm Linux-armhf Mac-i386 Mac-x86_64 FreeBSD-amd64 Windows-x86 Windows-amd64
|
||||
os_arch := $(OS_NAME)-$(OS_ARCH)
|
||||
|
||||
ifeq (,$(findstring $(strip $(os_arch)),$(known_os_archs)))
|
||||
|
@ -68,7 +68,7 @@ Linux-i386_SNAPPY_FLAGS:=
|
|||
Linux-amd64_CXX := $(CROSS_PREFIX)g++
|
||||
Linux-amd64_STRIP := $(CROSS_PREFIX)strip
|
||||
Linux-amd64_CXXFLAGS := -include lib/inc_linux/jni_md.h -I$(JAVA_HOME)/include -O2 -fPIC -fvisibility=hidden -m64
|
||||
Linux-amd64_LINKFLAGS := -shared -static-libgcc
|
||||
Linux-amd64_LINKFLAGS := -shared -static-libgcc -static-libstdc++
|
||||
Linux-amd64_LIBNAME := libsnappyjava.so
|
||||
Linux-amd64_SNAPPY_FLAGS :=
|
||||
|
||||
|
@ -105,6 +105,13 @@ Mac-x86_64_LINKFLAGS := -dynamiclib -static-libgcc
|
|||
Mac-x86_64_LIBNAME := libsnappyjava.jnilib
|
||||
Mac-x86_64_SNAPPY_FLAGS :=
|
||||
|
||||
FreeBSD-amd64_CXX := $(CROSS_PREFIX)g++
|
||||
FreeBSD-amd64_STRIP := $(CROSS_PREFIX)strip
|
||||
FreeBSD-amd64_CXXFLAGS := -I$(JAVA_HOME)/include -Ilib/inc_mac -O2 -fPIC -fvisibility=hidden
|
||||
FreeBSD-amd64_LINKFLAGS := -shared -static-libgcc
|
||||
FreeBSD-amd64_LIBNAME := libsnappyjava.so
|
||||
FreeBSD-amd64_SNAPPY_FLAGS :=
|
||||
|
||||
Windows-x86_CXX := $(CROSS_PREFIX)g++
|
||||
Windows-x86_STRIP := $(CROSS_PREFIX)strip
|
||||
Windows-x86_CXXFLAGS := -Ilib/inc_win -O2
|
||||
|
|
62
pom.xml
62
pom.xml
|
@ -4,7 +4,7 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.xerial.snappy</groupId>
|
||||
<artifactId>snappy-java</artifactId>
|
||||
<version>1.0.5-M3</version>
|
||||
<version>1.0.5-M4</version>
|
||||
<name>Snappy for Java</name>
|
||||
<description>snappy-java: A fast compression/decompression library</description>
|
||||
<packaging>bundle</packaging>
|
||||
|
@ -82,7 +82,6 @@
|
|||
</testResource>
|
||||
</testResources>
|
||||
|
||||
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
|
@ -146,7 +145,6 @@
|
|||
<charset>UTF-8</charset>
|
||||
<locale>en_US</locale>
|
||||
<show>public</show>
|
||||
<stylesheetfile>stylesheet.css</stylesheetfile>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
|
@ -171,18 +169,68 @@
|
|||
<plugin>
|
||||
<groupId>org.apache.felix</groupId>
|
||||
<artifactId>maven-bundle-plugin</artifactId>
|
||||
<version>2.3.4</version>
|
||||
<version>2.3.7</version>
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<manifestLocation>${project.build.directory}/META-INF</manifestLocation>
|
||||
<instructions>
|
||||
<Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
|
||||
<Bundle-Name>${pproject.name}</Bundle-Name>
|
||||
<Bundle-Name>${project.name}</Bundle-Name>
|
||||
<Bundle-Version>${project.version}</Bundle-Version>
|
||||
<Bundle-Activator>org.xerial.snappy.SnappyBundleActivator</Bundle-Activator>
|
||||
<Export-Package>org.xerial.snappy</Export-Package>
|
||||
<Import-Package>org.osgi.framework;version="[1.5,2)"</Import-Package>
|
||||
<Bundle-ActivationPolicy>lazy</Bundle-ActivationPolicy>
|
||||
<Bundle-NativeCode>
|
||||
org/xerial/snappy/native/Windows/amd64/snappyjava.dll;selection-filter="(&(osgi.arch=x86_64)(osgi.os=win32))",
|
||||
org/xerial/snappy/native/Windows/x86/snappyjava.dll;selection-filter="(&(osgi.arch=x86)(osgi.os=win32))",
|
||||
org/xerial/snappy/native/Mac/i386/libsnappyjava.jnilib;selection-filter="(&(osgi.arch=x86)(osgi.os=macosx))",
|
||||
org/xerial/snappy/native/Mac/x86_64/libsnappyjava.jnilib;selection-filter="(&(osgi.arch=x86_64)(osgi.os=macosx))",
|
||||
org/xerial/snappy/native/Linux/amd64/libsnappyjava.so;selection-filter="(&(osgi.arch=x86_64)(osgi.os=linux))",
|
||||
org/xerial/snappy/native/Linux/i386/libsnappyjava.so;selection-filter="(&(osgi.arch=x86)(osgi.os=linux))",
|
||||
org/xerial/snappy/native/Linux/arm/libsnappyjava.so;selection-filter="(&(osgi.arch=arm)(osgi.os=linux))"
|
||||
</Bundle-NativeCode>
|
||||
<!-- TODO: unsure about ARMHF -->
|
||||
</instructions>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>bundle-manifest</id>
|
||||
<phase>process-classes</phase>
|
||||
<goals>
|
||||
<goal>manifest</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.4</version>
|
||||
<configuration>
|
||||
<archive>
|
||||
<index>true</index>
|
||||
<manifestFile>${project.build.directory}/META-INF/MANIFEST.MF</manifestFile>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-clean-plugin</artifactId>
|
||||
<version>2.4.1</version>
|
||||
<configuration>
|
||||
<followSymLinks>false</followSymLinks>
|
||||
<filesets>
|
||||
<fileset>
|
||||
<directory>META-INF</directory>
|
||||
<includes>
|
||||
<include>MANIFEST.MF</include>
|
||||
</includes>
|
||||
</fileset>
|
||||
</filesets>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
|
@ -205,6 +253,7 @@
|
|||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
|
||||
<extensions>
|
||||
|
@ -254,7 +303,6 @@
|
|||
</profile>
|
||||
</profiles>
|
||||
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
|
@ -285,5 +333,7 @@
|
|||
<type>jar</type>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
|
|
@ -24,6 +24,9 @@
|
|||
//--------------------------------------
|
||||
package org.xerial.snappy;
|
||||
|
||||
import java.util.jar.Manifest;
|
||||
|
||||
import org.osgi.framework.Bundle;
|
||||
import org.osgi.framework.BundleActivator;
|
||||
import org.osgi.framework.BundleContext;
|
||||
|
||||
|
@ -35,12 +38,23 @@ import org.osgi.framework.BundleContext;
|
|||
*/
|
||||
public class SnappyBundleActivator implements BundleActivator
|
||||
{
|
||||
public void start(BundleContext context) throws Exception {
|
||||
/**
|
||||
* Name of the Snappy native library
|
||||
*/
|
||||
public static final String LIBRARY_NAME = "snappyjava";
|
||||
|
||||
/**
|
||||
* Make a call to {@link System#loadLibrary(String)} to load the native library which assumes
|
||||
* that the library is available on the path based on this {@link Bundle}'s {@link Manifest}.
|
||||
*/
|
||||
public void start(BundleContext context) throws Exception
|
||||
{
|
||||
System.loadLibrary(System.mapLibraryName(LIBRARY_NAME));
|
||||
SnappyLoader.setApi(new SnappyNative());
|
||||
}
|
||||
|
||||
public void stop(BundleContext context) throws Exception {
|
||||
|
||||
public void stop(BundleContext context) throws Exception
|
||||
{
|
||||
SnappyLoader.setApi(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -24,7 +24,13 @@
|
|||
//--------------------------------------
|
||||
package org.xerial.snappy;
|
||||
|
||||
import java.io.*;
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.URL;
|
||||
|
@ -87,8 +93,18 @@ public class SnappyLoader
|
|||
public static final String KEY_SNAPPY_USE_SYSTEMLIB = "org.xerial.snappy.use.systemlib";
|
||||
public static final String KEY_SNAPPY_DISABLE_BUNDLED_LIBS = "org.xerial.snappy.disable.bundled.libs"; // Depreciated, but preserved for backward compatibility
|
||||
|
||||
private static boolean isLoaded = false;
|
||||
private static Object api = null;
|
||||
private static volatile boolean isLoaded = false;
|
||||
private static volatile Object api = null;
|
||||
|
||||
/**
|
||||
* Set the api instance.
|
||||
*
|
||||
* @param nativeCode
|
||||
*/
|
||||
static synchronized void setApi(Object nativeCode)
|
||||
{
|
||||
api = nativeCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* load system properties when configuration file of the name
|
||||
|
@ -200,8 +216,8 @@ public class SnappyLoader
|
|||
*
|
||||
* @return
|
||||
*/
|
||||
static synchronized Object load() {
|
||||
|
||||
static synchronized Object load()
|
||||
{
|
||||
if (api != null)
|
||||
return api;
|
||||
|
||||
|
@ -216,7 +232,7 @@ public class SnappyLoader
|
|||
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.
|
||||
Object nativeCode = Class.forName("org.xerial.snappy.SnappyNative").newInstance();
|
||||
api = nativeCode;
|
||||
setApi(nativeCode);
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue