source: core/c/jbigi/mbuild-all.sh @ 929d471

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

uname -s is sufficient

The OS' release version is discarded anyway….so we won't ask for it.

  • Property mode set to 100755
File size: 7.1 KB
Line 
1#!/bin/sh
2
3#FIXME What platforms for MacOS?
4MISC_DARWIN_PLATFORMS="powerpc powerpc64 powerpc64le powerpcle"
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 *BSD 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"
22MISC_NETBSD_PLATFORMS="armv5tel mips64el ultrasparc2i sgi hppa2.0 alphaev56 powerpc powerpc64 powerpc64le powerpcle atari amiga m68knommu" # and many, many more
23MISC_OPENBSD_PLATFORMS="alphaev56 ultrasparc2i sgi powerpc powerpc64 hppa2.0 alphaev56 armv5tel mips64el"
24
25#
26# MINGW/Windows??
27#
28MISC_MINGW_PLATFORMS=""
29
30#
31# Are there any other X86 platforms that work on i2p? Add them here.
32#
33
34# Note! these build on 32bit as 32bit when operating as 32bit...
35X86_64_PLATFORMS="atom athlon64 core2 corei nano pentium4"
36
37# Note! these are 32bit _ONLY_
38X86_PLATFORMS="pentium pentiummmx pentium2 pentium3 pentiumm k6 k62 k63 athlon geode viac3 viac32 ${X86_64_PLATFORMS}"
39
40
41#
42# You should not need to edit anything below this comment.
43#
44
45# The built-in echo in /bin/sh (the real bourne shell) on BSD systems supports -e.
46# The built-in echo in dash (the default /bin/sh on Debian) does not support -e
47# but /bin/echo always supports -e in Linux; therefore, let's set echo to /bin/echo
48# whenever we're on Linux and use the shell's built-in "echo" on everything else.
49
50if [ $(uname -s |tr "[A-Z]" "[a-z]") = "linux" ]; then
51        ECHO="/bin/echo"
52else
53        ECHO="echo"
54fi
55
56MINGW_PLATFORMS="${X86_PLATFORMS} ${MISC_MINGW_PLATFORMS}"
57LINUX_PLATFORMS="${X86_PLATFORMS} ${MISC_LINUX_PLATFORMS}"
58FREEBSD_PLATFORMS="${X86_PLATFORMS} ${MISC_FREEBSD_PLATFORMS}"
59# As they say, "Of course it runs NetBSD!"
60NETBSD_PLATFORMS="${FREEBSD_PLATFORMS} ${MISC_LINUX_PLATFORMS} ${MISC_NETBSD_PLATFORMS}"
61OPENBSD_PLATFORM="${X86_PLATFORMS} ${MISC_OPENBSD_PLATFORMS}"
62
63# FIXME Is this all?
64DARWIN_PLATFORMS="core2 corei"
65
66# Set the version to 5.0.2 for OSX because AFAIK there are only 64bit capable CPUs for the Intel Macs
67if [ `uname -s |grep Darwin` ]; then
68        VER=5.0.2
69else
70        VER=$($ECHO gmp-*.tar.bz2 | sed -e "s/\(.*-\)\(.*\)\(.*.tar.bz2\)$/\2/" | tail -n 1)
71fi
72
73if [ "$VER" = "" ] ; then
74        $ECHO "ERROR! Can't find gmp source tarball."
75        exit 1
76fi
77
78
79case `uname -s` in
80MINGW*)
81        PLATFORM_LIST="${MINGW_PLATFORMS}"
82        NAME="jbigi"
83        TYPE="dll"
84        TARGET="-windows-"
85        $ECHO "Building windows .dlls for all architectures";;
86Darwin*)
87        PLATFORM_LIST="${DARWIN_PLATFORMS}"
88        NAME="libjbigi"
89        TYPE="jnilib"
90        TARGET="-osx-"
91        $ECHO "Building ${TARGET} .jnilibs for all architectures";;
92Linux*)
93        NAME="libjbigi"
94        TYPE="so"
95        PLATFORM_LIST=""
96        TARGET="-linux-"
97        arch=$(uname -m | cut -f1 -d" ")
98        case ${arch} in
99                i[3-6]86)
100                        arch="x86";;
101        esac
102        case ${arch} in
103                x86_64 | amd64)
104                        PLATFORM_LIST="${X86_64_PLATFORMS}"
105                        TARGET="-linux-X86_64-";;
106                ia64)
107                        PLATFORM_LIST="${X86_64_PLATFORMS}"
108                        TARGET="-linux-ia64-";;
109                x86)
110                        PLATFORM_LIST="${X86_PLATFORMS}"
111                        TARGET="-linux-x86-";;
112                *)
113                        PLATFORM_LIST="${LINUX_PLATFORMS}";;
114        esac
115        $ECHO "Building ${TARGET} .sos for ${arch}";;
116NetBSD*|FreeBSD*|OpenBSD*)
117        NAME="libjbigi"
118        TYPE="so"
119        PLATFORM_LIST=""
120        BSDTYPE=$(uname -s | tr "[A-Z]" "[a-z]")
121        arch=$(uname -m | cut -f1 -d" ")
122        case ${arch} in
123                i[3-6]86)
124                        arch="x86";;
125        esac
126        case ${arch} in
127                x86_64|amd64)
128                        PLATFORM_LIST="${X86_64_PLATFORMS}"
129                        TARGET="-${BSDTYPE}-X86_64-";;
130                ia64)
131                        PLATFORM_LIST="${X86_64_PLATFORMS}"
132                        TARGET="-${BSDTYPE}-ia64-";;
133                x86)
134                        PLATFORM_LIST="${X86_PLATFORMS}"
135                        TARGET="-${BSDTYPE}-x86-";;
136                *)
137                        case ${BSDTYPE} in
138                                netbsd)
139                                        PLATFORM_LIST="${NETBSD_PLATFORMS}";;
140                                openbsd)
141                                        PLATFORM_LIST="${OPENBSD_PLATFORMS}";;
142                                freebsd)
143                                        PLATFORM_LIST="${FREEBSD_PLATFORMS}";;
144                                *)
145                                        $ECHO "Unsupported build environment"
146                                        exit 1;;
147                        esac
148        esac
149        $ECHO "Building ${BSDTYPE} .sos for ${arch}";;
150*)
151        $ECHO "Unsupported build environment"
152        exit;;
153esac
154
155make_static () {
156        $ECHO "Attempting .${4} creation for ${3}${5}${2}"
157        ../../mbuild_jbigi.sh static || return 1
158        cp ${3}.${4} ../../lib/net/i2p/util/${3}${5}${2}.${4}
159        return 0
160}
161
162make_file () {
163        # Nonfatal bail out on Failed build.
164        $ECHO "Attempting build for ${3}${5}${2}"
165        make && return 0
166        cd ..
167        rm -R "$2"
168        $ECHO -e "\n\nFAILED! ${3}${5}${2} not made.\a"
169        sleep 10
170        return 1
171}
172
173configure_file () {
174        $ECHO -e "\n\n\nAttempting configure for ${3}${5}${2}\n\n\n"
175        sleep 10
176        # Nonfatal bail out on unsupported platform.
177        if [ `uname -s |grep Darwin` ]; then
178                ../../gmp-${1}/configure --build=${2}-apple-darwin --with-pic && return 0
179        else
180                ../../gmp-${1}/configure --build=${2} --with-pic && return 0
181        fi
182        cd ..
183        rm -R "$2"
184        $ECHO -e "\n\nSorry, ${3}${5}${2} is not supported on your build environment.\a"
185        sleep 10
186        return 1
187}
188
189build_file () {
190        configure_file "$1" "$2" "$3" "$4" "$5"  && make_file "$1" "$2" "$3" "$4" "$5" && make_static "$1" "$2" "$3" "$4" "$5" && return 0
191        $ECHO -e "\n\n\nError building static!\n\n\a"
192        sleep 10
193        return 1
194}
195
196$ECHO "Extracting GMP Version $VER ..."
197tar -xjf gmp-$VER.tar.bz2 || ( $ECHO "Error in tarball file!" ; exit 1 )
198
199if [ ! -d bin ]; then
200        mkdir bin
201fi
202if [ ! -d lib/net/i2p/util ]; then
203        mkdir -p lib/net/i2p/util
204fi
205
206# Don't touch this one.
207NO_PLATFORM=none
208
209for x in $NO_PLATFORM $PLATFORM_LIST
210do
211        (
212                if [ ! -d bin/$x ]; then
213                        mkdir bin/$x
214                        cd bin/$x
215                else
216                        cd bin/$x
217                        rm -Rf *
218                fi
219
220                build_file "$VER" "$x" "$NAME" "$TYPE" "$TARGET"
221        )
222done
223
224$ECHO "Success!"
225exit 0
Note: See TracBrowser for help on using the repository browser.