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

Last change on this file since 45f30209 was 45f30209, checked in by sponge <sponge@…>, 9 years ago

mbuild.sh document and fixes, mbuild-all.sh add cpu types

  • Property mode set to 100755
File size: 3.3 KB
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# Oddly athlon64 builds.... I wonder what others can :-)
31#
32X86_PLATFORMS="pentium pentiummmx pentium2 pentium3 pentiumm pentium4 k6 k62 k63 athlon core2 corei athlon64 geode atom nano viac3 viac32"
33
34
35#
36# You should not need to edit anything below this comment.
37#
38
39MINGW_PLATFORMS="${X86_PLATFORMS} ${MISC_MINGW_PLATFORMS}"
40LINUX_PLATFORMS="${X86_PLATFORMS} ${MISC_LINUX_PLATFORMS}"
41FREEBSD_PLATFORMS="${X86_PLATFORMS} ${MISC_FREEBSD_PLATFORMS}"
42
43VER=$(echo gmp-*.tar.bz2 | sed -re "s/(.*-)(.*)(.*.tar.bz2)$/\2/" | tail --lines=1)
44if [ "$VER" == "" ] ; then
45        echo "ERROR! Can't find gmp source tarball."
46        exit 1
47fi
48
49
50case `uname -sr` in
51MINGW*)
52        PLATFORM_LIST="${MINGW_PLATFORMS}"
53        NAME="jbigi"
54        TYPE="dll"
55        TARGET="-windows-"
56        echo "Building windows .dlls for all architectures";;
57Linux*)
58        PLATFORM_LIST="${LINUX_PLATFORMS}"
59        NAME="libjbigi"
60        TYPE="so"
61        TARGET="-linux-"
62        echo "Building linux .sos for all architectures";;
63FreeBSD*)
64        PLATFORM_LIST="${FREEBSD_PLATFORMS}"
65        NAME="libjbigi"
66        TYPE="so"
67        TARGET="-freebsd-"
68        echo "Building freebsd .sos for all architectures";;
69*)
70        echo "Unsupported build environment"
71        exit;;
72esac
73
74function make_static {
75        echo "Attempting .${4} creation for ${3}${5}${2}"
76        ../../mbuild_jbigi.sh static || return 1
77        cp ${3}.${4} ../../lib/net/i2p/util/${3}${5}${2}.${4}
78        return 0
79}
80
81function make_file {
82        # Nonfatal bail out on Failed build.
83        echo "Attempting build for ${3}${5}${2}"
84        make && return 0
85        cd ..
86        rm -R "$2" 
87        echo -e "\n\nFAILED! ${3}${5}${2} not made.\a"
88        sleep 10
89        return 1
90}
91
92function configure_file {
93        echo -e "\n\n\nAttempting configure for ${3}${5}${2}\n\n\n"
94        sleep 10
95        # Nonfatal bail out on unsupported platform.
96        ../../gmp-${1}/configure --build=${2} --with-pic && return 0
97        cd ..
98        rm -R "$2"
99        echo -e "\n\nSorry, ${3}${5}${2} is not supported on your build environment.\a"
100        sleep 10
101        return 1
102}
103
104function build_file {
105        configure_file "$1" "$2" "$3" "$4" "$5"  && make_file "$1" "$2" "$3" "$4" "$5" && make_static "$1" "$2" "$3" "$4" "$5" && return 0
106        echo -e "\n\n\nError building static!\n\n\a"
107        sleep 10
108        return 1
109}
110
111echo "Extracting GMP Version $VER ..."
112tar -xf gmp-$VER.tar.bz2 || ( echo "Error in tarball file!" ; exit 1 )
113
114if [ ! -d bin ]; then
115        mkdir bin
116fi
117if [ ! -d lib/net/i2p/util ]; then
118        mkdir -p lib/net/i2p/util
119fi
120
121# Don't touch this one.
122NO_PLATFORM=none
123
124for x in $NO_PLATFORM $PLATFORM_LIST
125do
126        (
127                if [ ! -d bin/$x ]; then
128                        mkdir bin/$x
129                        cd bin/$x
130                else
131                        cd bin/$x
132                        rm -Rf *
133                fi
134
135                build_file "$VER" "$x" "$NAME" "$TYPE" "$TARGET"
136        )
137done
138
139echo "Success!"
140exit 0
Note: See TracBrowser for help on using the repository browser.