source: core/c/README @ 1e3e02d

Last change on this file since 1e3e02d was 489ff65e, checked in by dev <dev@…>, 6 years ago

Added OSX notei

  • Property mode set to 100644
File size: 2.9 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
33jbigi/mbuild-all.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
36Linux -> Windows 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
46Linux -> FreeBSD cross-compilation
47----------------------------------
48Install gcc-multilib (on debian or whichever package that provides the C runtime)
49I used clang3.6 as CC, but gcc or most other things should work too.
50
51To build the 32-bit binaries run something like this:
52    TARGET=freebsd BITS=32 ./mbuild-all.sh
53
54To build the 64-bit binaries run something like this:
55    TARGET=freebsd BITS=64 ./mbuild-all.sh
56
57OSX Compilation
58---------------
59No working cross-compilation setup has been found. The gmp6 binaries were produced on an OSX host.
60
61
62Installation and testing
63========================
64
65To test, copy jbigi/lib/libjbigi.so
66and jcpuid/lib/freenet/support/CPUInformation/libjcpuid-*.so
67to your i2p installation directory ($I2P). You may also copy jbigi.jar to the $I2P/lib/ directory;
68it will be used only if the router fails to load the native library
69from the I2P installation directory.
70
71The build.sh script runs two speed tests, one with your existing
72I2P installation and one with the new libjbigi.
73
74Alternatively, after copying the files to the i2p/ directory,
75to run a speed test comparing the native library to the java library,
76run the shell script below. Adjust the I2P= line as necessary.
77
78-----------------
79
80#!/bin/sh
81export I2P=~/i2p
82java -cp $I2P/lib/i2p.jar:$I2P/lib/jbigi.jar net.i2p.util.NativeBigInteger
Note: See TracBrowser for help on using the repository browser.