]> git.saurik.com Git - wxWidgets.git/blob - BuildCVS.txt
small updates for Linux->Win32 cross compilation
[wxWidgets.git] / BuildCVS.txt
1 ------------------------------------------------------------------------
2 How to build the sources from CVS
3 ------------------------------------------------------------------------
4
5 I) Windows using plain makefiles
6 ----------------------------------------
7
8 a) If using Microsoft Visual C++ 5.0 or 6.0
9
10 Ensure that the command-line compiler and tools (including
11 nmake) are installed and ready to run. Depending on your
12 installation there may be a batch file (named something like
13 VCVARS32.BAT) that needs to be run to set correct environment
14 varaibles and PATH entries.
15
16 Continue with item c) below.
17
18
19 b) If using the GNU MinGW32 or GNU CygWin32 compilers
20
21 You'll need the compiler itself which is available from
22
23 http://www.cygwin.com
24
25 When using MingW32 you'll need GNU make which is a part
26 of the CygWin32 toolchain and is also available as a stand
27 alone port without the infamous Cygwin.dll from
28
29 http://agnes.dida.physik.uni-essen.de/~janjaap/mingw32
30
31 The makefile has small problems with Cygwin´s tools
32 so it is recommended not to use these (but MingGW32
33 and its make.exe).
34
35 -> Set your path so that it includes the directory
36 where your compiler and tools reside
37
38 b-2) Using Mingw32 with gcc-2.95 and Anders Norlander's
39 Win32 headers
40
41 Using the newer gcc-2.95/Noralander header combination
42 will allow you to compile more of the MSW code, such
43 as OLE and Drag-n-Drop.
44
45 Instructions are similar to those for Regular Mingw32 except
46
47 ->Get the compiler from
48 ftp://ftp.xraylith.wisc.edu/pub/khan/gnu-win32/mingw32/gcc-2.95/
49
50 ->patch the gcc headers with info in wxWin\Mingw32-gcc295.patches.
51 PLEASE APPLY THESE PATCHES BY HAND! There are apparently a few
52 different versions of the headers floating around.
53
54 ->copy wxWin\src\makeg295.env to wxWin\src\makeg95.env
55
56
57 c) Build instructions
58
59 -> Assumming that you installed the wxWindows sources
60 into c:\wxWin
61 -> Copy c:\wxWin\include\wx\msw\setup0.h
62 to c:\wxWin\include\wx\msw\setup.h
63 -> Edit c:\wxWin\include\wx\msw\setup.h so that
64 most features are enabled (i.e. defined to 1) with
65 #define wxUSE_ODBC 0
66 #define wxUSE_SOCKETS 0
67 #define wxUSE_HTML 1
68 #define wxUSE_THREADS 1
69 #define wxUSE_FS_INET 0
70 #define wxUSE_FS_ZIP 1
71 #define wxUSE_BUSYINFO 1
72 #define wxUSE_DYNLIB_CLASS 1
73 #define wxUSE_ZIPSTREAM 1
74 #define wxUSE_LIBJPEG 1
75 #define wxUSE_LIBPNG 1
76
77 and iostreams ares disabled with
78 #define wxUSE_STD_IOSTREAM 0
79
80 note: ODBC and SOCKETS can be 1 for gcc-2.95
81
82 -> type: cd c:\wxWin\src\msw
83 -> type: make -f makefile.g95 (if using GNU tools)
84 or type: make -f makefile.g295 (if using Mingw32/gcc-2.95)
85 or type: make -f makefile.vc (if using MS VC++)
86
87
88 II) Unix ports
89 --------------
90
91 Building wxGTK or wxMotif completely without configure
92 won't ever work, but there is now a new makefile system
93 that works without libtool and automake, using only
94 configure to create what is needed.
95
96 In order to create configure, you need to have the
97 GNU autoconf package (version 2.13 or 2.14) installed
98 on your system and type run "autoconf" in the base
99 directory (or run the autogen.sh script in the same
100 directory, which just calls autoconf).
101
102 Set WXWIN environment variable to the base directory such
103 as ~/wxWindows (this is actually not really needed).
104
105 -> type: export WXWIN=~/wxWindows
106 -> type: md mybuild
107 -> type: cd mybuild
108 -> type: ../configure --with-motif
109 or type: ../configure --with-gtk
110 -> type: make
111 -> type: su <type root password>
112 -> type: make install
113 -> type: ldconfig
114 -> type: exit
115
116 Call configure with --disable-shared to create a static
117 library. Calling "make uninstall" will remove the installed
118 library and "make dist" will create a distribution (not
119 yet complete).
120
121 III) Windows using configure
122 ----------------------------------------
123
124 Take a look at Unix->Windows cross compiling. With minor
125 modifications, this should work in Windows if you've got the cygnus
126 utilities (bash, GNU make, etc) and either mingw32 or cygwin32 installed.
127 See http://www.cygnus.com for these programs, or go straight to their
128 ftp server at ftp://sourceware.cygnus.com/pub/cygwin/.
129
130 Of course, you can also build the library using plain makefiles (see
131 section I).
132
133 V) MacOS
134 ----------------------------------------
135
136 VI) OS/2
137 ----------------------------------------
138
139 VII) Unix->Windows cross-compiling using configure
140 --------------------------------------------------
141
142 First you'll need a cross-compiler; linux glibc binaries of mingw32 and
143 cygwin32 (both based on egcs) can be found at
144 ftp://ftp.objsw.com/pub/crossgcc/linux-x-win32. Otherwise you can
145 compile one yourself. Check the relevant FAQs.
146
147 [ A Note about cygwin32 and mingw32: the main difference is that cygwin32
148 binaries are always linked against cygwin.dll. This dll encapsulates most
149 standard Unix C extensions, which is very handy if you're porting unix
150 software to windows. However, wxMSW doesn't need this, so mingw32 is
151 preferable if you write portable C(++). ]
152
153 You might want to build both Unix and Windows binaries in the same source
154 tree; to do this make subdirs for each e.g. unix and win32. If you've
155 already build wxWindows in the main dir, do a 'make distclean' there,
156 otherwise configure will get confused. (In any case, read the section 'Unix
157 using configure' and make sure you're able to build a native wxWindows
158 library; cross-compiling errors can be pretty obscure and you'll want to be
159 sure that your configure setup is basically sound.)
160
161 To cross compile the windows library, do
162 -> cd win32
163 (or whatever you called it)
164 Now run configure. There are two ways to do this
165 -> ../configure --host=i586-mingw32 --build=i586-linux --with-mingw \
166 --enable-dnd=no --without-odbc
167 where --build= should read whatever platform you're building on. Configure
168 will notice that build and host platforms differ, and automatically prepend
169 i586-mingw32- to gcc, ar, ld, etc (make sure they're in the PATH!).
170 The other way to run configure is by specifying the names of the binaries
171 yourself:
172 -> CC=i586-mingw32-gcc CXX=i586-mingw32-g++ RANLIB=i586-mingw32-ranlib \
173 DLLTOOL=i586-mingw32-dlltool LD=i586-mingw32-ld NM=i586-mingw32-nm \
174 ../configure --host=i586-mingw32 --with-mingw --enable-dnd=no
175
176 (all assuming you're using mingw32)
177 Drag'n'drop is disabled because mingw32 lacks (AFAIK) OLE headers.
178
179 [ Update: some new mingw32 versions now have a new set of windows header
180 files, which apparently can handle ole. Untested at the moment ]
181
182 ODBC files don't compile as of 13.10.99 - may be this will be fixed by the
183 moment you're reading these lines.
184
185 Configure will conclude that shared libraries are out of the question and
186 opt for a static one. I haven't looked into DLL creation yet.
187
188 Type
189 -> make
190 and wait, wait, wait. Don't leave the room, because the minute you do there
191 will be a compile error :-)
192
193 If this is successful, you end up with a libwx_msw.a in win32/lib. Now try
194 building the minimal sample:
195
196 -> cd samples/minimal
197 -> make
198 -> mv minimal minimal.exe
199
200 and run it with wine, for example
201 -> wine minimal.exe
202
203 If all is well, do an install; from win32
204 -> make install
205
206 Native and cross-compiled installations can co-exist peacefully
207 (as long as their widget sets differ), except for wx-config. You might
208 want to rename the cross-compiled one to i586-mingw32-wx-config, or something.
209
210 Cross-compiling TODO:
211 ---------------------
212 - resource compiling must be done manually for now (should/can we link the
213 default wx resources into libwx_msw.a?) [ No we can't; the linker won't
214 link it in... you have to supply an object file ]
215 - dynamic libraries
216 - static executables are HUGE -- there must be room for improvement.
217