2004-08-21 07:56:53 +00:00
|
|
|
#/bin/sh
|
2008-05-12 13:47:15 +00:00
|
|
|
#
|
|
|
|
# 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
|
|
|
|
#
|
2004-08-21 07:56:53 +00:00
|
|
|
|
2004-12-10 13:12:07 +00:00
|
|
|
mkdir -p lib/
|
|
|
|
mkdir -p bin/local
|
2009-03-30 05:31:40 +00:00
|
|
|
VER=4.2.4
|
2008-05-12 13:47:15 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2004-08-21 07:56:53 +00:00
|
|
|
cd bin/local
|
2008-05-12 13:47:15 +00:00
|
|
|
|
|
|
|
echo "Building..."
|
|
|
|
if [ "$1" != "dynamic" ]
|
|
|
|
then
|
|
|
|
case `uname -sr` in
|
|
|
|
Darwin*)
|
|
|
|
# --with-pic is required for static linking
|
|
|
|
../../gmp-$VER/configure --with-pic;;
|
|
|
|
*)
|
|
|
|
../../gmp-$VER/configure;;
|
|
|
|
esac
|
|
|
|
make
|
|
|
|
sh ../../build_jbigi.sh static
|
|
|
|
else
|
|
|
|
sh ../../build_jbigi.sh dynamic
|
|
|
|
fi
|
|
|
|
|
2004-12-10 13:12:07 +00:00
|
|
|
cp *jbigi???* ../../lib/
|
2008-05-12 13:47:15 +00:00
|
|
|
echo 'Library copied to lib/'
|
2004-12-10 13:12:07 +00:00
|
|
|
cd ../..
|
2008-05-12 13:47:15 +00:00
|
|
|
|
|
|
|
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
|