source: core/c/jbigi/mbuild-all.sh @ 450a5e1

Last change on this file since 450a5e1 was 450a5e1, checked in by kytv <kytv@…>, 10 years ago

add more platforums for (open|net)bsd

  • Property mode set to 100755
File size: 5.4 KB
Line 
1#!/usr/bin/env bash
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
45MINGW_PLATFORMS="${X86_PLATFORMS} ${MISC_MINGW_PLATFORMS}"
46LINUX_PLATFORMS="${X86_PLATFORMS} ${MISC_LINUX_PLATFORMS}"
47FREEBSD_PLATFORMS="${X86_PLATFORMS} ${MISC_FREEBSD_PLATFORMS}"
48# As they say, "Of course it runs NetBSD!"
49NETBSD_PLATFORMS="${FREEBSD_PLATFORMS} ${MISC_LINUX_PLATFORMS} ${MISC_NETBSD_PLATFORMS}"
50OPENBSD_PLATFORM="${X86_PLATFORMS} ${MISC_OPENBSD_PLATFORMS}"
51
52# FIXME Is this all?
53DARWIN_PLATFORMS="core2 corei"
54
55# Set the version to 5.0.2 for OSX because
56# 1) it doesn't have the -r parameter as an option for sed
57# 2) AFAIK there are only 64bit capable CPUs for the Intel Macs
58if [ `uname -s |grep Darwin` ]; then
59        VER=5.0.2
60else
61        VER=$(echo gmp-*.tar.bz2 | sed -re "s/(.*-)(.*)(.*.tar.bz2)$/\2/" | tail -n 1)
62fi
63
64if [ "$VER" = "" ] ; then
65        echo "ERROR! Can't find gmp source tarball."
66        exit 1
67fi
68
69
70case `uname -sr` in
71MINGW*)
72        PLATFORM_LIST="${MINGW_PLATFORMS}"
73        NAME="jbigi"
74        TYPE="dll"
75        TARGET="-windows-"
76        echo "Building windows .dlls for all architectures";;
77Darwin*)
78        PLATFORM_LIST="${DARWIN_PLATFORMS}"
79        NAME="libjbigi"
80        TYPE="jnilib"
81        TARGET="-osx-"
82        echo "Building ${TARGET} .jnilibs for all architectures";;
83Linux*)
84        NAME="libjbigi"
85        TYPE="so"
86        PLATFORM_LIST=""
87        TARGET="-linux-"
88        arch=$(uname -m | cut -f1 -d" ")
89        case ${arch} in
90                i[3-6]86)
91                        arch="x86";;
92        esac
93        case ${arch} in
94                x86_64 | amd64)
95                        PLATFORM_LIST="${X86_64_PLATFORMS}"
96                        TARGET="-linux-X86_64-";;
97                ia64)
98                        PLATFORM_LIST="${X86_64_PLATFORMS}"
99                        TARGET="-linux-ia64-";;
100                x86)
101                        PLATFORM_LIST="${X86_PLATFORMS}"
102                        TARGET="-linux-x86-";;
103                *)
104                        PLATFORM_LIST="${LINUX_PLATFORMS}";;
105        esac
106        echo "Building ${TARGET} .so's for ${arch}";;
107NetBSD*|FreeBSD*|OpenBSD*)
108        NAME="libjbigi"
109        TYPE="so"
110        PLATFORM_LIST=""
111        BSDTYPE="`uname -s | tr [A-Z] [a-z]`"
112        arch=$(uname -m | cut -f1 -d" ")
113        case ${arch} in
114                i[3-6]86)
115                        arch="x86";;
116        esac
117        case ${arch} in
118                x86_64|amd64)
119                        PLATFORM_LIST="${X86_64_PLATFORMS}"
120                        TARGET="-${BSDTYPE}-X86_64-";;
121                ia64)
122                        PLATFORM_LIST="${X86_64_PLATFORMS}"
123                        TARGET="-${BSDTYPE}-ia64-";;
124                x86)
125                        PLATFORM_LIST="${X86_PLATFORMS}"
126                        TARGET="-${BSDTYPE}-x86-";;
127                *)
128                        case ${BSDTYPE} in
129                                netbsd)
130                                        PLATFORM_LIST="${NETBSD_PLATFORMS}";;
131                                openbsd)
132                                        PLATFORM_LIST="${OPENBSD_PLATFORMS}";;
133                                freebsd)
134                                        PLATFORM_LIST="${FREEBSD_PLATFORMS}";;
135                                *)
136                                        echo "Unsupported build environment"
137                                        exit 1;;
138                        esac
139        esac
140        echo "Building ${BSDTYPE} .so's for ${arch}";;
141*)
142        echo "Unsupported build environment"
143        exit;;
144esac
145
146function make_static {
147        echo "Attempting .${4} creation for ${3}${5}${2}"
148        ../../mbuild_jbigi.sh static || return 1
149        cp ${3}.${4} ../../lib/net/i2p/util/${3}${5}${2}.${4}
150        return 0
151}
152
153function make_file {
154        # Nonfatal bail out on Failed build.
155        echo "Attempting build for ${3}${5}${2}"
156        make && return 0
157        cd ..
158        rm -R "$2"
159        echo -e "\n\nFAILED! ${3}${5}${2} not made.\a"
160        sleep 10
161        return 1
162}
163
164function configure_file {
165        echo -e "\n\n\nAttempting configure for ${3}${5}${2}\n\n\n"
166        sleep 10
167        # Nonfatal bail out on unsupported platform.
168        if [ `uname -s |grep Darwin` ]; then
169                ../../gmp-${1}/configure --build=${2}-apple-darwin --with-pic && return 0
170        else
171                ../../gmp-${1}/configure --build=${2} --with-pic && return 0
172        fi
173        cd ..
174        rm -R "$2"
175        echo -e "\n\nSorry, ${3}${5}${2} is not supported on your build environment.\a"
176        sleep 10
177        return 1
178}
179
180function build_file {
181        configure_file "$1" "$2" "$3" "$4" "$5"  && make_file "$1" "$2" "$3" "$4" "$5" && make_static "$1" "$2" "$3" "$4" "$5" && return 0
182        echo -e "\n\n\nError building static!\n\n\a"
183        sleep 10
184        return 1
185}
186
187echo "Extracting GMP Version $VER ..."
188tar -xjf gmp-$VER.tar.bz2 || ( echo "Error in tarball file!" ; exit 1 )
189
190if [ ! -d bin ]; then
191        mkdir bin
192fi
193if [ ! -d lib/net/i2p/util ]; then
194        mkdir -p lib/net/i2p/util
195fi
196
197# Don't touch this one.
198NO_PLATFORM=none
199
200for x in $NO_PLATFORM $PLATFORM_LIST
201do
202        (
203                if [ ! -d bin/$x ]; then
204                        mkdir bin/$x
205                        cd bin/$x
206                else
207                        cd bin/$x
208                        rm -Rf *
209                fi
210
211                build_file "$VER" "$x" "$NAME" "$TYPE" "$TARGET"
212        )
213done
214
215echo "Success!"
216exit 0
Note: See TracBrowser for help on using the repository browser.