]> git.saurik.com Git - wxWidgets.git/blame - docs/gtk/install.txt
1. Empty() now doesn't free memory - Clear() does
[wxWidgets.git] / docs / gtk / install.txt
CommitLineData
c98f0421
RR
1* The most simple case
2-----------------------
3
4If you compile wxWindows on Unix for the first time and don't like
5to read install instructions just do (in the base dir):
6
cf7a7e13 7./configure --without-threads
c98f0421
RR
8make
9
cf7a7e13 10and drink 10 coffees. Then you may log in as root and type
c98f0421 11
cf7a7e13
RR
12make install
13
14You can leave out the --without-threads option if you have a NEW
c67d8618
RR
15Linux distribution based on glibc (e.g. RedHat 5.1 or Debian 2.0)
16or any other Unix that comes with Posix threads or SGI threads.
cf7a7e13
RR
17
18Now create your super-application myfoo.app and compile anywhere with
19
f3cb6592 20g++ myfoo.cpp `wx-config --libs` `wx-config --cflags` -o myfoo
c98f0421
RR
21
22* General
23-----------------------
24
25The Unix variants of wxWindows use GNU configure. If you have problems
26with your make use GNU make instead.
27
28Read my homepage at
29
30 http://wesley.informatik.uni-freiburg.de/~wxxt
31
32for newest information.
33
34* GUI libraries
35-----------------------
36
c67d8618 37wxWindows/GTK requires the GTK+ library to be installed on your system.
58614078
RR
38It has to be a stable version, preferebly version 1.0.6. When using
39a version previous to 1.0.6 you'll get crashes here and there. This
40is certain to happen with colors in native widgets.
c98f0421 41
c67d8618 42You can get the newest version of the GTK+ from the GTK homepage
c98f0421
RR
43at
44 http://www.gtk.org
45
58614078
RR
46We also mirror GTK+ 1.0.6 at our ftp site. You'll find information
47about downloading at my homepage.
48
c98f0421
RR
49* Additional libraries
50-----------------------
51
58614078
RR
52wxWindows/Gtk requires a thread library and X libraries
53known to work with threads. This is the case on all
54commercial Unix-Variants and all Linux-Versions that
55are based on glibc 2 except RedHat 5.0 which is broken
56in many aspects. As of writing this, these Linux
57distributions have correct glibc 2 support:
58
59 - RedHat 5.1
60 - Debian 2.0
61 - Stampede
62
63The next major version of SuSE will also support glibc 2,
64but version 5.X does not. Also Caldera and Slackware
65don't yet support glibc 2.
66
67On IRIX you can also use SGI threads if Posix-Threads
68are not present. The SGI threads will be detected by
69configure automatically.
70
71You can always disable thread support by running
72
73./configure "--without-threads"
74make clean
75make
c98f0421 76
58614078
RR
77NB: I included thread support in wxWindows/Gtk, as this
78problem will disappear in the near future when all major
79Linux Variants have moved to glibc 2. Also, the Linux
80Base Standard will include glibc 2.
81
c98f0421
RR
82* Create your configuration
83-----------------------------
84
85Usage:
86 ./configure options
87
88If you want to use system's C and C++ compiler,
89set environment variables CC and CCC as
90
91 % setenv CC cc
92 % setenv CCC CC
93 % ./configure options
94
95Using the SGI native compilers, it is recommended that you
96also set CFLAGS and CXXFLAGS before running configure. These
97should be set to :
98
99CFLAGS="-mips3 -n32"
100CXXFLAGS="-mips3 -n32"
101
102This is essential if you want to use the resultant binaries
103on any other machine than the one it was compiled on. If you
104have a 64bit machine (Octane) you should also do this to ensure
105you don't accidently build the libraries as 64bit (which is
106untested).
107
108The SGI native compiler support has only been tested on Irix 6.5.
109
110to see all the options please use:
111
112 ./configure --help
113
114The basic philosophy is that if you want to use different
115configurations, like a debug and a release version,
116or use the same source tree on different systems,
117you have only to change the environment variable OSTYPE.
118(Sadly this variable is not set by default on some systems
119in some shells - on SGI's for example). So you will have to
120set it there. This variable HAS to be set before starting
121configure, so that it knows which system it tries to
122configure for.
123
124Configure will complain if the system variable OSTYPE has
125not been defined. And Make in some circumstances as well...
126
127
128* General options
129-------------------
130
cf7a7e13
RR
131Normally, you won't have to choose a toolkit, because when
132you download wxGTK, it will default to --with-gtk etc. But
133if you use all of our CVS repository you have to choose a
134toolkit. You must do this by running configure with either of:
c98f0421
RR
135
136 --with-gtk Use the GIMP ToolKit (GTK)
137
138 --with-qt Use Qt from TrollTec
139
140 --with-motif Use either Motif or Lesstif
141 Configure will look for both.
142
143The following options handle the kind of library you want to build.
144
145 --without-threads Compile without thread support.
146
cf7a7e13 147 --without-shared Do not create shared libraries.
c98f0421
RR
148
149 --without-optimise Do not optimise the code.
150
151 --with-profile Add profiling info to the object
152 files. Currently broken, I think.
153
154 --with-mem_tracing Add built-in memory tracing.
155 This doesn't work well with gcc.
156
157 --with-dmalloc Use the dmalloc memory debugger.
158 Read more at www.letters.com/dmalloc/
159
160 --with-debug_info Add debug info to object files and
161 executables.
162
163 --with-debug_flag Define __DEBUG__ and __WXDEBUG__ when
164 compiling.
165
166* Feature Options
167-------------------
168
c98f0421
RR
169As I don't yet care for binary size and target mainly at
170producing a shared library, wxWindows's configure system auto-
171matically enables all features, as long as they are already
c058d771
RR
172implemented. It is currently NOT possible to disable these
173options (in contrast to what configure tells you).
c98f0421
RR
174
175* Compiling
176-------------
177
178The following must be done in the base directory (e.g. ~/wxGTK
cf7a7e13 179or ~/wxWin or whatever)
c98f0421 180
c058d771
RR
181Now the makefiles are created and you can compile everything
182by typing:
c98f0421
RR
183
184 make
185
cf7a7e13 186make yourself some coffee, as it will try to compile ALL the
c058d771
RR
187files in this distribution. During compilation, you'll get
188a few warning messages.
c98f0421
RR
189
190if you want to be more selective:
191
192 make src will build only the base libraries
c98f0421 193 make samples will build the samples
c67d8618
RR
194 make other will build everything in other
195 make user will build everything in user
c98f0421 196
cf7a7e13
RR
197Then you may install the library and it's header files under
198/usr/local/include/wx and /usr/local/lib respectively. You
199have to log in as root (i.e. run "su" and enter the root
200password) and type
201
202 make install
203
c98f0421
RR
204Depending on the configuration of some files, the libraries
205and binaries will be placed in different directories.
206The "global" binaries and libraries will be placed in:
207
208 bin/$(OSTYPE) and
209 lib/$(OSTYPE) respectively
210
211"local" binaries and libraries will be placed in:
212
213 (basedir of that application)/$(OSTYPE).
214
215This is also the place where all the object-files will go.
216
217If you want to conserve disk space by removing unnecessary
218object-files:
219
220 make clean_obj
221
222will do the work for you.
223
224* Creating a new Project
225--------------------------
226
f3cb6592
RR
227There are two ways to create your own project:
228
2291) The first way uses the installed libraries and header files
230automatically using wx-config
231
232g++ myfoo.cpp `wx-config --libs` `wx-config --cflags` -o myfoo
233
234Using this way, a make file for the minimal sample would look
235like this
236
237CC = g++
238
239minimal: minimal.o
240 $(CC) -o minimal minimal.o `wx-config --libs`
241
242minimal.o: minimal.cpp mondrian.xpm
243 $(CC) `wx-config --cflags` -c minimal.cpp -o minimal.o
244
245clean:
246 rm -f *.o minimal
247
248This is certain to become the standard way unless we decide
249to sitch to tmake.
250
2512) The other way creates a project within the source code
252directories of wxWindows: In this case I propose to put
253all contributed programs in the directory "/user", with a
254directory of its own.
c98f0421
RR
255
256This directory then should include the following files:
257
258Makefile (You can copy this one from any application in samples
259 probably you will not need to edit this one. There is
260 only one case where you might be interested in changing
261 this file, but about that see later.)
262Makefile.in (This is the base application-Makefile template, from
263 which the actual Makefile for each system is created.
264 More about this later)
265
266put ALL your source code along with all the other stuff you need for
267your application in this directory (subdirectories are welcome).
268
cf7a7e13 269
c98f0421
RR
270** Something about Makefiles
271------------------------------
272
273On general principle it should only contain ONE line, which is as follows:
274
275 include ../../setup/general/makeapp
276
277this will include all the necessary definitions for creating the applications
278
279the only case where you might want to add another line is the following:
280this version of configure also supports creation of source archives of the
281application for easy distribution and updates to newer version of wxWindows.
282 For this purpose all files in the application-directory will be put into
283a gziped tar-file in the full notation user/<your application>/*
284if you want to include some other files that you want "more visible", like
285a README.<yourApp> or a shell script for easy
286compilation/installation/distribution, then you have to add a variable
287
288 DISTRIBUTE_ADDITIONAL=<your files>
289
290to the Makefile.
291So it would look like this:
292
293 DISTRIBUTE_ADDITIONAL=README.TheApp
294 include ../../setup/general/makeapp
295
296As we have already talked about distribution the command to create a
297distribution is:
298
299 make distrib
300
301NOTE: If you are in the base directory of wxWindows it will create
302distribution packages for wxWindows as well as for all packages in the
303user directory.
304 So if you want to create only packages for the files in user,
305then go to the directory other and type:
306
307 make distrib
308
309or if you only want one application to be created then
310enter the specific directory and type there:
311make distrib
312
313All the distribution files will be put in the directory
314distrib at the base of the wxWindows-tree (where also configure
315and template.mak can be found).
316
317** Something about Makefile.in
318--------------------------------
319
320As you have already seen with Makefile, configure makes a lot of use
321if the include statement in make to keep the Makefiles as simple as
322possible.
323
324So basically there are only variables to define and then a include command.
325Exception to this rule is if you have special rules for some stuff...
326These rules should go AFTER the include statement!!!
327
328so the general header looks like this:
329
330 # wxWindows base directory
331 WXBASEDIR=@WXBASEDIR@
332 # set the OS type for compilation
333 OS=@OS@
334 # compile a library only
335 RULE=bin
336
337and the general footer will look like this:
338
339 # include the definitions now
340 include ../../../template.mak
341
342the key variable is RULE, which defines what make should create
343in this directory.
344
345here are some examples:
346
347 RULE description
348 ===========================================================================
349 bin creates a local binary (for a global binary prefix bin with g)
350 additional variables needed:
351 BIN_TARGET this gives the name of your application
352 BIN_OBJ this gives the object files needed to
353 link the application
354 optional variables are:
355 BIN_SRC this gives the list of c/c++ files for
356 which dependencies will be checked.
357 (This can be achieved with: make depend)
358 BIN_LINK this gives commands for additional
359 libraries needed to link the application
360 ---------------------------------------------------------------------------
361 bin2 creates two local binaries (for global binaries prefix bin2 with g)
362 in addition to the variables specified above you MUST also
363 provide the same variables with BIN2_ instead of BIN_
364 ---------------------------------------------------------------------------
365 lib creates a local library (for a global binary prefix bin with g)
366 additional variables needed:
367 LIB_TARGET this gives the name of your library
368 LIB_OBJ this gives the object files needed for
369 the library to be build.
370 optional variables are:
371 LIB_SRC this gives the list of c/c++ files for
372 which dependencies will be checked.
373 libbin and libgbin are also possible and will need in addition
374 the variables from bin
375 ---------------------------------------------------------------------------
376 gslib is similar to lib, but it creates a shared library if the system
377 supports it.
378 additional variables needed:
379 LIB_MAJOR major number of the shared library
380 LIB_MINOR minor number of the shared library
381 ---------------------------------------------------------------------------
382 other additional variables:
383
384 ADD_COMPILE define additional includes/defines that
385 are needed to compile the object files
386 (if you need to reference some directory
387 utils - like wxGrid -, then please
388 reference them with the variables defined
389 in template.mak - e.g.: $(SRCDIR),$(UTILS),
390 $(SAMPLES),$(OTHERS))
391
392 NEEDED_DEFINES lists all the defines that HAVE to be set in
393 /include/wx/setup.h to compile correctly.
394
395 SRC_DIR lists all directories that are needed to
396 compile. (i.e: lists all the directories,
397 where there are source-files.) But it is
398 also needed to clean an object and for
399 machines, for which make does not support
400 VPATH
401
402currently there are the following compiling rules provided:
403object files are created for the following file extensions:
404.c .cc .cpp
405
406Please have a closer look at the Makefiles in this distribution.
407
408* Platforms configure is working with
409---------------------------------------
410
411Please report build succes on any machine. Especially non-
412Linux operating systems (which I don't have).
413
414Original author of the autoconf system for wxxt-1.66 and for this INSTALL
415file:
416
417 Martin Sperl sperl@dsn.ast.univie.ac.at
418
419Ported to wxGTK 0.1:
420
421 Wolfram Gloger wmglo@dent.med.uni-muenchen.de
422
423Thanks alot to both of them.
424
425In the hope that it will be useful,
426
427 Robert Roebling roebling@sun2.ruf.uni-freiburg.de
428
429