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