Re: Allow out-of-box-build for MSVC 2005

From: Date: Wed, 31 Jan 2007 05:44:53 +0000
Subject: Re: Allow out-of-box-build for MSVC 2005
References: 1  Groups: php.gtk.dev 
Request: Send a blank email to php-gtk-dev+get-3649@lists.php.net to get a copy of this message
OK, I finally made time for looking (5am, heh). Wondering why you took GX out of the lineup for release builds and then added it back in to 2005-only release builds as EHsc... Is GX actually deprecated in 2005? If so, just change it to EHsc in the original line - that will work under VC6 too. Please don't commit just yet, I can't keep my eyes open long enough to do a build right now and I'm not too sure about the MT business (why write any lines at all if mt doesn't exist? what happens when it's defined as ws?) or about the file include order. It probably won't break anything here, but it might for Andrei - we had all kinds of hell with circular inclusions at first. - Steph ----- Original Message ----- From: "Elizabeth Smith" <emsmith@elizabethmariesmith.com> To: <php-gtk-dev@lists.php.net> Sent: Tuesday, January 30, 2007 11:16 PM Subject: [PHP-GTK-DEV] Allow out-of-box-build for MSVC 2005
Evening, I started a new thread here because I think everyone was getting confused with all the generator patch stuff, and this is really something completely different. I know you're not looking to move the official builds off of MSVC6 for a while, Steph, (or at least until Edin moves PHP itself) but it's really annoying to have to alter a bunch of php-gtk2 files just to build development versions here with MSVC 2005 - any chance I can get an ok to apply the attached patch? It allows for three things - it folds in support for --enable-debug-pack (something the regular php build system already provides, in fact I copied the support from there, and it is very useful for tracking annoying windows crashes with release builds), allows --disable-zts to do non-thread-safe builds, and allows MSVC 2005 to compile php-gtk "out of the box" (fixes compiler flags and adds manifest packing) All the changes are transparent, meaning you won't even see them on MSVC6 (well, unless you want to use one of the new configure flags) because they're only applied when the right compiler is detected so it should not affect current builds at all. The only potentially problematic change is in php_gtk.h - the config.w32.h must be included before php.h - there are 2005 specific pragmas in there that tell the stupid compiler which types to use - without the change the compiler bombs miserably however I don't believe this should change anything. Thanks, Elizabeth Smith
--------------------------------------------------------------------------------
Index: main/php_gtk.h =================================================================== RCS file: /repository/php-gtk/main/php_gtk.h,v retrieving revision 1.138 diff -u -r1.138 php_gtk.h --- main/php_gtk.h 15 Oct 2006 00:48:48 -0000 1.138 +++ main/php_gtk.h 30 Jan 2007 20:38:50 -0000 @@ -23,13 +23,13 @@ #ifndef _PHP_GTK_H #define _PHP_GTK_H -#include "php.h" -#include "php_ini.h" #ifdef PHP_WIN32 #include "config.w32.h" #else #include "config.h" #endif +#include "php.h" +#include "php_ini.h" /* workaround for expat-related declaration in PHP compat file */ #ifdef lookup Index: win32/config.w32.in =================================================================== RCS file: /repository/php-gtk/win32/config.w32.in,v retrieving revision 1.12 diff -u -r1.12 config.w32.in --- win32/config.w32.in 17 Jun 2006 14:47:08 -0000 1.12 +++ win32/config.w32.in 30 Jan 2007 21:14:37 -0000 @@ -14,6 +14,9 @@ PATH_PROG('link', WshShell.Environment("Process").Item("PATH"), "LD"); PATH_PROG('nmake'); +// Try locating manifest tool +PATH_PROG('mt', WshShell.Environment("Process").Item("PATH"), "MT"); + // we don't want to define LIB, as that will override the default library path set in that env var PATH_PROG('lib', null, 'MAKE_LIB'); PATH_PROG('php'); @@ -45,6 +48,7 @@ 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('zts', 'Thread safety', 'yes'); // stick objects somewhere outside of the source tree ARG_ENABLE('object-out-dir', 'Alternative location for binary objects during build', ''); @@ -56,6 +60,10 @@ } ARG_ENABLE('debug', 'Compile with debugging symbols', "no"); +ARG_ENABLE('debug-pack', 'Release binaries with external debug symbols (--enable-debug must not be specified)', 'no'); +if (PHP_GTK_DEBUG == "yes" && PHP_GTK_DEBUG_PACK == "yes") { + ERROR("Use of both --enable-debug and --enable-debug-pack not allowed."); +} // Set some debug-specific options if (PHP_GTK_DEBUG == "yes") { @@ -81,22 +89,36 @@ DEFINE("LIBS", "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib"); if (PHP_GTK_DEBUG == "yes") { - DEFINE("CFLAGS", "/nologo /LDd /MDd /Gm /ZI /GZ /I . /I ..\\ /I ..\\.. /I main /I ..\\main /I ext /I ..\\ext /I ..\\php5\\main /I ..\\php5\\Zend /I ..\\php5\\TSRM /D ZEND_WIN32 /D ZTS=1 /D ZEND_DEBUG=1 /D PHP_WIN32 /D WIN32 /D _DEBUG /D _WINDOWS /D _MBCS /D _USRDLL"); + DEFINE("CFLAGS", "/nologo /LDd /MDd /Gm /ZI /GZ /I . /I ..\\ /I ..\\.. /I main /I ..\\main /I ext /I ..\\ext /I ..\\php5\\main /I ..\\php5\\Zend /I ..\\php5\\TSRM /D ZEND_WIN32 /D ZEND_DEBUG=1 /D PHP_WIN32 /D WIN32 /D _DEBUG /D _WINDOWS /D _MBCS /D _USRDLL"); ADD_FLAG("LDFLAGS", "/debug"); } else { - DEFINE("CFLAGS", "/nologo /MD /W3 /GX /O2 /I . /I ..\\ /I ..\\.. /I main /I ..\\main /I ext /I ..\\ext /I ..\\php5\\main /I ..\\php5\\Zend /I ..\\php5\\TSRM /D ZEND_WIN32 /D ZTS=1 /D ZEND_DEBUG=0 /D PHP_WIN32 /D WIN32 /D NDEBUG /D _WINDOWS /D _MBCS /D _USRDLL"); + DEFINE("CFLAGS", "/nologo /MD /W3 /O2 /I . /I ..\\ /I ..\\.. /I main /I ..\\main /I ext /I ..\\ext /I ..\\php5\\main /I ..\\php5\\Zend /I ..\\php5\\TSRM /D ZEND_WIN32 /D ZEND_DEBUG=0 /D PHP_WIN32 /D WIN32 /D NDEBUG /D _WINDOWS /D _MBCS /D _USRDLL"); + // Generate external debug files when --enable-debug-pack is specified + if (PHP_GTK_DEBUG_PACK == "yes") { + ADD_FLAG("CFLAGS", "/Zi"); + ADD_FLAG("LDFLAGS", "/incremental:no /debug /opt:ref,icf"); + } } if (VCVERS < 14) { // Enable automatic precompiled headers - ADD_FLAG('CFLAGS', '/YX /c'); + ADD_FLAG('CFLAGS', '/YX /c /GX'); } if (VCVERS >= 14) { // fun stuff: MS deprecated ANSI stdio and similar functions - disable warnings // GS hardens the binary against buffer overruns - ADD_FLAG('CFLAGS', '/GS /wd4996 '); + ADD_FLAG('CFLAGS', '/EHsc /GS /wd4996 '); + if (PHP_GTK_DEBUG == "yes") + { + // Set some debug/release specific options + ADD_FLAG('CFLAGS', ' /RTC1 '); + } +} + +if (PHP_GTK_ZTS == "yes") { + ADD_FLAG("CFLAGS", "/D ZTS=1"); } if (PHP_GTK_PHP_BUILD == 'no') { Index: win32/confutils.js =================================================================== RCS file: /repository/php-gtk/win32/confutils.js,v retrieving revision 1.19 diff -u -r1.19 confutils.js --- win32/confutils.js 17 Jul 2006 17:00:09 -0000 1.19 +++ win32/confutils.js 30 Jan 2007 21:18:50 -0000 @@ -668,6 +668,7 @@ MFO.WriteLine("$(BUILD_DIR)\\" + dllname + ": $(" + EXT + "_GLOBAL_OBJS)" + res_var); MFO.WriteLine("\t" + ld + " /out:$(BUILD_DIR)\\" + dllname + " $(" + EXT + "_LDFLAGS)" + dllflags + " $(LDFLAGS) $(" + EXT + "_GLOBAL_OBJS) $(LIBS_" + EXT + ")" + dep_libs + " $(LIBS)" + res_var); + MFO.WriteLine("\t-@$(_VC_MANIFEST_EMBED_DLL)"); MFO.WriteBlankLines(1); MFO.WriteLine(dllname + ": $(BUILD_DIR)\\" + dllname); @@ -968,6 +969,16 @@ MF.WriteLine(keys[i] + "=" + configure_subst.Item(keys[i]) + " "); } + MF.WriteLine("!if $(MT) == \"\""); + MF.WriteBlankLines(1); + MF.WriteLine("_VC_MANIFEST_EMBED_DLL="); + MF.WriteBlankLines(1); + MF.WriteLine("!else"); + MF.WriteBlankLines(1); + MF.WriteLine("_VC_MANIFEST_EMBED_DLL= $(MT) -nologo -manifest $@.manifest -outputresource:$@;2"); + MF.WriteBlankLines(1); + MF.WriteLine("!endif"); + MF.WriteBlankLines(1); MF.WriteLine("all: $(EXT_TARGETS)");
--------------------------------------------------------------------------------
-- PHP-GTK Development Mailing List (http://gtk.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.gtk.dev (#3649) next »