-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall-mingw2015.sh
executable file
·286 lines (204 loc) · 8.14 KB
/
install-mingw2015.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
#!/bin/sh
# check_error my_cmd --param ...
check_error() {
$* # we execute everything
if [ $? -ne 0 ]; then
echo "check_error(): error running command:"
echo "check_error(): $*"
echo "check_error(): Continue? y/n"
read a
if [ $a != "y" ]; then
exit
fi
echo "check_error(): On continue..."
else
echo "check_error(): OK: $*"
fi
}
# check_download "file_maybe_existing" download_cmd...
check_download() {
file=$1
shift
if [ ! -f "$file" ]; then
echo "check_download(): download of $file must be done"
$*
else
echo "check_download(): $file already downloaded"
fi
}
# check_unzip "dir_unzipped" unzip_cmd...
check_unzip() {
unzipped=$1
shift
if [ ! -d "$1" ]; then
echo "check_unzip(): unzip is needed"
$*
else
echo "check_unzip(): unzip not needed, the $1 dir already exists"
fi
}
# dependencies
echo "Installing dependencies via Homebrew (http://brew.sh)"
check_error ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
check_error brew update
check_error brew install gcc48
check_error brew install wget
check_error brew install gmp4
check_error brew install mpfr2
check_error brew install homebrew/versions/libmpc08
check_error brew install homebrew/versions/isl011
# mingw
PREFIX="/usr/local/mingw"
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
check_error cd $DIR
check_error mkdir source
check_error mkdir $PREFIX
echo "Downloading binutils\n"
check_error cd ./source
check_error check_download "binutils-2.24.tar.bz2" curl -O http://ftp.gnu.org/gnu/binutils/binutils-2.24.tar.bz2
check_error check_unzip "binutils-2.24" tar xjf binutils-2.24.tar.bz2
echo "Building binutils\n"
#echo "1/2 32-bit\n"
check_error cd binutils-2.24
check_error mkdir build
check_error cd build
#CC=gcc-4.8 CXX=g++-4.8 CPP=cpp-4.8 LD=gcc-4.8
#check_error ../configure --target=i686-w64-mingw32 --disable-werror --disable-multilib --prefix=$PREFIX --with-sysroot=$PREFIX
#check_error make -j4
#check_error make install-strip
echo "2/2 64-bit\n"
check_error cd ..
#check_error rm -rf build
check_error mkdir build64
cd build64
CC=gcc-4.8 CXX=g++-4.8 CPP=cpp-4.8 LD=gcc-4.8
check_error ../configure --target=x86_64-w64-mingw32 --disable-werror --disable-multilib --prefix=$PREFIX --with-sysroot=$PREFIX --enable-64-bit-bfd
check_error make -j4
check_error make install-strip
check_error cd ..
check_error cd ..
echo "Downloading mingw-w64\n"
check_error check_download "mingw-w64-v3.1.0.tar.bz2" wget -O mingw-w64-v3.1.0.tar.bz2 "http://downloads.sourceforge.net/project/mingw-w64/mingw-w64/mingw-w64-release/mingw-w64-v3.1.0.tar.bz2?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fmingw-w64%2Ffiles%2Fmingw-w64%2Fmingw-w64-release%2F&ts=1396199899&use_mirror=kent"
check_error check_unzip "mingw-w64-v3.1.0" tar xjf mingw-w64-v3.1.0.tar.bz2
echo "Building mingw-headers\n"
#echo "1/2 32-bit\n"
check_error cd mingw-w64-v3.1.0
#check_error mkdir build-headers32
#check_error cd build-headers32
#check_error ../mingw-w64-headers/configure --host=i686-w64-mingw32 --prefix=$PREFIX/i686-w64-mingw32
#check_error make -j4
#check_error make install-strip
#check_error cd $PREFIX/i686-w64-mingw32
#check_error ln -s lib lib32
#check_error cd $DIR/source/mingw-w64-v3.1.0
echo "2/2 64-bit\n"
#check_error rm -rf build-headers
check_error mkdir build-headers64
check_error cd build-headers64
check_error ../mingw-w64-headers/configure --host=x86_64-w64-mingw32 --prefix=$PREFIX/x86_64-w64-mingw32
check_error make -j4
check_error make install-strip
check_error cd $PREFIX/x86_64-w64-mingw32
check_error ln -s lib lib64
check_error cd $DIR/source/
echo "Downloading gcc\n"
check_error check_download "gcc-4.8.2.tar.bz2" curl -O ftp://gcc.gnu.org/pub/gcc/releases/gcc-4.8.2/gcc-4.8.2.tar.bz2
check_error check_unzip "gcc-4.8.2" tar xjf gcc-4.8.2.tar.bz2
echo "Building core gcc\n"
#echo "1/2 32-bit\n"
check_error cd $PREFIX
check_error ln -s i686-w64-mingw32 mingw
check_error cd $DIR/source/gcc-4.8.2
#check_error mkdir build32
#check_error cd build32
#CC=gcc-4.8 CXX=g++-4.8 CPP=cpp-4.8 LD=gcc-4.8 PATH=/usr/local/mingw/bin/:$PATH
#check_error ../configure --target=i686-w64-mingw32 --disable-multilib --enable-languages=c,c++,objc,obj-c++ --with-gmp=/usr/local/Cellar/gmp4/4.3.2/ --with-mpfr=/usr/local/Cellar/mpfr2/2.4.2/ --with-mpc=/usr/local/Cellar/libmpc08/0.8.1/ --with-cloog=/usr/local/Cellar/cloog018/0.18.0/ --with-isl=/usr/local/Cellar/isl011/0.11.1/ --with-system-zlib --enable-version-specific-runtime-libs --enable-libstdcxx-time=yes --enable-stage1-checking --enable-checking=release --enable-lto --enable-threads=win32 --disable-sjlj-exceptions --prefix=$PREFIX --with-sysroot=$PREFIX
#PATH=/usr/local/mingw/bin/:$PATH
#check_error make all-gcc -j4
#PATH=/usr/local/mingw/bin/:$PATH
#check_error make install-gcc
echo "2/2 64-bit\n"
check_error cd $PREFIX
check_error rm mingw
check_error ln -s x86_64-w64-mingw32 mingw
check_error cd $DIR/source/gcc-4.8.2
check_error mkdir build64
check_error cd build64
CC=gcc-4.8 CXX=g++-4.8 CPP=cpp-4.8 LD=gcc-4.8 PATH=/usr/local/mingw/bin/:$PATH
check_error ../configure --target=x86_64-w64-mingw32 --disable-multilib --enable-languages=c,c++,objc,obj-c++ --with-gmp=/usr/local/Cellar/gmp4/4.3.2/ --with-mpfr=/usr/local/Cellar/mpfr2/2.4.2/ --with-mpc=/usr/local/Cellar/libmpc08/0.8.1/ --with-cloog=/usr/local/Cellar/cloog018/0.18.0/ --with-isl=/usr/local/Cellar/isl011/0.11.1/ --with-system-zlib --enable-version-specific-runtime-libs --enable-libstdcxx-time=yes --enable-stage1-checking --enable-checking=release --enable-lto --enable-threads=win32 --prefix=$PREFIX --with-sysroot=$PREFIX
PATH=/usr/local/mingw/bin/:$PATH
check_error make all-gcc -j4
PATH=/usr/local/mingw/bin/:$PATH
check_error make install-gcc
# echo "Building mingw runtime\n"
check_error cd $PREFIX
check_error rm mingw
check_error ln -s i686-w64-mingw32 mingw
check_error cd $DIR/source/mingw-w64-v3.1.0
check_error mkdir build-crt32
check_error cd build-crt32
#echo "1/2 32-Bit\n"
#PATH=/usr/local/mingw/bin/:$PATH
#check_error ../mingw-w64-crt/configure --host=i686-w64-mingw32 --prefix=$PREFIX/i686-w64-mingw32 --with-sysroot=$PREFIX
#PATH=/usr/local/mingw/bin/:$PATH
#check_error make
#PATH=/usr/local/mingw/bin/:$PATH
#check_error make install-strip
echo "2/2 64-Bit\n"
check_error cd $PREFIX
check_error rm mingw
check_error ln -s x86_64-w64-mingw32 mingw
check_error cd $DIR/source/mingw-w64-v3.1.0
#check_error rm -rf build-crt
check_error mkdir build-crt64
check_error cd build-crt64
PATH=/usr/local/mingw/bin/:$PATH
check_error ../mingw-w64-crt/configure --host=x86_64-w64-mingw32 --prefix=$PREFIX/x86_64-w64-mingw32 --with-sysroot=$PREFIX
PATH=/usr/local/mingw/bin/:$PATH
check_error make
PATH=/usr/local/mingw/bin/:$PATH
check_error make install-strip
echo "Building all gcc\n"
#echo "1/2 32-Bit\n"
#check_error cd $PREFIX
#check_error rm mingw
#check_error ln -s i686-w64-mingw32 mingw
#check_error cd $DIR/source/gcc-4.8.2/build32
#PATH=/usr/local/mingw/bin/:$PATH
#check_error make
#PATH=/usr/local/mingw/bin/:$PATH
#check_error make install-strip
echo "2/2 64-Bit\n"
check_error cd $PREFIX
check_error rm mingw
check_error ln -s x86_64-w64-mingw32 mingw
check_error cd $DIR/source/gcc-4.8.2/build64
PATH=/usr/local/mingw/bin/:$PATH
check_error make
PATH=/usr/local/mingw/bin/:$PATH
check_error make install-strip
echo "Linking libgcc\n"
#check_error cd $PREFIX/i686-w64-mingw32/lib
#check_error ln -s ../../lib/gcc/i686-w64-mingw32/lib/libgcc_s.a ./
check_error cd $PREFIX/x86_64-w64-mingw32/lib
check_error ln -s ../../lib/gcc/x86_64-w64-mingw32/lib/libgcc_s.a ./
echo "Building winpthreads\n"
check_error cd $DIR/source/mingw-w64-v3.1.0/mingw-w64-libraries/winpthreads
echo "1/2 32-Bit\n"
#check_error mkdir build32
#check_error cd build32
#check_error ../configure --host=i686-w64-mingw32 --prefix=$PREFIX/i686-w64-mingw32
#check_error make
#check_error make install-strip
#check_error cd ..
#check_error rm -rf build
echo "2/2 64-Bit\n"
check_error mkdir build64
check_error cd build64
check_error ../configure --host=x86_64-w64-mingw32 --prefix=$PREFIX/x86_64-w64-mingw32
check_error make
check_error make install-strip
echo "Cleaning up\n"
check_error cd $DIR
#check_error rm -rf source
echo "Done"