1 | |
---|
2 | Dynamic library build |
---|
3 | ===================== |
---|
4 | |
---|
5 | If you have a libgmp.so installed on your system already |
---|
6 | (check in /usr/lib), you can build a dynamically linked libjbigi.so as follows: |
---|
7 | cd jbigi |
---|
8 | build.sh dynamic |
---|
9 | You do, of course, need the gmp headers installed. |
---|
10 | On ubuntu, check for libgmp3 and libgmp3-dev packages. |
---|
11 | This is much easier and faster than building GMP from source. |
---|
12 | |
---|
13 | |
---|
14 | Static library build |
---|
15 | ===================== |
---|
16 | |
---|
17 | Otherwise, the build script build.sh will download the the GMP source, |
---|
18 | unpack and build it. The GMP version and download location are configured |
---|
19 | in jbigi/build.sh, please review it to ensure you download |
---|
20 | and build the desired version. |
---|
21 | |
---|
22 | To build the native jbigi and jcpuid libraries for the current host CPU, |
---|
23 | simply run sh build.sh and the results will be packaged up into jbigi.jar |
---|
24 | and the libjbigi.so library. |
---|
25 | |
---|
26 | To build the native jbigi libraries for all supported CPUs (on the current OS), |
---|
27 | go into jbigi/ and run build-all.sh (the results will be under jbigi/lib/) |
---|
28 | |
---|
29 | |
---|
30 | Build for more than one target at a time |
---|
31 | ======================================== |
---|
32 | |
---|
33 | ./mbuild.sh is used to build a whole set of binaries at a time. |
---|
34 | Each run will build a set of binaries for a specific platform. |
---|
35 | |
---|
36 | Windows cross-compilation |
---|
37 | ------------------------- |
---|
38 | Install ming-w64 (on debian or whichever package that provides i686-w64-mingw32 and x86_64_w64_mingw32). |
---|
39 | |
---|
40 | To build the 32-bit binaries run something like this: |
---|
41 | CC=i686-w64-mingw32-gcc TARGET=windows BITS=32 ./mbuild-all.sh |
---|
42 | |
---|
43 | To build the 64-bit binaries run something like this: |
---|
44 | CC=x86_64-w64-mingw32-gcc TARGET=windows BITS=64 ./mbuild-all.sh |
---|
45 | |
---|
46 | |
---|
47 | Installation and testing |
---|
48 | ======================== |
---|
49 | |
---|
50 | To test, copy jbigi/lib/libjbigi.so |
---|
51 | and jcpuid/lib/freenet/support/CPUInformation/libjcpuid-*.so |
---|
52 | to your i2p installation directory ($I2P). You may also copy jbigi.jar to the $I2P/lib/ directory; |
---|
53 | it will be used only if the router fails to load the native library |
---|
54 | from the I2P installation directory. |
---|
55 | |
---|
56 | The build.sh script runs two speed tests, one with your existing |
---|
57 | I2P installation and one with the new libjbigi. |
---|
58 | |
---|
59 | Alternatively, after copying the files to the i2p/ directory, |
---|
60 | to run a speed test comparing the native library to the java library, |
---|
61 | run the shell script below. Adjust the I2P= line as necessary. |
---|
62 | |
---|
63 | ----------------- |
---|
64 | |
---|
65 | #!/bin/sh |
---|
66 | export I2P=~/i2p |
---|
67 | java -cp $I2P/lib/i2p.jar:$I2P/lib/jbigi.jar net.i2p.util.NativeBigInteger |
---|