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

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

NetBSD support

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