I2P

Invisible Internet Project


root/core/c/jbigi/mbuild-all.sh @ b9fa686ca4d2cac5596605135a8c93303e191cb0

Revision 0fa421282524f5cc2e85abbbc4deae464ed0f697, 3.7 KB (checked in by sponge@…, 2 years ago)

mbuild.sh fixups : add new jcpuid/mbuild.sh, edit jbigi/mbuild-all.sh -- pedantic naming

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