source: core/c/jbigi/mbuild-all.sh @ 18ee239

Last change on this file since 18ee239 was 18ee239, checked in by kytv <kytv@…>, 9 years ago

Add jbigi support for Intel Macs

The jnilibs were compiled on Snow Leopard 10.6.8 with Xcode 3.2 (gcc 4.2.1)

  • Property mode set to 100755
File size: 4.3 KB
Line 
1#/bin/bash
2
3#FIXME What platforms for MacOS?
4MISC_DARWIN_PLATFORMS=""
5
6# Note: You will have to add the CPU ID for the platform in the CPU ID code
7# for a new CPU. Just adding them here won't let I2P use the code!
8
9#
10# If you know of other platforms i2p on linux works on,
11# please add them here.
12# Do NOT add any X86 platforms, do that below in the x86 platform list.
13#
14MISC_LINUX_PLATFORMS="hppa2.0 alphaev56 armv5tel mips64el itanium itanium2 ultrasparc2 ultrasparc2i alphaev6 powerpc970 powerpc7455 powerpc7447"
15
16#
17# If you know of other platforms i2p on FREEBSD works on,
18# please add them here.
19# Do NOT add any X86 platforms, do that below in the x86 platform list.
20#
21MISC_FREEBSD_PLATFORMS="alphaev56 ultrasparc2i"
22
23#
24# MINGW/Windows??
25#
26MISC_MINGW_PLATFORMS=""
27
28#
29# Are there any other X86 platforms that work on i2p? Add them here.
30#
31
32# Note! these build on 32bit as 32bit when operating as 32bit...
33X86_64_PLATFORMS="atom athlon64 core2 corei nano pentium4"
34
35# Note! these are 32bit _ONLY_
36X86_PLATFORMS="pentium pentiummmx pentium2 pentium3 pentiumm k6 k62 k63 athlon geode viac3 viac32 ${X86_64_PLATFORMS}"
37
38
39#
40# You should not need to edit anything below this comment.
41#
42
43MINGW_PLATFORMS="${X86_PLATFORMS} ${MISC_MINGW_PLATFORMS}"
44LINUX_PLATFORMS="${X86_PLATFORMS} ${MISC_LINUX_PLATFORMS}"
45FREEBSD_PLATFORMS="${X86_PLATFORMS} ${MISC_FREEBSD_PLATFORMS}"
46DARWIN_PLATFORMS="core2 corei"
47
48# Set the version to 5.0.2 for OSX because
49# 1) it doesn't have the -r parameter as an option for sed
50# 2) AFAIK there are only 64bit capable CPUs for the Intel Macs
51if [ `uname -s |grep Darwin` ]; then
52        VER=5.0.2
53else
54        VER=$(echo gmp-*.tar.bz2 | sed -re "s/(.*-)(.*)(.*.tar.bz2)$/\2/" | tail -n 1)
55fi
56
57if [ "$VER" == "" ] ; then
58        echo "ERROR! Can't find gmp source tarball."
59        exit 1
60fi
61
62
63case `uname -sr` in
64MINGW*)
65        PLATFORM_LIST="${MINGW_PLATFORMS}"
66        NAME="jbigi"
67        TYPE="dll"
68        TARGET="-windows-"
69        echo "Building windows .dlls for all architectures";;
70Darwin*)
71        PLATFORM_LIST="${DARWIN_PLATFORMS}"
72        NAME="libjbigi"
73        TYPE="jnilib"
74        TARGET="-osx-"
75        echo "Building ${TARGET} .jnilibs for all architectures";;
76Linux*)
77        NAME="libjbigi"
78        TYPE="so"
79        PLATFORM_LIST=""
80        TARGET="-linux-"
81        arch=$(uname -m | cut -f1 -d" ")
82        case ${arch} in
83                i[3-6]86)
84                        arch="x86";;
85        esac
86        case ${arch} in
87                x86_64)
88                        PLATFORM_LIST="${X86_64_PLATFORMS}"
89                        TARGET="-linux-X86_64-";;
90                ia64)
91                        PLATFORM_LIST="${X86_64_PLATFORMS}"
92                        TARGET="-linux-ia64-";;
93                x86)
94                        PLATFORM_LIST="${X86_PLATFORMS}"
95                        TARGET="-linux-x86-";;
96                *)
97                        PLATFORM_LIST="${LINUX_PLATFORMS}";;
98        esac
99        echo "Building ${TARGET} .so's for ${arch}";;
100FreeBSD*)
101        PLATFORM_LIST="${FREEBSD_PLATFORMS}"
102        NAME="libjbigi"
103        TYPE="so"
104        TARGET="-freebsd-"
105        echo "Building freebsd .sos for all architectures";;
106*)
107        echo "Unsupported build environment"
108        exit;;
109esac
110
111function make_static {
112        echo "Attempting .${4} creation for ${3}${5}${2}"
113        ../../mbuild_jbigi.sh static || return 1
114        cp ${3}.${4} ../../lib/net/i2p/util/${3}${5}${2}.${4}
115        return 0
116}
117
118function make_file {
119        # Nonfatal bail out on Failed build.
120        echo "Attempting build for ${3}${5}${2}"
121        make && return 0
122        cd ..
123        rm -R "$2" 
124        echo -e "\n\nFAILED! ${3}${5}${2} not made.\a"
125        sleep 10
126        return 1
127}
128
129function configure_file {
130        echo -e "\n\n\nAttempting configure for ${3}${5}${2}\n\n\n"
131        sleep 10
132        # Nonfatal bail out on unsupported platform.
133        if [ `uname -s |grep Darwin` ]; then
134                ../../gmp-${1}/configure --build=${2}-apple-darwin --with-pic && return 0
135        else
136                ../../gmp-${1}/configure --build=${2} --with-pic && return 0
137        fi
138        cd ..
139        rm -R "$2"
140        echo -e "\n\nSorry, ${3}${5}${2} is not supported on your build environment.\a"
141        sleep 10
142        return 1
143}
144
145function build_file {
146        configure_file "$1" "$2" "$3" "$4" "$5"  && make_file "$1" "$2" "$3" "$4" "$5" && make_static "$1" "$2" "$3" "$4" "$5" && return 0
147        echo -e "\n\n\nError building static!\n\n\a"
148        sleep 10
149        return 1
150}
151
152echo "Extracting GMP Version $VER ..."
153tar -xf gmp-$VER.tar.bz2 || ( echo "Error in tarball file!" ; exit 1 )
154
155if [ ! -d bin ]; then
156        mkdir bin
157fi
158if [ ! -d lib/net/i2p/util ]; then
159        mkdir -p lib/net/i2p/util
160fi
161
162# Don't touch this one.
163NO_PLATFORM=none
164
165for x in $NO_PLATFORM $PLATFORM_LIST
166do
167        (
168                if [ ! -d bin/$x ]; then
169                        mkdir bin/$x
170                        cd bin/$x
171                else
172                        cd bin/$x
173                        rm -Rf *
174                fi
175
176                build_file "$VER" "$x" "$NAME" "$TYPE" "$TARGET"
177        )
178done
179
180echo "Success!"
181exit 0
Note: See TracBrowser for help on using the repository browser.