From 8c70af56ad15dabd7d83b82660831ef7b8d58188 Mon Sep 17 00:00:00 2001
From: kytv
Date: Sun, 8 Jan 2012 16:35:53 +0000
Subject: [PATCH 01/12] refreshed patch
---
debian/patches/0002-jbigi-soname.patch | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/debian/patches/0002-jbigi-soname.patch b/debian/patches/0002-jbigi-soname.patch
index a4f91eacf8..f38d5fb89d 100644
--- a/debian/patches/0002-jbigi-soname.patch
+++ b/debian/patches/0002-jbigi-soname.patch
@@ -27,6 +27,6 @@ a soname to shut lintian up.
rm -f jbigi.o $LIBFILE
-$CC -c $COMPILEFLAGS $INCLUDES ../../jbigi/src/jbigi.c || exit 1
+$CC -c $COMPILEFLAGS $INCLUDES ./jbigi/src/jbigi.c || exit 1
- $CC $LINKFLAGS $INCLUDES $INCLUDELIBS -o $LIBFILE jbigi.o $STATICLIBS || exit 1
+ $CC $LINKFLAGS $INCLUDES -o $LIBFILE jbigi.o $INCLUDELIBS $STATICLIBS || exit 1
exit 0
From 430ac8323fddb7502b35f515e94c708e36dd861a Mon Sep 17 00:00:00 2001
From: kytv
Date: Sun, 8 Jan 2012 19:08:04 +0000
Subject: [PATCH 02/12] Really send HUP signal when called with the graceful
parameter
---
installer/resources/i2prouter | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/installer/resources/i2prouter b/installer/resources/i2prouter
index 02b21ac987..eb9c476f68 100644
--- a/installer/resources/i2prouter
+++ b/installer/resources/i2prouter
@@ -1099,7 +1099,7 @@ graceful() {
# Running so try to stop it.
# This sends HUP. router.gracefulHUP must be set in router.config,
# or else this will do the same as stop.
- kill $pid
+ kill -HUP $pid
if [ $? -ne 0 ]
then
# An explanation for the failure should have been given
From 527c4b58c1b41a1f23c9c779e70d8c10a63b6d44 Mon Sep 17 00:00:00 2001
From: dev
Date: Sun, 8 Jan 2012 19:45:01 +0000
Subject: [PATCH 03/12] Added support for i7 Extreme Edition processors.
---
.../src/freenet/support/CPUInformation/IntelInfoImpl.java | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/core/java/src/freenet/support/CPUInformation/IntelInfoImpl.java b/core/java/src/freenet/support/CPUInformation/IntelInfoImpl.java
index 044088e10a..d469262f88 100644
--- a/core/java/src/freenet/support/CPUInformation/IntelInfoImpl.java
+++ b/core/java/src/freenet/support/CPUInformation/IntelInfoImpl.java
@@ -238,9 +238,15 @@ class IntelInfoImpl extends CPUIDCPUInfo implements IntelCPUInfo
case 10:
modelString = "Core i7/i5 (32nm)";
break;
+ case 11:
+ modelString = "Core i7/i5 (32nm)";
+ break;
case 12:
modelString = "Core i7 (32nm)";
break;
+ case 12:
+ modelString = "Core i7 Extreme Edition (32nm)";
+ break;
case 14:
modelString = "Xeon MP (45nm)";
break;
From f5b6d5648915aadc11eb4a889020b828a76f5628 Mon Sep 17 00:00:00 2001
From: dev
Date: Sun, 8 Jan 2012 19:54:22 +0000
Subject: [PATCH 04/12] Added support for AMD Bulldozer CPUs. Fixed issue with
last commit.
---
.../support/CPUInformation/AMDCPUInfo.java | 4 ++++
.../support/CPUInformation/AMDInfoImpl.java | 19 +++++++++++++++++++
.../support/CPUInformation/IntelInfoImpl.java | 2 +-
3 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/core/java/src/freenet/support/CPUInformation/AMDCPUInfo.java b/core/java/src/freenet/support/CPUInformation/AMDCPUInfo.java
index 174bbe4ed8..8d36c2cac7 100644
--- a/core/java/src/freenet/support/CPUInformation/AMDCPUInfo.java
+++ b/core/java/src/freenet/support/CPUInformation/AMDCPUInfo.java
@@ -43,4 +43,8 @@ public interface AMDCPUInfo extends CPUInfo {
* @return true if the CPU present in the machine is at least an 'k8' CPU (Atlhon 64, Opteron etc. and better)
*/
public boolean IsBobcatCompatible();
+ /**
+ * @return true if the CPU present in the machine is at least a 'bulldozer' CPU
+ */
+ public boolean IsBulldozerCompatible();
}
diff --git a/core/java/src/freenet/support/CPUInformation/AMDInfoImpl.java b/core/java/src/freenet/support/CPUInformation/AMDInfoImpl.java
index 9b60af9060..222f6e66d8 100644
--- a/core/java/src/freenet/support/CPUInformation/AMDInfoImpl.java
+++ b/core/java/src/freenet/support/CPUInformation/AMDInfoImpl.java
@@ -13,6 +13,7 @@ class AMDInfoImpl extends CPUIDCPUInfo implements AMDCPUInfo
protected static boolean isAthlonCompatible = false;
protected static boolean isAthlon64Compatible = false;
protected static boolean isBobcatCompatible = false;
+ protected static boolean isBulldozerCompatible = false;
// If modelString != null, the cpu is considered correctly identified.
protected static String modelString = null;
@@ -31,6 +32,8 @@ class AMDInfoImpl extends CPUIDCPUInfo implements AMDCPUInfo
public boolean IsBobcatCompatible(){ return isBobcatCompatible; }
+ public boolean IsBulldozerCompatible(){ return isBulldozerCompatible; }
+
static
{
identifyCPU();
@@ -349,6 +352,22 @@ class AMDInfoImpl extends CPUIDCPUInfo implements AMDCPUInfo
break;
}
}
+ //Bulldozer
+ if(CPUID.getCPUFamily() + CPUID.getCPUExtendedFamily() == 21){
+ isK6Compatible = true;
+ isK6_2_Compatible = true;
+ isK6_3_Compatible = true;
+ isAthlonCompatible = true;
+ isAthlon64Compatible = true;
+ isBobcatCompatible = true;
+ isBulldozerCompatible = true;
+ isX64 = true;
+ switch(CPUID.getCPUModel() + CPUID.getCPUExtendedModel()){
+ case 1:
+ modelString = "Bulldozer FX-6***/FX-8***";
+ break;
+ }
+ }
}
public boolean hasX64()
diff --git a/core/java/src/freenet/support/CPUInformation/IntelInfoImpl.java b/core/java/src/freenet/support/CPUInformation/IntelInfoImpl.java
index d469262f88..af2da3b484 100644
--- a/core/java/src/freenet/support/CPUInformation/IntelInfoImpl.java
+++ b/core/java/src/freenet/support/CPUInformation/IntelInfoImpl.java
@@ -244,7 +244,7 @@ class IntelInfoImpl extends CPUIDCPUInfo implements IntelCPUInfo
case 12:
modelString = "Core i7 (32nm)";
break;
- case 12:
+ case 13:
modelString = "Core i7 Extreme Edition (32nm)";
break;
case 14:
From b09071f20f1d28bda9edf4314dc6f53227288ac0 Mon Sep 17 00:00:00 2001
From: kytv
Date: Sun, 8 Jan 2012 23:23:00 +0000
Subject: [PATCH 05/12] update of jbigi scripts
- merge mbuild_jbigi.sh into build_jbigi.sh and drop mbuild_jbigi.sh
- make build.sh's tests optional
- try to determine the locations of JAVA_HOME and I2P
---
core/c/jbigi/README | 5 +-
core/c/jbigi/build.sh | 125 +++++++++++++++++--------
core/c/jbigi/build_jbigi.sh | 95 +++++++++----------
core/c/jbigi/find-java-home | 24 +++++
core/c/jbigi/mbuild-all.sh | 2 +-
core/c/jbigi/mbuild_jbigi.sh | 72 --------------
debian/patches/0002-jbigi-soname.patch | 16 ++--
7 files changed, 168 insertions(+), 171 deletions(-)
create mode 100644 core/c/jbigi/find-java-home
delete mode 100755 core/c/jbigi/mbuild_jbigi.sh
diff --git a/core/c/jbigi/README b/core/c/jbigi/README
index 98cba74c02..9e06381d6d 100644
--- a/core/c/jbigi/README
+++ b/core/c/jbigi/README
@@ -10,9 +10,10 @@ TODO: Document generated folder structure
Linux-specific information:
===========================
-Some linux distributions comes bundled with GMP.
+Some linux distributions come bundled with GMP.
Try 'locate lib/libgmp.so' to see.
-If so, install the the libgmp3-dev debian package to get the libgmp headers.
+
+In Debian/Ubuntu, install the the libgmp3-dev package to get the libgmp headers.
Then export I2P=/path/to/your/i2p/install.
Then do 'build.sh dynamic'. This will do a quick build using your installed libgmp library
and then test it and the jbigi in your I2P installation to see which is faster.
diff --git a/core/c/jbigi/build.sh b/core/c/jbigi/build.sh
index e511a0fd89..f87932e485 100755
--- a/core/c/jbigi/build.sh
+++ b/core/c/jbigi/build.sh
@@ -17,63 +17,106 @@
# The resulting library is lib/libjbigi.so
#
-mkdir -p lib/
-mkdir -p bin/local
+rm -rf bin/local
+mkdir -p lib bin/local
+
+# Use 4.3.2 32bit CPUs.
+# Use 5.0.2 64bit CPUs.
VER=4.3.2
+# If JAVA_HOME isn't set, try to figure it out on our own
+[ -z $JAVA_HOME ] && . ./find-java-home
+if [ ! -f "$JAVA_HOME/include/jni.h" ]; then
+ echo "ERROR: Cannot find jni.h! Looked in \"$JAVA_HOME/include/jni.h\"" >&2
+ echo "Please set JAVA_HOME to a java home that has the JNI" >&2
+ exit 1
+fi
+
+# Abort script on uncaught errors
set -e
-if [ "$1" != "dynamic" -a ! -d gmp-$VER ]
-then
- TAR=gmp-$VER.tar.bz2
- if [ ! -f $TAR ]
- then
- echo "Downloading ftp://ftp.gmplib.org/pub/gmp-${VER}/gmp-${VER}.tar.bz2"
- wget ftp://ftp.gmplib.org/pub/gmp-${VER}/gmp-${VER}.tar.bz2
- fi
+download_gmp ()
+{
+if [ $(which wget) ]; then
+ echo "Downloading ftp://ftp.gmplib.org/pub/gmp-${VER}/${TAR}"
+ wget -N --progress=dot ftp://ftp.gmplib.org/pub/gmp-${VER}/${TAR}
+else
+ echo "ERROR: Cannot find wget." >&2
+ echo >&2
+ echo "Please download ftp://ftp.gmplib.org/pub/gmp-${VER}/${TAR}" >&2
+ echo "manually and rerun this script." >&2
+ exit 1
+fi
+}
- echo "Building the jbigi library with GMP Version $VER"
+extract_gmp ()
+{
+tar -xjf ${TAR} > /dev/null 2>&1|| (rm -f ${TAR} && download_gmp && extract_gmp || exit 1)
+}
- echo "Extracting GMP..."
- tar -xjf gmp-$VER.tar.bz2
+TAR=gmp-${VER}.tar.bz2
+
+if [ "$1" != "dynamic" -a ! -d gmp-${VER} ]; then
+ if [ ! -f $TAR ]; then
+ download_gmp
+ fi
+
+ echo "Building the jbigi library with GMP Version ${VER}"
+ echo "Extracting GMP..."
+ extract_gmp
fi
cd bin/local
echo "Building..."
-if [ "$1" != "dynamic" ]
-then
- case `uname -sr` in
- Darwin*)
- # --with-pic is required for static linking
- ../../gmp-$VER/configure --with-pic;;
- *)
- # and it's required for ASLR
- ../../gmp-$VER/configure --with-pic;;
- esac
- make
- sh ../../build_jbigi.sh static
+if [ "$1" != "dynamic" ]; then
+ case `uname -sr` in
+ Darwin*)
+ # --with-pic is required for static linking
+ ../../gmp-${VER}/configure --with-pic;;
+ *)
+ # and it's required for ASLR
+ ../../gmp-${VER}/configure --with-pic;;
+ esac
+ make
+ sh ../../build_jbigi.sh static
else
- sh ../../build_jbigi.sh dynamic
+ shift
+ sh ../../build_jbigi.sh dynamic
fi
cp *jbigi???* ../../lib/
echo 'Library copied to lib/'
cd ../..
-if [ ! -f $I2P/lib/i2p.jar ]
-then
- echo "I2P installation not found"
- echo "We looked in '$I2P'"
- echo "Not running tests against I2P installation without knowing where it is"
- echo "Please set the environment variable I2P to the location of your I2P installation (so that \$I2P/lib/i2p.jar works)"
- echo "If you do so, this script will run two tests to compare your installed jbigi with the one here you just compiled (to see if there is a marked improvement)"
- exit 1
+if [ "$1" != "notest" ]; then
+ if [ -z "$I2P" ]; then
+ if [ -r $HOME/i2p/lib/i2p.jar ]; then
+ I2P="$HOME/i2p"
+ elif [ -r /usr/share/i2p/lib/i2p.jar ]; then
+ I2P="/usr/share/i2p"
+ else
+ echo "Please set the environment variable \$I2P to run tests." >&2
+ fi
+ fi
+
+ if [ ! -f $I2P/lib/i2p.jar ]; then
+ echo "I2P installation not found" >&2
+ echo "We looked in $I2P" >&2
+ echo "Not running tests against I2P installation without knowing where it is." >&2
+ echo >&2
+ echo "Please set the environment variable I2P to the location of your"
+ echo "I2P installation (so that \$I2P/lib/i2p.jar works)." >&2
+ echo "If you do so, this script will run two tests to compare your" >&2
+ echo "installed jbigi with the one here you just compiled to see if" >&2
+ echo "there is a marked improvement." >&2
+ exit 1
+ fi
+ echo 'Running test with standard I2P installation...'
+ java -cp $I2P/lib/i2p.jar:$I2P/lib/jbigi.jar net.i2p.util.NativeBigInteger
+ echo
+ echo 'Running test with new libjbigi...'
+ java -Djava.library.path=lib/ -cp $I2P/lib/i2p.jar:$I2P/lib/jbigi.jar net.i2p.util.NativeBigInteger
+ echo 'If the second run shows better performance, please use the jbigi that you have compiled so that I2P will work better!'
+ echo "(You can do that just by copying lib/libjbigi.so over the existing libjbigi.so file in \$I2P)"
fi
-echo 'Running test with standard I2P installation...'
-java -cp $I2P/lib/i2p.jar:$I2P/lib/jbigi.jar net.i2p.util.NativeBigInteger
-echo
-echo 'Running test with new libjbigi...'
-java -Djava.library.path=lib/ -cp $I2P/lib/i2p.jar:$I2P/lib/jbigi.jar net.i2p.util.NativeBigInteger
-echo 'If the second is better performance, please use the jbigi you have compiled i2p will work better!'
-echo '(You can do that just by copying lib/libjbigi.so over the existing libjbigi.so file in $I2P)'
diff --git a/core/c/jbigi/build_jbigi.sh b/core/c/jbigi/build_jbigi.sh
index b5f45b7dbc..91135d211d 100755
--- a/core/c/jbigi/build_jbigi.sh
+++ b/core/c/jbigi/build_jbigi.sh
@@ -1,61 +1,62 @@
#!/bin/sh
-# When executed in Mingw: Produces an jbigi.dll
-# When executed in Linux/FreeBSD: Produces an libjbigi.so
-# Darwin produces libjbigi.jnilib, right?
-
+# When executed in Mingw: Produces a jbigi.dll
+# When executed in Linux/FreeBSD: Produces a libjbigi.so
+# When executed in OSX: Produces a libjbigi.jnilib
CC="gcc"
-case `uname -sr` in
-MINGW*)
- JAVA_HOME="c:/software/j2sdk1.4.2_05"
- COMPILEFLAGS="-Wall"
- INCLUDES="-I. -I../../jbigi/include -I$JAVA_HOME/include/win32/ -I$JAVA_HOME/include/"
- LINKFLAGS="-shared -Wl,--kill-at"
- LIBFILE="jbigi.dll";;
-CYGWIN*)
- JAVA_HOME="c:/software/j2sdk1.4.2_05"
- COMPILEFLAGS="-Wall -mno-cygwin"
- INCLUDES="-I. -I../../jbigi/include -I$JAVA_HOME/include/win32/ -I$JAVA_HOME/include/"
- LINKFLAGS="-shared -Wl,--kill-at"
- LIBFILE="jbigi.dll";;
-Darwin*)
- JAVA_HOME="/Library/Java/Home"
- COMPILEFLAGS="-Wall"
- INCLUDES="-I. -I../../jbigi/include -I$JAVA_HOME/include"
- LINKFLAGS="-dynamiclib -framework JavaVM"
- LIBFILE="libjbigi.jnilib";;
-SunOS*)
- COMPILEFLAGS="-fPIC -Wall"
- INCLUDES="-I. -I../../jbigi/include -I$JAVA_HOME/include -I$JAVA_HOME/include/solaris"
- LINKFLAGS="-shared -Wl,-soname,libjbigi.so"
- LIBFILE="libjbigi.so";;
-*)
- COMPILEFLAGS="-fPIC -Wall"
- INCLUDES="-I. -I../../jbigi/include -I$JAVA_HOME/include -I$JAVA_HOME/include/linux"
- LINKFLAGS="-shared -Wl,-soname,libjbigi.so"
- LIBFILE="libjbigi.so";;
-esac
-
+# If JAVA_HOME isn't set we'll try to figure it out
+[ -z $JAVA_HOME ] && . ./find-java-home
if [ ! -f "$JAVA_HOME/include/jni.h" ]; then
echo "Cannot find jni.h! Looked in '$JAVA_HOME/include/jni.h'"
echo "Please set JAVA_HOME to a java home that has the JNI"
exit 1
fi
-#To link dynamically to GMP (use libgmp.so or gmp.lib), uncomment the first line below
-#To link statically to GMP, uncomment the second line below
-# Bug!!! Quote *BOTH* or neither! --Sponge
-if test "$1" = "dynamic"
-then
- echo "Building jbigi lib that is dynamically linked to GMP"
- LIBPATH="-L.libs"
- INCLUDELIBS="-lgmp"
+case `uname -s` in
+MINGW*)
+ JAVA_HOME="c:/software/j2sdk1.4.2_05"
+ COMPILEFLAGS="-Wall"
+ INCLUDES="-I. -I../../jbigi/include -I$JAVA_HOME/include/win32/ -I$JAVA_HOME/include/"
+ LINKFLAGS="-shared -Wl,--kill-at"
+ LIBFILE="jbigi.dll";;
+CYGWIN*)
+ JAVA_HOME="c:/software/j2sdk1.4.2_05"
+ COMPILEFLAGS="-Wall -mno-cygwin"
+ INCLUDES="-I. -I../../jbigi/include -I$JAVA_HOME/include/win32/ -I$JAVA_HOME/include/"
+ LINKFLAGS="-shared -Wl,--kill-at"
+ LIBFILE="jbigi.dll";;
+Darwin*)
+ JAVA_HOME=$(/usr/libexec/java_home)
+ COMPILEFLAGS="-fPIC -Wall"
+ INCLUDES="-I. -I../../jbigi/include -I$JAVA_HOME/include"
+ LINKFLAGS="-dynamiclib -framework JavaVM"
+ LIBFILE="libjbigi.jnilib";;
+SunOS*|OpenBSD*|NetBSD*|FreeBSD*|Linux*)
+ UNIXTYPE=$(uname -s | tr "[A-Z]" "[a-z]")
+ if [ $UNIXTYPE = "sunos" ]; then
+ UNIXTYPE="solaris"
+ fi
+ COMPILEFLAGS="-fPIC -Wall"
+ INCLUDES="-I. -I../../jbigi/include -I$JAVA_HOME/include -I$JAVA_HOME/include/${UNIXTYPE}"
+ LINKFLAGS="-shared -Wl,-soname,libjbigi.so"
+ LIBFILE="libjbigi.so";;
+*)
+ echo "Unsupported system type."
+ exit 1;;
+esac
+
+if [ "$1" = "dynamic" ] ; then
+ echo "Building a jbigi lib that is dynamically linked to GMP"
+ LIBPATH="-L.libs"
+ INCLUDELIBS="-lgmp"
else
- echo "Building jbigi lib that is statically linked to GMP"
- STATICLIBS=".libs/libgmp.a"
+ echo "Building a jbigi lib that is statically linked to GMP"
+ STATICLIBS=".libs/libgmp.a"
fi
echo "Compiling C code..."
rm -f jbigi.o $LIBFILE
-$CC -c $COMPILEFLAGS $INCLUDES ../../jbigi/src/jbigi.c
-$CC $LINKFLAGS $INCLUDES -o $LIBFILE jbigi.o $INCLUDELIBS $STATICLIBS
+$CC -c $COMPILEFLAGS $INCLUDES ../../jbigi/src/jbigi.c || exit 1
+$CC $LINKFLAGS $INCLUDES -o $LIBFILE jbigi.o $INCLUDELIBS $STATICLIBS || exit 1
+
+exit 0
diff --git a/core/c/jbigi/find-java-home b/core/c/jbigi/find-java-home
new file mode 100644
index 0000000000..fd069f4a64
--- /dev/null
+++ b/core/c/jbigi/find-java-home
@@ -0,0 +1,24 @@
+UNIXTYPE=$(uname -s | tr "[A-Z]" "[a-z]")
+if [ $UNIXTYPE = "freebsd" ]; then
+ if [ -d /usr/local/openjdk6 ]; then
+ JAVA_HOME="/usr/local/openjdk6"
+ elif [ -d /usr/local/openjdk7 ]; then
+ JAVA_HOME="/usr/local/openjdk7"
+ fi
+elif [ $UNIXTYPE = "openbsd" ]; then
+ if [ -d /usr/local/jdk-1.7.0 ]; then
+ JAVA_HOME="/usr/local/jdk-1.7.0"
+ fi
+elif [ $UNIXTYPE = "netbsd" ]; then
+ if [ -d /usr/pkg/java/openjdk7 ]; then
+ JAVA_HOME="/usr/pkg/java/openjdk7"
+ fi
+elif [ $UNIXTYPE = "linux" ] && [ -e /etc/debian_version ]; then
+ if [ -d /usr/lib/jvm/default-java ]; then
+ JAVA_HOME="/usr/lib/jvm/default-java"
+ fi
+elif [ $UNIXTYPE = "darwin" ]; then
+ JAVA_HOME=$(/usr/libexec/java_home)
+fi
+
+export JAVA_HOME
diff --git a/core/c/jbigi/mbuild-all.sh b/core/c/jbigi/mbuild-all.sh
index c257278caf..711b960df0 100755
--- a/core/c/jbigi/mbuild-all.sh
+++ b/core/c/jbigi/mbuild-all.sh
@@ -154,7 +154,7 @@ esac
make_static () {
$ECHO "Attempting .${4} creation for ${3}${5}${2}"
- ../../mbuild_jbigi.sh static || return 1
+ ../../build_jbigi.sh static || return 1
cp ${3}.${4} ../../lib/net/i2p/util/${3}${5}${2}.${4}
return 0
}
diff --git a/core/c/jbigi/mbuild_jbigi.sh b/core/c/jbigi/mbuild_jbigi.sh
deleted file mode 100755
index 4b05dc4f3c..0000000000
--- a/core/c/jbigi/mbuild_jbigi.sh
+++ /dev/null
@@ -1,72 +0,0 @@
-#!/bin/sh
-# When executed in Mingw: Produces a jbigi.dll
-# When executed in Linux/FreeBSD: Produces a libjbigi.so
-# When executed in OSX: Produces a libjbigi.jnilib
-CC="gcc"
-
-case `uname -s` in
-MINGW*)
- JAVA_HOME="c:/software/j2sdk1.4.2_05"
- COMPILEFLAGS="-Wall"
- INCLUDES="-I. -I../../jbigi/include -I$JAVA_HOME/include/win32/ -I$JAVA_HOME/include/"
- LINKFLAGS="-shared -Wl,--kill-at"
- LIBFILE="jbigi.dll";;
-CYGWIN*)
- JAVA_HOME="c:/software/j2sdk1.4.2_05"
- COMPILEFLAGS="-Wall -mno-cygwin"
- INCLUDES="-I. -I../../jbigi/include -I$JAVA_HOME/include/win32/ -I$JAVA_HOME/include/"
- LINKFLAGS="-shared -Wl,--kill-at"
- LIBFILE="jbigi.dll";;
-Darwin*)
- JAVA_HOME=$(/usr/libexec/java_home)
- COMPILEFLAGS="-fPIC -Wall"
- INCLUDES="-I. -I../../jbigi/include -I$JAVA_HOME/include"
- LINKFLAGS="-dynamiclib -framework JavaVM"
- LIBFILE="libjbigi.jnilib";;
-SunOS*|OpenBSD*|NetBSD*|FreeBSD*|Linux*)
- UNIXTYPE=$(uname -s | tr "[A-Z]" "[a-z]")
- if [ $UNIXTYPE = "sunos" ]; then
- UNIXTYPE="solaris"
- elif [ $UNIXTYPE = "freebsd" ]; then
- if [ -d /usr/local/openjdk6 ]; then
- JAVA_HOME="/usr/local/openjdk6"
- elif [ -d /usr/local/openjdk7 ]; then
- JAVA_HOME="/usr/local/openjdk7"
- fi
- elif [ $UNIXTYPE = "openbsd" ]; then
- if [ -d /usr/local/jdk-1.7.0 ]; then
- JAVA_HOME="/usr/local/jdk-1.7.0"
- fi
- elif [ $UNIXTYPE = "netbsd" ]; then
- if [ -d /usr/pkg/java/openjdk7 ]; then
- JAVA_HOME="/usr/pkg/java/openjdk7"
- fi
- elif [ $UNIXTYPE = "linux" ] && [ -e /etc/debian_version ]; then
- if [ -d /usr/lib/jvm/default-java ]; then
- JAVA_HOME="/usr/lib/jvm/default-java"
- fi
- fi
- COMPILEFLAGS="-fPIC -Wall"
- INCLUDES="-I. -I../../jbigi/include -I$JAVA_HOME/include -I$JAVA_HOME/include/${UNIXTYPE}"
- LINKFLAGS="-shared -Wl,-soname,libjbigi.so"
- LIBFILE="libjbigi.so";;
-*)
- echo "Unsupported system type."
- exit 1;;
-esac
-
-if [ "$1" = "dynamic" ] ; then
- echo "Building a jbigi lib that is dynamically linked to GMP"
- LIBPATH="-L.libs"
- INCLUDELIBS="-lgmp"
-else
- echo "Building a jbigi lib that is statically linked to GMP"
- STATICLIBS=".libs/libgmp.a"
-fi
-
-echo "Compiling C code..."
-rm -f jbigi.o $LIBFILE
-$CC -c $COMPILEFLAGS $INCLUDES ../../jbigi/src/jbigi.c || exit 1
-$CC $LINKFLAGS $INCLUDES -o $LIBFILE jbigi.o $INCLUDELIBS $STATICLIBS || exit 1
-
-exit 0
diff --git a/debian/patches/0002-jbigi-soname.patch b/debian/patches/0002-jbigi-soname.patch
index f38d5fb89d..09085deb6e 100644
--- a/debian/patches/0002-jbigi-soname.patch
+++ b/debian/patches/0002-jbigi-soname.patch
@@ -2,18 +2,18 @@ From: Kill Your TV
Date: Wed, 11 May 2011 00:12:04 +0000
Subject: jbigi soname
-The purpose of this patch is to change the path that mbuild_jbigi.sh
+The purpose of this patch is to change the path that build_jbigi.sh
expects to find the source files at. At the same time I'm specifying
a soname to shut lintian up.
---
- core/c/jbigi/mbuild_jbigi.sh | 6 +++---
- 1 files changed, 3 insertions(+), 3 deletions(-)
+ core/c/jbigi/build_jbigi.sh | 4 +++---
+ 1 files changed, 2 insertions(+), 2 deletions(-)
---- a/core/c/jbigi/mbuild_jbigi.sh
-+++ b/core/c/jbigi/mbuild_jbigi.sh
-@@ -47,7 +47,7 @@
- fi
+--- a/core/c/jbigi/build_jbigi.sh
++++ b/core/c/jbigi/build_jbigi.sh
+@@ -37,7 +37,7 @@
+ UNIXTYPE="solaris"
fi
COMPILEFLAGS="-fPIC -Wall"
- INCLUDES="-I. -I../../jbigi/include -I$JAVA_HOME/include -I$JAVA_HOME/include/${UNIXTYPE}"
@@ -21,7 +21,7 @@ a soname to shut lintian up.
LINKFLAGS="-shared -Wl,-soname,libjbigi.so"
LIBFILE="libjbigi.so";;
*)
-@@ -66,7 +66,7 @@
+@@ -56,7 +56,7 @@
echo "Compiling C code..."
rm -f jbigi.o $LIBFILE
From 0f62383aecbbe5d9e9ee394b237bbb4815c748fa Mon Sep 17 00:00:00 2001
From: kytv
Date: Sun, 8 Jan 2012 23:25:36 +0000
Subject: [PATCH 06/12] Reference /etc/i2p/wrapper.config when OOM when using
Debian packages
When I2P terminates with an OOM error, users are advised to update
$I2P/wrapper.config. That path isn't accurate for the Debian packages.
---
debian/patches/0004-oom-listener.patch | 11 +++++++++++
debian/patches/series | 1 +
2 files changed, 12 insertions(+)
create mode 100644 debian/patches/0004-oom-listener.patch
diff --git a/debian/patches/0004-oom-listener.patch b/debian/patches/0004-oom-listener.patch
new file mode 100644
index 0000000000..f803b8d9ef
--- /dev/null
+++ b/debian/patches/0004-oom-listener.patch
@@ -0,0 +1,11 @@
+--- a/router/java/src/net/i2p/router/tasks/OOMListener.java
++++ b/router/java/src/net/i2p/router/tasks/OOMListener.java
+@@ -33,7 +33,7 @@
+ // gobble
+ }
+ }
+- log.log(Log.CRIT, "To prevent future shutdowns, increase wrapper.java.maxmemory in $I2P/wrapper.config");
++ log.log(Log.CRIT, "To prevent future shutdowns, increase wrapper.java.maxmemory in /etc/i2p/wrapper.config");
+ _context.router().shutdown(Router.EXIT_OOM);
+ }
+ }
diff --git a/debian/patches/series b/debian/patches/series
index a289a6ae12..32c3c507a6 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,4 @@
0001-path-substitution.patch
0002-jbigi-soname.patch
0003-renaming-jcpuid.patch
+0004-oom-listener.patch
From 5fd6698d0536e207a7c0e40e24e61665294d0a6c Mon Sep 17 00:00:00 2001
From: kytv
Date: Sun, 8 Jan 2012 23:26:39 +0000
Subject: [PATCH 07/12] Refresh patch due to wrapper.config additions
---
debian/patches/0001-path-substitution.patch | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/debian/patches/0001-path-substitution.patch b/debian/patches/0001-path-substitution.patch
index dcbce0253a..f6b6c93107 100644
--- a/debian/patches/0001-path-substitution.patch
+++ b/debian/patches/0001-path-substitution.patch
@@ -105,7 +105,7 @@ Debian wrapper.config to try to prevent confusion.
# Java Bits. On applicable platforms, tells the JVM to run in 32 or 64-bit mode.
wrapper.java.additional.auto_bits=TRUE
-@@ -69,7 +61,7 @@
+@@ -71,7 +63,7 @@
wrapper.java.additional.1=-DloggerFilenameOverride=logs/log-router-@.txt
wrapper.java.additional.2=-Dorg.mortbay.http.Version.paranoid=true
wrapper.java.additional.3=-Dorg.mortbay.xml.XmlParser.NotValidating=true
@@ -114,7 +114,7 @@ Debian wrapper.config to try to prevent confusion.
wrapper.java.additional.4.stripquotes=TRUE
# On some IPv6 enabled systems, I2P and other network-enabled java applications
-@@ -139,11 +131,7 @@
+@@ -141,11 +133,7 @@
# tell the router where to find the wrapper log
# (change X to the next available number)
# wrapper.java.additional.X=-Dwrapper.logfile=/path/to/wrapper.log
@@ -127,7 +127,7 @@ Debian wrapper.config to try to prevent confusion.
# Format of output for the log file.
# The format consists of the tokens 'L' for log level, 'P' for prefix, 'D' for thread,
-@@ -205,10 +193,7 @@
+@@ -211,10 +199,7 @@
# you should copy this file, change the location or file name,
# and edit the i2prouter script to change the WRAPPER_CONF setting
# to point to the new wrapper.config location.
@@ -139,7 +139,7 @@ Debian wrapper.config to try to prevent confusion.
# pid file for the service monitoring the JVM
#
# From i2prouter:
-@@ -219,10 +204,7 @@
+@@ -225,10 +210,7 @@
#
# This means i2prouter looks for './i2p.pid'.
# See comments above for wrapper.java.pidfile
@@ -151,7 +151,7 @@ Debian wrapper.config to try to prevent confusion.
#********************************************************************
# Wrapper General Properties
-@@ -239,30 +221,3 @@
+@@ -245,30 +227,3 @@
wrapper.umask=0022
wrapper.java.umask=0022
wrapper.logfile.umask=077
From ce27d69e39d14c19ca8ead6e00ba26f908802ed1 Mon Sep 17 00:00:00 2001
From: zzz
Date: Mon, 9 Jan 2012 23:57:17 +0000
Subject: [PATCH 08/12] - Add info to error 500 page
---
apps/routerconsole/jsp/error500.jsp | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/apps/routerconsole/jsp/error500.jsp b/apps/routerconsole/jsp/error500.jsp
index c4af35bb1f..56ebe9b177 100644
--- a/apps/routerconsole/jsp/error500.jsp
+++ b/apps/routerconsole/jsp/error500.jsp
@@ -55,9 +55,14 @@
I2P version: <%=net.i2p.router.RouterVersion.FULL_VERSION%>
Java version: <%=System.getProperty("java.vendor")%> <%=System.getProperty("java.version")%> (<%=System.getProperty("java.runtime.name")%> <%=System.getProperty("java.runtime.version")%>)
+Wrapper version: <%=System.getProperty("wrapper.version", "none")%>
+
+ " />
+Server version:
Platform: <%=System.getProperty("os.name")%> <%=System.getProperty("os.arch")%> <%=System.getProperty("os.version")%>
Processor: <%=net.i2p.util.NativeBigInteger.cpuModel()%> (<%=net.i2p.util.NativeBigInteger.cpuType()%>)
Jbigi: <%=net.i2p.util.NativeBigInteger.loadStatus()%>
-Encoding: <%=System.getProperty("file.encoding")%>
+Encoding: <%=System.getProperty("file.encoding")%>
+Charset: <%=java.nio.charset.Charset.defaultCharset().name()%>
<%=intl._("Note that system information, log timestamps, and log messages may provide clues to your location; please review everything you include in a bug report.")%>