Re: Re: Patch for generator - allow compiling againstmultiple gtk versions
| From: | Steph Fox | Date: | Fri, 26 Jan 2007 19:18:49 +0000 |
| Subject: | Re: Re: Patch for generator - allow compiling againstmultiple gtk versions | ||
| References: | 1 2 3 4 5 | Groups: | php.gtk.dev |
| Request: | Send a blank email to php-gtk-dev+get-3589@lists.php.net to get a copy of this message | ||
:)
We all do it, no worries. Thanks for testing!
AGH - I did it again...just smack me someone- another cut and paste error, here's the correct version for the --enable-libversion patch...--------------------------------------------------------------------------------
Index: buildconf.js =================================================================== RCS file: /repository/php-gtk/win32/buildconf.js,v retrieving revision 1.7 diff -u -r1.7 buildconf.js --- buildconf.js 31 Oct 2005 11:44:42 -0000 1.7 +++ buildconf.js 25 Jan 2007 23:42:22 -0000 @@ -43,22 +43,6 @@ return t; } -function gen_functions() { - - /* generate source and header files for exported PHP-GTK functions */ - temp.WriteLine("/* usage: php generator.php [-l logfile] [-o overridesfile] [-p prefix] [-c functionclass ] [-r typesfile] [-f savefile] defsfile */"); - temp.WriteLine("mkdir win32\\logs"); - temp.WriteLine("php -q generator\\generator.php -l win32\\logs\\config_atk.log -o ext\\gtk+\\atk.overrides -p atk ext\\gtk+\\atk.defs > ext\\gtk+\\gen_atk.c"); - temp.WriteLine("php -q generator\\generator.php -l win32\\logs\\config_pango.log -o ext\\gtk+\\pango.overrides -p pango ext\\gtk+\\pango.defs > ext\\gtk+\\gen_pango.c"); - temp.WriteLine("php -q generator\\generator.php -l win32\\logs\\config_gdk.log -o ext\\gtk+\\gdk.overrides -p gdk -r ext\\gtk+\\atk-types.defs -r ext\\gtk+\\pango-types.defs ext\\gtk+\\gdk.defs > ext\\gtk+\\gen_gdk.c"); - temp.WriteLine("php -q generator\\generator.php -l win32\\logs\\config_gtk.log -o ext\\gtk+\\gtk.overrides -p gtk -r ext\\gtk+\\atk-types.defs -r ext\\gtk+\\pango-types.defs -r ext\\gtk+\\gdk-types.defs ext\\gtk+\\gtk.defs > ext\\gtk+\\gen_gtk.c"); - temp.WriteLine('grep -h "^PHP_GTK_EXPORT_CE" ext\\gtk+\\gen_atk.c | sed -e "s/^/PHP_GTK_API extern /" > ext\\gtk+\\gen_atk.h'); - temp.WriteLine('grep -h "^PHP_GTK_EXPORT_CE" ext\\gtk+\\gen_pango.c | sed -e "s/^/PHP_GTK_API extern /" > ext\\gtk+\\gen_pango.h'); - temp.WriteLine('grep -h "^PHP_GTK_EXPORT_CE" ext\\gtk+\\gen_gdk.c | sed -e "s/^/PHP_GTK_API extern /" > ext\\gtk+\\gen_gdk.h'); - temp.WriteLine('grep -h "^PHP_GTK_EXPORT_CE" ext\\gtk+\\gen_gtk.c | sed -e "s/^/PHP_GTK_API extern /" > ext\\gtk+\\gen_gtk.h'); - return; -} - function Module_Item(module_name, config_path, dir_line, content) { this.module_name = module_name; @@ -165,8 +149,6 @@ } } -gen_functions(); - // Write the head of the configure script C.WriteLine("/* This file is automatically generated from win32/confutils.js */"); C.Write(file_get_contents("win32/confutils.js")); Index: config.w32.in =================================================================== RCS file: /repository/php-gtk/win32/config.w32.in,v retrieving revision 1.12 diff -u -r1.12 config.w32.in --- config.w32.in 17 Jun 2006 14:47:08 -0000 1.12 +++ config.w32.in 26 Jan 2007 18:55:53 -0000 @@ -46,6 +46,53 @@ ARG_WITH('php-build', 'Path to where you extracted http://www.php.net/extra/win32build.zip. Assumes that it is a sibling of this source dir (..\\php_build) if not specified', 'no'); ARG_WITH('cygwin', 'Path to cygwin utilities on your system', '\\cygwin'); +ARG_ENABLE('libversion', 'gtk library version you wish to build against, overrides automatically detected version', '2.6'); +/* pick up the version from gtk/gtkversion.h */ + +STDOUT.Write("Checking for gtk\\gtkversion.h ... "); + +function get_gtk_libversion(requested) +{ + var env, i, file, found, vin, major, minor; + + env = WshShell.Environment("Process").Item('INCLUDE'); + env = env.split(";"); + for (i = 0; i < env.length; i++) { + file = glob(env[i] + "\\gtk\\gtkversion.h"); + if (file) { + found = true; + break; + } + } + + if (found == true) { + STDOUT.WriteLine(" <in default path>"); + } else { + STDOUT.WriteLine(" <not found>"); + } + + vin = file_get_contents(file); + + regex = new RegExp("GTK_MAJOR_VERSION\\s+\\(([0-9]+)\\)"); + regex.exec(vin); + major = RegExp.$1; + + regex = new RegExp("GTK_MINOR_VERSION\\s+\\(([0-9]+)\\)"); + regex.exec(vin); + minor = RegExp.$1; + + max = major + '.' + minor; + + if (!PHP_GTK_LIBVERSION.length || PHP_GTK_LIBVERSION > max) + { + PHP_GTK_LIBVERSION = max; + } + + STDOUT.Write("Library definitions for " + PHP_GTK_LIBVERSION + " will be used"); + STDERR.WriteBlankLines(1); +} +get_gtk_libversion(PHP_GTK_LIBVERSION); + // stick objects somewhere outside of the source tree ARG_ENABLE('object-out-dir', 'Alternative location for binary objects during build', ''); if (PHP_GTK_OBJECT_OUT_DIR.length) { Index: confutils.js =================================================================== RCS file: /repository/php-gtk/win32/confutils.js,v retrieving revision 1.19 diff -u -r1.19 confutils.js --- confutils.js 17 Jul 2006 17:00:09 -0000 1.19 +++ confutils.js 26 Jan 2007 18:54:02 -0000 @@ -302,9 +302,6 @@ } WScript.Quit(1); - } else { // not --help - - generate_source(); } // Now set any defaults we might have missed out earlier @@ -937,6 +934,7 @@ FSO.CreateFolder(bd); } } + generate_source(); STDOUT.WriteLine("Generating source files - this may take a few seconds"); WScript.Sleep(3500);--------------------------------------------------------------------------------
-- PHP-GTK Development Mailing List (http://gtk.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php