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