forked from I2P_Developers/i2p.i2p
* libjbigi:
- Add documentation on dynamic build option - Add two speed tests to the build script - Clean up the build script, make it easier to build dynamic
This commit is contained in:
@ -1,4 +1,10 @@
|
|||||||
Prior to building the jbigi library, you will need to fetch the GMP source
|
If you have a libgmp.so installed on your system already
|
||||||
|
(check in /usr/lib), you can build a dynamically linked libjbigi.so as follows:
|
||||||
|
cd jbigi
|
||||||
|
build.sh dynamic
|
||||||
|
The built library is jbigi/lib/libjbigi.so .
|
||||||
|
|
||||||
|
Otherwise, prior to building the jbigi library, you will need to fetch the GMP source
|
||||||
from http://www.swox.com/gmp/, saving it to jbigi/gmp-4.2.2.tar.bz2 (it will
|
from http://www.swox.com/gmp/, saving it to jbigi/gmp-4.2.2.tar.bz2 (it will
|
||||||
be unpacked and built as necessary).
|
be unpacked and built as necessary).
|
||||||
|
|
||||||
@ -16,9 +22,12 @@ it will be used only if the router fails to load the native library.
|
|||||||
To build the native jbigi libraries for all supported CPUs (on the current OS),
|
To build the native jbigi libraries for all supported CPUs (on the current OS),
|
||||||
go into jbigi/ and run build-all.sh (the results will be under jbigi/lib/)
|
go into jbigi/ and run build-all.sh (the results will be under jbigi/lib/)
|
||||||
|
|
||||||
After copying the files to the i2p/ directory,
|
The build.sh script runs two speed tests, one with your existing
|
||||||
|
I2P installation and one with the new libjbigi.
|
||||||
|
|
||||||
|
Alternatively, after copying the files to the i2p/ directory,
|
||||||
to run a speed test comparing the native library to the java library,
|
to run a speed test comparing the native library to the java library,
|
||||||
run the shell script below.
|
run the shell script below. Adjust the I2P= line as necessary.
|
||||||
|
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
***net.i2p.util.NativeBigInteger, native part of the code****
|
***net.i2p.util.NativeBigInteger, native part of the code****
|
||||||
|
|
||||||
|
See ../README for instructions.
|
||||||
|
|
||||||
Execute the build.sh script to produce jbigi library files optimized for a number of different CPU-types.
|
Execute the build.sh script to produce jbigi library files optimized for a number of different CPU-types.
|
||||||
|
|
||||||
TODO: What is jbigi
|
TODO: What is jbigi
|
||||||
@ -7,7 +9,9 @@ TODO: Document generated folder structure
|
|||||||
TODO: Instructions for adding the libraries to a jar
|
TODO: Instructions for adding the libraries to a jar
|
||||||
|
|
||||||
Linux-specific information:
|
Linux-specific information:
|
||||||
Some linux distributions comes bundled with GMP. There is currently no out-of-the-box support for this in the current build-scripts.
|
Some linux distributions comes bundled with GMP.
|
||||||
|
There is currently no out-of-the-box support for this in the current build-scripts.
|
||||||
|
|
||||||
Windows-specific information:
|
Windows-specific information:
|
||||||
The best way of building the jbigi dll's is to install Mingw {URL} and msys {URL}. The combination of these two should be able to run the included build-scripts without modifications.
|
The best way of building the jbigi dll's is to install Mingw {URL} and msys {URL}.
|
||||||
|
The combination of these two should be able to run the included build-scripts without modifications.
|
||||||
|
@ -1,22 +1,67 @@
|
|||||||
#/bin/sh
|
#/bin/sh
|
||||||
|
#
|
||||||
|
# Build the jbigi library for i2p
|
||||||
|
#
|
||||||
|
# To build a static library:
|
||||||
|
# download gmp-4.2.2.tar.bz2 to this directory
|
||||||
|
# (if a different version, change the VER= line below)
|
||||||
|
# build.sh
|
||||||
|
#
|
||||||
|
# To build a dynamic library (you must have a libgmp.so somewhere in your system)
|
||||||
|
# build.sh dynamic
|
||||||
|
#
|
||||||
|
# The resulting library is lib/libjbigi.so
|
||||||
|
#
|
||||||
|
|
||||||
VER=4.2.2
|
|
||||||
echo "Building the jbigi library with GMP Version $VER"
|
|
||||||
|
|
||||||
echo "Extracting GMP..."
|
|
||||||
tar -xjf gmp-$VER.tar.bz2
|
|
||||||
echo "Building..."
|
|
||||||
mkdir -p lib/
|
mkdir -p lib/
|
||||||
mkdir -p bin/local
|
mkdir -p bin/local
|
||||||
|
VER=4.2.2
|
||||||
|
|
||||||
|
if [ "$1" != "dynamic" -a ! -d gmp-$VER ]
|
||||||
|
then
|
||||||
|
TAR=gmp-$VER.tar.bz2
|
||||||
|
if [ ! -f $TAR ]
|
||||||
|
then
|
||||||
|
echo "GMP tarball $TAR not found. You must download it from http://gmplib.org/"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Building the jbigi library with GMP Version $VER"
|
||||||
|
|
||||||
|
echo "Extracting GMP..."
|
||||||
|
tar -xjf gmp-$VER.tar.bz2
|
||||||
|
fi
|
||||||
|
|
||||||
cd bin/local
|
cd bin/local
|
||||||
case `uname -sr` in
|
|
||||||
Darwin*)
|
echo "Building..."
|
||||||
# --with-pic is required for static linking
|
if [ "$1" != "dynamic" ]
|
||||||
../../gmp-$VER/configure --with-pic;;
|
then
|
||||||
*)
|
case `uname -sr` in
|
||||||
../../gmp-$VER/configure;;
|
Darwin*)
|
||||||
esac
|
# --with-pic is required for static linking
|
||||||
make
|
../../gmp-$VER/configure --with-pic;;
|
||||||
sh ../../build_jbigi.sh static
|
*)
|
||||||
|
../../gmp-$VER/configure;;
|
||||||
|
esac
|
||||||
|
make
|
||||||
|
sh ../../build_jbigi.sh static
|
||||||
|
else
|
||||||
|
sh ../../build_jbigi.sh dynamic
|
||||||
|
fi
|
||||||
|
|
||||||
cp *jbigi???* ../../lib/
|
cp *jbigi???* ../../lib/
|
||||||
|
echo 'Library copied to lib/'
|
||||||
cd ../..
|
cd ../..
|
||||||
|
|
||||||
|
I2P=~/i2p
|
||||||
|
if [ ! -f $I2P/lib/i2p.jar ]
|
||||||
|
then
|
||||||
|
echo "I2P installation not found in $I2P - correct \$I2P definition in script to run speed test"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo 'Running test with standard I2P installation...'
|
||||||
|
java -cp $I2P/lib/i2p.jar:$I2P/lib/jbigi.jar net.i2p.util.NativeBigInteger
|
||||||
|
echo
|
||||||
|
echo 'Running test with new libjbigi...'
|
||||||
|
java -Djava.library.path=lib/ -cp $I2P/lib/i2p.jar:$I2P/lib/jbigi.jar net.i2p.util.NativeBigInteger
|
||||||
|
Reference in New Issue
Block a user