]> git.saurik.com Git - wxWidgets.git/blame_incremental - BuildCVS.txt
Fixed toolbar crash for MinGW/Cygwin
[wxWidgets.git] / BuildCVS.txt
... / ...
CommitLineData
1------------------------------------------------------------------------
2 How to build the sources from CVS
3------------------------------------------------------------------------
4
5Please use the install.txt files in docs/gtk, docs/msw, docs/motif, docs/mac
6etc. alongside these instructions.
7
8I) Windows using plain makefiles
9----------------------------------------
10
11a) If using Microsoft Visual C++ 5.0 or 6.0
12
13Ensure that the command-line compiler and tools (including
14nmake) are installed and ready to run. Depending on your
15installation there may be a batch file (named something like
16VCVARS32.BAT) that needs to be run to set correct environment
17varaibles and PATH entries.
18
19Continue with item c) below.
20
21
22b) If using the GNU Mingw32 or GNU Cygwin32 compilers
23
24You can get Mingw32 from http://www.mingw.org
25
26Cygwin32 is available at http://www.cygwin.com
27
28The makefile might have small problems with Cygwin's tools
29so it is recommended to use Mingw32 and its toolchain instead
30if possible.
31
32-> Set your path so that it includes the directory
33 where your compiler and tools reside
34
35-> If your are using an old Mingw32 version (gcc-2.95 or older),
36 you might need to fix some headers with the patches contained
37 in the wxWin\Mingw32-gcc295.patches file. PLEASE APPLY THESE
38 PATCHES BY HAND! There are apparently a few different versions
39 of the headers floating around. Note that these patches are
40 not needed if you are using Mingw32 gcc-2.95.2 or newer.
41
42-> Edit wx/src/makeg95.env and set the MINGW32 variable at the top of
43 the file to either 1 (you have Mingw32) or 0 (you have Cygwin32).
44 If using MINGW32, also set the MINGW32VERSION variable
45 appropiately.
46
47
48c) Build instructions
49
50-> Assumming that you installed the wxWindows sources
51 into c:\wxWin
52-> Copy c:\wxWin\include\wx\msw\setup0.h
53 to c:\wxWin\include\wx\msw\setup.h
54-> Edit c:\wxWin\include\wx\msw\setup.h so that
55 most features are enabled (i.e. defined to 1), for example:
56 #define wxUSE_ODBC 0
57 #define wxUSE_SOCKETS 1
58 #define wxUSE_HTML 1
59 #define wxUSE_THREADS 1
60 #define wxUSE_FS_INET 0
61 #define wxUSE_FS_ZIP 1
62 #define wxUSE_BUSYINFO 1
63 #define wxUSE_DYNLIB_CLASS 1
64 #define wxUSE_ZIPSTREAM 1
65 #define wxUSE_LIBJPEG 1
66 #define wxUSE_LIBPNG 1
67
68 and std iostreams are disabled with
69 #define wxUSE_STD_IOSTREAM 0
70
71-> type: cd c:\wxWin\src\msw
72-> type: make -f makefile.g95 (if using GNU tools)
73or type: nmake -f makefile.vc (if using MS VC++)
74
75d) Borland (including free command line tools)
76 Download tools from http://www.borland.com/downloads/
77
78 See docs/msw/install.txt for details; in brief
79
80-> type set WXWIN=c:\wxwindows
81-> type set BCCDIR=c:\progra~1\borland\cb4
82-> type cd %WXWIN%\include\wx
83-> type copy msw\setup0.h setup.h
84-> type cd %WXWIN%\src\msw
85-> type make -f makefile.b32
86
87II) Unix ports
88--------------
89
90Building wxGTK or wxMotif completely without configure
91won't ever work, but there is now a new makefile system
92that works without libtool and automake, using only
93configure to create what is needed.
94
95In order to create configure, you need to have the
96GNU autoconf package (version 2.13 or 2.14) installed
97on your system and type run "autoconf" in the base
98directory (or run the autogen.sh script in the same
99directory, which just calls autoconf).
100
101Set WXWIN environment variable to the base directory such
102as ~/wxWindows (this is actually not really needed).
103
104-> type: export WXWIN=~/wxWindows
105-> type: md mybuild
106-> type: cd mybuild
107-> type: ../configure --with-motif
108or type: ../configure --with-gtk
109-> type: make
110-> type: su <type root password>
111-> type: make install
112-> type: ldconfig
113-> type: exit
114
115Call configure with --disable-shared to create a static
116library. Calling "make uninstall" will remove the installed
117library and "make dist" will create a distribution (not
118yet complete).
119
120III) Windows using configure
121----------------------------------------
122
123Take a look at Unix->Windows cross compiling. With minor
124modifications, this should work in Windows if you've got the cygnus
125utilities (bash, GNU make, etc) and either mingw32 or cygwin32 installed.
126See http://www.cygnus.com for these programs, or go straight to their
127ftp server at ftp://sourceware.cygnus.com/pub/cygwin/.
128
129Of course, you can also build the library using plain makefiles (see
130section I).
131
132IV) Classic MacOS using CodeWarrior (eg MacOS 8.x/9.x)
133----------------------------------------
134
135Refer to the readme.txt and install.txt files in docs/mac to build
136wxWindows under Classic Mac OS using CodeWarrior.
137
138If you are checking out the CVS sources using cvs under Mac OS X and
139compiling under Classic Mac OS:
140
141- make sure that all text files have a Mac OS type of 'TEXT' otherwise
142 CodeWarrior may ignore them. Checking out the CVS sources using cvs
143 under Mac OS X creates untyped files which can lead to compilation
144 errors under CodeWarrior which are hard to track down.
145
146- convert the xml files to CodeWarrior binary projects using the supplied
147 AppleScript in docs/mac (M5xml2mcp.applescript for CodeWarrior 5.3)
148
149V) MacOS X using configure and the Developer Tools
150----------------------------------------
151
152You need to have the Developer Tools installed. If this is not the case,
153you will need to register at the Apple Developer web site (this is a free
154registration) in order to download the Developer Tools installer.
155
156In order to create configure, you need to have the
157GNU autoconf package (version 2.13 or 2.14) installed
158on your system and type run "autoconf" in the base
159directory (or run the autogen.sh script in the same
160directory, which just calls autoconf).
161
162-> type: mkdir macbuild
163-> type: cd macbuild
164-> type: ../configure --with-mac
165or type: ../configure
166-> type: make
167
168VI) OS/2
169----------------------------------------
170
171VII) Unix->Windows cross-compiling using configure
172--------------------------------------------------
173
174First you'll need a cross-compiler; linux glibc binaries of mingw32 and
175cygwin32 (both based on egcs) can be found at
176ftp://ftp.objsw.com/pub/crossgcc/linux-x-win32. Alternative binaries,
177based on the latest MinGW release can be found at
178http://members.telering.at/jessich/mingw/mingwcross/mingw_cross.html
179Otherwise you can compile one yourself.
180
181[ A Note about cygwin32 and mingw32: the main difference is that cygwin32
182binaries are always linked against cygwin.dll. This dll encapsulates most
183standard Unix C extensions, which is very handy if you're porting unix
184software to windows. However, wxMSW doesn't need this, so mingw32 is
185preferable if you write portable C(++). ]
186
187You might want to build both Unix and Windows binaries in the same source
188tree; to do this make subdirs for each e.g. unix and win32. If you've
189already build wxWindows in the main dir, do a 'make distclean' there,
190otherwise configure will get confused. (In any case, read the section 'Unix
191using configure' and make sure you're able to build a native wxWindows
192library; cross-compiling errors can be pretty obscure and you'll want to be
193sure that your configure setup is basically sound.)
194
195To cross compile the windows library, do
196-> cd win32
197(or whatever you called it)
198Now run configure. There are two ways to do this
199-> ../configure --host=i586-mingw32 --build=i586-linux --with-mingw
200where --build= should read whatever platform you're building on. Configure
201will notice that build and host platforms differ, and automatically prepend
202i586-mingw32- to gcc, ar, ld, etc (make sure they're in the PATH!).
203The other way to run configure is by specifying the names of the binaries
204yourself:
205-> CC=i586-mingw32-gcc CXX=i586-mingw32-g++ RANLIB=i586-mingw32-ranlib \
206 DLLTOOL=i586-mingw32-dlltool LD=i586-mingw32-ld NM=i586-mingw32-nm \
207 ../configure --host=i586-mingw32 --with-mingw
208
209(all assuming you're using mingw32)
210By default this will compile a DLL, if you want a static library,
211specify --disable-shared.
212
213Type
214-> make
215and wait, wait, wait. Don't leave the room, because the minute you do there
216will be a compile error :-)
217
218NB: if you are using a very old compiler you risk to get quite a few warnings
219 about "ANSI C++ forbids implicit conversion from 'void *'" in all places
220 where va_arg macro is used. This is due to a bug in (some versions of)
221 mingw32 headers which may be corrected by upgrading your compier,
222 otherwise you might edit the file
223
224 ${install_prefix}/lib/gcc-lib/i586-mingw32/egcs-2.91.57/include/stdarg.h
225
226 (instead of egcs-2.91.57 you may have something different), searching for
227 the lines
228
229/* Define __gnuc_va_list. */
230
231#ifndef __GNUC_VA_LIST
232#define __GNUC_VA_LIST
233#if defined(__svr4__) || defined(_AIX) || defined(_M_UNIX) || defined(__NetBSD__)
234typedef char *__gnuc_va_list;
235#else
236typedef void *__gnuc_va_list;
237#endif
238#endif
239
240 and adding "|| defined(_WIN32)" to the list of platforms on which
241 __gnuc_va_list is char *.
242
243If this is successful, you end up with a wx23_2.dll/libwx23_2.a in win32/lib
244( or just libwx_msw.a if you opted for a static build ).
245Now try building the minimal sample:
246
247-> cd samples/minimal
248-> make
249
250and run it with wine, for example (or copy to a Windows box)
251-> wine minimal.exe
252
253If all is well, do an install; from win32
254-> make install
255
256Native and cross-compiled installations can co-exist peacefully
257(as long as their widget sets differ), except for wx-config. You might
258want to rename the cross-compiled one to i586-mingw32-wx-config, or something.
259
260Cross-compiling TODO:
261---------------------
262- resource compiling must be done manually for now (should/can we link the
263default wx resources into libwx_msw.a?) [ No we can't; the linker won't
264link it in... you have to supply an object file ]
265- static executables are HUGE -- there must be room for improvement.
266