Changeset 73228a1 for core/c


Ignore:
Timestamp:
Sep 29, 2015 3:31:42 PM (5 years ago)
Author:
dev <dev@…>
Branches:
master
Children:
2bc8766
Parents:
0848e34
Message:

Revamped downloading of gmp files.
Revamped cross-compilation support.

Location:
core/c
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • core/c/README

    r0848e34 r73228a1  
    2828
    2929
     30Build for more than one target at a time
     31========================================
     32
     33./mbuild.sh is used to build a whole set of binaries at a time.
     34Each run will build a set of binaries for a specific platform.
     35
     36Windows cross-compilation
     37-------------------------
     38Install ming-w64 (on debian or whichever package that provides i686-w64-mingw32 and x86_64_w64_mingw32).
     39
     40To build the 32-bit binaries run something like this:
     41    CC=i686-w64-mingw32-gcc TARGET=windows BITS=32 ./mbuild-all.sh
     42
     43To build the 64-bit binaries run something like this:
     44    CC=x86_64-w64-mingw32-gcc TARGET=windows BITS=64 ./mbuild-all.sh
     45
     46
    3047Installation and testing
    3148========================
  • core/c/jbigi/build.sh

    r0848e34 r73228a1  
    1 #!/bin/sh
     1#!/bin/bash
    22#
    33#  Build the jbigi library for i2p
     
    88#     build.sh
    99#       This script downloads gmp-4.3.2.tar.bz2 to this directory
    10 #       (if a different version, change the VER= line below)
     10#       (if a different version, change the GMP_VER= line below)
    1111#
    1212#  To build a dynamic library (you must have a libgmp.so somewhere in your system)
     
    2121mkdir -p lib bin/local
    2222
    23 # Use 4.3.2 32bit CPUs.
    24 # Use 5.0.2 64bit CPUs.
    25 VER=6.0.0
    26 TARVER=${VER}a
    27 TAR=gmp-${TARVER}.tar.bz2
     23# Import gmp version variables and download gmp.
     24source ./download_gmp.sh
     25
    2826
    2927# If JAVA_HOME isn't set, try to figure it out on our own
     
    3836set -e
    3937
    40 download_gmp ()
    41 {
    42 URL="https://gmplib.org/download/gmp/${TAR}"
    43 if [ $(which wget) ]; then
    44     echo "Downloading $URL"
    45     wget -N --progress=dot $URL
    46 else
    47     echo "ERROR: Cannot find wget." >&2
    48     echo >&2
    49     echo "Please download $URL" >&2
    50     echo "manually and rerun this script." >&2
    51     exit 1
    52 fi
    53 }
    54 
    55 extract_gmp ()
    56 {
    57 tar -xjf ${TAR} > /dev/null 2>&1|| (rm -f ${TAR} && download_gmp && extract_gmp || exit 1)
    58 }
    59 
    60 if [ "$1" != "dynamic" -a ! -d gmp-${VER} ]; then
    61     if [ ! -f $TAR ]; then
    62         download_gmp
    63     fi
    64 
    65     echo "Building the jbigi library with GMP Version ${VER}"
    66     echo "Extracting GMP..."
    67     extract_gmp
    68 fi
    69 
    7038cd bin/local
    7139
     
    7543        Darwin*)
    7644            # --with-pic is required for static linking
    77             ../../gmp-${VER}/configure --with-pic;;
     45            ../../gmp-${GMP_VER}/configure --with-pic;;
    7846        *)
    7947            # and it's required for ASLR
    80             ../../gmp-${VER}/configure --with-pic;;
     48            ../../gmp-${GMP_VER}/configure --with-pic;;
    8149    esac
    8250    make
  • core/c/jbigi/build_jbigi.sh

    r0848e34 r73228a1  
    1313fi
    1414
    15 case `uname -s` in
    16 MINGW*)
    17         JAVA_HOME="c:/software/j2sdk1.4.2_05"
     15
     16# Allow TARGET to be overridden (e.g. for use with cross compilers)
     17[ -z $TARGET ] && TARGET=$(uname -s | tr "[A-Z]" "[a-z]")
     18
     19# Note, this line does not support windows (and needs to generate a win32/win64 string for that to work)
     20BUILD_OS=$(uname -s | tr "[A-Z]" "[a-z]")
     21echo "TARGET=$TARGET"
     22
     23case "$TARGET" in
     24mingw*|windows*)
    1825        COMPILEFLAGS="-Wall"
    19         INCLUDES="-I. -I../../jbigi/include -I$JAVA_HOME/include/win32/ -I$JAVA_HOME/include/"
     26        INCLUDES="-I. -I../../jbigi/include -I$JAVA_HOME/include -I$JAVA_HOME/include/$BUILD_OS -I/usr/local/include"
    2027        LINKFLAGS="-shared -Wl,--kill-at"
    2128        LIBFILE="jbigi.dll";;
    2229CYGWIN*)
    23         JAVA_HOME="c:/software/j2sdk1.4.2_05"
    2430        COMPILEFLAGS="-Wall -mno-cygwin"
    25         INCLUDES="-I. -I../../jbigi/include -I$JAVA_HOME/include/win32/ -I$JAVA_HOME/include/"
     31        INCLUDES="-I. -I../../jbigi/include -I$JAVA_HOME/include/$BUILD_OS/ -I$JAVA_HOME/include/"
    2632        LINKFLAGS="-shared -Wl,--kill-at"
    2733        LIBFILE="jbigi.dll";;
    28 Darwin*)
    29         JAVA_HOME=$(/usr/libexec/java_home)
     34darwin*)
    3035        COMPILEFLAGS="-fPIC -Wall"
    31         INCLUDES="-I. -I../../jbigi/include -I$JAVA_HOME/include"
    32         LINKFLAGS="-dynamiclib -framework JavaVM"
     36        INCLUDES="-I. -I../../jbigi/include -I$JAVA_HOME/include -I$JAVA_HOME/include/$BUILD_OS -I/usr/local/include"
     37        LINKFLAGS="-m64 -dynamiclib -framework JavaVM"
    3338        LIBFILE="libjbigi.jnilib";;
    3439SunOS*|OpenBSD*|NetBSD*|*FreeBSD*|Linux*)
    35         UNIXTYPE=$(uname -s | tr "[A-Z]" "[a-z]")
    36         if [ $UNIXTYPE = "sunos" ]; then
    37             UNIXTYPE="solaris"
    38         elif [ $UNIXTYPE = "gnu/kfreebsd" ]; then
    39             UNIXTYPE="linux"
     40        if [ $BUILD_OS = "sunos" ]; then
     41            BUILD_OS="solaris"
     42        elif [ $BUILD_OS = "gnu/kfreebsd" ]; then
     43            BUILD_OS="linux"
    4044        fi
    4145        COMPILEFLAGS="-fPIC -Wall $CFLAGS"
    42         INCLUDES="-I. -I../../jbigi/include -I$JAVA_HOME/include -I$JAVA_HOME/include/${UNIXTYPE} -I/usr/local/include"
     46        INCLUDES="-I. -I../../jbigi/include -I$JAVA_HOME/include -I$JAVA_HOME/include/$BUILD_OS -I/usr/local/include"
    4347        LINKFLAGS="-shared -Wl,-soname,libjbigi.so"
    4448        LIBFILE="libjbigi.so";;
     
    5761fi
    5862
     63[ $BITS -eq 32 ] && COMPILEFLAGS="-m32 $COMPILEFLAGS"
     64[ $BITS -eq 64 ] && COMPILEFLAGS="-m64 $COMPILEFLAGS"
     65
    5966echo "Compiling C code..."
    6067rm -f jbigi.o $LIBFILE
     68echo "JAVA_HOME: $JAVA_HOME"
     69echo "INCLUDESs: $INCLUDES"
     70echo "LD: $LD"
     71echo "Compile: \"$CC -c $COMPILEFLAGS $INCLUDES ../../jbigi/src/jbigi.c || exit 1\""
    6172$CC -c $COMPILEFLAGS $INCLUDES ../../jbigi/src/jbigi.c || exit 1
     73echo "Link: \"$CC $LINKFLAGS $INCLUDES -o $LIBFILE jbigi.o $INCLUDELIBS $STATICLIBS $LIBPATH || exit 1\""
    6274$CC $LINKFLAGS $INCLUDES -o $LIBFILE jbigi.o $INCLUDELIBS $STATICLIBS $LIBPATH || exit 1
    6375
  • core/c/jbigi/mbuild-all.sh

    r0848e34 r73228a1  
    1 #!/bin/sh
     1#!/bin/bash
    22#
    33# Run with BITS=32 to generate 32-bit libs on a 64-bit platform
     
    88# Linux and *BSD will do the right thing.
    99#
    10 #BITS=32
    1110
    1211#
     
    1413#
    1514
    16 # FIXME Is this all?
    17 DARWIN_PLATFORMS="core2 corei"
    18 MISC_DARWIN_PLATFORMS="powerpc powerpc64 powerpc64le powerpcle"
    1915
    2016# Note: You will have to add the CPU ID for the platform in the CPU ID code
     
    3632MISC_NETBSD_PLATFORMS="armv5tel mips64el ultrasparc2i sgi hppa2.0 alphaev56 powerpc powerpc64 powerpc64le powerpcle atari amiga m68knommu" # and many, many more
    3733MISC_OPENBSD_PLATFORMS="alphaev56 ultrasparc2i sgi powerpc powerpc64 hppa2.0 alphaev56 armv5tel mips64el"
    38 
    39 #
    40 # MINGW/Windows??
    41 #
    42 MISC_MINGW_PLATFORMS=""
    4334
    4435#
     
    6152# As of GMP 6.0.0, libgmp 3,
    6253X86_64_PLATFORMS="coreisbr coreihwl coreibwl bobcat jaguar bulldozer piledriver steamroller excavator atom athlon64 core2 corei nano pentium4 k10 x86_64"
    63 TRANSLATE_NAME_x86_64="x86" # The _64 tag will be appended to the filename at another place.
     54TRANSLATE_NAME_x86_64="none" # Rename x86_64 to none_64
    6455
    6556# Note! these are 32bit _ONLY_ (after the 64 bit ones)
    66 X86_PLATFORMS="${X86_64_PLATFORMS} pentium pentiummmx pentium2 pentium3 pentiumm k6 k62 k63 athlon geode viac3 viac32 x86"
    67 
     57# Also note that the 64-bit entry "x86_64" is filtered out since it already has the more appropriate "i386" entry
     58X86_PLATFORMS="${X86_64_PLATFORMS//x86_64} pentium pentiummmx pentium2 pentium3 pentiumm k6 k62 k63 athlon geode viac3 viac32 i386"
     59TRANSLATE_NAME_i386="none" # Rename i386 to none
     60
     61DARWIN_PLATFORMS="core2 corei coreisbr coreihwl coreibwl"
    6862MINGW_PLATFORMS="${X86_PLATFORMS} ${MISC_MINGW_PLATFORMS}"
    6963LINUX_PLATFORMS="${X86_PLATFORMS} ${MISC_LINUX_PLATFORMS}"
     
    7367OPENBSD_PLATFORM="${X86_PLATFORMS} ${MISC_OPENBSD_PLATFORMS}"
    7468
    75 #
    76 # You should not need to edit anything below this comment.
    77 #
     69
     70# Import gmp version variables and download gmp.
     71source ./download_gmp.sh
    7872
    7973# If JAVA_HOME isn't set we'll try to figure it out
     
    8579fi
    8680
    87 if [ ! $(which m4)  ]; then
     81if ! command -v m4 > /dev/null; then
    8882    printf "\aWARNING: \`m4\` not found. If this process fails to complete, install m4 " >&2
    8983    printf "and re-run this script.\n\n\n\a" >&2
    90     sleep 10
    91 fi
    92 
     84    exit 1
     85fi
     86
     87
     88if [ -z $BITS ]; then
     89  BITS=32
     90  printf "\aBITS variable not set, defaulting to $BITS\n\a" >&2
     91fi
     92
     93if [ -z $CC ]; then
     94  export CC="gcc"
     95  printf "\aCC variable not set, defaulting to $CC\n\a" >&2
     96fi
     97
     98if [ $BITS -eq 32 ]; then
     99  export CFLAGS="-m32"
     100  export LDFLAGS="-m32"
     101elif [ $BITS -eq 64 ]; then
     102  export CFLAGS="-m64"
     103  export LDFLAGS="-m64"
     104else
     105  printf "\aBITS value \"$BITS\" not valid, please select 32 or 64\n\a" >&2
     106  exit 1
     107fi
     108
     109if ! command -v ${CC} > /dev/null; then
     110  echo "The compiler you've selected \"$CC\" does not appear to exist"
     111  exit 1
     112fi
     113
     114# Set the "_64" filname filename suffix for 64-bit builds
     115if [ $BITS -ne 32 ]; then
     116    [ -z $SUFFIX ] && SUFFIX="_64"
     117fi
    93118
    94119# Allow TARGET to be overridden (e.g. for use with cross compilers)
    95120[ -z $TARGET ] && TARGET=$(uname -s |tr "[A-Z]" "[a-z]")
    96121
    97 
    98 # Set the version to 5.0.2 for OSX because AFAIK there are only 64bit capable CPUs for the Intel Macs
    99 # FIXME do this without sed (and tail) (= portably)
    100 if [ `echo $TARGET|grep darwin` ]; then
    101         VER=5.0.2
    102 elif [ `echo $TARGET|grep sunos` ]; then
    103         VER=$(echo gmp-*.tar.bz2 | sed -e "s/\(.*-\)\(.*\)\(.*.tar.bz2\)$/\2/" | /usr/xpg4/bin/tail -n 1)
    104 else
    105         VER=$(echo gmp-*.tar.bz2 | sed -e "s/\(.*-\)\(.*\)\(.*.tar.bz2\)$/\2/" | tail -n 1)
    106 fi
    107 
    108 if [ "$VER" = "" ] ; then
    109         echo "ERROR! Can't find gmp source tarball."
    110         exit 1
    111 fi
    112 
    113 # If the BITS variable isn't set above we'll proceed without setting the *FLAGS
    114 # variables ourselves.
    115 [ -z $BITS ] && BITS=0
    116 
    117 if [ $BITS -eq 32 ]; then
    118     export CC="gcc -m32"
    119     export CFLAGS="-m32"
    120     export LDFLAGS="-m32"
    121     SUFFIX=
    122 elif [ $BITS -eq 64 ]; then
    123     export CC="gcc -m64"
    124     export CFLAGS="-m64"
     122# Note, this line does not support windows (and needs to generate a win32/win64 string for that to work)
     123BUILD_OS=$(uname -s | tr "[A-Z]" "[a-z]")
     124
     125# Do some sanity checks for when we're cross-compiling and
     126# set up host string, ARCH_VENDOR_OS. The "\$2" will be replaced
     127# with the name of the arch at configuration time
     128if [ "$TARGET" != "$BUILD_OS" ]; then
     129  case "$TARGET" in
     130  windows*)
     131    HOST_CONFIGURE_FLAG="\$2-w64-mingw32"
     132    case "$CC" in
     133    *i*86*mingw32*gcc)
     134      [ $BITS -ne 32 ] && echo "Error, 32-bit cross-compiler used with non 32-bit architecture" && exit 1
     135      ;;
     136    *x86_64*mingw32*gcc)
     137      [ $BITS -ne 64 ] && echo "Error, 64-bit cross-compiler used with non 64-bit architecture" && exit 1
     138      ;;
     139    *)
     140      echo "No recognized cross-compiler provided in CC env variable."
     141      [ $BITS -eq 32 ] && echo "For 32-bit targets, i686-w64-mingw32-gcc recommended"
     142      [ $BITS -eq 64 ] && echo "For 64-bit targets, x86_64-w64-mingw32-gcc recommended"
     143      exit 1;
     144      ;;
     145    esac
     146  ;;
     147  freebsd*)
     148    HOST_CONFIGURE_FLAG="\$2-pc-freebsd"
     149  ;;
     150  darwin*)
     151    HOST_CONFIGURE_FLAG="\$2-apple-darwin"
     152#     case "$CC" in
     153#     *i*86*darwin*)
     154
     155
     156#       [ $BITS -ne 32 ] && echo "Error, 32-bit cross-compiler used with non 32-bit architecture" && exit 1
     157      ;;
     158#     *x86_64*darwin*)
     159#       HOST_CONFIGURE_FLAG="\$2-apple-darwin"
     160#       [ $BITS -ne 64 ] && echo "Error, 64-bit cross-compiler used with non 64-bit architecture" && exit 1
     161#       ;;
     162#     *)
     163#       echo "No recognized cross-compiler provided in CC env variable."
     164#       [ $BITS -eq 32 ] && echo "For 32-bit targets, i686-apple-darwin10-gcc recommended"
     165#       [ $BITS -eq 64 ] && echo "For 64-bit targets, x86_64-apple-darwin10-gcc recommended"
     166#       exit 1;
     167#       ;;
     168#     esac
     169#   ;;
     170  esac
    125171fi
    126172
    127173case "$TARGET" in
    128 mingw*)
    129         PLATFORM_LIST="${MINGW_PLATFORMS}"
     174mingw*|windows*)
    130175        NAME="jbigi"
    131176        TYPE="dll"
    132177        TARGET="windows"
    133         echo "Building windows .dlls for all architectures";;
     178        if [ $BITS -ne 32 ]; then
     179                PLATFORM_LIST="${X86_64_PLATFORMS}"
     180        else
     181                PLATFORM_LIST="${X86_PLATFORMS}"
     182        fi
     183        echo "Building ${TARGET} .dlls for all architectures";;
    134184darwin*)
    135         PLATFORM_LIST="${DARWIN_PLATFORMS}"
    136185        NAME="libjbigi"
    137186        TYPE="jnilib"
    138187        TARGET="osx"
     188        PLATFORM_LIST="${DARWIN_PLATFORMS}"
    139189        echo "Building ${TARGET} .jnilibs for all architectures";;
    140190sunos*)
    141         PLATFORM_LIST="${X86_64_PLATFORMS}"
    142191        NAME="libjbigi"
    143192        TYPE="so"
    144         UNIXTYPE="solaris"
    145         TARGET="${UNIXTYPE}"
    146         if $(echo "$CFLAGS" | grep -q "\-m64") ; then
    147             [ -z $SUFFIX ] && SUFFIX="_64"
     193        BUILD_OS="solaris"
     194        TARGET="${BUILD_OS}"
     195        if [ $BITS -eq 32 ]; then
    148196            PLATFORM_LIST="${X86_PLATFORMS}"
    149197        else
     
    163211                ;;
    164212        esac
    165         arch=$(uname -m | cut -f1 -d" ")
    166         case ${arch} in
    167                 i[3-6]86)
    168                         arch="x86";;
    169         esac
    170         case ${arch} in
    171                 x86_64 | amd64)
    172                         PLATFORM_LIST="${X86_64_PLATFORMS}"
    173                         if [ $BITS -ne 32 ]; then
    174                             [ -z $SUFFIX ] && SUFFIX="_64"
    175                         fi
    176                         ;;
    177                 #ia64)
    178                 #        PLATFORM_LIST="${X86_64_PLATFORMS}"
    179                 #        TARGET="$TARGET-ia64";;
    180                 x86)
    181                         PLATFORM_LIST="${X86_PLATFORMS}";;
     213        ARCH=$(uname -m | cut -f1 -d" ")
     214
     215        case ${ARCH} in
     216                x86_64 | amd64 | i*86)
     217                        if [ $BITS -eq 32 ]; then
     218                          PLATFORM_LIST="${X86_PLATFORMS}"
     219                          ARCH="x86"
     220                        else
     221                          PLATFORM_LIST="${X86_64_PLATFORMS}"
     222                          ARCH="x86_64"
     223                        fi;;
    182224                arm*)
    183225                        PLATFORM_LIST="${ARM_PLATFORMS}";;
     
    185227                        PLATFORM_LIST="${LINUX_PLATFORMS}";;
    186228        esac
    187         echo "Building ${TARGET} .sos for ${arch}";;
     229        echo "Building ${TARGET} .sos for ${ARCH}";;
    188230netbsd*|freebsd*|openbsd*)
    189231        NAME="libjbigi"
    190232        TYPE="so"
    191233        PLATFORM_LIST=
    192         arch=$(uname -m | cut -f1 -d" ")
    193         case ${arch} in
    194                 i[3-6]86)
    195                         arch="x86";;
    196         esac
    197         case ${arch} in
    198                 x86_64|amd64)
    199                         PLATFORM_LIST="${X86_64_PLATFORMS}"
    200                        [ -z $SUFFIX ] && SUFFIX="_64";;
    201                 #ia64)
    202                 #        PLATFORM_LIST="${X86_64_PLATFORMS}"
    203                 #        SUFFIX="{SYS}-ia64";;
    204                 x86)
    205                         PLATFORM_LIST="${X86_PLATFORMS}";;
     234        ARCH=$(uname -m | cut -f1 -d" ")
     235        case ${ARCH} in
     236                x86_64 | amd64 | i*86)
     237                        if [ $BITS -eq 32 ]; then
     238                          PLATFORM_LIST="${X86_PLATFORMS}"
     239                          ARCH="x86"
     240                        else
     241                          PLATFORM_LIST="${X86_64_PLATFORMS}"
     242                          ARCH="x86_64"
     243                        fi;;
    206244                *)
    207245                        case ${TARGET} in
     
    217255                        esac
    218256        esac
    219         echo "Building ${TARGET} .sos for ${arch}";;
     257        echo "Building ${TARGET} .sos for ${ARCH}";;
    220258*)
    221259        echo "Unsupported build environment"
     
    236274        ../../build_jbigi.sh static || return 1
    237275        PLATFORM="${2}"
     276       
     277        # Some platforms have different build-time names from
     278        # what java and NativeBigInteger refers to them as.
     279        # Translate to the proper name here
    238280        eval TRANSLATED_NAME=\$TRANSLATE_NAME_$PLATFORM
    239281        if [ -n "$TRANSLATED_NAME" ]; then
    240282            PLATFORM="${TRANSLATED_NAME}"
    241283        fi
     284       
    242285        cp ${3}.${4} ../../lib/net/i2p/util/${3}${5}${PLATFORM}${6}.${4}
    243286        return 0
     
    265308        # Nonfatal bail out on unsupported platform.
    266309        (cd ../../gmp-${1}; make clean)
    267         if [ $(echo $TARGET| grep -q osx) ]; then
    268                 ../../gmp-${1}/configure --build=${2}-apple-darwin --with-pic && return 0
     310        if [ "$TARGET" != "$BUILD_OS" ]; then
     311            # We're cross-compiling, supply a --host flag
     312           
     313            # Here we're making sure that the platform we're target is injected into
     314            # the HOST_CONFIGURE_FLAG string. The string looks somehing like this
     315            # before the eval: "$2_VENDOR_OS"
     316            # and this after:  "x86_VENDOR_OS"
     317            eval HOST_CONFIGURE_FLAG=$HOST_CONFIGURE_FLAG
     318            echo "gmp-${1}/configure --host=${HOST_CONFIGURE_FLAG} --with-pic"
     319            ../../gmp-${1}/configure --host=${HOST_CONFIGURE_FLAG} --with-pic && return 0
    269320        else
    270                 ../../gmp-${1}/configure --build=${2} --with-pic && return 0
    271         fi
     321            # We're not cross-compiling, we are however building
     322            # optimized versions for other platforms on our OS.
     323            echo "gmp-${1}/configure --build=${2} --with-pic"
     324            ../../gmp-${1}/configure --build=${2} --with-pic && return 0
     325        fi
     326        kate config.log
     327#        if [ $(echo $TARGET| grep -q darwin) ]; then
     328               
     329 #       else
     330  #              ../../gmp-${1}/configure --build=${2} ${HOST_CONFIGURE_FLAG} --with-pic && return 0
     331   #     fi
    272332        cd ..
     333       
    273334        rm -R "$2"
    274335        printf "\n\nSorry, ${3}${5}${2} is not supported on your build environment.\a"
     
    284345}
    285346
    286 if [ ! -d gmp-$VER ]; then
    287   echo "Extracting GMP Version $VER ..."
    288   if [ -e gmp-$VER.tar.bz2 ]; then
    289     tar -xjf gmp-$VER.tar.bz2 || ( echo "Error in tarball file!" >&2 ; exit 1 )
    290   else
    291     echo "ERROR: gmp tarball not found in current directory" >&2
    292     exit 1
    293   fi
    294 fi
    295347
    296348if [ ! -d bin ]; then
    297349        mkdir bin
    298350fi
     351
    299352if [ ! -d lib/net/i2p/util ]; then
    300353        mkdir -p lib/net/i2p/util
    301354fi
    302355
    303 
    304356for x in $PLATFORM_LIST
    305357do
    306         (
    307                 if [ ! -d bin/$x ]; then
    308                         mkdir bin/$x
    309                         cd bin/$x
    310                 else
    311                         cd bin/$x
    312                         rm -Rf *
    313                 fi
    314 
    315                 build_file "$VER" "$x" "$NAME" "$TYPE" "-$TARGET-" "$SUFFIX"
    316         )
     358  (
     359    if [ ! -d bin/$x ]; then
     360      mkdir bin/$x
     361      cd bin/$x
     362    else
     363      cd bin/$x
     364      rm -Rf *
     365    fi
     366    build_file "$GMP_VER" "$x" "$NAME" "$TYPE" "-$TARGET-" "$SUFFIX"
     367  )
    317368done
    318369
Note: See TracChangeset for help on using the changeset viewer.