From 73228a1514d0e758652164762cfc3502376b337e Mon Sep 17 00:00:00 2001 From: dev Date: Tue, 29 Sep 2015 15:31:42 +0000 Subject: [PATCH] Revamped downloading of gmp files. Revamped cross-compilation support. --- core/c/README | 17 +++ core/c/jbigi/build.sh | 46 +----- core/c/jbigi/build_jbigi.sh | 44 +++--- core/c/jbigi/download_gmp.sh | 35 +++++ core/c/jbigi/mbuild-all.sh | 267 +++++++++++++++++++++-------------- 5 files changed, 246 insertions(+), 163 deletions(-) create mode 100644 core/c/jbigi/download_gmp.sh diff --git a/core/c/README b/core/c/README index c7584ac3a..4cbc06946 100644 --- a/core/c/README +++ b/core/c/README @@ -27,6 +27,23 @@ To build the native jbigi libraries for all supported CPUs (on the current OS), go into jbigi/ and run build-all.sh (the results will be under jbigi/lib/) +Build for more than one target at a time +======================================== + +./mbuild.sh is used to build a whole set of binaries at a time. +Each run will build a set of binaries for a specific platform. + +Windows cross-compilation +------------------------- +Install ming-w64 (on debian or whichever package that provides i686-w64-mingw32 and x86_64_w64_mingw32). + +To build the 32-bit binaries run something like this: + CC=i686-w64-mingw32-gcc TARGET=windows BITS=32 ./mbuild-all.sh + +To build the 64-bit binaries run something like this: + CC=x86_64-w64-mingw32-gcc TARGET=windows BITS=64 ./mbuild-all.sh + + Installation and testing ======================== diff --git a/core/c/jbigi/build.sh b/core/c/jbigi/build.sh index dcde001a3..8ccfcc7fe 100755 --- a/core/c/jbigi/build.sh +++ b/core/c/jbigi/build.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # # Build the jbigi library for i2p # @@ -7,7 +7,7 @@ # Set $JAVA_HOME to point to your Java SDK # build.sh # This script downloads gmp-4.3.2.tar.bz2 to this directory -# (if a different version, change the VER= line below) +# (if a different version, change the GMP_VER= line below) # # To build a dynamic library (you must have a libgmp.so somewhere in your system) # Set $I2P to point to your I2P installation @@ -20,11 +20,9 @@ rm -rf bin/local mkdir -p lib bin/local -# Use 4.3.2 32bit CPUs. -# Use 5.0.2 64bit CPUs. -VER=6.0.0 -TARVER=${VER}a -TAR=gmp-${TARVER}.tar.bz2 +# Import gmp version variables and download gmp. +source ./download_gmp.sh + # If JAVA_HOME isn't set, try to figure it out on our own [ -z $JAVA_HOME ] && . ../find-java-home @@ -37,36 +35,6 @@ fi # Abort script on uncaught errors set -e -download_gmp () -{ -URL="https://gmplib.org/download/gmp/${TAR}" -if [ $(which wget) ]; then - echo "Downloading $URL" - wget -N --progress=dot $URL -else - echo "ERROR: Cannot find wget." >&2 - echo >&2 - echo "Please download $URL" >&2 - echo "manually and rerun this script." >&2 - exit 1 -fi -} - -extract_gmp () -{ -tar -xjf ${TAR} > /dev/null 2>&1|| (rm -f ${TAR} && download_gmp && extract_gmp || exit 1) -} - -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..." @@ -74,10 +42,10 @@ if [ "$1" != "dynamic" ]; then case `uname -sr` in Darwin*) # --with-pic is required for static linking - ../../gmp-${VER}/configure --with-pic;; + ../../gmp-${GMP_VER}/configure --with-pic;; *) # and it's required for ASLR - ../../gmp-${VER}/configure --with-pic;; + ../../gmp-${GMP_VER}/configure --with-pic;; esac make sh ../../build_jbigi.sh static diff --git a/core/c/jbigi/build_jbigi.sh b/core/c/jbigi/build_jbigi.sh index d09446e09..e3a6e1c55 100755 --- a/core/c/jbigi/build_jbigi.sh +++ b/core/c/jbigi/build_jbigi.sh @@ -12,34 +12,38 @@ if [ ! -f "$JAVA_HOME/include/jni.h" ]; then exit 1 fi -case `uname -s` in -MINGW*) - JAVA_HOME="c:/software/j2sdk1.4.2_05" + +# Allow TARGET to be overridden (e.g. for use with cross compilers) +[ -z $TARGET ] && TARGET=$(uname -s | tr "[A-Z]" "[a-z]") + +# Note, this line does not support windows (and needs to generate a win32/win64 string for that to work) +BUILD_OS=$(uname -s | tr "[A-Z]" "[a-z]") +echo "TARGET=$TARGET" + +case "$TARGET" in +mingw*|windows*) COMPILEFLAGS="-Wall" - INCLUDES="-I. -I../../jbigi/include -I$JAVA_HOME/include/win32/ -I$JAVA_HOME/include/" + INCLUDES="-I. -I../../jbigi/include -I$JAVA_HOME/include -I$JAVA_HOME/include/$BUILD_OS -I/usr/local/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/" + INCLUDES="-I. -I../../jbigi/include -I$JAVA_HOME/include/$BUILD_OS/ -I$JAVA_HOME/include/" LINKFLAGS="-shared -Wl,--kill-at" LIBFILE="jbigi.dll";; -Darwin*) - JAVA_HOME=$(/usr/libexec/java_home) +darwin*) COMPILEFLAGS="-fPIC -Wall" - INCLUDES="-I. -I../../jbigi/include -I$JAVA_HOME/include" - LINKFLAGS="-dynamiclib -framework JavaVM" + INCLUDES="-I. -I../../jbigi/include -I$JAVA_HOME/include -I$JAVA_HOME/include/$BUILD_OS -I/usr/local/include" + LINKFLAGS="-m64 -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 = "gnu/kfreebsd" ]; then - UNIXTYPE="linux" + if [ $BUILD_OS = "sunos" ]; then + BUILD_OS="solaris" + elif [ $BUILD_OS = "gnu/kfreebsd" ]; then + BUILD_OS="linux" fi COMPILEFLAGS="-fPIC -Wall $CFLAGS" - INCLUDES="-I. -I../../jbigi/include -I$JAVA_HOME/include -I$JAVA_HOME/include/${UNIXTYPE} -I/usr/local/include" + INCLUDES="-I. -I../../jbigi/include -I$JAVA_HOME/include -I$JAVA_HOME/include/$BUILD_OS -I/usr/local/include" LINKFLAGS="-shared -Wl,-soname,libjbigi.so" LIBFILE="libjbigi.so";; *) @@ -56,9 +60,17 @@ else STATICLIBS=".libs/libgmp.a" fi +[ $BITS -eq 32 ] && COMPILEFLAGS="-m32 $COMPILEFLAGS" +[ $BITS -eq 64 ] && COMPILEFLAGS="-m64 $COMPILEFLAGS" + echo "Compiling C code..." rm -f jbigi.o $LIBFILE +echo "JAVA_HOME: $JAVA_HOME" +echo "INCLUDESs: $INCLUDES" +echo "LD: $LD" +echo "Compile: \"$CC -c $COMPILEFLAGS $INCLUDES ../../jbigi/src/jbigi.c || exit 1\"" $CC -c $COMPILEFLAGS $INCLUDES ../../jbigi/src/jbigi.c || exit 1 +echo "Link: \"$CC $LINKFLAGS $INCLUDES -o $LIBFILE jbigi.o $INCLUDELIBS $STATICLIBS $LIBPATH || exit 1\"" $CC $LINKFLAGS $INCLUDES -o $LIBFILE jbigi.o $INCLUDELIBS $STATICLIBS $LIBPATH || exit 1 exit 0 diff --git a/core/c/jbigi/download_gmp.sh b/core/c/jbigi/download_gmp.sh new file mode 100644 index 000000000..e5a2d1b4c --- /dev/null +++ b/core/c/jbigi/download_gmp.sh @@ -0,0 +1,35 @@ +#!/bin/sh + +export GMP_VER=6.0.0 +export GMP_TARVER=${GMP_VER}a +export GMP_DIR="gmp-$GMP_VER" +export GMP_TAR="gmp-$GMP_TARVER.tar.bz2" + + +function download_tar +{ + GMP_TAR_URL="https://gmplib.org/download/gmp/${GMP_TAR}" + if [ $(which wget) ]; then + echo "Downloading $GMP_TAR_URL" + wget -N --progress=dot $GMP_TAR_URL + else + echo "ERROR: Cannot find wget." >&2 + echo >&2 + echo "Please download $GMP_TAR_URL" >&2 + echo "manually and rerun this script." >&2 + exit 1 + fi +} + +function extract_tar +{ + tar -xjf ${GMP_TAR} > /dev/null 2>&1 || (rm -f ${GMP_TAR} && download_tar && extract_tar || exit 1) +} + +if [ ! -d "$GMP_DIR" -a ! -e "$GMP_TAR" ]; then + download_tar +fi + +if [ ! -d "$GMP_DIR" ]; then + extract_tar +fi \ No newline at end of file diff --git a/core/c/jbigi/mbuild-all.sh b/core/c/jbigi/mbuild-all.sh index 9f91c6a3c..2ae4833e9 100755 --- a/core/c/jbigi/mbuild-all.sh +++ b/core/c/jbigi/mbuild-all.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # # Run with BITS=32 to generate 32-bit libs on a 64-bit platform # On Ubuntu you will need sudo apt-get install gcc-multilib libc6-i386 libc6-dev-i386 @@ -7,15 +7,11 @@ # ON Solaris 11 (at least) this variable must be set. # Linux and *BSD will do the right thing. # -#BITS=32 # # look in configure file in gmp source for supported host CPUs, at about line 5000 # -# FIXME Is this all? -DARWIN_PLATFORMS="core2 corei" -MISC_DARWIN_PLATFORMS="powerpc powerpc64 powerpc64le powerpcle" # Note: You will have to add the CPU ID for the platform in the CPU ID code # for a new CPU. Just adding them here won't let I2P use the code! @@ -36,11 +32,6 @@ MISC_FREEBSD_PLATFORMS="alphaev56 ultrasparc2i" MISC_NETBSD_PLATFORMS="armv5tel mips64el ultrasparc2i sgi hppa2.0 alphaev56 powerpc powerpc64 powerpc64le powerpcle atari amiga m68knommu" # and many, many more MISC_OPENBSD_PLATFORMS="alphaev56 ultrasparc2i sgi powerpc powerpc64 hppa2.0 alphaev56 armv5tel mips64el" -# -# MINGW/Windows?? -# -MISC_MINGW_PLATFORMS="" - # # ARM # @@ -60,11 +51,14 @@ TRANSLATE_NAME_armv7a="armv7" # starting with k10 added for 6.0.0 # As of GMP 6.0.0, libgmp 3, X86_64_PLATFORMS="coreisbr coreihwl coreibwl bobcat jaguar bulldozer piledriver steamroller excavator atom athlon64 core2 corei nano pentium4 k10 x86_64" -TRANSLATE_NAME_x86_64="x86" # The _64 tag will be appended to the filename at another place. +TRANSLATE_NAME_x86_64="none" # Rename x86_64 to none_64 # Note! these are 32bit _ONLY_ (after the 64 bit ones) -X86_PLATFORMS="${X86_64_PLATFORMS} pentium pentiummmx pentium2 pentium3 pentiumm k6 k62 k63 athlon geode viac3 viac32 x86" +# Also note that the 64-bit entry "x86_64" is filtered out since it already has the more appropriate "i386" entry +X86_PLATFORMS="${X86_64_PLATFORMS//x86_64} pentium pentiummmx pentium2 pentium3 pentiumm k6 k62 k63 athlon geode viac3 viac32 i386" +TRANSLATE_NAME_i386="none" # Rename i386 to none +DARWIN_PLATFORMS="core2 corei coreisbr coreihwl coreibwl" MINGW_PLATFORMS="${X86_PLATFORMS} ${MISC_MINGW_PLATFORMS}" LINUX_PLATFORMS="${X86_PLATFORMS} ${MISC_LINUX_PLATFORMS}" FREEBSD_PLATFORMS="${X86_PLATFORMS} ${MISC_FREEBSD_PLATFORMS}" @@ -72,9 +66,9 @@ FREEBSD_PLATFORMS="${X86_PLATFORMS} ${MISC_FREEBSD_PLATFORMS}" NETBSD_PLATFORMS="${FREEBSD_PLATFORMS} ${MISC_LINUX_PLATFORMS} ${MISC_NETBSD_PLATFORMS}" OPENBSD_PLATFORM="${X86_PLATFORMS} ${MISC_OPENBSD_PLATFORMS}" -# -# You should not need to edit anything below this comment. -# + +# Import gmp version variables and download gmp. +source ./download_gmp.sh # If JAVA_HOME isn't set we'll try to figure it out [ -z $JAVA_HOME ] && . ../find-java-home @@ -84,67 +78,121 @@ if [ ! -f "$JAVA_HOME/include/jni.h" ]; then exit 1 fi -if [ ! $(which m4) ]; then +if ! command -v m4 > /dev/null; then printf "\aWARNING: \`m4\` not found. If this process fails to complete, install m4 " >&2 printf "and re-run this script.\n\n\n\a" >&2 - sleep 10 + exit 1 fi +if [ -z $BITS ]; then + BITS=32 + printf "\aBITS variable not set, defaulting to $BITS\n\a" >&2 +fi + +if [ -z $CC ]; then + export CC="gcc" + printf "\aCC variable not set, defaulting to $CC\n\a" >&2 +fi + +if [ $BITS -eq 32 ]; then + export CFLAGS="-m32" + export LDFLAGS="-m32" +elif [ $BITS -eq 64 ]; then + export CFLAGS="-m64" + export LDFLAGS="-m64" +else + printf "\aBITS value \"$BITS\" not valid, please select 32 or 64\n\a" >&2 + exit 1 +fi + +if ! command -v ${CC} > /dev/null; then + echo "The compiler you've selected \"$CC\" does not appear to exist" + exit 1 +fi + +# Set the "_64" filname filename suffix for 64-bit builds +if [ $BITS -ne 32 ]; then + [ -z $SUFFIX ] && SUFFIX="_64" +fi + # Allow TARGET to be overridden (e.g. for use with cross compilers) [ -z $TARGET ] && TARGET=$(uname -s |tr "[A-Z]" "[a-z]") +# Note, this line does not support windows (and needs to generate a win32/win64 string for that to work) +BUILD_OS=$(uname -s | tr "[A-Z]" "[a-z]") -# Set the version to 5.0.2 for OSX because AFAIK there are only 64bit capable CPUs for the Intel Macs -# FIXME do this without sed (and tail) (= portably) -if [ `echo $TARGET|grep darwin` ]; then - VER=5.0.2 -elif [ `echo $TARGET|grep sunos` ]; then - VER=$(echo gmp-*.tar.bz2 | sed -e "s/\(.*-\)\(.*\)\(.*.tar.bz2\)$/\2/" | /usr/xpg4/bin/tail -n 1) -else - VER=$(echo gmp-*.tar.bz2 | sed -e "s/\(.*-\)\(.*\)\(.*.tar.bz2\)$/\2/" | tail -n 1) -fi +# Do some sanity checks for when we're cross-compiling and +# set up host string, ARCH_VENDOR_OS. The "\$2" will be replaced +# with the name of the arch at configuration time +if [ "$TARGET" != "$BUILD_OS" ]; then + case "$TARGET" in + windows*) + HOST_CONFIGURE_FLAG="\$2-w64-mingw32" + case "$CC" in + *i*86*mingw32*gcc) + [ $BITS -ne 32 ] && echo "Error, 32-bit cross-compiler used with non 32-bit architecture" && exit 1 + ;; + *x86_64*mingw32*gcc) + [ $BITS -ne 64 ] && echo "Error, 64-bit cross-compiler used with non 64-bit architecture" && exit 1 + ;; + *) + echo "No recognized cross-compiler provided in CC env variable." + [ $BITS -eq 32 ] && echo "For 32-bit targets, i686-w64-mingw32-gcc recommended" + [ $BITS -eq 64 ] && echo "For 64-bit targets, x86_64-w64-mingw32-gcc recommended" + exit 1; + ;; + esac + ;; + freebsd*) + HOST_CONFIGURE_FLAG="\$2-pc-freebsd" + ;; + darwin*) + HOST_CONFIGURE_FLAG="\$2-apple-darwin" +# case "$CC" in +# *i*86*darwin*) -if [ "$VER" = "" ] ; then - echo "ERROR! Can't find gmp source tarball." - exit 1 -fi -# If the BITS variable isn't set above we'll proceed without setting the *FLAGS -# variables ourselves. -[ -z $BITS ] && BITS=0 - -if [ $BITS -eq 32 ]; then - export CC="gcc -m32" - export CFLAGS="-m32" - export LDFLAGS="-m32" - SUFFIX= -elif [ $BITS -eq 64 ]; then - export CC="gcc -m64" - export CFLAGS="-m64" +# [ $BITS -ne 32 ] && echo "Error, 32-bit cross-compiler used with non 32-bit architecture" && exit 1 + ;; +# *x86_64*darwin*) +# HOST_CONFIGURE_FLAG="\$2-apple-darwin" +# [ $BITS -ne 64 ] && echo "Error, 64-bit cross-compiler used with non 64-bit architecture" && exit 1 +# ;; +# *) +# echo "No recognized cross-compiler provided in CC env variable." +# [ $BITS -eq 32 ] && echo "For 32-bit targets, i686-apple-darwin10-gcc recommended" +# [ $BITS -eq 64 ] && echo "For 64-bit targets, x86_64-apple-darwin10-gcc recommended" +# exit 1; +# ;; +# esac +# ;; + esac fi case "$TARGET" in -mingw*) - PLATFORM_LIST="${MINGW_PLATFORMS}" +mingw*|windows*) NAME="jbigi" TYPE="dll" TARGET="windows" - echo "Building windows .dlls for all architectures";; + if [ $BITS -ne 32 ]; then + PLATFORM_LIST="${X86_64_PLATFORMS}" + else + PLATFORM_LIST="${X86_PLATFORMS}" + fi + echo "Building ${TARGET} .dlls for all architectures";; darwin*) - PLATFORM_LIST="${DARWIN_PLATFORMS}" NAME="libjbigi" TYPE="jnilib" TARGET="osx" + PLATFORM_LIST="${DARWIN_PLATFORMS}" echo "Building ${TARGET} .jnilibs for all architectures";; sunos*) - PLATFORM_LIST="${X86_64_PLATFORMS}" NAME="libjbigi" TYPE="so" - UNIXTYPE="solaris" - TARGET="${UNIXTYPE}" - if $(echo "$CFLAGS" | grep -q "\-m64") ; then - [ -z $SUFFIX ] && SUFFIX="_64" + BUILD_OS="solaris" + TARGET="${BUILD_OS}" + if [ $BITS -eq 32 ]; then PLATFORM_LIST="${X86_PLATFORMS}" else PLATFORM_LIST="${X86_PLATFORMS}" @@ -162,47 +210,37 @@ linux*|*kfreebsd) TARGET="linux" ;; esac - arch=$(uname -m | cut -f1 -d" ") - case ${arch} in - i[3-6]86) - arch="x86";; - esac - case ${arch} in - x86_64 | amd64) - PLATFORM_LIST="${X86_64_PLATFORMS}" - if [ $BITS -ne 32 ]; then - [ -z $SUFFIX ] && SUFFIX="_64" - fi - ;; - #ia64) - # PLATFORM_LIST="${X86_64_PLATFORMS}" - # TARGET="$TARGET-ia64";; - x86) - PLATFORM_LIST="${X86_PLATFORMS}";; + ARCH=$(uname -m | cut -f1 -d" ") + + case ${ARCH} in + x86_64 | amd64 | i*86) + if [ $BITS -eq 32 ]; then + PLATFORM_LIST="${X86_PLATFORMS}" + ARCH="x86" + else + PLATFORM_LIST="${X86_64_PLATFORMS}" + ARCH="x86_64" + fi;; arm*) PLATFORM_LIST="${ARM_PLATFORMS}";; *) PLATFORM_LIST="${LINUX_PLATFORMS}";; esac - echo "Building ${TARGET} .sos for ${arch}";; + echo "Building ${TARGET} .sos for ${ARCH}";; netbsd*|freebsd*|openbsd*) NAME="libjbigi" TYPE="so" PLATFORM_LIST= - arch=$(uname -m | cut -f1 -d" ") - case ${arch} in - i[3-6]86) - arch="x86";; - esac - case ${arch} in - x86_64|amd64) - PLATFORM_LIST="${X86_64_PLATFORMS}" - [ -z $SUFFIX ] && SUFFIX="_64";; - #ia64) - # PLATFORM_LIST="${X86_64_PLATFORMS}" - # SUFFIX="{SYS}-ia64";; - x86) - PLATFORM_LIST="${X86_PLATFORMS}";; + ARCH=$(uname -m | cut -f1 -d" ") + case ${ARCH} in + x86_64 | amd64 | i*86) + if [ $BITS -eq 32 ]; then + PLATFORM_LIST="${X86_PLATFORMS}" + ARCH="x86" + else + PLATFORM_LIST="${X86_64_PLATFORMS}" + ARCH="x86_64" + fi;; *) case ${TARGET} in netbsd) @@ -216,7 +254,7 @@ netbsd*|freebsd*|openbsd*) exit 1;; esac esac - echo "Building ${TARGET} .sos for ${arch}";; + echo "Building ${TARGET} .sos for ${ARCH}";; *) echo "Unsupported build environment" exit;; @@ -235,10 +273,15 @@ make_static () { echo "Attempting .${4} creation for ${3}${5}${2}${6}" ../../build_jbigi.sh static || return 1 PLATFORM="${2}" + + # Some platforms have different build-time names from + # what java and NativeBigInteger refers to them as. + # Translate to the proper name here eval TRANSLATED_NAME=\$TRANSLATE_NAME_$PLATFORM if [ -n "$TRANSLATED_NAME" ]; then PLATFORM="${TRANSLATED_NAME}" fi + cp ${3}.${4} ../../lib/net/i2p/util/${3}${5}${PLATFORM}${6}.${4} return 0 } @@ -264,12 +307,30 @@ configure_file () { # Nonfatal bail out on unsupported platform. (cd ../../gmp-${1}; make clean) - if [ $(echo $TARGET| grep -q osx) ]; then - ../../gmp-${1}/configure --build=${2}-apple-darwin --with-pic && return 0 + if [ "$TARGET" != "$BUILD_OS" ]; then + # We're cross-compiling, supply a --host flag + + # Here we're making sure that the platform we're target is injected into + # the HOST_CONFIGURE_FLAG string. The string looks somehing like this + # before the eval: "$2_VENDOR_OS" + # and this after: "x86_VENDOR_OS" + eval HOST_CONFIGURE_FLAG=$HOST_CONFIGURE_FLAG + echo "gmp-${1}/configure --host=${HOST_CONFIGURE_FLAG} --with-pic" + ../../gmp-${1}/configure --host=${HOST_CONFIGURE_FLAG} --with-pic && return 0 else - ../../gmp-${1}/configure --build=${2} --with-pic && return 0 + # We're not cross-compiling, we are however building + # optimized versions for other platforms on our OS. + echo "gmp-${1}/configure --build=${2} --with-pic" + ../../gmp-${1}/configure --build=${2} --with-pic && return 0 fi + kate config.log +# if [ $(echo $TARGET| grep -q darwin) ]; then + + # else + # ../../gmp-${1}/configure --build=${2} ${HOST_CONFIGURE_FLAG} --with-pic && return 0 + # fi cd .. + rm -R "$2" printf "\n\nSorry, ${3}${5}${2} is not supported on your build environment.\a" sleep 10 @@ -283,37 +344,27 @@ build_file () { return 1 } -if [ ! -d gmp-$VER ]; then - echo "Extracting GMP Version $VER ..." - if [ -e gmp-$VER.tar.bz2 ]; then - tar -xjf gmp-$VER.tar.bz2 || ( echo "Error in tarball file!" >&2 ; exit 1 ) - else - echo "ERROR: gmp tarball not found in current directory" >&2 - exit 1 - fi -fi if [ ! -d bin ]; then mkdir bin fi + if [ ! -d lib/net/i2p/util ]; then mkdir -p lib/net/i2p/util fi - for x in $PLATFORM_LIST do - ( - if [ ! -d bin/$x ]; then - mkdir bin/$x - cd bin/$x - else - cd bin/$x - rm -Rf * - fi - - build_file "$VER" "$x" "$NAME" "$TYPE" "-$TARGET-" "$SUFFIX" - ) + ( + if [ ! -d bin/$x ]; then + mkdir bin/$x + cd bin/$x + else + cd bin/$x + rm -Rf * + fi + build_file "$GMP_VER" "$x" "$NAME" "$TYPE" "-$TARGET-" "$SUFFIX" + ) done echo "Success!"