~i2p.packages/i2p/trunk

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# Makefile for building native I2P binaries and libraries with GCJ
#
# WARNING: Do not use this yet, as it may explode (etc).
#
GCJ=gcj #/usr/local/gcc-4.0.2/bin/gcj
EXTRA_LD_PATH= #/usr/local/gcc-4.0.2/lib
ANT=ant #/opt/apache-ant-1.6.5/bin/ant
ANT_TARGET=build2
NATIVE_DIR=native

## 
# Define what jar files get into libi2p.so.  The current setup is
# *incredibly* lazy, throwing everything in the .so, rather than
# give each .jar file its own .so.
#  i2p.jar: base SDK
#  mstreaming.jar: streaming API
#  streaming.jar: full streaming lib implementation
#  i2ptunnel.jar: I2PTunnel proxy
#  sam.jar: SAM bridge and API
#  i2psnark.jar: bittorrent client
#  router.jar: full I2P router
#  jbigi.jar: collection of native optimized GMP routines for crypto
JAR_BASE=i2p.jar mstreaming.jar streaming.jar
JAR_CLIENTS=i2ptunnel.jar sam.jar
JAR_ROUTER=router.jar
JAR_JBIGI=jbigi.jar
JAR_CONSOLE=\
            javax.servlet.jar \
            commons-el.jar \
            commons-logging.jar \
	    jasper-runtime.jar \
            jasper-compiler.jar \
            org.mortbay.jetty.jar \
	    routerconsole.jar
LIBI2P_JARS=${JAR_BASE} ${JAR_CLIENTS} ${JAR_ROUTER} ${JAR_JBIGI}
LIBSAM_JARS=${JAR_BASE} sam.jar
LIBROUTER_JARS=i2p.jar ${JAR_ROUTER} ${JAR_JBIGI}
LIBCONSOLE_JARS=${LIBROUTER_JARS} ${JAR_CONSOLE}
LIBSNARK_JARS=${LIBROUTER_JARS} i2psnark.jar
# update:
# similar error with gcj 4.3.3.
#
# unfortunately, its not quite ready for most end users, as the
# ${JAR_CONSOLE} fails to compile with: 
# org/apache/commons/logging/impl/LogKitLogger.java: In class 'org.apache.commons.logging.impl.LogKitLogger':
# .../LogKitLogger.java: In constructor '(java.lang.String)':
# .../LogKitLogger.java:91: error: cannot find file for class org.apache.log.Hierarchy
# .../LogKitLogger.java:91: error: cannot find file for class org.apache.log.Hierarchy
# .../LogKitLogger.java:104: error: cannot find file for class org.apache.log.Hierarchy
# .../LogKitLogger.java:104: confused by earlier errors, bailing out

#${JAR_CONSOLE}\
#${JAR_XML} \
#${JAR_SUCKER}
#${JAR_CONSOLE}

SYSTEM_PROPS=-DloggerFilenameOverride=logs/log-router-@.txt \
             -Dorg.mortbay.http.Version.paranoid=true \
	     -Dorg.mortbay.util.FileResource.checkAliases=false \
	     -Dorg.mortbay.xml.XmlParser.NotValidating=true
#SYSTEM_PROPS=-Di2p.weakPRNG=true
OPTIMIZE=-O2
#OPTIMIZE=-O3

LD_LIBRARY_PATH=${EXTRA_LD_PATH}:.

all: jars native
	@echo "* Build complete"

jars:
	@${ANT} ${ANT_TARGET}

clean: native_clean

native: native_clean native_shared
	@echo "* Native code build in ${NATIVE}"

native_clean:
	@rm -rf ${NATIVE_DIR}
	@mkdir ${NATIVE_DIR}

native_shared: libi2p.so
	@cd build ; ${GCJ} ${OPTIMIZE} -fjni -L../${NATIVE_DIR} -li2p ${SYSTEM_PROPS} -o ../${NATIVE_DIR}/i2p_dsa --main=net.i2p.crypto.DSAEngine 
	@echo "* i2p_dsa is a simple test app with the DSA engine and Fortuna PRNG to make sure crypto is working"
	@cd build ; ${GCJ} ${OPTIMIZE} -fjni -L../${NATIVE_DIR} -li2p ${SYSTEM_PROPS} -o ../${NATIVE_DIR}/prng --main=gnu.crypto.prng.FortunaStandalone
	@cd build ; ${GCJ} ${OPTIMIZE} -fjni -L../${NATIVE_DIR} -li2p ${SYSTEM_PROPS} -o ../${NATIVE_DIR}/i2ptunnel --main=net.i2p.i2ptunnel.I2PTunnel 
	@echo "* i2ptunnel is mihi's I2PTunnel CLI"
	@echo "  run it as ./i2ptunnel -cli to avoid awt complaints"
	@cd build ; ${GCJ} ${OPTIMIZE} -fjni -L../${NATIVE_DIR} -li2p ${SYSTEM_PROPS} -o ../${NATIVE_DIR}/i2ptunnelctl --main=net.i2p.i2ptunnel.TunnelControllerGroup 
	@echo "* i2ptunnelctl is a controller for I2PTunnel, reading i2ptunnel.config"
	@echo "  and launching the appropriate proxies"
	#@cd build ; ${GCJ} ${OPTIMIZE} -fjni -L../${NATIVE_DIR} -li2p ${SYSTEM_PROPS} -o ../${NATIVE_DIR}/i2psnark --main=org.klomp.snark.Snark
	#@echo "* i2psnark is an anonymous bittorrent client"
	@cd build ; ${GCJ} ${OPTIMIZE} -fjni -L../${NATIVE_DIR} -li2p ${SYSTEM_PROPS} -o ../${NATIVE_DIR}/i2prouter --main=net.i2p.router.Router 
	@echo "* i2prouter is the main I2P router"
	@echo "  it can be used, and while the router console won't load,"
	@echo "  i2ptunnel will, so it will start all the proxies defined in i2ptunnel.config"

libi2p.so:
	@echo "* Building $@"
	@(cd build ; time ${GCJ} ${OPTIMIZE} -fPIC -fjni -shared -o ../${NATIVE_DIR}/$@ ${LIBI2P_JARS} ; cd .. )
	@ls -l ${NATIVE_DIR}/$@
	@echo "* $@ built"

sam: jars libi2psam.so

libi2psam.so:
	@echo "* Building $@"
	@rm -f ${NATIVE_DIR}/$@
	@(cd build ; time ${GCJ} ${OPTIMIZE} -fPIC -fjni -shared -o ../${NATIVE_DIR}/$@ ${LIBSAM_JARS} ; cd .. )
	@ls -l ${NATIVE_DIR}/$@
	@echo "* $@ built"

router: jars libi2prouter.so

libi2prouter.so:
	@echo "* Building $@"
	@rm -f ${NATIVE_DIR}/$@
	@(cd build ; time ${GCJ} ${OPTIMIZE} -fPIC -fjni -shared -o ../${NATIVE_DIR}/$@ ${LIBROUTER_JARS} ; cd .. )
	@ls -l ${NATIVE_DIR}/$@
	@echo "* $@ built"

console: jars libi2pconsole.so

# doesn't work, see above
libi2pconsole.so:
	@echo "* Building $@"
	@rm -f ${NATIVE_DIR}/$@
	@(cd build ; time ${GCJ} ${OPTIMIZE} -fPIC -fjni -shared -o ../${NATIVE_DIR}/$@ ${LIBCONSOLE_JARS} ; cd .. )
	@ls -l ${NATIVE_DIR}/$@
	@echo "* $@ built"