Changeset c1da7f7 for core/c/jbigi/mbuild-all.sh
- Timestamp:
- May 12, 2013 12:08:52 AM (8 years ago)
- Branches:
- master
- Children:
- b096834
- Parents:
- dca5e98
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
core/c/jbigi/mbuild-all.sh
rdca5e98 rc1da7f7 1 1 #!/bin/sh 2 2 3 # If JAVA_HOME isn't set we'll try to figure it out 4 [ -z $JAVA_HOME ] && . ../find-java-home 5 if [ ! -f "$JAVA_HOME/include/jni.h" ]; then 6 echo "Cannot find jni.h! Looked in '$JAVA_HOME/include/jni.h'" 7 echo "Please set JAVA_HOME to a java home that has the JNI" 8 exit 1 9 fi 10 11 #FIXME What platforms for MacOS? 3 # ON Solaris 11 (at least) this variable must be set. 4 # Linux and *BSD will do the right thing. 5 # 6 #BITS=32 7 8 # FIXME Is this all? 9 DARWIN_PLATFORMS="core2 corei" 12 10 MISC_DARWIN_PLATFORMS="powerpc powerpc64 powerpc64le powerpcle" 13 11 … … 45 43 # Note! these are 32bit _ONLY_ 46 44 X86_PLATFORMS="pentium pentiummmx pentium2 pentium3 pentiumm k6 k62 k63 athlon geode viac3 viac32 ${X86_64_PLATFORMS}" 47 48 49 #50 # You should not need to edit anything below this comment.51 #52 53 # The built-in echo in /bin/sh (the real bourne shell) on BSD systems supports -e.54 # The built-in echo in dash (the default /bin/sh on Debian) does not support -e55 # but /bin/echo always supports -e in Linux; therefore, let's set echo to /bin/echo56 # whenever we're on Linux and use the shell's built-in "echo" on everything else.57 58 if [ $(uname -s |tr "[A-Z]" "[a-z]") = "linux" ]; then59 ECHO="/bin/echo"60 elif [ $(uname -s |tr "[A-Z]" "[a-z]") = "gnu/kfreebsd" ]; then61 ECHO="/bin/echo"62 else63 ECHO="echo"64 fi65 45 66 46 MINGW_PLATFORMS="${X86_PLATFORMS} ${MISC_MINGW_PLATFORMS}" … … 71 51 OPENBSD_PLATFORM="${X86_PLATFORMS} ${MISC_OPENBSD_PLATFORMS}" 72 52 73 # FIXME Is this all? 74 DARWIN_PLATFORMS="core2 corei" 53 # 54 # You should not need to edit anything below this comment. 55 # 56 57 # If JAVA_HOME isn't set we'll try to figure it out 58 [ -z $JAVA_HOME ] && . ../find-java-home 59 if [ ! -f "$JAVA_HOME/include/jni.h" ]; then 60 echo "Cannot find jni.h! Looked in '$JAVA_HOME/include/jni.h'" >&2 61 echo "Please set JAVA_HOME to a java home that has the JNI" >&2 62 exit 1 63 fi 64 65 if [ ! $(which m4) ]; then 66 printf "\aWARNING: \`m4\` not found. If this process fails to complete, install m4 " >&2 67 printf "and re-run this script.\n\n\n\a" >&2 68 sleep 10 69 fi 70 71 72 # Allow TARGET to be overridden (e.g. for use with cross compilers) 73 [ -z $TARGET ] && TARGET=$(uname -s |tr "[A-Z]" "[a-z]") 74 75 75 76 76 # Set the version to 5.0.2 for OSX because AFAIK there are only 64bit capable CPUs for the Intel Macs 77 if [ `uname -s |grep Darwin` ]; then 77 # FIXME do this without sed (and tail) (= portably) 78 if [ `echo $TARGET|grep darwin` ]; then 78 79 VER=5.0.2 80 elif [ `echo $TARGET|grep sunos` ]; then 81 VER=$(echo gmp-*.tar.bz2 | sed -e "s/\(.*-\)\(.*\)\(.*.tar.bz2\)$/\2/" | /usr/xpg4/bin/tail -n 1) 79 82 else 80 VER=$( $ECHOgmp-*.tar.bz2 | sed -e "s/\(.*-\)\(.*\)\(.*.tar.bz2\)$/\2/" | tail -n 1)83 VER=$(echo gmp-*.tar.bz2 | sed -e "s/\(.*-\)\(.*\)\(.*.tar.bz2\)$/\2/" | tail -n 1) 81 84 fi 82 85 83 86 if [ "$VER" = "" ] ; then 84 $ECHO"ERROR! Can't find gmp source tarball."87 echo "ERROR! Can't find gmp source tarball." 85 88 exit 1 86 89 fi 87 90 88 89 case `uname -s` in 90 MINGW*) 91 # If the BITS variable isn't set above we'll proceed without setting the *FLAGS 92 # variables ourselves. 93 [ -z $BITS ] && BITS=0 94 95 if [ $BITS -eq 32 ]; then 96 export CC="gcc -m32" 97 export CFLAGS="-m32" 98 export LDFLAGS="-m32" 99 SUFFIX= 100 elif [ $BITS -eq 64 ]; then 101 export CC="gcc -m64" 102 export CFLAGS="-m64" 103 fi 104 105 case "$TARGET" in 106 mingw*) 91 107 PLATFORM_LIST="${MINGW_PLATFORMS}" 92 108 NAME="jbigi" 93 109 TYPE="dll" 94 110 TARGET="windows" 95 $ECHO"Building windows .dlls for all architectures";;96 Darwin*)111 echo "Building windows .dlls for all architectures";; 112 darwin*) 97 113 PLATFORM_LIST="${DARWIN_PLATFORMS}" 98 114 NAME="libjbigi" 99 115 TYPE="jnilib" 100 116 TARGET="osx" 101 $ECHO "Building ${TARGET} .jnilibs for all architectures";; 102 Linux*|*kFreeBSD) 117 echo "Building ${TARGET} .jnilibs for all architectures";; 118 sunos*) 119 PLATFORM_LIST="${X86_64_PLATFORMS}" 120 NAME="libjbigi" 121 TYPE="so" 122 UNIXTYPE="solaris" 123 TARGET="${UNIXTYPE}" 124 if $(echo "$CFLAGS" | grep -q "\-m64") ; then 125 [ -z $SUFFIX ] && SUFFIX="_64" 126 PLATFORM_LIST="${X86_64_PLATFORMS}" 127 else 128 PLATFORM_LIST="${X86_PLATFORMS}" 129 fi 130 echo "Building ${TARGET} .sos for all architectures";; 131 linux*|*kfreebsd) 103 132 NAME="libjbigi" 104 133 TYPE="so" 105 134 PLATFORM_LIST="" 106 if [ $(uname -s | tr "[A-Z]" "[a-z]") = "gnu/kfreebsd" ]; then 135 case "$TARGET" in 136 *kfreebsd) 107 137 TARGET="kfreebsd" 108 else 138 ;; 139 *) 109 140 TARGET="linux" 110 fi 141 ;; 142 esac 111 143 arch=$(uname -m | cut -f1 -d" ") 112 144 case ${arch} in … … 117 149 x86_64 | amd64) 118 150 PLATFORM_LIST="${X86_64_PLATFORMS}" 119 TARGET="$TARGET-X86_64";; 120 ia64) 121 PLATFORM_LIST="${X86_64_PLATFORMS}" 122 TARGET="$TARGET-ia64";; 151 if [ $BITS -ne 32 ]; then 152 [ -z $SUFFIX ] && SUFFIX="_64" 153 fi 154 ;; 155 #ia64) 156 # PLATFORM_LIST="${X86_64_PLATFORMS}" 157 # TARGET="$TARGET-ia64";; 123 158 x86) 124 PLATFORM_LIST="${X86_PLATFORMS}" 125 TARGET="$TARGET-x86";; 159 PLATFORM_LIST="${X86_PLATFORMS}";; 126 160 *) 127 161 PLATFORM_LIST="${LINUX_PLATFORMS}";; 128 162 esac 129 $ECHO"Building ${TARGET} .sos for ${arch}";;130 NetBSD*|FreeBSD*|OpenBSD*)163 echo "Building ${TARGET} .sos for ${arch}";; 164 netbsd*|freebsd*|openbsd*) 131 165 NAME="libjbigi" 132 166 TYPE="so" 133 PLATFORM_LIST="" 134 BSDTYPE=$(uname -s | tr "[A-Z]" "[a-z]") 167 PLATFORM_LIST= 135 168 arch=$(uname -m | cut -f1 -d" ") 136 169 case ${arch} in … … 141 174 x86_64|amd64) 142 175 PLATFORM_LIST="${X86_64_PLATFORMS}" 143 TARGET="${BSDTYPE}-X86_64";;144 ia64)145 PLATFORM_LIST="${X86_64_PLATFORMS}"146 TARGET="${BSDTYPE}-ia64";;176 [ -z $SUFFIX ] && SUFFIX="_64";; 177 #ia64) 178 # PLATFORM_LIST="${X86_64_PLATFORMS}" 179 # SUFFIX="{SYS}-ia64";; 147 180 x86) 148 PLATFORM_LIST="${X86_PLATFORMS}" 149 TARGET="${BSDTYPE}-x86";; 181 PLATFORM_LIST="${X86_PLATFORMS}";; 150 182 *) 151 case ${ BSDTYPE} in183 case ${TARGET} in 152 184 netbsd) 153 185 PLATFORM_LIST="${NETBSD_PLATFORMS}";; … … 157 189 PLATFORM_LIST="${FREEBSD_PLATFORMS}";; 158 190 *) 159 $ECHO"Unsupported build environment"191 echo "Unsupported build environment" 160 192 exit 1;; 161 193 esac 162 194 esac 163 $ECHO "Building ${BSDTYPE} .sos for ${arch}";;195 echo "Building ${TARGET} .sos for ${arch}";; 164 196 *) 165 $ECHO"Unsupported build environment"197 echo "Unsupported build environment" 166 198 exit;; 167 199 esac 168 200 201 ##################### 202 # In the below functions: 203 # $1 = gmp version 204 # $2 = platform: such as athlon64 205 # $3 = basename: "jbigi" on Windows, "libjbigi" everywhere else 206 # $4 = type/extension: windows = "dll". osx = "jnilib". Everything else = "so" 207 # $5 = target: "linux", "freebsd", "kfreebsd", "osx", "windows", etc. 208 # $6 = suffix: null if 32bit, _64 if 64bit 209 169 210 make_static () { 170 # 171 # TODO 172 # Fix formatting of output filename. Final versions will need to look 173 # like libjbigi-linux-athlon64.so or libjbigi-linux-athlon64_64.so 174 $ECHO "Attempting .${4} creation for ${3}${5}${2}" 211 echo "Attempting .${4} creation for ${3}${5}${2}${6}" 175 212 ../../build_jbigi.sh static || return 1 176 cp ${3}.${4} ../../lib/net/i2p/util/${3}${5}${2} .${4}213 cp ${3}.${4} ../../lib/net/i2p/util/${3}${5}${2}${6}.${4} 177 214 return 0 178 215 } … … 180 217 make_file () { 181 218 # Nonfatal bail out on Failed build. 182 $ECHO"Attempting build for ${3}${5}${2}"219 echo "Attempting build for ${3}${5}${2}" 183 220 make && return 0 184 221 cd .. 185 222 rm -R "$2" 186 $ECHO -e"\n\nFAILED! ${3}${5}${2} not made.\a"223 printf "\n\nFAILED! ${3}${5}${2} not made.\a" 187 224 sleep 10 188 225 return 1 … … 190 227 191 228 configure_file () { 192 $ECHO -e "\n\n\nAttempting configure for ${3}${5}${2}\n\n\n" 229 printf "\n\n\nAttempting configure for ${3}${5}${2}${6}\n\n\n" 230 if [ $BITS -eq 32 ] && [ "$2" = "none" ]; then 231 unset ABI 232 elif [ $BITS -eq 32 ] && [ "$2" != "none" ]; then 233 export ABI=32 234 fi 193 235 sleep 10 194 236 # Nonfatal bail out on unsupported platform. 195 if [ `uname -s |grep Darwin`]; then237 if [ $(echo $TARGET| grep -q osx) ]; then 196 238 ../../gmp-${1}/configure --build=${2}-apple-darwin --with-pic && return 0 197 239 else … … 200 242 cd .. 201 243 rm -R "$2" 202 $ECHO -e"\n\nSorry, ${3}${5}${2} is not supported on your build environment.\a"244 printf "\n\nSorry, ${3}${5}${2} is not supported on your build environment.\a" 203 245 sleep 10 204 246 return 1 … … 206 248 207 249 build_file () { 208 configure_file "$1" "$2" "$3" "$4" "$5" && make_file "$1" "$2" "$3" "$4" "$5" && make_static "$1" "$2" "$3" "$4" "$5" && return 0209 $ECHO -e"\n\n\nError building static!\n\n\a"250 configure_file "$1" "$2" "$3" "$4" "$5" "$6" && make_file "$1" "$2" "$3" "$4" "$5" "$6" && make_static "$1" "$2" "$3" "$4" "$5" "$6" && return 0 251 printf "\n\n\nError building static!\n\n\a" 210 252 sleep 10 211 253 return 1 212 254 } 213 255 214 $ECHO "Extracting GMP Version $VER ..." 215 tar -xjf gmp-$VER.tar.bz2 || ( $ECHO "Error in tarball file!" ; exit 1 ) 256 echo "Extracting GMP Version $VER ..." 257 if [ -e gmp-$VER.tar.bz2 ]; then 258 tar -xjf gmp-$VER.tar.bz2 || ( echo "Error in tarball file!" >&2 ; exit 1 ) 259 else 260 echo "ERROR: gmp tarball not found in current directory" >&2 261 exit 1 262 fi 216 263 217 264 if [ ! -d bin ]; then … … 236 283 fi 237 284 238 build_file "$VER" "$x" "$NAME" "$TYPE" "-$TARGET-" 285 build_file "$VER" "$x" "$NAME" "$TYPE" "-$TARGET-" "$SUFFIX" 239 286 ) 240 287 done 241 288 242 $ECHO"Success!"289 echo "Success!" 243 290 exit 0 291 292 # vim:fenc=utf-8:ai:si:ts=4:sw=4:et:nu
Note: See TracChangeset
for help on using the changeset viewer.