Patch for generator - allow compiling against multiple gtk versions
| From: | Elizabeth Smith | Date: | Thu, 25 Jan 2007 20:45:43 +0000 |
| Subject: | Patch for generator - allow compiling against multiple gtk versions | ||
| Groups: | php.gtk.dev | ||
| Request: | Send a blank email to php-gtk-dev+get-3578@lists.php.net to get a copy of this message | ||
Afternoon,
I sat down and looked at the generator code to find a way to allow
building against multiple gtk versions. I decided the easiest way to
handle things would be to add version information to included files in
order to only use defs/overrides specific to a version.
This means in the .defs adding
(include "my.file.here" 2.8)
or in the overrides files adding
%% include my.file.here 2.8
Each file would only be included if the version passed to the generator
via -v is greater than or equal to 2.8 (default is always 2.6)
Using this with the current build system will require some patching of
the configure files so -v 2.6 or whatever is passed to the generator.php
file. The configure files will also need to do gtk version
autodetection and allow the user to specify a version. Anant said he'd
manage the ./configure stuff for normal build systems and I'm almost
finished with the fixes to the MSVC build system to allow this to work
(I had some additional enhancements for the windows build system,
including dealing with unknown/deprecated compile flags in msvc 2005 and
adding --enable-debug-pack so I'll send it all in one shot). If no
version is passed to the generator, 2.6 is always assumed.
This patch does not deal with version numbers for pango or atk. That
might need to be added at a later date but I'd like to get gtk and gdk
rolling first.
The attached patch adds
1. -v argument to generator.php and applies it to the defs_parser and
override classes where appropriate.
2. a check against the gtkversion in includes in the def_parser class
3. a check against the gtkversion in includes in the overrides class and
a restore option to un-ignore items (gtkplug and gtksocket come to mind)
To actually build against 2.10 or 2.8 there will need to be some
additional changes made, basically adding some arg_types and adding
enums to generator.php, but this patch should make building against
multiple versions of gtk+ possible. It might be a good idea to add a
gtk_lib_version function/method somewhere - right now gtk::get_version
returns the version of gtk+ that php-gtk2 was built against - but with
the changes I've made you could build against 2.10 but only include
features from 2.8 or 2.6 by passing that value via -v to the generator.
Thanks,
Elizabeth Smith