diff --git a/README.md b/README.md index 179a0f1..496e440 100755 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Then, retrieve this project from git: `git clone https://github.com/knaccc/i2p-zero.git` Note that the current version of this script uses jdk-11.0.2. If this version of Java becomes no longer available for -download, then update the references to jdk-11.0.2 in this folder structure to the later version. To locate a recent +download, then update the references to jdk-11.0.2 in java-config.sh to the later version. To locate a recent JDK download URL, see https://jdk.java.net/11/ Also note that JDKs for Linux, MacOS and Windows will be downloaded, which will total several hundred megabytes. diff --git a/bin/build-launcher.sh b/bin/build-launcher.sh index c2ef72d..01ebee8 100755 --- a/bin/build-launcher.sh +++ b/bin/build-launcher.sh @@ -2,13 +2,6 @@ basedir=$(dirname $(dirname $(readlink -fm $0))) -OS=`uname -s` -if [ $OS = "Darwin" ]; then - export JAVA_HOME=`realpath $basedir/import/jdks/mac/jdk-11.0.2.jdk/Contents/Home` -else - export JAVA_HOME=`realpath $basedir/import/jdks/linux/jdk-11.0.2` -fi - # convert the jar files from an existing I2P build into modules suitable for use with jlink $basedir/bin/convert-jars-to-modules.sh @@ -24,13 +17,13 @@ mkdir -p $basedir/dist/linux $basedir/dist/mac $basedir/dist/win # create OS specific launchers which will bundle together the code and a minimal JVM echo "*** Performing jlink (Linux)" -$JAVA_HOME/bin/jlink --module-path $JAVA_HOME/jmods:target/modules:target/org.getmonero.i2p.embedded.jar --add-modules org.getmonero.i2p.embedded --launcher router=org.getmonero.i2p.embedded --output dist/linux/router --strip-debug --compress 2 --no-header-files --no-man-pages +$JAVA_HOME/bin/jlink --module-path $basedir/import/jdks/linux/jdk-${JDK_VERSION}/jmods:target/modules:target/org.getmonero.i2p.embedded.jar --add-modules org.getmonero.i2p.embedded --output dist/linux/router --strip-debug --compress 2 --no-header-files --no-man-pages echo "*** Performing jlink (Mac)" -$JAVA_HOME/bin/jlink --module-path $basedir/import/jdks/mac/jdk-11.0.2.jdk/Contents/Home/jmods:target/modules:target/org.getmonero.i2p.embedded.jar --add-modules org.getmonero.i2p.embedded --launcher router=org.getmonero.i2p.embedded --output dist/mac/router --strip-debug --compress 2 --no-header-files --no-man-pages +$JAVA_HOME/bin/jlink --module-path $basedir/import/jdks/mac/jdk-${JDK_VERSION}.jdk/Contents/Home/jmods:target/modules:target/org.getmonero.i2p.embedded.jar --add-modules org.getmonero.i2p.embedded --output dist/mac/router --strip-debug --compress 2 --no-header-files --no-man-pages echo "*** Performing jlink (Windows)" -$JAVA_HOME/bin/jlink --module-path $basedir/import/jdks/win/jdk-11.0.2/jmods:target/modules:target/org.getmonero.i2p.embedded.jar --add-modules org.getmonero.i2p.embedded --launcher router=org.getmonero.i2p.embedded --output dist/win/router --strip-debug --compress 2 --no-header-files --no-man-pages +$JAVA_HOME/bin/jlink --module-path $basedir/import/jdks/win/jdk-${JDK_VERSION}/jmods:target/modules:target/org.getmonero.i2p.embedded.jar --add-modules org.getmonero.i2p.embedded --output dist/win/router --strip-debug --compress 2 --no-header-files --no-man-pages cp $basedir/resources/launch.sh $basedir/dist/linux/router/bin/ @@ -52,5 +45,7 @@ zip -d $basedir/dist/win/router/i2p.base/jbigi.jar *-osx-* zip -d $basedir/dist/win/router/i2p.base/jbigi.jar *-linux-* zip -d $basedir/dist/win/router/i2p.base/jbigi.jar *-freebsd-* +du -sh $basedir/dist/* + echo "*** Done ***" echo "To run, type: dist/linux/router/bin/launch.sh" diff --git a/bin/build-original-i2p.sh b/bin/build-original-i2p.sh index 82ac11c..c81b5d5 100755 --- a/bin/build-original-i2p.sh +++ b/bin/build-original-i2p.sh @@ -4,13 +4,7 @@ basedir=$(dirname $(dirname $(readlink -fm $0))) cd $basedir/import -OS=`uname -s` -if [ $OS = "Darwin" ]; then - export JAVA_HOME=`realpath $basedir/import/jdks/mac/jdk-11.0.2.jdk/Contents/Home` -else - export JAVA_HOME=`realpath $basedir/import/jdks/linux/jdk-11.0.2` -fi - +source $basedir/bin/java-config.sh # build the jars we're going to modularize cd $basedir/import/i2p.i2p diff --git a/bin/convert-jars-to-modules.sh b/bin/convert-jars-to-modules.sh index 22ed72e..ddc1601 100755 --- a/bin/convert-jars-to-modules.sh +++ b/bin/convert-jars-to-modules.sh @@ -2,12 +2,7 @@ basedir=$(dirname $(dirname $(readlink -fm $0))) -OS=`uname -s` -if [ $OS = "Darwin" ]; then - export JAVA_HOME=`realpath $basedir/import/jdks/mac/jdk-11.0.2.jdk/Contents/Home` -else - export JAVA_HOME=`realpath $basedir/import/jdks/linux/jdk-11.0.2` -fi +source $basedir/bin/java-config.sh jarPaths=`find $basedir/import/lib -name '*.jar'` diff --git a/bin/import-packages.sh b/bin/import-packages.sh index 807bf6f..eff3de5 100755 --- a/bin/import-packages.sh +++ b/bin/import-packages.sh @@ -2,21 +2,32 @@ basedir=$(dirname $(dirname $(readlink -fm $0))) -mkdir $basedir/import +source $basedir/bin/java-config.sh + +mkdir -p $basedir/import cd $basedir/import -git clone https://github.com/i2p/i2p.i2p.git +if [ ! -d ""$basedir/i2p.i2p" ]; then + git clone https://github.com/i2p/i2p.i2p.git +fi + +git checkout tags/i2p-0.9.37 + +if [ ! -d ""$basedir/jdks" ]; then + mkdir -p jdks + mkdir -p jdks/linux jdks/mac jdks/win + wget --directory-prefix=jdks/linux $JDK_DOWNLOAD_URL_LINUX + wget --directory-prefix=jdks/mac $JDK_DOWNLOAD_URL_MAC + wget --directory-prefix=jdks/win $JDK_DOWNLOAD_URL_WIN -mkdir jdks -mkdir jdks/linux jdks/mac jdks/win -wget --directory-prefix=jdks/linux https://download.java.net/java/GA/jdk11/7/GPL/openjdk-11.0.2_linux-x64_bin.tar.gz -wget --directory-prefix=jdks/mac https://download.java.net/java/GA/jdk11/7/GPL/openjdk-11.0.2_osx-x64_bin.tar.gz -wget --directory-prefix=jdks/win https://download.java.net/java/GA/jdk11/7/GPL/openjdk-11.0.2_windows-x64_bin.zip + tar zxvf jdks/linux/$JDK_DOWNLOAD_FILENAME_LINUX -C jdks/linux/ + tar zxvf jdks/mac/$JDK_DOWNLOAD_FILENAME_MAC -C jdks/mac/ + unzip jdks/win/$JDK_DOWNLOAD_FILENAME_WIN -d jdks/win/ +fi -wget https://www-us.apache.org/dist/ant/binaries/apache-ant-1.10.5-bin.tar.gz +if [ ! -d ""$basedir/apache-ant-1.10.5" ]; then + wget https://www-us.apache.org/dist/ant/binaries/apache-ant-1.10.5-bin.tar.gz + tar zxvf apache-ant-1.10.5-bin.tar.gz +fi -tar zxvf jdks/linux/openjdk-11.0.2_linux-x64_bin.tar.gz -C jdks/linux/ -tar zxvf jdks/mac/openjdk-11.0.2_osx-x64_bin.tar.gz -C jdks/mac/ -unzip jdks/win/openjdk-11.0.2_windows-x64_bin.zip -d jdks/win/ -tar zxvf apache-ant-1.10.5-bin.tar.gz \ No newline at end of file diff --git a/bin/java-config.sh b/bin/java-config.sh new file mode 100644 index 0000000..4400f59 --- /dev/null +++ b/bin/java-config.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +basedir=$(dirname $(dirname $(readlink -fm $0))) + +JDK_VERSION=11.0.2 + +JDK_DOWNLOAD_FILENAME_LINUX=openjdk-${JDK_VERSION}_linux-x64_bin.tar.gz +JDK_DOWNLOAD_FILENAME_MAC=openjdk-${JDK_VERSION}_osx-x64_bin.tar.gz +JDK_DOWNLOAD_FILENAME_WIN=openjdk-${JDK_VERSION}_windows-x64_bin.zip + +JDK_DOWNLOAD_URL_LINUX=https://download.java.net/java/GA/jdk11/7/GPL/$JDK_DOWNLOAD_FILENAME_LINUX +JDK_DOWNLOAD_URL_MAC=https://download.java.net/java/GA/jdk11/7/GPL/$JDK_DOWNLOAD_FILENAME_MAC +JDK_DOWNLOAD_URL_WIN=https://download.java.net/java/GA/jdk11/7/GPL/$JDK_DOWNLOAD_FILENAME_WIN + +OS=`uname -s` +if [ $OS = "Darwin" ]; then + export JAVA_HOME=`realpath $basedir/import/jdks/mac/jdk-${JDK_VERSION}.jdk/Contents/Home` +else + export JAVA_HOME=`realpath $basedir/import/jdks/linux/jdk-${JDK_VERSION}` +fi