Kalle Sommer Nielsen
2010-03-17 16:00:11 UTC
kalle Wed, 17 Mar 2010 16:00:11 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=296329
Log:
Improve Windows build system take #1
* Generate configure.bat
* Use php_gtk_build as first priority build folder to prevent interfering with php-src builds
* Write 2 blank lines before the error message in ERROR() to prevent error messages while detecting locations to look screwy
* Proper detect MSVC versions, merged from php-src (Fixes #50888)
Bugs: http://bugs.php.net/1 (Assigned) Apache 1.3b3 + mod_php3 is slow
http://bugs.php.net/50888 (Assigned) Patch Request: Detection of Microsoft VS.NET 2008
Changed paths:
U gtk/php-gtk/trunk/NEWS
U gtk/php-gtk/trunk/win32/buildconf.js
U gtk/php-gtk/trunk/win32/config.w32.in
U gtk/php-gtk/trunk/win32/confutils.js
Modified: gtk/php-gtk/trunk/NEWS
===================================================================
--- gtk/php-gtk/trunk/NEWS 2010-03-17 15:13:56 UTC (rev 296328)
+++ gtk/php-gtk/trunk/NEWS 2010-03-17 16:00:11 UTC (rev 296329)
@@ -1,3 +1,7 @@
+Version 2.0.3 "???" XX-XXX-201X
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ - Fixed bug #50888 (Detection of Microsoft VS.NET 2008) (Kalle)
+
Version 2.0.2 "and then there was none" 07-March-2010
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- API coverage improved, specifically for 2.14, 2.16 and 2.18 gtk+ additions
Modified: gtk/php-gtk/trunk/win32/buildconf.js
===================================================================
--- gtk/php-gtk/trunk/win32/buildconf.js 2010-03-17 15:13:56 UTC (rev 296328)
+++ gtk/php-gtk/trunk/win32/buildconf.js 2010-03-17 16:00:11 UTC (rev 296329)
@@ -159,6 +159,8 @@
FSO.DeleteFile('Makefile');
}
+var F = FSO.CreateTextFile("configure.bat", true);
+
iter = new Enumerator(dir.Files);
name = "";
for (; !iter.atEnd(); iter.moveNext()) {
@@ -204,5 +206,8 @@
C.WriteBlankLines(1);
C.Write("generate_files();");
+// Generate configure.bat utility
+F.Write("@ECHO OFF\r\ncscript /nologo configure.js %*");
+
WScript.StdOut.WriteBlankLines(1);
-WScript.StdOut.WriteLine("Now run 'cscript /nologo configure.js --help'");
+WScript.StdOut.WriteLine("Now run 'configure --help'");
Modified: gtk/php-gtk/trunk/win32/config.w32.in
===================================================================
--- gtk/php-gtk/trunk/win32/config.w32.in 2010-03-17 15:13:56 UTC (rev 296328)
+++ gtk/php-gtk/trunk/win32/config.w32.in 2010-03-17 16:00:11 UTC (rev 296329)
@@ -2,6 +2,15 @@
// $Id$
// "Master" config file; think of it as a configure.in equivalent.
+// MSVC version table
+var MSVCVERS = [];
+MSVCVERS[1200] = 'MSVC6 (Visual C++ 6.0)';
+MSVCVERS[1300] = 'MSVC7 (Visual C++ 2002)';
+MSVCVERS[1310] = 'MSVC7.1 (Visual C++ 2003)';
+MSVCVERS[1400] = 'MSVC8 (Visual C++ 2005)';
+MSVCVERS[1500] = 'MSVC9 (Visual C++ 2008)';
+MSVCVERS[1600] = 'MSVC10 (Visual C++ 2010)';
+
STDOUT.WriteBlankLines(1);
CL = PATH_PROG('cl');
@@ -27,23 +36,15 @@
STDOUT.WriteBlankLines(1);
if (CL) {
+ var VCVERS = probe_msvc_compiler_version(CL);
- VCVERS = probe_msvc_compiler_version(CL);
- var msversion = "unknown";
-
- if (VCVERS == 12) {
- msversion = "Microsoft Visual C++ 6.0";
- }
- if (VCVERS == 13) {
- msversion = "Microsoft VS.NET 2003";
- }
- if (VCVERS == 14) {
- msversion = "Microsoft VS.NET 2005";
- }
- STDOUT.WriteLine("Detected compiler version: " + msversion);
-
+ if (typeof(MSVCVERS[VCVERS]) == undefined) {
+ // Lets just bail out if we dont know the MSVC version
+ ERROR("MS C++ compiler is required -- unable to detect version");
+ } else {
+ STDOUT.WriteLine("Detected compiler version: " + MSVCVERS[VCVERS]);
+ }
} else {
-
ERROR("MS C++ compiler is required");
}
@@ -88,7 +89,9 @@
PHP_LIB = "php5.lib";
}
if (PHP_GTK_PHP_BUILD == 'no') {
- if (FSO.FolderExists("..\\php_build")) {
+ if (FSO.FolderExists("..\\php_gtk_build")) {
+ PHP_GTK_PHP_BUILD = "..\\php_gtk_build";
+ } else if (FSO.FolderExists("..\\php_build")) {
PHP_GTK_PHP_BUILD = "..\\php_build";
} else if (FSO.FolderExists("..\\win32build")) {
PHP_GTK_PHP_BUILD = "..\\win32build";
@@ -135,12 +138,10 @@
ADD_FLAG("CFLAGS", "/D ZTS=1");
}
-if (VCVERS < 14) {
+if (VCVERS < 1400) {
// Enable automatic precompiled headers
ADD_FLAG('CFLAGS', '/YX /c');
-}
-
-if (VCVERS >= 14) {
+} else {
// fun stuff: MS deprecated ANSI stdio and similar functions - disable warnings
// GS hardens the binary against buffer overruns
ADD_FLAG('CFLAGS', '/GS /wd4996 ');
Modified: gtk/php-gtk/trunk/win32/confutils.js
===================================================================
--- gtk/php-gtk/trunk/win32/confutils.js 2010-03-17 15:13:56 UTC (rev 296328)
+++ gtk/php-gtk/trunk/win32/confutils.js 2010-03-17 16:00:11 UTC (rev 296329)
@@ -808,6 +808,7 @@
function ERROR(msg) {
+ STDERR.WriteBlankLines(2);
STDERR.WriteLine("ERROR: " + msg);
WScript.Quit(3);
}
@@ -1220,14 +1221,14 @@
}
// Which version of the compiler do we have?
-function probe_msvc_compiler_version(CL) {
+function probe_msvc_compiler_version(CL) {
+ var command = 'cmd /c ""' + CL + '" -v"';
+ var version = execute(command + '" 2>&1"');
+
+ if (version.match(/(\d+\.\d+)/)) {
+ return RegExp.$1.split(".").join("");
+ }
- // tricky escapes to get stderr redirection to work
- var banner = execute('cmd /c ""' + CL + '" 2>&1"');
-
- if (banner.match(/(\d+)\.(\d+)\.(\d+)(\.(\d+))?/)) {
- return RegExp.$1;
- }
return 0;
}
Revision: http://svn.php.net/viewvc?view=revision&revision=296329
Log:
Improve Windows build system take #1
* Generate configure.bat
* Use php_gtk_build as first priority build folder to prevent interfering with php-src builds
* Write 2 blank lines before the error message in ERROR() to prevent error messages while detecting locations to look screwy
* Proper detect MSVC versions, merged from php-src (Fixes #50888)
Bugs: http://bugs.php.net/1 (Assigned) Apache 1.3b3 + mod_php3 is slow
http://bugs.php.net/50888 (Assigned) Patch Request: Detection of Microsoft VS.NET 2008
Changed paths:
U gtk/php-gtk/trunk/NEWS
U gtk/php-gtk/trunk/win32/buildconf.js
U gtk/php-gtk/trunk/win32/config.w32.in
U gtk/php-gtk/trunk/win32/confutils.js
Modified: gtk/php-gtk/trunk/NEWS
===================================================================
--- gtk/php-gtk/trunk/NEWS 2010-03-17 15:13:56 UTC (rev 296328)
+++ gtk/php-gtk/trunk/NEWS 2010-03-17 16:00:11 UTC (rev 296329)
@@ -1,3 +1,7 @@
+Version 2.0.3 "???" XX-XXX-201X
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ - Fixed bug #50888 (Detection of Microsoft VS.NET 2008) (Kalle)
+
Version 2.0.2 "and then there was none" 07-March-2010
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- API coverage improved, specifically for 2.14, 2.16 and 2.18 gtk+ additions
Modified: gtk/php-gtk/trunk/win32/buildconf.js
===================================================================
--- gtk/php-gtk/trunk/win32/buildconf.js 2010-03-17 15:13:56 UTC (rev 296328)
+++ gtk/php-gtk/trunk/win32/buildconf.js 2010-03-17 16:00:11 UTC (rev 296329)
@@ -159,6 +159,8 @@
FSO.DeleteFile('Makefile');
}
+var F = FSO.CreateTextFile("configure.bat", true);
+
iter = new Enumerator(dir.Files);
name = "";
for (; !iter.atEnd(); iter.moveNext()) {
@@ -204,5 +206,8 @@
C.WriteBlankLines(1);
C.Write("generate_files();");
+// Generate configure.bat utility
+F.Write("@ECHO OFF\r\ncscript /nologo configure.js %*");
+
WScript.StdOut.WriteBlankLines(1);
-WScript.StdOut.WriteLine("Now run 'cscript /nologo configure.js --help'");
+WScript.StdOut.WriteLine("Now run 'configure --help'");
Modified: gtk/php-gtk/trunk/win32/config.w32.in
===================================================================
--- gtk/php-gtk/trunk/win32/config.w32.in 2010-03-17 15:13:56 UTC (rev 296328)
+++ gtk/php-gtk/trunk/win32/config.w32.in 2010-03-17 16:00:11 UTC (rev 296329)
@@ -2,6 +2,15 @@
// $Id$
// "Master" config file; think of it as a configure.in equivalent.
+// MSVC version table
+var MSVCVERS = [];
+MSVCVERS[1200] = 'MSVC6 (Visual C++ 6.0)';
+MSVCVERS[1300] = 'MSVC7 (Visual C++ 2002)';
+MSVCVERS[1310] = 'MSVC7.1 (Visual C++ 2003)';
+MSVCVERS[1400] = 'MSVC8 (Visual C++ 2005)';
+MSVCVERS[1500] = 'MSVC9 (Visual C++ 2008)';
+MSVCVERS[1600] = 'MSVC10 (Visual C++ 2010)';
+
STDOUT.WriteBlankLines(1);
CL = PATH_PROG('cl');
@@ -27,23 +36,15 @@
STDOUT.WriteBlankLines(1);
if (CL) {
+ var VCVERS = probe_msvc_compiler_version(CL);
- VCVERS = probe_msvc_compiler_version(CL);
- var msversion = "unknown";
-
- if (VCVERS == 12) {
- msversion = "Microsoft Visual C++ 6.0";
- }
- if (VCVERS == 13) {
- msversion = "Microsoft VS.NET 2003";
- }
- if (VCVERS == 14) {
- msversion = "Microsoft VS.NET 2005";
- }
- STDOUT.WriteLine("Detected compiler version: " + msversion);
-
+ if (typeof(MSVCVERS[VCVERS]) == undefined) {
+ // Lets just bail out if we dont know the MSVC version
+ ERROR("MS C++ compiler is required -- unable to detect version");
+ } else {
+ STDOUT.WriteLine("Detected compiler version: " + MSVCVERS[VCVERS]);
+ }
} else {
-
ERROR("MS C++ compiler is required");
}
@@ -88,7 +89,9 @@
PHP_LIB = "php5.lib";
}
if (PHP_GTK_PHP_BUILD == 'no') {
- if (FSO.FolderExists("..\\php_build")) {
+ if (FSO.FolderExists("..\\php_gtk_build")) {
+ PHP_GTK_PHP_BUILD = "..\\php_gtk_build";
+ } else if (FSO.FolderExists("..\\php_build")) {
PHP_GTK_PHP_BUILD = "..\\php_build";
} else if (FSO.FolderExists("..\\win32build")) {
PHP_GTK_PHP_BUILD = "..\\win32build";
@@ -135,12 +138,10 @@
ADD_FLAG("CFLAGS", "/D ZTS=1");
}
-if (VCVERS < 14) {
+if (VCVERS < 1400) {
// Enable automatic precompiled headers
ADD_FLAG('CFLAGS', '/YX /c');
-}
-
-if (VCVERS >= 14) {
+} else {
// fun stuff: MS deprecated ANSI stdio and similar functions - disable warnings
// GS hardens the binary against buffer overruns
ADD_FLAG('CFLAGS', '/GS /wd4996 ');
Modified: gtk/php-gtk/trunk/win32/confutils.js
===================================================================
--- gtk/php-gtk/trunk/win32/confutils.js 2010-03-17 15:13:56 UTC (rev 296328)
+++ gtk/php-gtk/trunk/win32/confutils.js 2010-03-17 16:00:11 UTC (rev 296329)
@@ -808,6 +808,7 @@
function ERROR(msg) {
+ STDERR.WriteBlankLines(2);
STDERR.WriteLine("ERROR: " + msg);
WScript.Quit(3);
}
@@ -1220,14 +1221,14 @@
}
// Which version of the compiler do we have?
-function probe_msvc_compiler_version(CL) {
+function probe_msvc_compiler_version(CL) {
+ var command = 'cmd /c ""' + CL + '" -v"';
+ var version = execute(command + '" 2>&1"');
+
+ if (version.match(/(\d+\.\d+)/)) {
+ return RegExp.$1.split(".").join("");
+ }
- // tricky escapes to get stderr redirection to work
- var banner = execute('cmd /c ""' + CL + '" 2>&1"');
-
- if (banner.match(/(\d+)\.(\d+)\.(\d+)(\.(\d+))?/)) {
- return RegExp.$1;
- }
return 0;
}