I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Makefile.gcj 4.96 KiB
Newer Older
jrandom's avatar
jrandom committed
# 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
zzz's avatar
zzz committed
ANT_TARGET=build2
jrandom's avatar
jrandom committed
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
jrandom's avatar
jrandom committed
JAR_CLIENTS=i2ptunnel.jar sam.jar
jrandom's avatar
jrandom committed
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
jrandom's avatar
jrandom committed
LIBI2P_JARS=${JAR_BASE} ${JAR_CLIENTS} ${JAR_ROUTER} ${JAR_JBIGI}
zzz's avatar
zzz committed
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
jrandom's avatar
jrandom committed

#${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
jrandom's avatar
jrandom committed
#SYSTEM_PROPS=-Di2p.weakPRNG=true
jrandom's avatar
jrandom committed

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 
jrandom's avatar
jrandom committed
	@echo "* i2p_dsa is a simple test app with the DSA engine and Fortuna PRNG to make sure crypto is working"
jrandom's avatar
jrandom committed
	@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 
jrandom's avatar
jrandom committed
	@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 
jrandom's avatar
jrandom committed
	@echo "* i2ptunnelctl is a controller for I2PTunnel, reading i2ptunnel.config"
	@echo "  and launching the appropriate proxies"
jrandom's avatar
jrandom committed
	#@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 
jrandom's avatar
jrandom committed
	@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:
zzz's avatar
zzz committed
	@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"