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