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