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