Minor fixes to plug memory hole, will add WXLO import ASAP.
[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 ->Edit wx/src/makeg95.env and set the MINGW32 variable at the top of
55   the file to either 1 (you have Mingw32) or 0 (you have Cygwin32).
56   If using MINGW32, also set the MINGW32VERSION variable
57   appropriately.
58
59
60 c) Build instructions
61
62 -> Assumming that you installed the wxWindows sources
63    into c:\wxWin
64 -> Copy c:\wxWin\include\wx\msw\setup0.h
65    to   c:\wxWin\include\wx\msw\setup.h
66 -> Edit c:\wxWin\include\wx\msw\setup.h so that
67    most features are enabled (i.e. defined to 1) with
68    #define wxUSE_ODBC          0
69    #define wxUSE_SOCKETS       0
70    #define wxUSE_HTML          1
71    #define wxUSE_THREADS       1
72    #define wxUSE_FS_INET       0
73    #define wxUSE_FS_ZIP        1
74    #define wxUSE_BUSYINFO      1
75    #define wxUSE_DYNLIB_CLASS  1
76    #define wxUSE_ZIPSTREAM     1
77    #define wxUSE_LIBJPEG       1
78    #define wxUSE_LIBPNG        1
79
80    and iostreams ares disabled with
81    #define wxUSE_STD_IOSTREAM   0
82
83    note: ODBC and SOCKETS can be 1 for gcc-2.95
84
85 -> type: cd c:\wxWin\src\msw
86 -> type: make -f makefile.g95  (if using GNU tools)
87 or type: make -f makefile.vc   (if using MS VC++)
88
89
90 II) Unix ports
91 --------------
92
93 Building wxGTK or wxMotif completely without configure
94 won't ever work, but there is now a new makefile system
95 that works without libtool and automake, using only
96 configure to create what is needed.
97
98 In order to create configure, you need to have the
99 GNU autoconf package (version 2.13 or 2.14) installed
100 on your system and type run "autoconf" in the base
101 directory (or run the autogen.sh script in the same
102 directory, which just calls autoconf).
103
104 Set WXWIN environment variable to the base directory such
105 as ~/wxWindows (this is actually not really needed).
106
107 -> type: export WXWIN=~/wxWindows
108 -> type: md mybuild
109 -> type: cd mybuild
110 -> type: ../configure --with-motif
111 or type: ../configure --with-gtk
112 -> type: make
113 -> type: su <type root password>
114 -> type: make install
115 -> type: ldconfig
116 -> type: exit
117
118 Call configure with --disable-shared to create a static
119 library. Calling "make uninstall" will remove the installed
120 library and "make dist" will create a distribution (not
121 yet complete).
122
123 III) Windows using configure
124 ----------------------------------------
125
126 Take a look at Unix->Windows cross compiling. With minor
127 modifications, this should work in Windows if you've got the cygnus
128 utilities (bash, GNU make, etc) and either mingw32 or cygwin32 installed.
129 See http://www.cygnus.com for these programs, or go straight to their
130 ftp server at ftp://sourceware.cygnus.com/pub/cygwin/.
131
132 Of course, you can also build the library using plain makefiles (see
133 section I).
134
135 V) MacOS
136 ----------------------------------------
137
138 VI) OS/2
139 ----------------------------------------
140
141 VII) Unix->Windows cross-compiling using configure
142 --------------------------------------------------
143
144 First you'll need a cross-compiler; linux glibc binaries of mingw32 and
145 cygwin32 (both based on egcs) can be found at
146 ftp://ftp.objsw.com/pub/crossgcc/linux-x-win32. Otherwise you can
147 compile one yourself. Check the relevant FAQs.
148
149 [ A Note about cygwin32 and mingw32: the main difference is that cygwin32
150 binaries are always linked against cygwin.dll. This dll encapsulates most
151 standard Unix C extensions, which is very handy if you're porting unix
152 software to windows. However, wxMSW doesn't need this, so mingw32 is
153 preferable if you write portable C(++). ]
154
155 You might want to build both Unix and Windows binaries in the same source
156 tree; to do this make subdirs for each e.g. unix and win32. If you've
157 already build wxWindows in the main dir, do a 'make distclean' there,
158 otherwise configure will get confused. (In any case, read the section 'Unix
159 using configure' and make sure you're able to build a native wxWindows
160 library; cross-compiling errors can be pretty obscure and you'll want to be
161 sure that your configure setup is basically sound.)
162
163 To cross compile the windows library, do
164 -> cd win32
165 (or whatever you called it)
166 Now run configure. There are two ways to do this
167 -> ../configure --host=i586-mingw32 --build=i586-linux --with-mingw \
168    --enable-dnd=no --without-odbc
169 where --build= should read whatever platform you're building on. Configure
170 will notice that build and host platforms differ, and automatically prepend
171 i586-mingw32- to gcc, ar, ld, etc (make sure they're in the PATH!).
172 The other way to run configure is by specifying the names of the binaries
173 yourself:
174 -> CC=i586-mingw32-gcc CXX=i586-mingw32-g++ RANLIB=i586-mingw32-ranlib \
175    DLLTOOL=i586-mingw32-dlltool LD=i586-mingw32-ld NM=i586-mingw32-nm \
176    ../configure --host=i586-mingw32 --with-mingw --enable-dnd=no
177
178 (all assuming you're using mingw32)
179 Drag'n'drop is disabled because mingw32 lacks (AFAIK) OLE headers.
180
181 [ Update: some new mingw32 versions now have a new set of windows header
182 files, which apparently can handle ole. Untested at the moment ]
183
184 ODBC files don't compile as of 13.10.99 - may be this will be fixed by the
185 moment you're reading these lines.
186
187 Configure will conclude that shared libraries are out of the question and
188 opt for a static one. I haven't looked into DLL creation yet.
189
190 Type
191 -> make
192 and wait, wait, wait. Don't leave the room, because the minute you do there
193 will be a compile error :-)
194
195 NB: you risk to get quite a few warnings about "ANSI C++ forbids implicit
196     conversion from 'void *'" in all places where va_arg macro is used. This
197     is due to a bug in (some versions of) mingw32 headers which may be
198     corrected by editing the file
199
200     ${install_prefix}/lib/gcc-lib/i586-mingw32/egcs-2.91.57/include/stdarg.h
201
202     (instead of egcs-2.91.57 you may have something different), searching for
203     the lines
204
205 /* Define __gnuc_va_list.  */
206
207 #ifndef __GNUC_VA_LIST
208 #define __GNUC_VA_LIST
209 #if defined(__svr4__) || defined(_AIX) || defined(_M_UNIX) || defined(__NetBSD__)
210 typedef char *__gnuc_va_list;
211 #else
212 typedef void *__gnuc_va_list;
213 #endif
214 #endif
215
216     and adding "|| defined(_WIN32)" to the list of platforms on which
217     __gnuc_va_list is char *.
218
219 If this is successful, you end up with a libwx_msw.a in win32/lib.  Now try
220 building the minimal sample:
221
222 -> cd samples/minimal
223 -> make
224
225 and run it with wine, for example (or copy to a Windows box)
226 -> wine minimal.exe
227
228 If all is well, do an install; from win32
229 -> make install
230
231 Native and cross-compiled installations can co-exist peacefully
232 (as long as their widget sets differ), except for wx-config. You might
233 want to rename the cross-compiled one to i586-mingw32-wx-config, or something.
234
235 Cross-compiling TODO:
236 ---------------------
237 - resource compiling must be done manually for now (should/can we link the
238 default wx resources into libwx_msw.a?) [ No we can't; the linker won't
239 link it in... you have to supply an object file ]
240 - dynamic libraries
241 - static executables are HUGE -- there must be room for improvement.
242