Merge pull request #14 from trevorr/develop

Merging ARM support, contributed by Trevor
This commit is contained in:
Taro L. Saito 2012-09-06 18:01:14 -07:00
commit cd469e1138
4 changed files with 34 additions and 5 deletions

View File

@ -82,7 +82,11 @@ test: $(NATIVE_DLL)
$(MVN) test
win32:
$(MAKE) native CXX=mingw32-g++ OS_NAME=Windows OS_ARCH=x86
$(MAKE) native CROSS_PREFIX=i686-w64-mingw32- OS_NAME=Windows OS_ARCH=x86
# for cross-compilation on Ubuntu, install the g++-mingw-w64-x86-64 package
win64:
$(MAKE) native CROSS_PREFIX=x86_64-w64-mingw32- OS_NAME=Windows OS_ARCH=amd64
mac32:
$(MAKE) native OS_NAME=Mac OS_ARCH=i386
@ -90,6 +94,14 @@ mac32:
linux32:
$(MAKE) native OS_NAME=Linux OS_ARCH=i386
# 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
# for cross-compilation on Ubuntu, install the g++-arm-linux-gnueabihf package
linux-armhf:
$(MAKE) native CROSS_PREFIX=arm-linux-gnueabihf- OS_NAME=Linux OS_ARCH=armhf
clean-native-linux32:
$(MAKE) clean-native OS_NAME=Linux OS_ARCH=i386

View File

@ -105,15 +105,15 @@ Mac-x86_64_LINKFLAGS := -dynamiclib -static-libgcc
Mac-x86_64_LIBNAME := libsnappyjava.jnilib
Mac-x86_64_SNAPPY_FLAGS :=
Windows-x86_CXX := mingw32-g++
Windows-x86_STRIP := strip
Windows-x86_CXX := $(CROSS_PREFIX)g++
Windows-x86_STRIP := $(CROSS_PREFIX)strip
Windows-x86_CXXFLAGS := -Ilib/inc_win -O2
Windows-x86_LINKFLAGS := -Wl,--kill-at -shared -static
Windows-x86_LIBNAME := snappyjava.dll
Windows-x86_SNAPPY_FLAGS :=
Windows-amd64_CXX := x86_64-w64-mingw32-g++
Windows-amd64_STRIP := x86_64-w64-mingw32-strip
Windows-amd64_CXX := $(CROSS_PREFIX)g++
Windows-amd64_STRIP := $(CROSS_PREFIX)strip
Windows-amd64_CXXFLAGS := -Ilib/inc_win -O2
Windows-amd64_LINKFLAGS := -Wl,--kill-at -shared -static
Windows-amd64_LIBNAME := snappyjava.dll

View File

@ -90,6 +90,23 @@ See the [installation instruction](https://github.com/xerial/snappy-java/blob/de
A file `target/snappy-java-$(version).jar` is the product additionally containing the native library built for your platform.
## Cross-compiling for other platforms
The Makefile contains rules for cross-compiling the native library for other platforms so that the snappy-java JAR can support multiple platforms. For example, to build the native libraries for x86 Linux, x86 and x86-64 Windows, and soft- and hard-float ARM:
$ make linux32 win32 win64 linux-arm linux-armhf
If you append `snappy` to the line above, it will also build the native library for the current platform and then build the snappy-java JAR (containing all native libraries built so far).
Of course, you must first have the necessary cross-compilers and development libraries installed for each target CPU and OS. For example, on Ubuntu 12.04 for x86-64, install the following packages for each target:
* linux32: `sudo apt-get install g++-multilib libc6-dev-i386 lib32stdc++6`
* win32: `sudo apt-get install g++-mingw-w64-i686`
* win64: `sudo apt-get install g++-mingw-w64-x86-64`
* arm: `sudo apt-get install g++-arm-linux-gnueabi`
* armhf: `sudo apt-get install g++-arm-linux-gnueabihf`
Unfortunately, cross-compiling for Mac OS X is not currently possible; you must compile within OS X.
## Miscellaneous Notes
### Using snappy-java with Tomcat 6 (or higher) Web Server