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