source: core/c/README @ 73228a1

Last change on this file since 73228a1 was 73228a1, checked in by dev <dev@…>, 6 years ago

Revamped downloading of gmp files.
Revamped cross-compilation support.

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