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
|
Introduction
------------
MinGW is short for the Minimalist GNU Windows. It's package which allows you
to use GCC and other GNU tools to compile native windows programs.
In this case "native" means programs which don't require extra DLLs like
cygwin DLL. Mingw32 programs use DLLs supplied with all current Win32
platforms. Thus the programs are light weight and easy to distribute.
This document describes by shell commands how to compile and install MinGW
cross development tools on Unix host and how to use it for building windows
version of xine.
Download
--------
MinGW packages:
http://mingw.org/download.shtml
1) binutils (sources), binutils-build.sh
2) gcc-core, gcc-c++ (sources), gcc-build.sh
3) w32api, mingw-runtime (binaries and sources)
DirectX headers (tested with version 7):
http://www.google.com/search?hl=cs&q=win32-dx7headers.tgz
http://www.google.com/search?q=dx7adxf.exe
Pthread Win32:
ftp://sources.redhat.com/pub/pthreads-win32/
zlib:
http://www.zlib.net
Build
-----
In the following text are used symbols $PREFIX and $USER with this meaning:
$PREFIX .... directory of the mingw cross environtment
$USER ...... current user
1. compile binutils
tar xzf binutils-2.13.90-20030111-1-src.tar.gz
mkdir bin
cd bin
../binutils-2.13.90-20030111-1-src/configure \
--target=i386-mingw32 \
--prefix=$PREFIX
make
su
make install
exit
2. add $PREFIX/bin into PATH
...
3. compile compiler (gcc-core, gcc-c++)
#
# prepare runtime environment from binaries
#
mkdir runtime
cd runtime
tar xzf ../w32api-2.5.tar.gz
tar xzf ../mingw-runtime-3.3.tar.gz
cd ..
#
# compile and install the compiler
#
# if you'll want rerun this step, I recommend delete
# $PREFIX/i386-mingw32/sys-include
#
tar xzf gcc-core-3.3.1-20030804-1-src.tar.gz
tar xzf gcc-g++-3.3.1-20030804-1-src.tar.gz
mkdir gcc-bin
cd gcc-bin
# needed for the copying header files
su
# more option may be needed for successfull compilation,
# see gcc-3.3.1-1-build.sh
../gcc-3.3.1-20030804-1/configure \
--disable-shared \
--target=i386-mingw32 \
--with-headers=../runtime/include \
--with-libs=../runtime/lib \
--prefix=$PREFIX
exit
make
#or recommended: make CFLAGS=-O2 LDFLAGS=-s
su
make install
exit
4. recompile w32api and mingw-runtime from sources (optional)
#
# installing must be into $PREFIX/i386-mingw32
#
tar xzf w32api-2.5-src.tar.gz
cd w32api-2.5
./configure --prefix=$PREFIX/i386-mingw32 --host=i386-mingw32
make
su
make install
exit
#
# installing must be into $PREFIX/i386-mingw32
#
tar xzf mingw-runtime-3.3-src.tar.gz
cd mingw-runtime-3.3
# copying w32api headers into ./include (because of a bug in runtime
# package)
...
# compiling
CC=i386-mingw32-gcc \
DLLTOOL=i386-mingw32-dlltool \
AR=i386-mingw32-ar \
AS=i386-mingw32-as \
RANLIB=i386-mingw32-ranlib \
./configure --prefix=$PREFIX/i386-mingw32 --target=i386-mingw32
make
su
make install
exit
5. install DirectX headers and other libraries
su
cd $PREFIX/include
# untar dx7headers.tar.gz (maybe to a subdirectory)
...
exit
6. compile and install pthreads-win32
tar xzf pthreads-w32-2-7-0-release.tar.gz
cd pthreads-w32-2-7-0-release/
make CROSS=i386-mingw32- PTHREAD_DEF=pthreadGC2.def clean GC
#
# possibility to use pthread library in M$ Visual C (optional)
#
mv pthread.def pthreadGC2.def
wine LIB.EXE /machine:i386 /def:pthreadGC2.def
#
# installing
#
su
mkdir -p $PREFIX/pthreads-win32/bin
mkdir -p $PREFIX/pthreads-win32/include
mkdir -p $PREFIX/pthreads-win32/lib
cp pthreadGC2.dll $PREFIX/pthreads-win32/bin/
cp libpthreadGC2.a pthreadGC2.lib $PREFIX/pthreads-win32/lib/
ln -s libpthreadGC2.a $PREFIX/pthreads-win32/lib/libpthread.a
ln -s pthreadGC2.lib $PREFIX/pthreads-win32/lib/pthread.lib
cp pthread.h semaphore.h sched.h $PREFIX/pthreads-win32/include/
exit
7. compile and install zlib
tar xjf zlib-1.2.3.tar.bz2
cd zlib-1.2.3
#
# small workaround in Makefile:
#
sed -e 's/dllwrap /i386-mingw32-dllwrap /g' win32/Makefile.gcc > Makefile
#
# compiling
#
make CC=i386-mingw32-gcc AR=i386-mingw32-ar RC=i386-mingw32-windres STATICLIB=libz-static.a IMPLIB=libz.a
#
# possibility to use zlib library in M$ Visual C (optional)
#
cp win32/zlib.def zlib1.def
wine LIB.EXE /machine:i386 /def:zlib1.def
#
# installing
#
su
mkdir -p $PREFIX/zlib/{include,lib,bin}
cp zconf.h zlib.h $PREFIX/zlib/include/
cp libz.a libz-static.a zlib1.lib $PREFIX/zlib/lib/
cp zlib1.dll $PREFIX/zlib/bin/
exit
Using MinGW cross development tools
-----------------------------------
Now we can build xine library for Windows by this way:
#
# configure for mingw cross compiling
# (the build option is needed only for forcing cross compilation mode)
#
./configure \
--host=i386-mingw32 \
--build=i686-debian-linux \
--disable-freetype \
--disable-vcd \
--with-dxheaders=$PREFIX/include/dx7headers \
--with-zlib-prefix=$PREFIX/zlib \
--with-pthread-prefix=$PREFIX/pthreads-win32
#
# compile
#
make
#
# install
#
make install DESTDIR=/tmp/xine-lib-mingwcross
rm /tmp/xine-lib-mingwcross/lib/xine/plugins/1.1.0{/,/post}/*.a
#
# create libxine-1.lib file (optional, when we want to use xine library in
# M$ compilers)
#
# we will need wine and some tools from M$ Visual C: LIB.EXE, LINK.EXE,
# MSPDB60.DLL
#
cd <path_where_libxine_is_installed_>/lib
cp ../bin/libxine-1.dll .
wine LIB.EXE /machine:i386 /def:libxine-1.def
rm libxine-1.dll
|