Changeset 5be7ea1 for core/c


Ignore:
Timestamp:
May 12, 2008 1:47:15 PM (12 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
042399f
Parents:
db34665
Message:
  • 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
Location:
core/c
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • core/c/README

    rdb34665 r5be7ea1  
    1 Prior to building the jbigi library, you will need to fetch the GMP source
     1If you have a libgmp.so installed on your system already
     2(check in /usr/lib), you can build a dynamically linked libjbigi.so as follows:
     3        cd jbigi
     4        build.sh dynamic
     5The built library is jbigi/lib/libjbigi.so .
     6       
     7Otherwise, prior to building the jbigi library, you will need to fetch the GMP source
    28from http://www.swox.com/gmp/, saving it to jbigi/gmp-4.2.2.tar.bz2 (it will
    39be unpacked and built as necessary).
     
    1723go into jbigi/ and run build-all.sh (the results will be under jbigi/lib/)
    1824
    19 After copying the files to the i2p/ directory,
     25The build.sh script runs two speed tests, one with your existing
     26I2P installation and one with the new libjbigi.
     27
     28Alternatively, after copying the files to the i2p/ directory,
    2029to run a speed test comparing the native library to the java library,
    21 run the shell script below.
     30run the shell script below. Adjust the I2P= line as necessary.
    2231
    2332-----------------
  • core/c/jbigi/README

    rdb34665 r5be7ea1  
    11***net.i2p.util.NativeBigInteger, native part of the code****
     2
     3See ../README for instructions.
    24
    35Execute the build.sh script to produce jbigi library files optimized for a number of different CPU-types.
     
    810
    911Linux-specific information:
    10 Some linux distributions comes bundled with GMP. There is currently no out-of-the-box support for this in the current build-scripts.
     12Some linux distributions comes bundled with GMP.
     13There is currently no out-of-the-box support for this in the current build-scripts.
    1114
    1215Windows-specific information:
    13 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.
     16The best way of building the jbigi dll's is to install Mingw {URL} and msys {URL}.
     17The combination of these two should be able to run the included build-scripts without modifications.
  • core/c/jbigi/build.sh

    rdb34665 r5be7ea1  
    11#/bin/sh
     2#
     3#  Build the jbigi library for i2p
     4#
     5#  To build a static library:
     6#     download gmp-4.2.2.tar.bz2 to this directory
     7#       (if a different version, change the VER= line below)
     8#     build.sh
     9#
     10#  To build a dynamic library (you must have a libgmp.so somewhere in your system)
     11#     build.sh dynamic
     12#
     13#  The resulting library is lib/libjbigi.so
     14#
    215
    3 VER=4.2.2
    4 echo "Building the jbigi library with GMP Version $VER"
    5 
    6 echo "Extracting GMP..."
    7 tar -xjf gmp-$VER.tar.bz2
    8 echo "Building..."
    916mkdir -p lib/
    1017mkdir -p bin/local
     18VER=4.2.2
     19
     20if [ "$1" != "dynamic" -a ! -d gmp-$VER ]
     21then
     22        TAR=gmp-$VER.tar.bz2
     23        if [ ! -f $TAR ]
     24        then
     25                echo "GMP tarball $TAR not found. You must download it from http://gmplib.org/"
     26                exit 1
     27        fi
     28
     29        echo "Building the jbigi library with GMP Version $VER"
     30
     31        echo "Extracting GMP..."
     32        tar -xjf gmp-$VER.tar.bz2
     33fi
     34
    1135cd bin/local
    12 case `uname -sr` in
    13 Darwin*)
    14 # --with-pic is required for static linking
    15 ../../gmp-$VER/configure --with-pic;;
    16 *)
    17 ../../gmp-$VER/configure;;
    18 esac
    19 make
    20 sh ../../build_jbigi.sh static
     36
     37echo "Building..."
     38if [ "$1" != "dynamic" ]
     39then
     40        case `uname -sr` in
     41                Darwin*)
     42                        # --with-pic is required for static linking
     43                        ../../gmp-$VER/configure --with-pic;;
     44                *)
     45                        ../../gmp-$VER/configure;;
     46        esac
     47        make
     48        sh ../../build_jbigi.sh static
     49else
     50        sh ../../build_jbigi.sh dynamic
     51fi
     52
    2153cp *jbigi???* ../../lib/
     54echo 'Library copied to lib/'
    2255cd ../..
     56
     57I2P=~/i2p
     58if [ ! -f $I2P/lib/i2p.jar ]
     59then
     60        echo "I2P installation not found in $I2P - correct \$I2P definition in script to run speed test"
     61        exit 1
     62fi
     63echo 'Running test with standard I2P installation...'
     64java -cp $I2P/lib/i2p.jar:$I2P/lib/jbigi.jar net.i2p.util.NativeBigInteger
     65echo
     66echo 'Running test with new libjbigi...'
     67java -Djava.library.path=lib/ -cp $I2P/lib/i2p.jar:$I2P/lib/jbigi.jar net.i2p.util.NativeBigInteger
Note: See TracChangeset for help on using the changeset viewer.