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