summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
Diffstat (limited to 'win32')
-rw-r--r--win32/build/Makefile4
-rw-r--r--win32/build/block.template.dsw30
-rw-r--r--win32/build/buildconf.js553
-rw-r--r--win32/build/config.w324
-rw-r--r--win32/build/config.w32.h.in2
-rw-r--r--win32/build/configure.tail2
-rw-r--r--win32/build/confutils.js3722
-rw-r--r--win32/build/cvsclean.js58
-rw-r--r--win32/build/deplister.c2
-rw-r--r--win32/build/mkdist.php42
-rw-r--r--win32/build/svnclean.js120
-rw-r--r--win32/build/template.dsw126
-rw-r--r--win32/build/template.rc2
-rw-r--r--win32/builddef.bat2
-rw-r--r--win32/fnmatch.c2
-rw-r--r--win32/fnmatch.h2
-rw-r--r--win32/glob.c2
-rw-r--r--win32/glob.h2
-rwxr-xr-xwin32/globals.c2
-rw-r--r--win32/grp.h2
-rw-r--r--win32/install.txt22
-rw-r--r--win32/php5.dsw214
-rw-r--r--win32/php5dll.dsp8
-rw-r--r--win32/php5dllts.dsp8
-rw-r--r--win32/php5dllts.rc2122
-rw-r--r--win32/php5ts_cli.rc2122
-rwxr-xr-xwin32/php_win32_globals.h2
-rw-r--r--win32/readdir.c24
-rw-r--r--win32/registry.c4
-rw-r--r--win32/resource.h30
-rw-r--r--win32/select.c2
-rw-r--r--win32/select.h2
-rw-r--r--win32/sendmail.c87
-rw-r--r--win32/sendmail.h1
-rw-r--r--win32/sockets.c2
-rw-r--r--win32/sockets.h2
-rw-r--r--win32/syslog.h2
-rw-r--r--win32/time.c2
-rw-r--r--win32/winutil.c2
39 files changed, 2767 insertions, 2572 deletions
diff --git a/win32/build/Makefile b/win32/build/Makefile
index f0cd9ead6..5f6338216 100644
--- a/win32/build/Makefile
+++ b/win32/build/Makefile
@@ -14,7 +14,7 @@
# | Author: Wez Furlong <wez@thebrainroom.com> |
# +----------------------------------------------------------------------+
#
-# $Id: Makefile,v 1.35.2.1.2.6.2.14 2009/06/23 01:37:23 kalle Exp $
+# $Id: Makefile 289764 2009-10-19 19:05:58Z pajoye $
# This is the makefile template for the win32 build
CC="$(CL)"
@@ -128,7 +128,7 @@ build-dist: $(BUILD_DIR)\deplister.exe
-del /f /q $(BUILD_DIR)\php-$(PHP_VERSION_STRING)$(PHP_ZTS_ARCHIVE_POSTFIX)-Win32-$(PHP_COMPILER_SHORT)-$(PHP_ARCHITECTURE).zip
-del /f /q $(BUILD_DIR)\php-debug-pack-$(PHP_VERSION_STRING)$(PHP_ZTS_ARCHIVE_POSTFIX)-Win32-$(PHP_COMPILER_SHORT)-$(PHP_ARCHITECTURE).zip
-del /f /q $(BUILD_DIR)\pecl-$(PHP_VERSION_STRING)$(PHP_ZTS_ARCHIVE_POSTFIX)-Win32-$(PHP_COMPILER_SHORT)-$(PHP_ARCHITECTURE).zip
- $(BUILD_DIR)\php.exe -d date.timezone=UTC -n -dphar.readonly=0 win32/build/mkdist.php "$(BUILD_DIR)" "$(PHPDLL)" "$(SAPI_TARGETS)" "$(EXT_TARGETS) $(PHP_EXTRA_DIST_FILES)" "$(PECL_TARGETS) $(PECL_EXTRA_DIST_FILES)" "$(SNAPSHOT_TEMPLATE)"
+ $(BUILD_DIR)\php.exe -d date.timezone=UTC -n -dphar.readonly=0 win32/build/mkdist.php "$(BUILD_DIR)" "$(PHP_BUILD)" "$(PHPDLL)" "$(SAPI_TARGETS)" "$(EXT_TARGETS) $(PHP_EXTRA_DIST_FILES)" "$(PECL_TARGETS) $(PECL_EXTRA_DIST_FILES)" "$(SNAPSHOT_TEMPLATE)"
cd $(BUILD_DIR)\php-$(PHP_VERSION_STRING)
-$(ZIP) -9 -q -r ..\php-$(PHP_VERSION_STRING)$(PHP_ZTS_ARCHIVE_POSTFIX)-Win32-$(PHP_COMPILER_SHORT)-$(PHP_ARCHITECTURE).zip .
cd ..\..
diff --git a/win32/build/block.template.dsw b/win32/build/block.template.dsw
index 06f356b44..2f2682dc7 100644
--- a/win32/build/block.template.dsw
+++ b/win32/build/block.template.dsw
@@ -1,15 +1,15 @@
-
-Project: "EXTNAME"=..\ADDRESS - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name php5ts
- End Project Dependency
-}}}
-
-###############################################################################
+
+Project: "EXTNAME"=..\ADDRESS - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name php5ts
+ End Project Dependency
+}}}
+
+###############################################################################
diff --git a/win32/build/buildconf.js b/win32/build/buildconf.js
index 6efe3d708..d26b4c740 100644
--- a/win32/build/buildconf.js
+++ b/win32/build/buildconf.js
@@ -1,280 +1,273 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Wez Furlong <wez@thebrainroom.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id: buildconf.js,v 1.13.2.2.2.1.2.5 2009/01/02 12:18:21 kalle Exp $ */
-// This generates a configure script for win32 build
-
-WScript.StdOut.WriteLine("Rebuilding configure.js");
-var FSO = WScript.CreateObject("Scripting.FileSystemObject");
-var C = FSO.CreateTextFile("configure.js", true);
-var B = FSO.CreateTextFile("configure.bat", true);
-var DSP = false;
-
-var modules = "";
-var MODULES = WScript.CreateObject("Scripting.Dictionary");
-var module_dirs = new Array();
-
-function file_get_contents(filename)
-{
- var F = FSO.OpenTextFile(filename, 1);
- var t = F.ReadAll();
- F.Close();
- return t;
-}
-
-function Module_Item(module_name, config_path, dir_line, deps, content)
-{
- this.module_name = module_name;
- this.config_path = config_path;
- this.dir_line = dir_line;
- this.deps = deps;
- this.content = content;
-}
-
-function find_config_w32(dirname)
-{
- if (!FSO.FolderExists(dirname)) {
- return;
- }
-
- var f = FSO.GetFolder(dirname);
- var fc = new Enumerator(f.SubFolders);
- var c, i, ok, n;
- var item = null;
- var re_dep_line = new RegExp("ADD_EXTENSION_DEP\\([^,]*\\s*,\\s*['\"]([^'\"]+)['\"].*\\)", "gm");
-
- for (; !fc.atEnd(); fc.moveNext())
- {
- ok = true;
- /* check if we already picked up a module with the same dirname;
- * if we have, don't include it here */
- n = FSO.GetFileName(fc.item());
-
- if (n == 'CVS' || n == 'tests')
- continue;
-
- // WScript.StdOut.WriteLine("checking " + dirname + "/" + n);
- if (MODULES.Exists(n)) {
- WScript.StdOut.WriteLine("Skipping " + dirname + "/" + n + " -- already have a module with that name");
- continue;
- }
-
- c = FSO.BuildPath(fc.item(), "config.w32");
- if (FSO.FileExists(c)) {
-// WScript.StdOut.WriteLine(c);
-
- var dir_line = "configure_module_dirname = condense_path(FSO.GetParentFolderName('"
- + c.replace(new RegExp('(["\\\\])', "g"), '\\$1') + "'));\r\n";
- var contents = file_get_contents(c);
- var deps = new Array();
-
- // parse out any deps from the file
- var calls = contents.match(re_dep_line);
- if (calls != null) {
- for (i = 0; i < calls.length; i++) {
- // now we need the extension name out of this thing
- if (calls[i].match(re_dep_line)) {
-// WScript.StdOut.WriteLine("n depends on " + RegExp.$1);
- deps[deps.length] = RegExp.$1;
-
- }
- }
- }
-
- item = new Module_Item(n, c, dir_line, deps, contents);
- MODULES.Add(n, item);
- }
- }
-}
-
-// Emit core modules array. This is used by a snapshot
-// build to override a default "yes" value so that external
-// modules don't break the build by becoming statically compiled
-function emit_core_module_list()
-{
- var module_names = (new VBArray(MODULES.Keys())).toArray();
- var i, mod_name, j;
- var item;
- var output = "";
-
- C.WriteLine("core_module_list = new Array(");
-
- // first, look for modules with empty deps; emit those first
- for (i in module_names) {
- mod_name = module_names[i];
- C.WriteLine("\"" + mod_name.replace(/_/g, "-") + "\",");
- }
-
- C.WriteLine("false // dummy");
-
- C.WriteLine(");");
-}
-
-
-function emit_module(item)
-{
- return item.dir_line + item.content;
-}
-
-function emit_dep_modules(module_names)
-{
- var i, mod_name, j;
- var output = "";
- var item = null;
-
- for (i in module_names) {
- mod_name = module_names[i];
-
- if (MODULES.Exists(mod_name)) {
- item = MODULES.Item(mod_name);
- MODULES.Remove(mod_name);
- if (item.deps.length) {
- output += emit_dep_modules(item.deps);
- }
- output += emit_module(item);
- }
- }
-
- return output;
-}
-
-function gen_modules()
-{
- var module_names = (new VBArray(MODULES.Keys())).toArray();
- var i, mod_name, j;
- var item;
- var output = "";
-
- // first, look for modules with empty deps; emit those first
- for (i in module_names) {
- mod_name = module_names[i];
- item = MODULES.Item(mod_name);
- if (item.deps.length == 0) {
- MODULES.Remove(mod_name);
- output += emit_module(item);
- }
- }
-
- // now we are left with modules that have dependencies on other modules
- module_names = (new VBArray(MODULES.Keys())).toArray();
- output += emit_dep_modules(module_names);
-
- return output;
-}
-
-if (FSO.FileExists("ZendEngine2\\OBJECTS2_HOWTO")) {
- if (FSO.FolderExists("Zend")) {
- FSO.MoveFolder("Zend", "ZendEngine1");
- }
- FSO.MoveFolder("ZendEngine2", "Zend");
-}
-
-// Process buildconf arguments
-function buildconf_process_args()
-{
- args = WScript.Arguments;
-
- for (i = 0; i < args.length; i++) {
- arg = args(i);
- // If it is --foo=bar, split on the equals sign
- arg = arg.split("=", 2);
- argname = arg[0];
- if (arg.length > 1) {
- argval = arg[1];
- } else {
- argval = null;
- }
-
- if (argname == '--add-modules-dir' && argval != null) {
- WScript.StdOut.WriteLine("Adding " + argval + " to the module search path");
- module_dirs[module_dirs.length] = argval;
- }
-
- if (argname == '--add-project-files') {
- WScript.StdOut.WriteLine("Adding dsp templates into the mix");
- DSP = true;
- }
- }
-}
-
-buildconf_process_args();
-
-// Write the head of the configure script
-C.WriteLine("/* This file automatically generated from win32/build/confutils.js */");
-C.Write(file_get_contents("win32/build/confutils.js"));
-
-// If project files were requested, pull in the code to generate them
-if (DSP == true) {
- C.WriteLine('PHP_DSP="yes"');
- C.WriteBlankLines(1);
- C.Write(file_get_contents("win32/build/projectgen.js"));
-} else {
- C.WriteLine('PHP_DSP="no"');
- C.WriteBlankLines(1);
-}
-
-// Pull in code from sapi and extensions
-modules = file_get_contents("win32/build/config.w32");
-
-// Pick up confs from TSRM and Zend if present
-find_config_w32(".");
-find_config_w32("sapi");
-find_config_w32("ext");
-emit_core_module_list();
-
-// If we have not specified any module dirs let's add some defaults
-if (module_dirs.length == 0) {
- find_config_w32("pecl");
- find_config_w32("..\\pecl");
- find_config_w32("pecl\\rpc");
- find_config_w32("..\\pecl\\rpc");
-} else {
- for (i = 0; i < module_dirs.length; i++) {
- find_config_w32(module_dirs[i]);
- }
-}
-
-// Now generate contents of module based on MODULES, chasing dependencies
-// to ensure that dependent modules are emitted first
-modules += gen_modules();
-
-// Look for ARG_ENABLE or ARG_WITH calls
-re = new RegExp("(ARG_(ENABLE|WITH)\([^;]+\);)", "gm");
-calls = modules.match(re);
-for (i = 0; i < calls.length; i++) {
- item = calls[i];
- C.WriteLine("try {");
- C.WriteLine(item);
- C.WriteLine("} catch (e) {");
- C.WriteLine('\tSTDOUT.WriteLine("problem: " + e);');
- C.WriteLine("}");
-}
-
-C.WriteBlankLines(1);
-C.WriteLine("conf_process_args();");
-C.WriteBlankLines(1);
-
-// Comment out the calls from their original positions
-modules = modules.replace(re, "/* $1 */");
-C.Write(modules);
-
-C.WriteBlankLines(1);
-C.Write(file_get_contents("win32/build/configure.tail"));
-
-B.WriteLine("@echo off");
-B.WriteLine("cscript /nologo configure.js %*");
+/*
+ +----------------------------------------------------------------------+
+ | PHP Version 5 |
+ +----------------------------------------------------------------------+
+ | Copyright (c) 1997-2008 The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Author: Wez Furlong <wez@thebrainroom.com> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $Id: buildconf.js,v 1.13.2.2.2.1.2.5 2009-01-02 12:18:21 kalle Exp $ */
+// This generates a configure script for win32 build
+
+WScript.StdOut.WriteLine("Rebuilding configure.js");
+var FSO = WScript.CreateObject("Scripting.FileSystemObject");
+var C = FSO.CreateTextFile("configure.js", true);
+var B = FSO.CreateTextFile("configure.bat", true);
+var DSP = false;
+
+var modules = "";
+var MODULES = WScript.CreateObject("Scripting.Dictionary");
+var module_dirs = new Array();
+
+function file_get_contents(filename)
+{
+ var F = FSO.OpenTextFile(filename, 1);
+ var t = F.ReadAll();
+ F.Close();
+ return t;
+}
+
+function Module_Item(module_name, config_path, dir_line, deps, content)
+{
+ this.module_name = module_name;
+ this.config_path = config_path;
+ this.dir_line = dir_line;
+ this.deps = deps;
+ this.content = content;
+}
+
+function find_config_w32(dirname)
+{
+ if (!FSO.FolderExists(dirname)) {
+ return;
+ }
+
+ var f = FSO.GetFolder(dirname);
+ var fc = new Enumerator(f.SubFolders);
+ var c, i, ok, n;
+ var item = null;
+ var re_dep_line = new RegExp("ADD_EXTENSION_DEP\\([^,]*\\s*,\\s*['\"]([^'\"]+)['\"].*\\)", "gm");
+
+ for (; !fc.atEnd(); fc.moveNext())
+ {
+ ok = true;
+ /* check if we already picked up a module with the same dirname;
+ * if we have, don't include it here */
+ n = FSO.GetFileName(fc.item());
+
+ if (n == '.svn' || n == 'tests')
+ continue;
+
+ // WScript.StdOut.WriteLine("checking " + dirname + "/" + n);
+ if (MODULES.Exists(n)) {
+ WScript.StdOut.WriteLine("Skipping " + dirname + "/" + n + " -- already have a module with that name");
+ continue;
+ }
+
+ c = FSO.BuildPath(fc.item(), "config.w32");
+ if (FSO.FileExists(c)) {
+// WScript.StdOut.WriteLine(c);
+
+ var dir_line = "configure_module_dirname = condense_path(FSO.GetParentFolderName('"
+ + c.replace(new RegExp('(["\\\\])', "g"), '\\$1') + "'));\r\n";
+ var contents = file_get_contents(c);
+ var deps = new Array();
+
+ // parse out any deps from the file
+ var calls = contents.match(re_dep_line);
+ if (calls != null) {
+ for (i = 0; i < calls.length; i++) {
+ // now we need the extension name out of this thing
+ if (calls[i].match(re_dep_line)) {
+// WScript.StdOut.WriteLine("n depends on " + RegExp.$1);
+ deps[deps.length] = RegExp.$1;
+
+ }
+ }
+ }
+
+ item = new Module_Item(n, c, dir_line, deps, contents);
+ MODULES.Add(n, item);
+ }
+ }
+}
+
+// Emit core modules array. This is used by a snapshot
+// build to override a default "yes" value so that external
+// modules don't break the build by becoming statically compiled
+function emit_core_module_list()
+{
+ var module_names = (new VBArray(MODULES.Keys())).toArray();
+ var i, mod_name, j;
+ var item;
+ var output = "";
+
+ C.WriteLine("core_module_list = new Array(");
+
+ // first, look for modules with empty deps; emit those first
+ for (i in module_names) {
+ mod_name = module_names[i];
+ C.WriteLine("\"" + mod_name.replace(/_/g, "-") + "\",");
+ }
+
+ C.WriteLine("false // dummy");
+
+ C.WriteLine(");");
+}
+
+
+function emit_module(item)
+{
+ return item.dir_line + item.content;
+}
+
+function emit_dep_modules(module_names)
+{
+ var i, mod_name, j;
+ var output = "";
+ var item = null;
+
+ for (i in module_names) {
+ mod_name = module_names[i];
+
+ if (MODULES.Exists(mod_name)) {
+ item = MODULES.Item(mod_name);
+ MODULES.Remove(mod_name);
+ if (item.deps.length) {
+ output += emit_dep_modules(item.deps);
+ }
+ output += emit_module(item);
+ }
+ }
+
+ return output;
+}
+
+function gen_modules()
+{
+ var module_names = (new VBArray(MODULES.Keys())).toArray();
+ var i, mod_name, j;
+ var item;
+ var output = "";
+
+ // first, look for modules with empty deps; emit those first
+ for (i in module_names) {
+ mod_name = module_names[i];
+ item = MODULES.Item(mod_name);
+ if (item.deps.length == 0) {
+ MODULES.Remove(mod_name);
+ output += emit_module(item);
+ }
+ }
+
+ // now we are left with modules that have dependencies on other modules
+ module_names = (new VBArray(MODULES.Keys())).toArray();
+ output += emit_dep_modules(module_names);
+
+ return output;
+}
+
+// Process buildconf arguments
+function buildconf_process_args()
+{
+ args = WScript.Arguments;
+
+ for (i = 0; i < args.length; i++) {
+ arg = args(i);
+ // If it is --foo=bar, split on the equals sign
+ arg = arg.split("=", 2);
+ argname = arg[0];
+ if (arg.length > 1) {
+ argval = arg[1];
+ } else {
+ argval = null;
+ }
+
+ if (argname == '--add-modules-dir' && argval != null) {
+ WScript.StdOut.WriteLine("Adding " + argval + " to the module search path");
+ module_dirs[module_dirs.length] = argval;
+ }
+
+ if (argname == '--add-project-files') {
+ WScript.StdOut.WriteLine("Adding dsp templates into the mix");
+ DSP = true;
+ }
+ }
+}
+
+buildconf_process_args();
+
+// Write the head of the configure script
+C.WriteLine("/* This file automatically generated from win32/build/confutils.js */");
+C.Write(file_get_contents("win32/build/confutils.js"));
+
+// If project files were requested, pull in the code to generate them
+if (DSP == true) {
+ C.WriteLine('PHP_DSP="yes"');
+ C.WriteBlankLines(1);
+ C.Write(file_get_contents("win32/build/projectgen.js"));
+} else {
+ C.WriteLine('PHP_DSP="no"');
+ C.WriteBlankLines(1);
+}
+
+// Pull in code from sapi and extensions
+modules = file_get_contents("win32/build/config.w32");
+
+// Pick up confs from TSRM and Zend if present
+find_config_w32(".");
+find_config_w32("sapi");
+find_config_w32("ext");
+emit_core_module_list();
+
+// If we have not specified any module dirs let's add some defaults
+if (module_dirs.length == 0) {
+ find_config_w32("pecl");
+ find_config_w32("..\\pecl");
+ find_config_w32("pecl\\rpc");
+ find_config_w32("..\\pecl\\rpc");
+} else {
+ for (i = 0; i < module_dirs.length; i++) {
+ find_config_w32(module_dirs[i]);
+ }
+}
+
+// Now generate contents of module based on MODULES, chasing dependencies
+// to ensure that dependent modules are emitted first
+modules += gen_modules();
+
+// Look for ARG_ENABLE or ARG_WITH calls
+re = new RegExp("(ARG_(ENABLE|WITH)\([^;]+\);)", "gm");
+calls = modules.match(re);
+for (i = 0; i < calls.length; i++) {
+ item = calls[i];
+ C.WriteLine("try {");
+ C.WriteLine(item);
+ C.WriteLine("} catch (e) {");
+ C.WriteLine('\tSTDOUT.WriteLine("problem: " + e);');
+ C.WriteLine("}");
+}
+
+C.WriteBlankLines(1);
+C.WriteLine("conf_process_args();");
+C.WriteBlankLines(1);
+
+// Comment out the calls from their original positions
+modules = modules.replace(re, "/* $1 */");
+C.Write(modules);
+
+C.WriteBlankLines(1);
+C.Write(file_get_contents("win32/build/configure.tail"));
+
+B.WriteLine("@echo off");
+B.WriteLine("cscript /nologo configure.js %*");
diff --git a/win32/build/config.w32 b/win32/build/config.w32
index 72b4c0447..67b9fe6fd 100644
--- a/win32/build/config.w32
+++ b/win32/build/config.w32
@@ -1,5 +1,5 @@
// vim:ft=javascript
-// $Id: config.w32,v 1.40.2.8.2.10.2.49 2009/06/04 18:20:45 mattwil Exp $
+// $Id: config.w32 289764 2009-10-19 19:05:58Z pajoye $
// "Master" config file; think of it as a configure.in
// equivalent.
@@ -82,6 +82,7 @@ if (VCVERS > 1200) {
// stick objects somewhere outside of the source tree
ARG_ENABLE('object-out-dir', 'Alternate location for binary objects during build', '');
if (PHP_OBJECT_OUT_DIR.length) {
+ PHP_OBJECT_OUT_DIR = FSO.GetAbsolutePathName(PHP_OBJECT_OUT_DIR);
if (!FSO.FolderExists(PHP_OBJECT_OUT_DIR)) {
ERROR('you chosen output directory ' + PHP_OBJECT_OUT_DIR + ' does not exist');
}
@@ -250,6 +251,7 @@ if (PHP_PHP_BUILD == 'no') {
}
}
}
+ PHP_PHP_BUILD = FSO.GetAbsolutePathName(PHP_PHP_BUILD);
}
DEFINE("PHP_BUILD", PHP_PHP_BUILD);
diff --git a/win32/build/config.w32.h.in b/win32/build/config.w32.h.in
index f3459bdac..e585e0ab5 100644
--- a/win32/build/config.w32.h.in
+++ b/win32/build/config.w32.h.in
@@ -1,6 +1,6 @@
/*
Build Configuration Template for Win32.
- $Id: config.w32.h.in,v 1.7.2.4.2.3.2.14 2009/06/23 06:56:45 kalle Exp $
+ $Id: config.w32.h.in 282624 2009-06-23 06:56:45Z kalle $
*/
/* Define the minimum supported version */
diff --git a/win32/build/configure.tail b/win32/build/configure.tail
index ad81c3349..c904bf44e 100644
--- a/win32/build/configure.tail
+++ b/win32/build/configure.tail
@@ -1,5 +1,5 @@
// vim:ft=javascript
-// $Id: configure.tail,v 1.1.8.1 2008/12/25 00:09:49 pajoye Exp $
+// $Id: configure.tail 271838 2008-12-25 00:09:49Z pajoye $
// tail end of configure
if (sapi_enabled.length < 1) {
diff --git a/win32/build/confutils.js b/win32/build/confutils.js
index 63bfd85bf..28b5e0d86 100644
--- a/win32/build/confutils.js
+++ b/win32/build/confutils.js
@@ -1,1861 +1,1861 @@
-// Utils for configure script
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Wez Furlong <wez@thebrainroom.com> |
- +----------------------------------------------------------------------+
-*/
-
-// $Id: confutils.js,v 1.60.2.1.2.8.2.33 2009/05/29 07:43:07 kalle Exp $
-
-var STDOUT = WScript.StdOut;
-var STDERR = WScript.StdErr;
-var WshShell = WScript.CreateObject("WScript.Shell");
-var FSO = WScript.CreateObject("Scripting.FileSystemObject");
-var MFO = null;
-var SYSTEM_DRIVE = WshShell.Environment("Process").Item("SystemDrive");
-var PROGRAM_FILES = WshShell.Environment("Process").Item("ProgramFiles");
-var DSP_FLAGS = new Array();
-
-/* Store the enabled extensions (summary + QA check) */
-var extensions_enabled = new Array();
-
-/* Store the SAPI enabled (summary + QA check) */
-var sapi_enabled = new Array();
-
-/* Mapping CL version > human readable name */
-var VC_VERSIONS = new Array();
-VC_VERSIONS[1200] = 'MSVC6 (Visual C++ 6.0)';
-VC_VERSIONS[1300] = 'MSVC7 (Visual C++ 2002)';
-VC_VERSIONS[1310] = 'MSVC7.1 (Visual C++ 2003)';
-VC_VERSIONS[1400] = 'MSVC8 (Visual C++ 2005)';
-VC_VERSIONS[1500] = 'MSVC9 (Visual C++ 2008)';
-
-var VC_VERSIONS_SHORT = new Array();
-VC_VERSIONS_SHORT[1200] = 'VC6';
-VC_VERSIONS_SHORT[1300] = 'VC7';
-VC_VERSIONS_SHORT[1310] = 'VC7.1';
-VC_VERSIONS_SHORT[1400] = 'VC8';
-VC_VERSIONS_SHORT[1500] = 'VC9';
-
-if (PROGRAM_FILES == null) {
- PROGRAM_FILES = "C:\\Program Files";
-}
-
-if (!FSO.FileExists("README.CVS-RULES")) {
- STDERR.WriteLine("Must be run from the root of the php source");
- WScript.Quit(10);
-}
-
-var CWD = WshShell.CurrentDirectory;
-
-if (typeof(CWD) == "undefined") {
- CWD = FSO.GetParentFolderName(FSO.GetAbsolutePathName("README.CVS-RULES"));
-}
-
-/* defaults; we pick up the precise versions from configure.in */
-var PHP_VERSION = 5;
-var PHP_MINOR_VERSION = 0;
-var PHP_RELEASE_VERSION = 0;
-var PHP_EXTRA_VERSION = "";
-var PHP_VERSION_STRING = "5.0.0";
-
-function get_version_numbers()
-{
- var cin = file_get_contents("configure.in");
-
- if (cin.match(new RegExp("PHP_MAJOR_VERSION=(\\d+)"))) {
- PHP_VERSION = RegExp.$1;
- }
- if (cin.match(new RegExp("PHP_MINOR_VERSION=(\\d+)"))) {
- PHP_MINOR_VERSION = RegExp.$1;
- }
- if (cin.match(new RegExp("PHP_RELEASE_VERSION=(\\d+)"))) {
- PHP_RELEASE_VERSION = RegExp.$1;
- }
- PHP_VERSION_STRING = PHP_VERSION + "." + PHP_MINOR_VERSION + "." + PHP_RELEASE_VERSION;
-
- if (cin.match(new RegExp("PHP_EXTRA_VERSION=\"([^\"]+)\""))) {
- PHP_EXTRA_VERSION = RegExp.$1;
- if (PHP_EXTRA_VERSION.length) {
- PHP_VERSION_STRING += PHP_EXTRA_VERSION;
- }
- }
- DEFINE('PHP_VERSION_STRING', PHP_VERSION_STRING);
-}
-
-configure_args = new Array();
-configure_subst = WScript.CreateObject("Scripting.Dictionary");
-
-configure_hdr = WScript.CreateObject("Scripting.Dictionary");
-build_dirs = new Array();
-
-extension_include_code = "";
-extension_module_ptrs = "";
-
-get_version_numbers();
-
-/* execute a command and return the output as a string */
-function execute(command_line)
-{
- var e = WshShell.Exec(command_line);
- var ret = "";
-
- ret = e.StdOut.ReadAll();
-
-//STDOUT.WriteLine("command " + command_line);
-//STDOUT.WriteLine(ret);
-
- return ret;
-}
-
-function probe_binary(EXE, what)
-{
- // tricky escapes to get stderr redirection to work
- var command = 'cmd /c ""' + EXE;
- if (what == "version") {
- command = command + '" -v"';
- }
- var version = execute(command + '" 2>&1"');
-
- if (what == "64") {
- if (version.match(/x64/)) {
- return 1;
- }
- } else {
- if (version.match(/(\d+\.\d+(\.\d+)?(\.\d+)?)/)) {
- return RegExp.$1;
- }
- }
- return 0;
-}
-
-function condense_path(path)
-{
- path = FSO.GetAbsolutePathName(path);
-
- if (path.substr(0, CWD.length).toLowerCase()
- == CWD.toLowerCase() &&
- (path.charCodeAt(CWD.length) == 92 || path.charCodeAt(CWD.length) == 47)) {
- return path.substr(CWD.length + 1);
- }
-
- var a = CWD.split("\\");
- var b = path.split("\\");
- var i, j;
-
- for (i = 0; i < b.length; i++) {
- if (a[i].toLowerCase() == b[i].toLowerCase())
- continue;
- if (i > 0) {
- /* first difference found */
- path = "";
- for (j = 0; j < a.length - i; j++) {
- path += "..\\";
- }
- for (j = i; j < b.length; j++) {
- path += b[j];
- if (j < b.length - 1)
- path += "\\";
- }
- return path;
- }
- /* on a different drive */
- break;
- }
-
- return path;
-}
-
-function ConfigureArg(type, optname, helptext, defval)
-{
- var opptype = type == "enable" ? "disable" : "without";
-
- if (defval == "yes" || defval == "yes,shared") {
- this.arg = "--" + opptype + "-" + optname;
- this.imparg = "--" + type + "-" + optname;
- } else {
- this.arg = "--" + type + "-" + optname;
- this.imparg = "--" + opptype + "-" + optname;
- }
-
- this.optname = optname;
- this.helptext = helptext;
- this.defval = defval;
- this.symval = optname.toUpperCase().replace(new RegExp("-", "g"), "_");
- this.seen = false;
- this.argval = defval;
-}
-
-function ARG_WITH(optname, helptext, defval)
-{
- configure_args[configure_args.length] = new ConfigureArg("with", optname, helptext, defval);
-}
-
-function ARG_ENABLE(optname, helptext, defval)
-{
- configure_args[configure_args.length] = new ConfigureArg("enable", optname, helptext, defval);
-}
-
-function analyze_arg(argval)
-{
- var ret = new Array();
- var shared = false;
-
- if (argval == "shared") {
- shared = true;
- argval = "yes";
- } else if (argval == null) {
- /* nothing */
- } else if (arg_match = argval.match(new RegExp("^shared,(.*)"))) {
- shared = true;
- argval = arg_match[1];
- } else if (arg_match = argval.match(new RegExp("^(.*),shared$"))) {
- shared = true;
- argval = arg_match[1];
- }
-
- ret[0] = shared;
- ret[1] = argval;
- return ret;
-}
-
-function word_wrap_and_indent(indent, text, line_suffix, indent_char)
-{
- if (text == null) {
- return "";
- }
-
- var words = text.split(new RegExp("\\s+", "g"));
- var i = 0;
- var ret_text = "";
- var this_line = "";
- var t;
- var space = "";
- var lines = 0;
-
- if (line_suffix == null) {
- line_suffix = "";
- }
-
- if (indent_char == null) {
- indent_char = " ";
- }
-
- for (i = 0; i < indent; i++) {
- space += indent_char;
- }
-
- for (i = 0; i < words.length; i++) {
- if (this_line.length) {
- t = this_line + " " + words[i];
- } else {
- t = words[i];
- }
-
- if (t.length + indent > 78) {
- if (lines++) {
- ret_text += space;
- }
- ret_text += this_line + line_suffix + "\r\n";
- this_line = "";
- }
-
- if (this_line.length) {
- this_line += " " + words[i];
- } else {
- this_line = words[i];
- }
- }
-
- if (this_line.length) {
- if (lines)
- ret_text += space;
- ret_text += this_line;
- }
-
- return ret_text;
-}
-
-function conf_process_args()
-{
- var i, j;
- var configure_help_mode = false;
- var analyzed = false;
- var nice = "cscript /nologo configure.js ";
- var disable_all = false;
-
- args = WScript.Arguments;
- for (i = 0; i < args.length; i++) {
- arg = args(i);
- nice += ' "' + arg + '"';
- if (arg == "--help") {
- configure_help_mode = true;
- break;
- }
- if (arg == "--disable-all") {
- disable_all = true;
- continue;
- }
-
- // If it is --foo=bar, split on the equals sign
- arg = arg.split("=", 2);
- argname = arg[0];
- if (arg.length > 1) {
- argval = arg[1];
- } else {
- argval = null;
- }
-
- // Find the arg
- found = false;
- for (j = 0; j < configure_args.length; j++) {
- if (argname == configure_args[j].imparg || argname == configure_args[j].arg) {
- found = true;
-
- arg = configure_args[j];
- arg.seen = true;
-
- analyzed = analyze_arg(argval);
- shared = analyzed[0];
- argval = analyzed[1];
-
- if (argname == arg.imparg) {
- /* we matched the implicit, or default arg */
- if (argval == null) {
- argval = arg.defval;
- }
- } else {
- /* we matched the non-default arg */
- if (argval == null) {
- argval = arg.defval == "no" ? "yes" : "no";
- }
- }
-
- arg.argval = argval;
- eval("PHP_" + arg.symval + " = argval;");
- eval("PHP_" + arg.symval + "_SHARED = shared;");
- break;
- }
- }
- if (!found) {
- STDERR.WriteLine("Unknown option " + argname + "; please try configure.js --help for a list of valid options");
- WScript.Quit(2);
- }
- }
-
- if (configure_help_mode) {
- STDOUT.WriteLine(word_wrap_and_indent(0,
-"Options that enable extensions and SAPI will accept \
-'yes' or 'no' as a parameter. They also accept 'shared' \
-as a synonym for 'yes' and request a shared build of that \
-module. Not all modules can be built as shared modules; \
-configure will display [shared] after the module name if \
-can be built that way. \
-"
- ));
- STDOUT.WriteBlankLines(1);
-
- // Measure width to pretty-print the output
- max_width = 0;
- for (i = 0; i < configure_args.length; i++) {
- arg = configure_args[i];
- if (arg.arg.length > max_width)
- max_width = arg.arg.length;
- }
-
- for (i = 0; i < configure_args.length; i++) {
- arg = configure_args[i];
-
- n = max_width - arg.arg.length;
- pad = " ";
- for (j = 0; j < n; j++) {
- pad += " ";
- }
- STDOUT.WriteLine(" " + arg.arg + pad + word_wrap_and_indent(max_width + 5, arg.helptext));
- }
- WScript.Quit(1);
- }
-
- var snapshot_build_exclusions = new Array(
- 'debug', 'crt-debug', 'lzf-better-compression',
- 'php-build', 'snapshot-template', 'ereg',
- 'pcre-regex', 'fastcgi', 'force-cgi-redirect',
- 'path-info-check', 'zts', 'ipv6', 'memory-limit',
- 'zend-multibyte', 'fd-setsize', 'memory-manager', 't1lib'
- );
- var force;
-
- // Now set any defaults we might have missed out earlier
- for (i = 0; i < configure_args.length; i++) {
- arg = configure_args[i];
- if (arg.seen)
- continue;
- analyzed = analyze_arg(arg.defval);
- shared = analyzed[0];
- argval = analyzed[1];
-
- // Don't trust a default "yes" answer for a non-core module
- // in a snapshot build
- if (PHP_SNAPSHOT_BUILD != "no" && argval == "yes" && !shared) {
-
- force = true;
- for (j = 0; j < snapshot_build_exclusions.length; j++) {
- if (snapshot_build_exclusions[j] == arg.optname) {
- force = false;
- break;
- }
- }
-
- if (force) {
- /* now check if it is a core module */
- force = false;
- for (j = 0; j < core_module_list.length; j++) {
- if (core_module_list[j] == arg.optname) {
- force = true;
- break;
- }
- }
-
- if (!force) {
- STDOUT.WriteLine("snapshot: forcing " + arg.arg + " shared");
- shared = true;
- }
- }
- }
-
- if (PHP_SNAPSHOT_BUILD != "no" && argval == "no") {
- force = true;
- for (j = 0; j < snapshot_build_exclusions.length; j++) {
- if (snapshot_build_exclusions[j] == arg.optname) {
- force = false;
- break;
- }
- }
- if (force) {
- STDOUT.WriteLine("snapshot: forcing " + arg.optname + " on");
- argval = "yes";
- shared = true;
- }
- }
-
- if (disable_all) {
- force = true;
- for (j = 0; j < snapshot_build_exclusions.length; j++) {
- if (snapshot_build_exclusions[j] == arg.optname) {
- force = false;
- break;
- }
- }
- if (force) {
- if (arg.defval == '') {
- argval = '';
- } else {
- argval = "no";
- }
- shared = false;
- }
- }
-
- eval("PHP_" + arg.symval + " = argval;");
- eval("PHP_" + arg.symval + "_SHARED = shared;");
- }
-
- MFO = FSO.CreateTextFile("Makefile.objects", true);
-
- STDOUT.WriteLine("Saving configure options to config.nice.bat");
- var nicefile = FSO.CreateTextFile("config.nice.bat", true);
- nicefile.WriteLine(nice + " %*");
- nicefile.Close();
-
- AC_DEFINE('CONFIGURE_COMMAND', nice, "Configure line");
-}
-
-function DEFINE(name, value)
-{
- if (configure_subst.Exists(name)) {
- configure_subst.Remove(name);
- }
- configure_subst.Add(name, value);
-}
-
-// Searches a set of paths for a file;
-// returns the dir in which the file was found,
-// true if it was found in the default env path,
-// or false if it was not found at all.
-// env_name is the optional name of an env var
-// specifying the default path to search
-function search_paths(thing_to_find, explicit_path, env_name)
-{
- var i, found = false, place = false, file, env;
-
- STDOUT.Write("Checking for " + thing_to_find + " ... ");
-
- thing_to_find = thing_to_find.replace(new RegExp("/", "g"), "\\");
-
- if (explicit_path != null) {
- if (typeof(explicit_path) == "string") {
- explicit_path = explicit_path.split(";");
- }
-
- for (i = 0; i < explicit_path.length; i++) {
- file = glob(explicit_path[i] + "\\" + thing_to_find);
- if (file) {
- found = true;
- place = file[0];
- place = place.substr(0, place.length - thing_to_find.length - 1);
- break;
- }
- }
- }
-
- if (!found && env_name != null) {
- env = WshShell.Environment("Process").Item(env_name);
- env = env.split(";");
- for (i = 0; i < env.length; i++) {
- file = glob(env[i] + "\\" + thing_to_find);
- if (file) {
- found = true;
- place = true;
- break;
- }
- }
- }
-
- if (found && place == true) {
- STDOUT.WriteLine(" <in default path>");
- } else if (found) {
- STDOUT.WriteLine(" " + place);
- } else {
- STDOUT.WriteLine(" <not found>");
- }
- return place;
-}
-
-function PATH_PROG(progname, additional_paths, symbol)
-{
- var exe;
- var place;
- var cyg_path = PHP_CYGWIN + "\\bin;" + PHP_CYGWIN + "\\usr\\local\\bin";
- var php_build_bin_path = PHP_PHP_BUILD + "\\bin"
-
- exe = progname + ".exe";
-
- if (additional_paths == null) {
- additional_paths = cyg_path;
- } else {
- additional_paths += ";" + cyg_path;
- }
-
- additional_paths = additional_paths + ";" + php_build_bin_path;
-
- place = search_paths(exe, additional_paths, "PATH");
-
- if (place == true) {
- place = exe;
- } else if (place != false) {
- place = place + "\\" + exe;
- }
-
- if (place) {
- if (symbol == null) {
- symbol = progname.toUpperCase();
- }
- DEFINE(symbol, place);
- }
- return place;
-}
-
-function find_pattern_in_path(pattern, path)
-{
- if (path == null) {
- return false;
- }
-
- var dirs = path.split(';');
- var i;
- var items;
-
- for (i = 0; i < dirs.length; i++) {
- items = glob(dirs[i] + "\\" + pattern);
- if (items) {
- return condense_path(items[0]);
- }
- }
- return false;
-}
-
-function CHECK_LIB(libnames, target, path_to_check, common_name)
-{
- STDOUT.Write("Checking for library " + libnames + " ... ");
-
- if (common_name == null && target != null) {
- common_name = target;
- }
-
- if (path_to_check == null) {
- path_to_check = "";
- }
-
- // if they specified a common name for the package that contains
- // the library, tag some useful defaults on to the end of the
- // path to be searched
- if (common_name != null) {
- path_to_check += ";" + PHP_PHP_BUILD + "\\" + common_name + "*";
- path_to_check += ";" + PHP_PHP_BUILD + "\\lib\\" + common_name + "*";
- path_to_check += ";..\\" + common_name + "*";
- }
-
- // Determine target for build flags
- if (target == null) {
- target = "";
- } else {
- target = "_" + target.toUpperCase();
- }
-
- // Expand path to include general dirs
- path_to_check += ";" + php_usual_lib_suspects;
-
- // It is common practice to put libs under one of these dir names
- var subdirs = new Array(PHP_DEBUG == "yes" ? "Debug" : (PHP_DEBUG_PACK == "yes"?"Release_Dbg":"Release"), "lib", "libs", "libexec");
-
- // libnames can be ; separated list of accepted library names
- libnames = libnames.split(';');
-
- // for debug builds, lib may have _debug appended, we want that first
- if (PHP_DEBUG == "yes") {
- var length = libnames.length;
- for (var i = 0; i < length; i++) {
- var name = new String(libnames[i]);
- rExp = /.lib$/i;
- name = name.replace(rExp,"_debug.lib");
- libnames.unshift(name);
- }
- }
-
- var i, j, k, libname;
- var location = false;
- var path = path_to_check.split(';');
-
- for (i = 0; i < libnames.length; i++) {
- libname = libnames[i];
-
- for (k = 0; k < path.length; k++) {
- location = glob(path[k] + "\\" + libname);
- if (location) {
- location = location[0];
- break;
- }
- for (j = 0; j < subdirs.length; j++) {
- location = glob(path[k] + "\\" + subdirs[j] + "\\" + libname);
- if (location) {
- location = location[0];
- break;
- }
- }
- if (location)
- break;
- }
-
- if (location) {
- location = condense_path(location);
- var libdir = FSO.GetParentFolderName(location);
- libname = FSO.GetFileName(location);
- ADD_FLAG("LDFLAGS" + target, '/libpath:"' + libdir + '" ');
- ADD_FLAG("LIBS" + target, libname);
-
- STDOUT.WriteLine(location);
-
- return location;
- }
-
- // Check in their standard lib path
- location = find_pattern_in_path(libname, WshShell.Environment("Process").Item("LIB"));
-
- if (location) {
- location = condense_path(location);
- libname = FSO.GetFileName(location);
- ADD_FLAG("LIBS" + target, libname);
-
- STDOUT.WriteLine("<in LIB path> " + libname);
- return location;
- }
-
- // Check in their general extra libs path
- location = find_pattern_in_path(libname, PHP_EXTRA_LIBS);
- if (location) {
- location = condense_path(location);
- libname = FSO.GetFileName(location);
- ADD_FLAG("LIBS" + target, libname);
- STDOUT.WriteLine("<in extra libs path>");
- return location;
- }
- }
-
- STDOUT.WriteLine("<not found>");
-
- return false;
-}
-
-function OLD_CHECK_LIB(libnames, target, path_to_check)
-{
- if (target == null) {
- target = "";
- } else {
- target = "_" + target.toUpperCase();
- }
-
- if (path_to_check == null) {
- path_to_check = php_usual_lib_suspects;
- } else {
- path_to_check += ";" + php_usual_lib_suspects;
- }
- var have = 0;
- var p;
- var i;
- var libname;
-
- var subdir = PHP_DEBUG == "yes" ? "Debug" : (PHP_DEBUG_PACK == "yes"?"Release_Dbg":"Release");
-
- libnames = libnames.split(';');
- for (i = 0; i < libnames.length; i++) {
- libname = libnames[i];
- p = search_paths(libname, path_to_check, "LIB");
-
- if (!p) {
- p = search_paths(subdir + "\\" + libname, path_to_check, "LIB");
- if (p) {
- p += "\\" + subdir;
- }
- }
-
- if (typeof(p) == "string") {
- ADD_FLAG("LDFLAGS" + target, '/libpath:"' + p + '" ');
- ADD_FLAG("LIBS" + target, libname);
- have = 1;
- } else if (p == true) {
- ADD_FLAG("LIBS" + target, libname);
- have = 1;
- } else {
- /* not found in the defaults or the explicit paths,
- * so check the general extra libs; if we find
- * it here, no need to add another /libpath: for it as we
- * already have it covered, but we need to add the lib
- * to LIBS_XXX */
- if (false != search_paths(libname, PHP_EXTRA_LIBS, null)) {
- ADD_FLAG("LIBS" + target, libname);
- have = 1;
- }
- }
-
- if (have) {
- break;
- }
- }
-
-// AC_DEFINE("HAVE_" + header_name.toUpperCase().replace(new RegExp("/\\\\-\.", "g"), "_"), have);
-
- return have;
-
-}
-
-function CHECK_FUNC_IN_HEADER(header_name, func_name, path_to_check, add_to_flag)
-{
- var c = false;
- var sym;
-
- STDOUT.Write("Checking for " + func_name + " in " + header_name + " ... ");
-
- c = GREP_HEADER(header_name, func_name, path_to_check);
-
- sym = func_name.toUpperCase();
- sym = sym.replace(new RegExp("[\\\\/\.-]", "g"), "_");
-
- if (typeof(add_to_flag) == "undefined") {
- AC_DEFINE("HAVE_" + sym, c ? 1 : 0);
- } else {
- ADD_FLAG(add_to_flag, "/DHAVE_" + sym + "=" + (c ? "1" : "0"));
- }
-
- if (c) {
- STDOUT.WriteLine("OK");
- return c;
- }
- STDOUT.WriteLine("No");
- return false;
-}
-
-function GREP_HEADER(header_name, regex, path_to_check)
-{
- var c = false;
-
- if (FSO.FileExists(path_to_check + "\\" + header_name)) {
- c = file_get_contents(path_to_check + "\\" + header_name);
- }
-
- if (!c) {
- /* look in the include path */
-
- var p = search_paths(header_name, path_to_check, "INCLUDE");
- if (typeof(p) == "string") {
- c = file_get_contents(p);
- } else if (p == false) {
- p = search_paths(header_name, PHP_EXTRA_INCLUDES, null);
- if (typeof(p) == "string") {
- c = file_get_contents(p);
- }
- }
- if (!c) {
- return false;
- }
- }
-
- if (typeof(regex) == "string") {
- regex = new RegExp(regex);
- }
-
- if (c.match(regex)) {
- /* caller can now use RegExp.$1 etc. to get at patterns */
- return true;
- }
- return false;
-}
-
-function CHECK_HEADER_ADD_INCLUDE(header_name, flag_name, path_to_check, use_env, add_dir_part, add_to_flag_only)
-{
- var dir_part_to_add = "";
-
- if (use_env == null) {
- use_env = true;
- }
-
- // if true, add the dir part of the header_name to the include path
- if (add_dir_part == null) {
- add_dir_part = false;
- } else if (add_dir_part) {
- var basename = FSO.GetFileName(header_name);
- dir_part_to_add = "\\" + header_name.substr(0, header_name.length - basename.length - 1);
- }
-
- if (path_to_check == null) {
- path_to_check = php_usual_include_suspects;
- } else {
- path_to_check += ";" + php_usual_include_suspects;
- }
-
- var p = search_paths(header_name, path_to_check, use_env ? "INCLUDE" : null);
- var have = 0;
- var sym;
-
- if (typeof(p) == "string") {
- ADD_FLAG(flag_name, '/I "' + p + dir_part_to_add + '" ');
- } else if (p == false) {
- /* not found in the defaults or the explicit paths,
- * so check the general extra includes; if we find
- * it here, no need to add another /I for it as we
- * already have it covered, unless we are adding
- * the dir part.... */
- p = search_paths(header_name, PHP_EXTRA_INCLUDES, null);
- if (typeof(p) == "string" && add_dir_part) {
- ADD_FLAG(flag_name, '/I "' + p + dir_part_to_add + '" ');
- }
- }
- have = p ? 1 : 0
-
- sym = header_name.toUpperCase();
- sym = sym.replace(new RegExp("[\\\\/\.-]", "g"), "_");
-
- if (typeof(add_to_flag_only) == "undefined" &&
- flag_name.match(new RegExp("^CFLAGS_(.*)$"))) {
- add_to_flag_only = true;
- }
-
- if (typeof(add_to_flag_only) != "undefined") {
- ADD_FLAG(flag_name, "/DHAVE_" + sym + "=" + have);
- } else {
- AC_DEFINE("HAVE_" + sym, have, "have the " + header_name + " header file");
- }
-
- return p;
-}
-
-/* emits rule to generate version info for a SAPI
- * or extension. Returns the name of the .res file
- * that will be generated */
-function generate_version_info_resource(makefiletarget, basename, creditspath, sapi)
-{
- var resname = makefiletarget + ".res";
- var res_desc = makefiletarget;
- var res_prod_name = "PHP " + makefiletarget;
- var credits;
- var thanks = "";
- var logo = "";
- var debug = "";
- var project_url = "http://www.php.net";
- var project_header = creditspath + "/php_" + basename + ".h";
- var versioning = "";
-
- if (sapi) {
- var internal_name = basename.toUpperCase() + " SAPI";
- } else {
- var internal_name = basename.toUpperCase() + " extension";
- }
-
- if (FSO.FileExists(creditspath + '/CREDITS')) {
- credits = FSO.OpenTextFile(creditspath + '/CREDITS', 1);
- res_desc = credits.ReadLine();
- try {
- thanks = credits.ReadLine();
- } catch (e) {
- thanks = null;
- }
- if (thanks == null) {
- thanks = "";
- } else {
- thanks = "Thanks to " + thanks;
- }
- credits.Close();
- }
-
- if (creditspath.match(new RegExp("pecl"))) {
- /* PECL project url - this will eventually work correctly for all */
- project_url = "http://pecl.php.net/" + basename;
-
- /* keep independent versioning PECL-specific for now */
- if (FSO.FileExists(project_header)) {
- if (header = FSO.OpenTextFile(project_header, 1)) {
- contents = header.ReadAll();
- /* allowed: x.x.x[a|b|-alpha|-beta][RCx][-dev] */
- if (contents.match(new RegExp('PHP_' + basename.toUpperCase() + '_VERSION(\\s+)"((\\d+\.\\d+(\.\\d+)?)((a|b)(\\d)?|\-[a-z]{3,5})?(RC\\d+)?(\-dev)?)'))) {
- project_version = RegExp.$2;
- file_version = RegExp.$3.split('.');
- if (!file_version[2]) {
- file_version[2] = 0;
- }
- versioning = '\\"" /d EXT_FILE_VERSION=' + file_version[0] + ',' + file_version[1] + ',' + file_version[2] + ' /d EXT_VERSION="\\"' + project_version;
- }
- header.Close();
- }
- }
- }
-
- if (makefiletarget.match(new RegExp("\\.exe$"))) {
- logo = " /d WANT_LOGO ";
- }
-
- if (PHP_DEBUG != "no") {
- debug = " /d _DEBUG";
- }
-
- /**
- * Use user supplied template.rc if it exists
- */
- if (FSO.FileExists(creditspath + '\\template.rc')) {
- MFO.WriteLine("$(BUILD_DIR)\\" + resname + ": " + creditspath + "\\template.rc");
- MFO.WriteLine("\t$(RC) /fo $(BUILD_DIR)\\" + resname + logo + debug +
- ' /d FILE_DESCRIPTION="\\"' + res_desc + '\\"" /d FILE_NAME="\\"' +
- makefiletarget + '\\"" /d PRODUCT_NAME="\\"' + res_prod_name +
- versioning + '\\"" /d THANKS_GUYS="\\"' + thanks + '\\"" ' +
- creditspath + '\\template.rc');
- return resname;
- }
-
- MFO.WriteLine("$(BUILD_DIR)\\" + resname + ": win32\\build\\template.rc");
- MFO.WriteLine("\t$(RC) /n /fo $(BUILD_DIR)\\" + resname + logo + debug +
- ' /d FILE_DESCRIPTION="\\"' + res_desc + '\\"" /d FILE_NAME="\\"'
- + makefiletarget + '\\"" /d URL="\\"' + project_url +
- '\\"" /d INTERNAL_NAME="\\"' + internal_name + versioning +
- '\\"" /d THANKS_GUYS="\\"' + thanks + '\\"" win32\\build\\template.rc');
- MFO.WriteBlankLines(1);
- return resname;
-}
-
-function SAPI(sapiname, file_list, makefiletarget, cflags, obj_dir)
-{
- var SAPI = sapiname.toUpperCase();
- var ldflags;
- var resname;
- var ld;
- var manifest;
-
- if (typeof(obj_dir) == "undefined") {
- sapiname_for_printing = configure_module_dirname;
- } else {
- sapiname_for_printing = configure_module_dirname + " (via " + obj_dir + ")";
- }
-
- STDOUT.WriteLine("Enabling SAPI " + sapiname_for_printing);
-
- MFO.WriteBlankLines(1);
- MFO.WriteLine("# objects for SAPI " + sapiname);
- MFO.WriteBlankLines(1);
-
- if (cflags) {
- ADD_FLAG('CFLAGS_' + SAPI, cflags);
- }
-
- ADD_SOURCES(configure_module_dirname, file_list, sapiname, obj_dir);
- MFO.WriteBlankLines(1);
- MFO.WriteLine("# SAPI " + sapiname);
- MFO.WriteBlankLines(1);
-
- /* generate a .res file containing version information */
- resname = generate_version_info_resource(makefiletarget, sapiname, configure_module_dirname, true);
-
- MFO.WriteLine(makefiletarget + ": $(BUILD_DIR)\\" + makefiletarget);
- MFO.WriteLine("\t@echo SAPI " + sapiname_for_printing + " build complete");
- MFO.WriteLine("$(BUILD_DIR)\\" + makefiletarget + ": $(DEPS_" + SAPI + ") $(" + SAPI + "_GLOBAL_OBJS) $(BUILD_DIR)\\$(PHPLIB) $(BUILD_DIR)\\" + resname);
-
- if (makefiletarget.match(new RegExp("\\.dll$"))) {
- ldflags = "/dll $(LDFLAGS)";
- manifest = "-@$(_VC_MANIFEST_EMBED_DLL)";
- } else if (makefiletarget.match(new RegExp("\\.lib$"))) {
- ldflags = "$(LDFLAGS)";
- ld = "$(MAKE_LIB)";
- } else {
- ldflags = "$(LDFLAGS)";
- manifest = "-@$(_VC_MANIFEST_EMBED_EXE)";
- }
-
- if (ld) {
- MFO.WriteLine("\t" + ld + " /nologo /out:$(BUILD_DIR)\\" + makefiletarget + " " + ldflags + " $(" + SAPI + "_GLOBAL_OBJS) $(BUILD_DIR)\\$(PHPLIB) $(LDFLAGS_" + SAPI + ") $(LIBS_" + SAPI + ") $(BUILD_DIR)\\" + resname);
- } else {
- ld = "@$(CC)";
- MFO.WriteLine("\t" + ld + " /nologo " + " $(" + SAPI + "_GLOBAL_OBJS) $(BUILD_DIR)\\$(PHPLIB) $(LIBS_" + SAPI + ") $(BUILD_DIR)\\" + resname + " /link /out:$(BUILD_DIR)\\" + makefiletarget + " " + ldflags + " $(LDFLAGS_" + SAPI + ")");
- }
-
- if (manifest) {
- MFO.WriteLine("\t" + manifest);
- }
-
- DEFINE('CFLAGS_' + SAPI + '_OBJ', '$(CFLAGS_' + SAPI + ')');
-
- if (configure_module_dirname.match("pecl")) {
- ADD_FLAG("PECL_TARGETS", makefiletarget);
- } else {
- ADD_FLAG("SAPI_TARGETS", makefiletarget);
- }
-
- if (PHP_DSP != "no") {
- generate_dsp_file(sapiname, configure_module_dirname, file_list, false);
- }
-
- MFO.WriteBlankLines(1);
- sapi_enabled[sapi_enabled.length] = [sapiname];
-}
-
-function ADD_DIST_FILE(filename)
-{
- if (configure_module_dirname.match("pecl")) {
- ADD_FLAG("PECL_EXTRA_DIST_FILES", filename);
- } else {
- ADD_FLAG("PHP_EXTRA_DIST_FILES", filename);
- }
-}
-
-function file_get_contents(filename)
-{
- var f, c;
- try {
- f = FSO.OpenTextFile(filename, 1);
- c = f.ReadAll();
- f.Close();
- return c;
- } catch (e) {
- STDOUT.WriteLine("Problem reading " + filename);
- return false;
- }
-}
-
-// Add a dependency on another extension, so that
-// the dependencies are built before extname
-function ADD_EXTENSION_DEP(extname, dependson, optional)
-{
- var EXT = extname.toUpperCase();
- var DEP = dependson.toUpperCase();
- var dep_present = false;
- var dep_shared = false;
-
- try {
- dep_present = eval("PHP_" + DEP);
-
- if (dep_present != "no") {
- try {
- dep_shared = eval("PHP_" + DEP + "_SHARED");
- } catch (e) {
- dep_shared = false;
- }
- }
-
- } catch (e) {
- dep_present = "no";
- }
-
- if (optional) {
- if (dep_present == "no") {
- MESSAGE("\t" + dependson + " not found: " + dependson + " support in " + extname + " disabled");
- return false;
- }
- }
-
- var ext_shared = eval("PHP_" + EXT + "_SHARED");
-
- if (dep_shared) {
- if (!ext_shared) {
- if (optional) {
- MESSAGE("\tstatic " + extname + " cannot depend on shared " + dependson + ": " + dependson + "support disabled");
- return false;
- }
- ERROR("static " + extname + " cannot depend on shared " + dependson);
- }
-
- ADD_FLAG("LDFLAGS_" + EXT, "/libpath:$(BUILD_DIR)");
- ADD_FLAG("LIBS_" + EXT, "php_" + dependson + ".lib");
- ADD_FLAG("DEPS_" + EXT, "$(BUILD_DIR)\\php_" + dependson + ".lib");
-
- } else {
-
- if (dep_present == "no") {
- if (ext_shared) {
- WARNING(extname + " cannot be built: missing dependency, " + dependson + " not found");
-
- var dllname = ' php_' + extname + '.dll';
-
- if (!REMOVE_TARGET(dllname, 'EXT_TARGETS')) {
- REMOVE_TARGET(dllname, 'PECL_TARGETS');
- }
-
- return false;
-
- }
-
- ERROR("Cannot build " + extname + "; " + dependson + " not enabled");
- return false;
- }
- } // dependency is statically built-in to PHP
- return true;
-}
-
-function EXTENSION(extname, file_list, shared, cflags, dllname, obj_dir)
-{
- var objs = null;
- var EXT = extname.toUpperCase();
- var extname_for_printing;
-
- if (shared == null) {
- eval("shared = PHP_" + EXT + "_SHARED;");
- } else {
- eval("PHP_" + EXT + "_SHARED = shared;");
- }
-
- if (cflags == null) {
- cflags = "";
- }
-
- if (typeof(obj_dir) == "undefined") {
- extname_for_printing = configure_module_dirname;
- } else {
- extname_for_printing = configure_module_dirname + " (via " + obj_dir + ")";
- }
-
- if (shared) {
- STDOUT.WriteLine("Enabling extension " + extname_for_printing + " [shared]");
- cflags = "/D COMPILE_DL_" + EXT + " /D " + EXT + "_EXPORTS=1 " + cflags;
- ADD_FLAG("CFLAGS_PHP", "/D COMPILE_DL_" + EXT);
- } else {
- STDOUT.WriteLine("Enabling extension " + extname_for_printing);
- }
-
- MFO.WriteBlankLines(1);
- MFO.WriteLine("# objects for EXT " + extname);
- MFO.WriteBlankLines(1);
-
-
- ADD_SOURCES(configure_module_dirname, file_list, extname, obj_dir);
-
- MFO.WriteBlankLines(1);
-
- if (shared) {
- if (dllname == null) {
- dllname = "php_" + extname + ".dll";
- }
- var libname = dllname.substring(0, dllname.length-4) + ".lib";
-
- var resname = generate_version_info_resource(dllname, extname, configure_module_dirname, false);
- var ld = "@$(CC)";
-
- MFO.WriteLine("$(BUILD_DIR)\\" + libname + ": $(BUILD_DIR)\\" + dllname);
- MFO.WriteBlankLines(1);
- MFO.WriteLine("$(BUILD_DIR)\\" + dllname + ": $(DEPS_" + EXT + ") $(" + EXT + "_GLOBAL_OBJS) $(BUILD_DIR)\\$(PHPLIB) $(BUILD_DIR)\\" + resname);
- MFO.WriteLine("\t" + ld + " $(" + EXT + "_GLOBAL_OBJS) $(BUILD_DIR)\\$(PHPLIB) $(LIBS_" + EXT + ") $(LIBS) $(BUILD_DIR)\\" + resname + " /link /out:$(BUILD_DIR)\\" + dllname + " $(DLL_LDFLAGS) $(LDFLAGS) $(LDFLAGS_" + EXT + ")");
- MFO.WriteLine("\t-@$(_VC_MANIFEST_EMBED_DLL)");
- MFO.WriteBlankLines(1);
-
- if (configure_module_dirname.match("pecl")) {
- ADD_FLAG("PECL_TARGETS", dllname);
- } else {
- ADD_FLAG("EXT_TARGETS", dllname);
- }
- MFO.WriteLine(dllname + ": $(BUILD_DIR)\\" + dllname);
- MFO.WriteLine("\t@echo EXT " + extname + " build complete");
- MFO.WriteBlankLines(1);
-
- DEFINE('CFLAGS_' + EXT + '_OBJ', '$(CFLAGS_' + EXT + ')');
- } else {
- ADD_FLAG("STATIC_EXT_OBJS", "$(" + EXT + "_GLOBAL_OBJS)");
- ADD_FLAG("STATIC_EXT_LIBS", "$(LIBS_" + EXT + ")");
- ADD_FLAG("STATIC_EXT_LDFLAGS", "$(LDFLAGS_" + EXT + ")");
- ADD_FLAG("STATIC_EXT_CFLAGS", "$(CFLAGS_" + EXT + ")");
-
- /* find the header that declares the module pointer,
- * so we can include it in internal_functions.c */
- var ext_dir = FSO.GetFolder(configure_module_dirname);
- var fc = new Enumerator(ext_dir.Files);
- var re = /\.h$/;
- var s, c;
- for (; !fc.atEnd(); fc.moveNext()) {
- s = fc.item() + "";
- if (s.match(re)) {
- c = file_get_contents(s);
- if (c.match("phpext_")) {
- extension_include_code += '#include "' + configure_module_dirname + '/' + FSO.GetFileName(s) + '"\r\n';
- }
- }
- }
-
- extension_module_ptrs += '\tphpext_' + extname + '_ptr,\r\n';
-
- DEFINE('CFLAGS_' + EXT + '_OBJ', '$(CFLAGS_PHP) $(CFLAGS_' + EXT + ')');
- }
- ADD_FLAG("CFLAGS_" + EXT, cflags);
-
- if (PHP_DSP != "no") {
- generate_dsp_file(extname, configure_module_dirname, file_list, shared);
- }
-
- extensions_enabled[extensions_enabled.length] = [extname, shared ? 'shared' : 'static'];
-}
-
-function ADD_SOURCES(dir, file_list, target, obj_dir)
-{
- var i;
- var tv;
- var src, obj, sym, flags;
-
- if (target == null) {
- target = "php";
- }
-
- sym = target.toUpperCase() + "_GLOBAL_OBJS";
- flags = "CFLAGS_" + target.toUpperCase() + '_OBJ';
-
- if (configure_subst.Exists(sym)) {
- tv = configure_subst.Item(sym);
- } else {
- tv = "";
- }
-
- file_list = file_list.split(new RegExp("\\s+"));
- file_list.sort();
-
- var re = new RegExp("\.[a-z0-9A-Z]+$");
-
- dir = dir.replace(new RegExp("/", "g"), "\\");
- var objs_line = "";
- var srcs_line = "";
-
- var sub_build = "$(BUILD_DIR)\\";
-
- /* if module dir is not a child of the main source dir,
- * we need to tweak it; we should have detected such a
- * case in condense_path and rewritten the path to
- * be relative.
- * This probably breaks for non-sibling dirs, but that
- * is not a problem as buildconf only checks for pecl
- * as either a child or a sibling */
- if (obj_dir == null) {
- var build_dir = dir.replace(new RegExp("^..\\\\"), "");
- var mangle_dir = build_dir.replace(new RegExp("[\\\\/.]", "g"), "_");
- var bd_flags_name = "CFLAGS_BD_" + mangle_dir.toUpperCase();
- }
- else {
- var build_dir = obj_dir.replace(new RegExp("^..\\\\"), "");
- var mangle_dir = build_dir.replace(new RegExp("[\\\\/.]", "g"), "_");
- var bd_flags_name = "CFLAGS_BD_" + mangle_dir.toUpperCase();
- }
-
- var dirs = build_dir.split("\\");
- var i, d = "";
- for (i = 0; i < dirs.length; i++) {
- d += dirs[i];
- build_dirs[build_dirs.length] = d;
- d += "\\";
- }
- sub_build += d;
-
-
- DEFINE(bd_flags_name, " /Fd" + sub_build + " /Fp" + sub_build + " /FR" + sub_build + " ");
-
- for (i in file_list) {
- src = file_list[i];
- obj = src.replace(re, ".obj");
- tv += " " + sub_build + obj;
-
- if (PHP_ONE_SHOT == "yes") {
- if (i > 0) {
- objs_line += " " + sub_build + obj;
- srcs_line += " " + dir + "\\" + src;
- } else {
- objs_line = sub_build + obj;
- srcs_line = dir + "\\" + src;
- }
- } else {
- MFO.WriteLine(sub_build + obj + ": " + dir + "\\" + src);
- MFO.WriteLine("\t@$(CC) $(" + flags + ") $(CFLAGS) $(" + bd_flags_name + ") /c " + dir + "\\" + src + " /Fo" + sub_build + obj);
- }
- }
-
- if (PHP_ONE_SHOT == "yes") {
- MFO.WriteLine(objs_line + ": " + srcs_line);
- MFO.WriteLine("\t$(CC) $(" + flags + ") $(CFLAGS) /Fo" + sub_build + " $(" + bd_flags_name + ") /c " + srcs_line);
- }
-
- DEFINE(sym, tv);
-}
-
-function REMOVE_TARGET(dllname, flag)
-{
- var dllname = dllname.replace(/\s/g, "");
- var EXT = dllname.replace(/php_(\S+)\.dll/, "$1").toUpperCase();
- var php_flags = configure_subst.Item("CFLAGS_PHP");
-
- if (configure_subst.Exists(flag)) {
- var targets = configure_subst.Item(flag);
-
- if (targets.match(dllname)) {
- configure_subst.Remove(flag);
- targets = targets.replace(dllname, "");
- targets = targets.replace(/\s+/, " ");
- targets = targets.replace(/\s$/, "");
- configure_subst.Add(flag, targets);
- configure_hdr.Add("HAVE_" + EXT, new Array(0, ""));
- configure_subst.Item("CFLAGS_PHP") = php_flags.replace(" /D COMPILE_DL_" + EXT, "");
- extensions_enabled.pop();
- return true;
- }
- }
- return false;
-}
-
-function generate_internal_functions()
-{
- var infile, outfile;
- var indata;
-
- STDOUT.WriteLine("Generating main/internal_functions.c");
-
- infile = FSO.OpenTextFile("main/internal_functions.c.in", 1);
- indata = infile.ReadAll();
- infile.Close();
-
- indata = indata.replace("@EXT_INCLUDE_CODE@", extension_include_code);
- indata = indata.replace("@EXT_MODULE_PTRS@", extension_module_ptrs);
-
- if (FSO.FileExists("main/internal_functions.c")) {
- var origdata = file_get_contents("main/internal_functions.c");
-
- if (origdata == indata) {
- STDOUT.WriteLine("\t[content unchanged; skipping]");
- return;
- }
- }
-
- outfile = FSO.CreateTextFile("main/internal_functions.c", true);
- outfile.Write(indata);
- outfile.Close();
-}
-
-function output_as_table(header, ar_out)
-{
- var l = header.length;
- var cols = 80;
- var fixedlenght = "";
- var t = 0;
- var i,j,k,m;
- var out = "| ";
- var min = new Array(l);
- var max = new Array(l);
-
- if (l != ar_out[0].length) {
- STDOUT.WriteLine("Invalid header argument, can't output the table " + l + " " + ar_out[0].length );
- return;
- }
-
- for (j=0; j < l; j++) {
- var tmax, tmin;
-
- /*Figure out the max length per column */
- tmin = 0;
- tmax = 0;
- for (k = 0; k < ar_out.length; k++) {
- var t = ar_out[k][j].length;
- if (t > tmax) tmax = t;
- else if (t < tmin) tmin = t;
- }
- if (tmax > header[j].length) {
- max[j] = tmax;
- } else {
- max[j] = header[j].length;
- }
- if (tmin < header[j].length) {
- min[j] = header[j].length;
- }
- }
-
- sep = "";
- k = 0;
- for (i = 0; i < l; i++) {
- k += max[i] + 3;
- }
- k++;
-
- for (j=0; j < k; j++) {
- sep += "-";
- }
-
- STDOUT.WriteLine(sep);
- out = "|";
- for (j=0; j < l; j++) {
- out += " " + header[j];
- for (var i = 0; i < (max[j] - header[j].length); i++){
- out += " ";
- }
- out += " |";
- }
- STDOUT.WriteLine(out);
-
- STDOUT.WriteLine(sep);
-
- out = "|";
- for (i=0; i < ar_out.length; i++) {
- line = ar_out[i];
- for (j=0; j < l; j++) {
- out += " " + line[j];
- for (var k = 0; k < (max[j] - line[j].length); k++){
- out += " ";
- }
- out += " |";
- }
- STDOUT.WriteLine(out);
- out = "|";
- }
-
- STDOUT.WriteLine(sep);
-}
-
-function write_summary()
-{
- var ar = new Array();
-
- STDOUT.WriteBlankLines(2);
-
- STDOUT.WriteLine("Enabled extensions:");
- output_as_table(["Extension", "Mode"], extensions_enabled.sort());
- STDOUT.WriteBlankLines(2);
-
- STDOUT.WriteLine("Enabled SAPI:");
- output_as_table(["Sapi Name"], sapi_enabled);
- STDOUT.WriteBlankLines(2);
-
- ar[0] = ['Build type', PHP_DEBUG == "yes" ? "Debug" : "Release"];
- ar[1] = ['Thread Safety', PHP_ZTS == "yes" ? "Yes" : "No"];
- ar[2] = ['Compiler', VC_VERSIONS[VCVERS]];
- ar[3] = ['Architecture', X64 ? 'x64' : 'x86'];
-
- output_as_table(["",""], ar);
- STDOUT.WriteBlankLines(2);
-}
-
-function generate_files()
-{
- var i, dir, bd, last;
-
- STDOUT.WriteBlankLines(1);
- STDOUT.WriteLine("Creating build dirs...");
- dir = get_define("BUILD_DIR");
- build_dirs.sort();
- last = null;
-
- if (!FSO.FolderExists(dir)) {
- FSO.CreateFolder(dir);
- }
-
- for (i = 0; i < build_dirs.length; i++) {
- bd = FSO.BuildPath(dir, build_dirs[i]);
- if (bd == last) {
- continue;
- }
- last = bd;
- ADD_FLAG("BUILD_DIRS_SUB", bd.replace(new RegExp('^'+dir+'\\\\'), '$(BUILD_DIR)\\'));
- if (!FSO.FolderExists(bd)) {
- FSO.CreateFolder(bd);
- }
- }
-
- if (PHP_DSP != "no") {
- generate_dsp_file("TSRM", "TSRM", null, false);
- generate_dsp_file("Zend", "Zend", null, false);
- generate_dsp_file("win32", "win32", null, false);
- generate_dsp_file("main", "main", null, false);
- generate_dsp_file("streams", "main\\streams", null, false);
- copy_dsp_files();
- }
-
- STDOUT.WriteLine("Generating files...");
- generate_makefile();
- generate_internal_functions();
- generate_config_h();
-
- STDOUT.WriteLine("Done.");
- STDOUT.WriteBlankLines(1);
- write_summary();
-
- if (PHP_SNAPSHOT_BUILD != "no") {
- STDOUT.WriteLine("Type 'nmake snap' to build a PHP snapshot");
- } else {
- STDOUT.WriteLine("Type 'nmake' to build PHP");
- }
-}
-
-function generate_config_h()
-{
- var infile, outfile;
- var indata;
- var prefix;
-
- prefix = PHP_PREFIX.replace(new RegExp("\\\\", "g"), "\\\\");
-
- STDOUT.WriteLine("Generating main/config.w32.h");
-
- infile = FSO.OpenTextFile("win32/build/config.w32.h.in", 1);
- indata = infile.ReadAll();
- infile.Close();
-
- outfile = FSO.CreateTextFile("main/config.w32.h", true);
-
- indata = indata.replace(new RegExp("@PREFIX@", "g"), prefix);
- outfile.Write(indata);
-
- var keys = (new VBArray(configure_hdr.Keys())).toArray();
- var i, j;
- var item;
- var pieces, stuff_to_crack, chunk;
-
- outfile.WriteBlankLines(1);
- outfile.WriteLine("/* values determined by configure.js */");
-
- for (i in keys) {
- item = configure_hdr.Item(keys[i]);
- outfile.WriteBlankLines(1);
- pieces = item[0];
-
- if (item[1] != undefined) {
- outfile.WriteLine("/* " + item[1] + " */");
- }
-
- if (typeof(pieces) == "string" && pieces.charCodeAt(0) == 34) {
- /* quoted string have a maximal length of 2k under vc.
- * solution is to crack them and let the compiler concat
- * them implicitly */
- stuff_to_crack = pieces;
- pieces = "";
-
- while (stuff_to_crack.length) {
- j = 65;
- while (stuff_to_crack.charCodeAt(j) != 32 && j < stuff_to_crack.length)
- j++;
-
- chunk = stuff_to_crack.substr(0, j);
- pieces += chunk;
- stuff_to_crack = stuff_to_crack.substr(chunk.length);
- if (stuff_to_crack.length)
- pieces += '" "';
- }
- }
-
- outfile.WriteLine("#define " + keys[i] + " " + pieces);
- }
-
- outfile.Close();
-}
-
-function generate_makefile()
-{
- STDOUT.WriteLine("Generating Makefile");
- var MF = FSO.CreateTextFile("Makefile", true);
-
- MF.WriteLine("# Generated by configure.js");
-
- /* spit out variable definitions */
- var keys = (new VBArray(configure_subst.Keys())).toArray();
- var i;
-
- for (i in keys) {
- // The trailing space is needed to prevent the trailing backslash
- // that is part of the build dir flags (CFLAGS_BD_XXX) from being
- // seen as a line continuation character
- MF.WriteLine(keys[i] + "=" +
- //word_wrap_and_indent(1, configure_subst.Item(keys[i]), ' \\', '\t') + " "
- configure_subst.Item(keys[i]) + " "
- );
- MF.WriteBlankLines(1);
- }
-
- MF.WriteBlankLines(1);
-
- var TF = FSO.OpenTextFile("win32/build/Makefile", 1);
- MF.Write(TF.ReadAll());
- TF.Close();
-
- MF.WriteBlankLines(2);
-
- MFO.Close();
- TF = FSO.OpenTextFile("Makefile.objects", 1);
- MF.Write(TF.ReadAll());
- TF.Close();
-
- MF.Close();
-}
-
-function ADD_FLAG(name, flags, target)
-{
- if (target != null) {
- name = target.toUpperCase() + "_" + name;
- }
- if (configure_subst.Exists(name)) {
- var curr_flags = configure_subst.Item(name);
-
- if (curr_flags.indexOf(flags) >= 0) {
- return;
- }
-
- flags = curr_flags + " " + flags;
- configure_subst.Remove(name);
- }
- configure_subst.Add(name, flags);
-
- if (PHP_DSP != "no") {
- if (flags && (name.substr(name.length-3) != "PHP") && (name.substr(0, 7) == "CFLAGS_")) {
- DSP_FLAGS[DSP_FLAGS.length] = new Array(name, flags);
- }
- }
-}
-
-function get_define(name)
-{
- if (configure_subst.Exists(name)) {
- return configure_subst.Item(name);
- }
- return "";
-}
-
-// Add a .def to the core to export symbols
-function ADD_DEF_FILE(name)
-{
- if (!configure_subst.Exists("PHPDEF")) {
- DEFINE("PHPDEF", "$(BUILD_DIR)\\$(PHPDLL).def");
- ADD_FLAG("PHP_LDFLAGS", "/def:$(PHPDEF)");
- }
- ADD_FLAG("PHP_DLL_DEF_SOURCES", name);
-}
-
-function AC_DEFINE(name, value, comment, quote)
-{
- if (quote == null) {
- quote = true;
- }
- if (quote && typeof(value) == "string") {
- value = '"' + value.replace(new RegExp('(["\\\\])', "g"), '\\$1') + '"';
- } else if (value.length == 0) {
- value = '""';
- }
- var item = new Array(value, comment);
- if (configure_hdr.Exists(name)) {
- var orig_item = configure_hdr.Item(name);
- STDOUT.WriteLine("AC_DEFINE[" + name + "]=" + value + ": is already defined to " + orig_item[0]);
- } else {
- configure_hdr.Add(name, item);
- }
-}
-
-function MESSAGE(msg)
-{
- STDOUT.WriteLine("" + msg);
-}
-
-function ERROR(msg)
-{
- STDERR.WriteLine("ERROR: " + msg);
- WScript.Quit(3);
-}
-
-function WARNING(msg)
-{
- STDERR.WriteLine("WARNING: " + msg);
- STDERR.WriteBlankLines(1);
-}
-
-function copy_and_subst(srcname, destname, subst_array)
-{
- if (!FSO.FileExists(srcname)) {
- srcname = configure_module_dirname + "\\" + srcname;
- destname = configure_module_dirname + "\\" + destname;
- }
-
- var content = file_get_contents(srcname);
- var i;
-
- for (i = 0; i < subst_array.length; i+=2) {
- var re = subst_array[i];
- var rep = subst_array[i+1];
-
- content = content.replace(re, rep);
- }
-
- var f = FSO.CreateTextFile(destname, true);
- f.Write(content);
- f.Close();
-}
-
-// glob using simple filename wildcards
-// returns an array of matches that are found
-// in the filesystem
-function glob(path_pattern)
-{
- var path_parts = path_pattern.replace(new RegExp("/", "g"), "\\").split("\\");
- var p;
- var base = "";
- var is_pat_re = /\*/;
-
-//STDOUT.WriteLine("glob: " + path_pattern);
-
- if (FSO.FileExists(path_pattern)) {
- return new Array(path_pattern);
- }
-
- // first, build as much as possible that doesn't have a pattern
- for (p = 0; p < path_parts.length; p++) {
- if (path_parts[p].match(is_pat_re))
- break;
- if (p)
- base += "\\";
- base += path_parts[p];
- }
-
- return _inner_glob(base, p, path_parts);
-}
-
-function _inner_glob(base, p, parts)
-{
- var pat = parts[p];
- var full_name = base + "\\" + pat;
- var re = null;
- var items = null;
-
- if (p == parts.length) {
- return false;
- }
-
-//STDOUT.WriteLine("inner: base=" + base + " p=" + p + " pat=" + pat);
-
- if (FSO.FileExists(full_name)) {
- if (p < parts.length - 1) {
- // we didn't reach the full extent of the pattern
- return false;
- }
- return new Array(full_name);
- }
-
- if (FSO.FolderExists(full_name) && p == parts.length - 1) {
- // we have reached the end of the pattern; no need to recurse
- return new Array(full_name);
- }
-
- // Convert the pattern into a regexp
- re = new RegExp("^" + pat.replace(/\./g, '\\.').replace(/\*/g, '.*').replace(/\?/g, '.') + "$", "i");
-
- items = new Array();
-
- if (!FSO.FolderExists(base)) {
- return false;
- }
-
- var folder = FSO.GetFolder(base);
- var fc = null;
- var subitems = null;
- var item_name = null;
- var j;
-
- fc = new Enumerator(folder.SubFolders);
- for (; !fc.atEnd(); fc.moveNext()) {
- item_name = FSO.GetFileName(fc.item());
-
- if (item_name.match(re)) {
- // got a match; if we are at the end of the pattern, just add these
- // things to the items array
- if (p == parts.length - 1) {
- items[items.length] = fc.item();
- } else {
- // we should recurse and do more matches
- subitems = _inner_glob(base + "\\" + item_name, p + 1, parts);
- if (subitems) {
- for (j = 0; j < subitems.length; j++) {
- items[items.length] = subitems[j];
- }
- }
- }
- }
- }
-
- // if we are at the end of the pattern, we should match
- // files too
- if (p == parts.length - 1) {
- fc = new Enumerator(folder.Files);
- for (; !fc.atEnd(); fc.moveNext()) {
- item_name = FSO.GetFileName(fc.item());
- if (item_name.match(re)) {
- items[items.length] = fc.item();
- }
- }
- }
-
- if (items.length == 0)
- return false;
-
- return items;
-}
-
-
-// for snapshot builders, this option will attempt to enable everything
-// and you can then build everything, ignoring fatal errors within a module
-// by running "nmake snap"
-PHP_SNAPSHOT_BUILD = "no";
-ARG_ENABLE('snapshot-build', 'Build a snapshot; turns on everything it can and ignores build errors', 'no');
-
-// one-shot build optimizes build by asking compiler to build
-// several objects at once, reducing overhead of starting new
-// compiler processes.
-ARG_ENABLE('one-shot', 'Optimize for fast build - best for release and snapshot builders, not so hot for edit-and-rebuild hacking', 'no');
-
-
+// Utils for configure script
+/*
+ +----------------------------------------------------------------------+
+ | PHP Version 5 |
+ +----------------------------------------------------------------------+
+ | Copyright (c) 1997-2008 The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Author: Wez Furlong <wez@thebrainroom.com> |
+ +----------------------------------------------------------------------+
+*/
+
+// $Id: confutils.js,v 1.60.2.1.2.8.2.33 2009-05-29 07:43:07 kalle Exp $
+
+var STDOUT = WScript.StdOut;
+var STDERR = WScript.StdErr;
+var WshShell = WScript.CreateObject("WScript.Shell");
+var FSO = WScript.CreateObject("Scripting.FileSystemObject");
+var MFO = null;
+var SYSTEM_DRIVE = WshShell.Environment("Process").Item("SystemDrive");
+var PROGRAM_FILES = WshShell.Environment("Process").Item("ProgramFiles");
+var DSP_FLAGS = new Array();
+
+/* Store the enabled extensions (summary + QA check) */
+var extensions_enabled = new Array();
+
+/* Store the SAPI enabled (summary + QA check) */
+var sapi_enabled = new Array();
+
+/* Mapping CL version > human readable name */
+var VC_VERSIONS = new Array();
+VC_VERSIONS[1200] = 'MSVC6 (Visual C++ 6.0)';
+VC_VERSIONS[1300] = 'MSVC7 (Visual C++ 2002)';
+VC_VERSIONS[1310] = 'MSVC7.1 (Visual C++ 2003)';
+VC_VERSIONS[1400] = 'MSVC8 (Visual C++ 2005)';
+VC_VERSIONS[1500] = 'MSVC9 (Visual C++ 2008)';
+
+var VC_VERSIONS_SHORT = new Array();
+VC_VERSIONS_SHORT[1200] = 'VC6';
+VC_VERSIONS_SHORT[1300] = 'VC7';
+VC_VERSIONS_SHORT[1310] = 'VC7.1';
+VC_VERSIONS_SHORT[1400] = 'VC8';
+VC_VERSIONS_SHORT[1500] = 'VC9';
+
+if (PROGRAM_FILES == null) {
+ PROGRAM_FILES = "C:\\Program Files";
+}
+
+if (!FSO.FileExists("README.SVN-RULES")) {
+ STDERR.WriteLine("Must be run from the root of the php source");
+ WScript.Quit(10);
+}
+
+var CWD = WshShell.CurrentDirectory;
+
+if (typeof(CWD) == "undefined") {
+ CWD = FSO.GetParentFolderName(FSO.GetAbsolutePathName("README.SVN-RULES"));
+}
+
+/* defaults; we pick up the precise versions from configure.in */
+var PHP_VERSION = 5;
+var PHP_MINOR_VERSION = 0;
+var PHP_RELEASE_VERSION = 0;
+var PHP_EXTRA_VERSION = "";
+var PHP_VERSION_STRING = "5.0.0";
+
+function get_version_numbers()
+{
+ var cin = file_get_contents("configure.in");
+
+ if (cin.match(new RegExp("PHP_MAJOR_VERSION=(\\d+)"))) {
+ PHP_VERSION = RegExp.$1;
+ }
+ if (cin.match(new RegExp("PHP_MINOR_VERSION=(\\d+)"))) {
+ PHP_MINOR_VERSION = RegExp.$1;
+ }
+ if (cin.match(new RegExp("PHP_RELEASE_VERSION=(\\d+)"))) {
+ PHP_RELEASE_VERSION = RegExp.$1;
+ }
+ PHP_VERSION_STRING = PHP_VERSION + "." + PHP_MINOR_VERSION + "." + PHP_RELEASE_VERSION;
+
+ if (cin.match(new RegExp("PHP_EXTRA_VERSION=\"([^\"]+)\""))) {
+ PHP_EXTRA_VERSION = RegExp.$1;
+ if (PHP_EXTRA_VERSION.length) {
+ PHP_VERSION_STRING += PHP_EXTRA_VERSION;
+ }
+ }
+ DEFINE('PHP_VERSION_STRING', PHP_VERSION_STRING);
+}
+
+configure_args = new Array();
+configure_subst = WScript.CreateObject("Scripting.Dictionary");
+
+configure_hdr = WScript.CreateObject("Scripting.Dictionary");
+build_dirs = new Array();
+
+extension_include_code = "";
+extension_module_ptrs = "";
+
+get_version_numbers();
+
+/* execute a command and return the output as a string */
+function execute(command_line)
+{
+ var e = WshShell.Exec(command_line);
+ var ret = "";
+
+ ret = e.StdOut.ReadAll();
+
+//STDOUT.WriteLine("command " + command_line);
+//STDOUT.WriteLine(ret);
+
+ return ret;
+}
+
+function probe_binary(EXE, what)
+{
+ // tricky escapes to get stderr redirection to work
+ var command = 'cmd /c ""' + EXE;
+ if (what == "version") {
+ command = command + '" -v"';
+ }
+ var version = execute(command + '" 2>&1"');
+
+ if (what == "64") {
+ if (version.match(/x64/)) {
+ return 1;
+ }
+ } else {
+ if (version.match(/(\d+\.\d+(\.\d+)?(\.\d+)?)/)) {
+ return RegExp.$1;
+ }
+ }
+ return 0;
+}
+
+function condense_path(path)
+{
+ path = FSO.GetAbsolutePathName(path);
+
+ if (path.substr(0, CWD.length).toLowerCase()
+ == CWD.toLowerCase() &&
+ (path.charCodeAt(CWD.length) == 92 || path.charCodeAt(CWD.length) == 47)) {
+ return path.substr(CWD.length + 1);
+ }
+
+ var a = CWD.split("\\");
+ var b = path.split("\\");
+ var i, j;
+
+ for (i = 0; i < b.length; i++) {
+ if (a[i].toLowerCase() == b[i].toLowerCase())
+ continue;
+ if (i > 0) {
+ /* first difference found */
+ path = "";
+ for (j = 0; j < a.length - i; j++) {
+ path += "..\\";
+ }
+ for (j = i; j < b.length; j++) {
+ path += b[j];
+ if (j < b.length - 1)
+ path += "\\";
+ }
+ return path;
+ }
+ /* on a different drive */
+ break;
+ }
+
+ return path;
+}
+
+function ConfigureArg(type, optname, helptext, defval)
+{
+ var opptype = type == "enable" ? "disable" : "without";
+
+ if (defval == "yes" || defval == "yes,shared") {
+ this.arg = "--" + opptype + "-" + optname;
+ this.imparg = "--" + type + "-" + optname;
+ } else {
+ this.arg = "--" + type + "-" + optname;
+ this.imparg = "--" + opptype + "-" + optname;
+ }
+
+ this.optname = optname;
+ this.helptext = helptext;
+ this.defval = defval;
+ this.symval = optname.toUpperCase().replace(new RegExp("-", "g"), "_");
+ this.seen = false;
+ this.argval = defval;
+}
+
+function ARG_WITH(optname, helptext, defval)
+{
+ configure_args[configure_args.length] = new ConfigureArg("with", optname, helptext, defval);
+}
+
+function ARG_ENABLE(optname, helptext, defval)
+{
+ configure_args[configure_args.length] = new ConfigureArg("enable", optname, helptext, defval);
+}
+
+function analyze_arg(argval)
+{
+ var ret = new Array();
+ var shared = false;
+
+ if (argval == "shared") {
+ shared = true;
+ argval = "yes";
+ } else if (argval == null) {
+ /* nothing */
+ } else if (arg_match = argval.match(new RegExp("^shared,(.*)"))) {
+ shared = true;
+ argval = arg_match[1];
+ } else if (arg_match = argval.match(new RegExp("^(.*),shared$"))) {
+ shared = true;
+ argval = arg_match[1];
+ }
+
+ ret[0] = shared;
+ ret[1] = argval;
+ return ret;
+}
+
+function word_wrap_and_indent(indent, text, line_suffix, indent_char)
+{
+ if (text == null) {
+ return "";
+ }
+
+ var words = text.split(new RegExp("\\s+", "g"));
+ var i = 0;
+ var ret_text = "";
+ var this_line = "";
+ var t;
+ var space = "";
+ var lines = 0;
+
+ if (line_suffix == null) {
+ line_suffix = "";
+ }
+
+ if (indent_char == null) {
+ indent_char = " ";
+ }
+
+ for (i = 0; i < indent; i++) {
+ space += indent_char;
+ }
+
+ for (i = 0; i < words.length; i++) {
+ if (this_line.length) {
+ t = this_line + " " + words[i];
+ } else {
+ t = words[i];
+ }
+
+ if (t.length + indent > 78) {
+ if (lines++) {
+ ret_text += space;
+ }
+ ret_text += this_line + line_suffix + "\r\n";
+ this_line = "";
+ }
+
+ if (this_line.length) {
+ this_line += " " + words[i];
+ } else {
+ this_line = words[i];
+ }
+ }
+
+ if (this_line.length) {
+ if (lines)
+ ret_text += space;
+ ret_text += this_line;
+ }
+
+ return ret_text;
+}
+
+function conf_process_args()
+{
+ var i, j;
+ var configure_help_mode = false;
+ var analyzed = false;
+ var nice = "cscript /nologo configure.js ";
+ var disable_all = false;
+
+ args = WScript.Arguments;
+ for (i = 0; i < args.length; i++) {
+ arg = args(i);
+ nice += ' "' + arg + '"';
+ if (arg == "--help") {
+ configure_help_mode = true;
+ break;
+ }
+ if (arg == "--disable-all") {
+ disable_all = true;
+ continue;
+ }
+
+ // If it is --foo=bar, split on the equals sign
+ arg = arg.split("=", 2);
+ argname = arg[0];
+ if (arg.length > 1) {
+ argval = arg[1];
+ } else {
+ argval = null;
+ }
+
+ // Find the arg
+ found = false;
+ for (j = 0; j < configure_args.length; j++) {
+ if (argname == configure_args[j].imparg || argname == configure_args[j].arg) {
+ found = true;
+
+ arg = configure_args[j];
+ arg.seen = true;
+
+ analyzed = analyze_arg(argval);
+ shared = analyzed[0];
+ argval = analyzed[1];
+
+ if (argname == arg.imparg) {
+ /* we matched the implicit, or default arg */
+ if (argval == null) {
+ argval = arg.defval;
+ }
+ } else {
+ /* we matched the non-default arg */
+ if (argval == null) {
+ argval = arg.defval == "no" ? "yes" : "no";
+ }
+ }
+
+ arg.argval = argval;
+ eval("PHP_" + arg.symval + " = argval;");
+ eval("PHP_" + arg.symval + "_SHARED = shared;");
+ break;
+ }
+ }
+ if (!found) {
+ STDERR.WriteLine("Unknown option " + argname + "; please try configure.js --help for a list of valid options");
+ WScript.Quit(2);
+ }
+ }
+
+ if (configure_help_mode) {
+ STDOUT.WriteLine(word_wrap_and_indent(0,
+"Options that enable extensions and SAPI will accept \
+'yes' or 'no' as a parameter. They also accept 'shared' \
+as a synonym for 'yes' and request a shared build of that \
+module. Not all modules can be built as shared modules; \
+configure will display [shared] after the module name if \
+can be built that way. \
+"
+ ));
+ STDOUT.WriteBlankLines(1);
+
+ // Measure width to pretty-print the output
+ max_width = 0;
+ for (i = 0; i < configure_args.length; i++) {
+ arg = configure_args[i];
+ if (arg.arg.length > max_width)
+ max_width = arg.arg.length;
+ }
+
+ for (i = 0; i < configure_args.length; i++) {
+ arg = configure_args[i];
+
+ n = max_width - arg.arg.length;
+ pad = " ";
+ for (j = 0; j < n; j++) {
+ pad += " ";
+ }
+ STDOUT.WriteLine(" " + arg.arg + pad + word_wrap_and_indent(max_width + 5, arg.helptext));
+ }
+ WScript.Quit(1);
+ }
+
+ var snapshot_build_exclusions = new Array(
+ 'debug', 'crt-debug', 'lzf-better-compression',
+ 'php-build', 'snapshot-template', 'ereg',
+ 'pcre-regex', 'fastcgi', 'force-cgi-redirect',
+ 'path-info-check', 'zts', 'ipv6', 'memory-limit',
+ 'zend-multibyte', 'fd-setsize', 'memory-manager', 't1lib'
+ );
+ var force;
+
+ // Now set any defaults we might have missed out earlier
+ for (i = 0; i < configure_args.length; i++) {
+ arg = configure_args[i];
+ if (arg.seen)
+ continue;
+ analyzed = analyze_arg(arg.defval);
+ shared = analyzed[0];
+ argval = analyzed[1];
+
+ // Don't trust a default "yes" answer for a non-core module
+ // in a snapshot build
+ if (PHP_SNAPSHOT_BUILD != "no" && argval == "yes" && !shared) {
+
+ force = true;
+ for (j = 0; j < snapshot_build_exclusions.length; j++) {
+ if (snapshot_build_exclusions[j] == arg.optname) {
+ force = false;
+ break;
+ }
+ }
+
+ if (force) {
+ /* now check if it is a core module */
+ force = false;
+ for (j = 0; j < core_module_list.length; j++) {
+ if (core_module_list[j] == arg.optname) {
+ force = true;
+ break;
+ }
+ }
+
+ if (!force) {
+ STDOUT.WriteLine("snapshot: forcing " + arg.arg + " shared");
+ shared = true;
+ }
+ }
+ }
+
+ if (PHP_SNAPSHOT_BUILD != "no" && argval == "no") {
+ force = true;
+ for (j = 0; j < snapshot_build_exclusions.length; j++) {
+ if (snapshot_build_exclusions[j] == arg.optname) {
+ force = false;
+ break;
+ }
+ }
+ if (force) {
+ STDOUT.WriteLine("snapshot: forcing " + arg.optname + " on");
+ argval = "yes";
+ shared = true;
+ }
+ }
+
+ if (disable_all) {
+ force = true;
+ for (j = 0; j < snapshot_build_exclusions.length; j++) {
+ if (snapshot_build_exclusions[j] == arg.optname) {
+ force = false;
+ break;
+ }
+ }
+ if (force) {
+ if (arg.defval == '') {
+ argval = '';
+ } else {
+ argval = "no";
+ }
+ shared = false;
+ }
+ }
+
+ eval("PHP_" + arg.symval + " = argval;");
+ eval("PHP_" + arg.symval + "_SHARED = shared;");
+ }
+
+ MFO = FSO.CreateTextFile("Makefile.objects", true);
+
+ STDOUT.WriteLine("Saving configure options to config.nice.bat");
+ var nicefile = FSO.CreateTextFile("config.nice.bat", true);
+ nicefile.WriteLine(nice + " %*");
+ nicefile.Close();
+
+ AC_DEFINE('CONFIGURE_COMMAND', nice, "Configure line");
+}
+
+function DEFINE(name, value)
+{
+ if (configure_subst.Exists(name)) {
+ configure_subst.Remove(name);
+ }
+ configure_subst.Add(name, value);
+}
+
+// Searches a set of paths for a file;
+// returns the dir in which the file was found,
+// true if it was found in the default env path,
+// or false if it was not found at all.
+// env_name is the optional name of an env var
+// specifying the default path to search
+function search_paths(thing_to_find, explicit_path, env_name)
+{
+ var i, found = false, place = false, file, env;
+
+ STDOUT.Write("Checking for " + thing_to_find + " ... ");
+
+ thing_to_find = thing_to_find.replace(new RegExp("/", "g"), "\\");
+
+ if (explicit_path != null) {
+ if (typeof(explicit_path) == "string") {
+ explicit_path = explicit_path.split(";");
+ }
+
+ for (i = 0; i < explicit_path.length; i++) {
+ file = glob(explicit_path[i] + "\\" + thing_to_find);
+ if (file) {
+ found = true;
+ place = file[0];
+ place = place.substr(0, place.length - thing_to_find.length - 1);
+ break;
+ }
+ }
+ }
+
+ if (!found && env_name != null) {
+ env = WshShell.Environment("Process").Item(env_name);
+ env = env.split(";");
+ for (i = 0; i < env.length; i++) {
+ file = glob(env[i] + "\\" + thing_to_find);
+ if (file) {
+ found = true;
+ place = true;
+ break;
+ }
+ }
+ }
+
+ if (found && place == true) {
+ STDOUT.WriteLine(" <in default path>");
+ } else if (found) {
+ STDOUT.WriteLine(" " + place);
+ } else {
+ STDOUT.WriteLine(" <not found>");
+ }
+ return place;
+}
+
+function PATH_PROG(progname, additional_paths, symbol)
+{
+ var exe;
+ var place;
+ var cyg_path = PHP_CYGWIN + "\\bin;" + PHP_CYGWIN + "\\usr\\local\\bin";
+ var php_build_bin_path = PHP_PHP_BUILD + "\\bin"
+
+ exe = progname + ".exe";
+
+ if (additional_paths == null) {
+ additional_paths = cyg_path;
+ } else {
+ additional_paths += ";" + cyg_path;
+ }
+
+ additional_paths = additional_paths + ";" + php_build_bin_path;
+
+ place = search_paths(exe, additional_paths, "PATH");
+
+ if (place == true) {
+ place = exe;
+ } else if (place != false) {
+ place = place + "\\" + exe;
+ }
+
+ if (place) {
+ if (symbol == null) {
+ symbol = progname.toUpperCase();
+ }
+ DEFINE(symbol, place);
+ }
+ return place;
+}
+
+function find_pattern_in_path(pattern, path)
+{
+ if (path == null) {
+ return false;
+ }
+
+ var dirs = path.split(';');
+ var i;
+ var items;
+
+ for (i = 0; i < dirs.length; i++) {
+ items = glob(dirs[i] + "\\" + pattern);
+ if (items) {
+ return condense_path(items[0]);
+ }
+ }
+ return false;
+}
+
+function CHECK_LIB(libnames, target, path_to_check, common_name)
+{
+ STDOUT.Write("Checking for library " + libnames + " ... ");
+
+ if (common_name == null && target != null) {
+ common_name = target;
+ }
+
+ if (path_to_check == null) {
+ path_to_check = "";
+ }
+
+ // if they specified a common name for the package that contains
+ // the library, tag some useful defaults on to the end of the
+ // path to be searched
+ if (common_name != null) {
+ path_to_check += ";" + PHP_PHP_BUILD + "\\" + common_name + "*";
+ path_to_check += ";" + PHP_PHP_BUILD + "\\lib\\" + common_name + "*";
+ path_to_check += ";..\\" + common_name + "*";
+ }
+
+ // Determine target for build flags
+ if (target == null) {
+ target = "";
+ } else {
+ target = "_" + target.toUpperCase();
+ }
+
+ // Expand path to include general dirs
+ path_to_check += ";" + php_usual_lib_suspects;
+
+ // It is common practice to put libs under one of these dir names
+ var subdirs = new Array(PHP_DEBUG == "yes" ? "Debug" : (PHP_DEBUG_PACK == "yes"?"Release_Dbg":"Release"), "lib", "libs", "libexec");
+
+ // libnames can be ; separated list of accepted library names
+ libnames = libnames.split(';');
+
+ // for debug builds, lib may have _debug appended, we want that first
+ if (PHP_DEBUG == "yes") {
+ var length = libnames.length;
+ for (var i = 0; i < length; i++) {
+ var name = new String(libnames[i]);
+ rExp = /.lib$/i;
+ name = name.replace(rExp,"_debug.lib");
+ libnames.unshift(name);
+ }
+ }
+
+ var i, j, k, libname;
+ var location = false;
+ var path = path_to_check.split(';');
+
+ for (i = 0; i < libnames.length; i++) {
+ libname = libnames[i];
+
+ for (k = 0; k < path.length; k++) {
+ location = glob(path[k] + "\\" + libname);
+ if (location) {
+ location = location[0];
+ break;
+ }
+ for (j = 0; j < subdirs.length; j++) {
+ location = glob(path[k] + "\\" + subdirs[j] + "\\" + libname);
+ if (location) {
+ location = location[0];
+ break;
+ }
+ }
+ if (location)
+ break;
+ }
+
+ if (location) {
+ location = condense_path(location);
+ var libdir = FSO.GetParentFolderName(location);
+ libname = FSO.GetFileName(location);
+ ADD_FLAG("LDFLAGS" + target, '/libpath:"' + libdir + '" ');
+ ADD_FLAG("LIBS" + target, libname);
+
+ STDOUT.WriteLine(location);
+
+ return location;
+ }
+
+ // Check in their standard lib path
+ location = find_pattern_in_path(libname, WshShell.Environment("Process").Item("LIB"));
+
+ if (location) {
+ location = condense_path(location);
+ libname = FSO.GetFileName(location);
+ ADD_FLAG("LIBS" + target, libname);
+
+ STDOUT.WriteLine("<in LIB path> " + libname);
+ return location;
+ }
+
+ // Check in their general extra libs path
+ location = find_pattern_in_path(libname, PHP_EXTRA_LIBS);
+ if (location) {
+ location = condense_path(location);
+ libname = FSO.GetFileName(location);
+ ADD_FLAG("LIBS" + target, libname);
+ STDOUT.WriteLine("<in extra libs path>");
+ return location;
+ }
+ }
+
+ STDOUT.WriteLine("<not found>");
+
+ return false;
+}
+
+function OLD_CHECK_LIB(libnames, target, path_to_check)
+{
+ if (target == null) {
+ target = "";
+ } else {
+ target = "_" + target.toUpperCase();
+ }
+
+ if (path_to_check == null) {
+ path_to_check = php_usual_lib_suspects;
+ } else {
+ path_to_check += ";" + php_usual_lib_suspects;
+ }
+ var have = 0;
+ var p;
+ var i;
+ var libname;
+
+ var subdir = PHP_DEBUG == "yes" ? "Debug" : (PHP_DEBUG_PACK == "yes"?"Release_Dbg":"Release");
+
+ libnames = libnames.split(';');
+ for (i = 0; i < libnames.length; i++) {
+ libname = libnames[i];
+ p = search_paths(libname, path_to_check, "LIB");
+
+ if (!p) {
+ p = search_paths(subdir + "\\" + libname, path_to_check, "LIB");
+ if (p) {
+ p += "\\" + subdir;
+ }
+ }
+
+ if (typeof(p) == "string") {
+ ADD_FLAG("LDFLAGS" + target, '/libpath:"' + p + '" ');
+ ADD_FLAG("LIBS" + target, libname);
+ have = 1;
+ } else if (p == true) {
+ ADD_FLAG("LIBS" + target, libname);
+ have = 1;
+ } else {
+ /* not found in the defaults or the explicit paths,
+ * so check the general extra libs; if we find
+ * it here, no need to add another /libpath: for it as we
+ * already have it covered, but we need to add the lib
+ * to LIBS_XXX */
+ if (false != search_paths(libname, PHP_EXTRA_LIBS, null)) {
+ ADD_FLAG("LIBS" + target, libname);
+ have = 1;
+ }
+ }
+
+ if (have) {
+ break;
+ }
+ }
+
+// AC_DEFINE("HAVE_" + header_name.toUpperCase().replace(new RegExp("/\\\\-\.", "g"), "_"), have);
+
+ return have;
+
+}
+
+function CHECK_FUNC_IN_HEADER(header_name, func_name, path_to_check, add_to_flag)
+{
+ var c = false;
+ var sym;
+
+ STDOUT.Write("Checking for " + func_name + " in " + header_name + " ... ");
+
+ c = GREP_HEADER(header_name, func_name, path_to_check);
+
+ sym = func_name.toUpperCase();
+ sym = sym.replace(new RegExp("[\\\\/\.-]", "g"), "_");
+
+ if (typeof(add_to_flag) == "undefined") {
+ AC_DEFINE("HAVE_" + sym, c ? 1 : 0);
+ } else {
+ ADD_FLAG(add_to_flag, "/DHAVE_" + sym + "=" + (c ? "1" : "0"));
+ }
+
+ if (c) {
+ STDOUT.WriteLine("OK");
+ return c;
+ }
+ STDOUT.WriteLine("No");
+ return false;
+}
+
+function GREP_HEADER(header_name, regex, path_to_check)
+{
+ var c = false;
+
+ if (FSO.FileExists(path_to_check + "\\" + header_name)) {
+ c = file_get_contents(path_to_check + "\\" + header_name);
+ }
+
+ if (!c) {
+ /* look in the include path */
+
+ var p = search_paths(header_name, path_to_check, "INCLUDE");
+ if (typeof(p) == "string") {
+ c = file_get_contents(p);
+ } else if (p == false) {
+ p = search_paths(header_name, PHP_EXTRA_INCLUDES, null);
+ if (typeof(p) == "string") {
+ c = file_get_contents(p);
+ }
+ }
+ if (!c) {
+ return false;
+ }
+ }
+
+ if (typeof(regex) == "string") {
+ regex = new RegExp(regex);
+ }
+
+ if (c.match(regex)) {
+ /* caller can now use RegExp.$1 etc. to get at patterns */
+ return true;
+ }
+ return false;
+}
+
+function CHECK_HEADER_ADD_INCLUDE(header_name, flag_name, path_to_check, use_env, add_dir_part, add_to_flag_only)
+{
+ var dir_part_to_add = "";
+
+ if (use_env == null) {
+ use_env = true;
+ }
+
+ // if true, add the dir part of the header_name to the include path
+ if (add_dir_part == null) {
+ add_dir_part = false;
+ } else if (add_dir_part) {
+ var basename = FSO.GetFileName(header_name);
+ dir_part_to_add = "\\" + header_name.substr(0, header_name.length - basename.length - 1);
+ }
+
+ if (path_to_check == null) {
+ path_to_check = php_usual_include_suspects;
+ } else {
+ path_to_check += ";" + php_usual_include_suspects;
+ }
+
+ var p = search_paths(header_name, path_to_check, use_env ? "INCLUDE" : null);
+ var have = 0;
+ var sym;
+
+ if (typeof(p) == "string") {
+ ADD_FLAG(flag_name, '/I "' + p + dir_part_to_add + '" ');
+ } else if (p == false) {
+ /* not found in the defaults or the explicit paths,
+ * so check the general extra includes; if we find
+ * it here, no need to add another /I for it as we
+ * already have it covered, unless we are adding
+ * the dir part.... */
+ p = search_paths(header_name, PHP_EXTRA_INCLUDES, null);
+ if (typeof(p) == "string" && add_dir_part) {
+ ADD_FLAG(flag_name, '/I "' + p + dir_part_to_add + '" ');
+ }
+ }
+ have = p ? 1 : 0
+
+ sym = header_name.toUpperCase();
+ sym = sym.replace(new RegExp("[\\\\/\.-]", "g"), "_");
+
+ if (typeof(add_to_flag_only) == "undefined" &&
+ flag_name.match(new RegExp("^CFLAGS_(.*)$"))) {
+ add_to_flag_only = true;
+ }
+
+ if (typeof(add_to_flag_only) != "undefined") {
+ ADD_FLAG(flag_name, "/DHAVE_" + sym + "=" + have);
+ } else {
+ AC_DEFINE("HAVE_" + sym, have, "have the " + header_name + " header file");
+ }
+
+ return p;
+}
+
+/* emits rule to generate version info for a SAPI
+ * or extension. Returns the name of the .res file
+ * that will be generated */
+function generate_version_info_resource(makefiletarget, basename, creditspath, sapi)
+{
+ var resname = makefiletarget + ".res";
+ var res_desc = makefiletarget;
+ var res_prod_name = "PHP " + makefiletarget;
+ var credits;
+ var thanks = "";
+ var logo = "";
+ var debug = "";
+ var project_url = "http://www.php.net";
+ var project_header = creditspath + "/php_" + basename + ".h";
+ var versioning = "";
+
+ if (sapi) {
+ var internal_name = basename.toUpperCase() + " SAPI";
+ } else {
+ var internal_name = basename.toUpperCase() + " extension";
+ }
+
+ if (FSO.FileExists(creditspath + '/CREDITS')) {
+ credits = FSO.OpenTextFile(creditspath + '/CREDITS', 1);
+ res_desc = credits.ReadLine();
+ try {
+ thanks = credits.ReadLine();
+ } catch (e) {
+ thanks = null;
+ }
+ if (thanks == null) {
+ thanks = "";
+ } else {
+ thanks = "Thanks to " + thanks;
+ }
+ credits.Close();
+ }
+
+ if (creditspath.match(new RegExp("pecl"))) {
+ /* PECL project url - this will eventually work correctly for all */
+ project_url = "http://pecl.php.net/" + basename;
+
+ /* keep independent versioning PECL-specific for now */
+ if (FSO.FileExists(project_header)) {
+ if (header = FSO.OpenTextFile(project_header, 1)) {
+ contents = header.ReadAll();
+ /* allowed: x.x.x[a|b|-alpha|-beta][RCx][-dev] */
+ if (contents.match(new RegExp('PHP_' + basename.toUpperCase() + '_VERSION(\\s+)"((\\d+\.\\d+(\.\\d+)?)((a|b)(\\d)?|\-[a-z]{3,5})?(RC\\d+)?(\-dev)?)'))) {
+ project_version = RegExp.$2;
+ file_version = RegExp.$3.split('.');
+ if (!file_version[2]) {
+ file_version[2] = 0;
+ }
+ versioning = '\\"" /d EXT_FILE_VERSION=' + file_version[0] + ',' + file_version[1] + ',' + file_version[2] + ' /d EXT_VERSION="\\"' + project_version;
+ }
+ header.Close();
+ }
+ }
+ }
+
+ if (makefiletarget.match(new RegExp("\\.exe$"))) {
+ logo = " /d WANT_LOGO ";
+ }
+
+ if (PHP_DEBUG != "no") {
+ debug = " /d _DEBUG";
+ }
+
+ /**
+ * Use user supplied template.rc if it exists
+ */
+ if (FSO.FileExists(creditspath + '\\template.rc')) {
+ MFO.WriteLine("$(BUILD_DIR)\\" + resname + ": " + creditspath + "\\template.rc");
+ MFO.WriteLine("\t$(RC) /fo $(BUILD_DIR)\\" + resname + logo + debug +
+ ' /d FILE_DESCRIPTION="\\"' + res_desc + '\\"" /d FILE_NAME="\\"' +
+ makefiletarget + '\\"" /d PRODUCT_NAME="\\"' + res_prod_name +
+ versioning + '\\"" /d THANKS_GUYS="\\"' + thanks + '\\"" ' +
+ creditspath + '\\template.rc');
+ return resname;
+ }
+
+ MFO.WriteLine("$(BUILD_DIR)\\" + resname + ": win32\\build\\template.rc");
+ MFO.WriteLine("\t$(RC) /n /fo $(BUILD_DIR)\\" + resname + logo + debug +
+ ' /d FILE_DESCRIPTION="\\"' + res_desc + '\\"" /d FILE_NAME="\\"'
+ + makefiletarget + '\\"" /d URL="\\"' + project_url +
+ '\\"" /d INTERNAL_NAME="\\"' + internal_name + versioning +
+ '\\"" /d THANKS_GUYS="\\"' + thanks + '\\"" win32\\build\\template.rc');
+ MFO.WriteBlankLines(1);
+ return resname;
+}
+
+function SAPI(sapiname, file_list, makefiletarget, cflags, obj_dir)
+{
+ var SAPI = sapiname.toUpperCase();
+ var ldflags;
+ var resname;
+ var ld;
+ var manifest;
+
+ if (typeof(obj_dir) == "undefined") {
+ sapiname_for_printing = configure_module_dirname;
+ } else {
+ sapiname_for_printing = configure_module_dirname + " (via " + obj_dir + ")";
+ }
+
+ STDOUT.WriteLine("Enabling SAPI " + sapiname_for_printing);
+
+ MFO.WriteBlankLines(1);
+ MFO.WriteLine("# objects for SAPI " + sapiname);
+ MFO.WriteBlankLines(1);
+
+ if (cflags) {
+ ADD_FLAG('CFLAGS_' + SAPI, cflags);
+ }
+
+ ADD_SOURCES(configure_module_dirname, file_list, sapiname, obj_dir);
+ MFO.WriteBlankLines(1);
+ MFO.WriteLine("# SAPI " + sapiname);
+ MFO.WriteBlankLines(1);
+
+ /* generate a .res file containing version information */
+ resname = generate_version_info_resource(makefiletarget, sapiname, configure_module_dirname, true);
+
+ MFO.WriteLine(makefiletarget + ": $(BUILD_DIR)\\" + makefiletarget);
+ MFO.WriteLine("\t@echo SAPI " + sapiname_for_printing + " build complete");
+ MFO.WriteLine("$(BUILD_DIR)\\" + makefiletarget + ": $(DEPS_" + SAPI + ") $(" + SAPI + "_GLOBAL_OBJS) $(BUILD_DIR)\\$(PHPLIB) $(BUILD_DIR)\\" + resname);
+
+ if (makefiletarget.match(new RegExp("\\.dll$"))) {
+ ldflags = "/dll $(LDFLAGS)";
+ manifest = "-@$(_VC_MANIFEST_EMBED_DLL)";
+ } else if (makefiletarget.match(new RegExp("\\.lib$"))) {
+ ldflags = "$(LDFLAGS)";
+ ld = "$(MAKE_LIB)";
+ } else {
+ ldflags = "$(LDFLAGS)";
+ manifest = "-@$(_VC_MANIFEST_EMBED_EXE)";
+ }
+
+ if (ld) {
+ MFO.WriteLine("\t" + ld + " /nologo /out:$(BUILD_DIR)\\" + makefiletarget + " " + ldflags + " $(" + SAPI + "_GLOBAL_OBJS) $(BUILD_DIR)\\$(PHPLIB) $(LDFLAGS_" + SAPI + ") $(LIBS_" + SAPI + ") $(BUILD_DIR)\\" + resname);
+ } else {
+ ld = "@$(CC)";
+ MFO.WriteLine("\t" + ld + " /nologo " + " $(" + SAPI + "_GLOBAL_OBJS) $(BUILD_DIR)\\$(PHPLIB) $(LIBS_" + SAPI + ") $(BUILD_DIR)\\" + resname + " /link /out:$(BUILD_DIR)\\" + makefiletarget + " " + ldflags + " $(LDFLAGS_" + SAPI + ")");
+ }
+
+ if (manifest) {
+ MFO.WriteLine("\t" + manifest);
+ }
+
+ DEFINE('CFLAGS_' + SAPI + '_OBJ', '$(CFLAGS_' + SAPI + ')');
+
+ if (configure_module_dirname.match("pecl")) {
+ ADD_FLAG("PECL_TARGETS", makefiletarget);
+ } else {
+ ADD_FLAG("SAPI_TARGETS", makefiletarget);
+ }
+
+ if (PHP_DSP != "no") {
+ generate_dsp_file(sapiname, configure_module_dirname, file_list, false);
+ }
+
+ MFO.WriteBlankLines(1);
+ sapi_enabled[sapi_enabled.length] = [sapiname];
+}
+
+function ADD_DIST_FILE(filename)
+{
+ if (configure_module_dirname.match("pecl")) {
+ ADD_FLAG("PECL_EXTRA_DIST_FILES", filename);
+ } else {
+ ADD_FLAG("PHP_EXTRA_DIST_FILES", filename);
+ }
+}
+
+function file_get_contents(filename)
+{
+ var f, c;
+ try {
+ f = FSO.OpenTextFile(filename, 1);
+ c = f.ReadAll();
+ f.Close();
+ return c;
+ } catch (e) {
+ STDOUT.WriteLine("Problem reading " + filename);
+ return false;
+ }
+}
+
+// Add a dependency on another extension, so that
+// the dependencies are built before extname
+function ADD_EXTENSION_DEP(extname, dependson, optional)
+{
+ var EXT = extname.toUpperCase();
+ var DEP = dependson.toUpperCase();
+ var dep_present = false;
+ var dep_shared = false;
+
+ try {
+ dep_present = eval("PHP_" + DEP);
+
+ if (dep_present != "no") {
+ try {
+ dep_shared = eval("PHP_" + DEP + "_SHARED");
+ } catch (e) {
+ dep_shared = false;
+ }
+ }
+
+ } catch (e) {
+ dep_present = "no";
+ }
+
+ if (optional) {
+ if (dep_present == "no") {
+ MESSAGE("\t" + dependson + " not found: " + dependson + " support in " + extname + " disabled");
+ return false;
+ }
+ }
+
+ var ext_shared = eval("PHP_" + EXT + "_SHARED");
+
+ if (dep_shared) {
+ if (!ext_shared) {
+ if (optional) {
+ MESSAGE("\tstatic " + extname + " cannot depend on shared " + dependson + ": " + dependson + "support disabled");
+ return false;
+ }
+ ERROR("static " + extname + " cannot depend on shared " + dependson);
+ }
+
+ ADD_FLAG("LDFLAGS_" + EXT, "/libpath:$(BUILD_DIR)");
+ ADD_FLAG("LIBS_" + EXT, "php_" + dependson + ".lib");
+ ADD_FLAG("DEPS_" + EXT, "$(BUILD_DIR)\\php_" + dependson + ".lib");
+
+ } else {
+
+ if (dep_present == "no") {
+ if (ext_shared) {
+ WARNING(extname + " cannot be built: missing dependency, " + dependson + " not found");
+
+ var dllname = ' php_' + extname + '.dll';
+
+ if (!REMOVE_TARGET(dllname, 'EXT_TARGETS')) {
+ REMOVE_TARGET(dllname, 'PECL_TARGETS');
+ }
+
+ return false;
+
+ }
+
+ ERROR("Cannot build " + extname + "; " + dependson + " not enabled");
+ return false;
+ }
+ } // dependency is statically built-in to PHP
+ return true;
+}
+
+function EXTENSION(extname, file_list, shared, cflags, dllname, obj_dir)
+{
+ var objs = null;
+ var EXT = extname.toUpperCase();
+ var extname_for_printing;
+
+ if (shared == null) {
+ eval("shared = PHP_" + EXT + "_SHARED;");
+ } else {
+ eval("PHP_" + EXT + "_SHARED = shared;");
+ }
+
+ if (cflags == null) {
+ cflags = "";
+ }
+
+ if (typeof(obj_dir) == "undefined") {
+ extname_for_printing = configure_module_dirname;
+ } else {
+ extname_for_printing = configure_module_dirname + " (via " + obj_dir + ")";
+ }
+
+ if (shared) {
+ STDOUT.WriteLine("Enabling extension " + extname_for_printing + " [shared]");
+ cflags = "/D COMPILE_DL_" + EXT + " /D " + EXT + "_EXPORTS=1 " + cflags;
+ ADD_FLAG("CFLAGS_PHP", "/D COMPILE_DL_" + EXT);
+ } else {
+ STDOUT.WriteLine("Enabling extension " + extname_for_printing);
+ }
+
+ MFO.WriteBlankLines(1);
+ MFO.WriteLine("# objects for EXT " + extname);
+ MFO.WriteBlankLines(1);
+
+
+ ADD_SOURCES(configure_module_dirname, file_list, extname, obj_dir);
+
+ MFO.WriteBlankLines(1);
+
+ if (shared) {
+ if (dllname == null) {
+ dllname = "php_" + extname + ".dll";
+ }
+ var libname = dllname.substring(0, dllname.length-4) + ".lib";
+
+ var resname = generate_version_info_resource(dllname, extname, configure_module_dirname, false);
+ var ld = "@$(CC)";
+
+ MFO.WriteLine("$(BUILD_DIR)\\" + libname + ": $(BUILD_DIR)\\" + dllname);
+ MFO.WriteBlankLines(1);
+ MFO.WriteLine("$(BUILD_DIR)\\" + dllname + ": $(DEPS_" + EXT + ") $(" + EXT + "_GLOBAL_OBJS) $(BUILD_DIR)\\$(PHPLIB) $(BUILD_DIR)\\" + resname);
+ MFO.WriteLine("\t" + ld + " $(" + EXT + "_GLOBAL_OBJS) $(BUILD_DIR)\\$(PHPLIB) $(LIBS_" + EXT + ") $(LIBS) $(BUILD_DIR)\\" + resname + " /link /out:$(BUILD_DIR)\\" + dllname + " $(DLL_LDFLAGS) $(LDFLAGS) $(LDFLAGS_" + EXT + ")");
+ MFO.WriteLine("\t-@$(_VC_MANIFEST_EMBED_DLL)");
+ MFO.WriteBlankLines(1);
+
+ if (configure_module_dirname.match("pecl")) {
+ ADD_FLAG("PECL_TARGETS", dllname);
+ } else {
+ ADD_FLAG("EXT_TARGETS", dllname);
+ }
+ MFO.WriteLine(dllname + ": $(BUILD_DIR)\\" + dllname);
+ MFO.WriteLine("\t@echo EXT " + extname + " build complete");
+ MFO.WriteBlankLines(1);
+
+ DEFINE('CFLAGS_' + EXT + '_OBJ', '$(CFLAGS_' + EXT + ')');
+ } else {
+ ADD_FLAG("STATIC_EXT_OBJS", "$(" + EXT + "_GLOBAL_OBJS)");
+ ADD_FLAG("STATIC_EXT_LIBS", "$(LIBS_" + EXT + ")");
+ ADD_FLAG("STATIC_EXT_LDFLAGS", "$(LDFLAGS_" + EXT + ")");
+ ADD_FLAG("STATIC_EXT_CFLAGS", "$(CFLAGS_" + EXT + ")");
+
+ /* find the header that declares the module pointer,
+ * so we can include it in internal_functions.c */
+ var ext_dir = FSO.GetFolder(configure_module_dirname);
+ var fc = new Enumerator(ext_dir.Files);
+ var re = /\.h$/;
+ var s, c;
+ for (; !fc.atEnd(); fc.moveNext()) {
+ s = fc.item() + "";
+ if (s.match(re)) {
+ c = file_get_contents(s);
+ if (c.match("phpext_")) {
+ extension_include_code += '#include "' + configure_module_dirname + '/' + FSO.GetFileName(s) + '"\r\n';
+ }
+ }
+ }
+
+ extension_module_ptrs += '\tphpext_' + extname + '_ptr,\r\n';
+
+ DEFINE('CFLAGS_' + EXT + '_OBJ', '$(CFLAGS_PHP) $(CFLAGS_' + EXT + ')');
+ }
+ ADD_FLAG("CFLAGS_" + EXT, cflags);
+
+ if (PHP_DSP != "no") {
+ generate_dsp_file(extname, configure_module_dirname, file_list, shared);
+ }
+
+ extensions_enabled[extensions_enabled.length] = [extname, shared ? 'shared' : 'static'];
+}
+
+function ADD_SOURCES(dir, file_list, target, obj_dir)
+{
+ var i;
+ var tv;
+ var src, obj, sym, flags;
+
+ if (target == null) {
+ target = "php";
+ }
+
+ sym = target.toUpperCase() + "_GLOBAL_OBJS";
+ flags = "CFLAGS_" + target.toUpperCase() + '_OBJ';
+
+ if (configure_subst.Exists(sym)) {
+ tv = configure_subst.Item(sym);
+ } else {
+ tv = "";
+ }
+
+ file_list = file_list.split(new RegExp("\\s+"));
+ file_list.sort();
+
+ var re = new RegExp("\.[a-z0-9A-Z]+$");
+
+ dir = dir.replace(new RegExp("/", "g"), "\\");
+ var objs_line = "";
+ var srcs_line = "";
+
+ var sub_build = "$(BUILD_DIR)\\";
+
+ /* if module dir is not a child of the main source dir,
+ * we need to tweak it; we should have detected such a
+ * case in condense_path and rewritten the path to
+ * be relative.
+ * This probably breaks for non-sibling dirs, but that
+ * is not a problem as buildconf only checks for pecl
+ * as either a child or a sibling */
+ if (obj_dir == null) {
+ var build_dir = dir.replace(new RegExp("^..\\\\"), "");
+ var mangle_dir = build_dir.replace(new RegExp("[\\\\/.-]", "g"), "_");
+ var bd_flags_name = "CFLAGS_BD_" + mangle_dir.toUpperCase();
+ }
+ else {
+ var build_dir = obj_dir.replace(new RegExp("^..\\\\"), "");
+ var mangle_dir = build_dir.replace(new RegExp("[\\\\/.-]", "g"), "_");
+ var bd_flags_name = "CFLAGS_BD_" + mangle_dir.toUpperCase();
+ }
+
+ var dirs = build_dir.split("\\");
+ var i, d = "";
+ for (i = 0; i < dirs.length; i++) {
+ d += dirs[i];
+ build_dirs[build_dirs.length] = d;
+ d += "\\";
+ }
+ sub_build += d;
+
+
+ DEFINE(bd_flags_name, " /Fd" + sub_build + " /Fp" + sub_build + " /FR" + sub_build + " ");
+
+ for (i in file_list) {
+ src = file_list[i];
+ obj = src.replace(re, ".obj");
+ tv += " " + sub_build + obj;
+
+ if (PHP_ONE_SHOT == "yes") {
+ if (i > 0) {
+ objs_line += " " + sub_build + obj;
+ srcs_line += " " + dir + "\\" + src;
+ } else {
+ objs_line = sub_build + obj;
+ srcs_line = dir + "\\" + src;
+ }
+ } else {
+ MFO.WriteLine(sub_build + obj + ": " + dir + "\\" + src);
+ MFO.WriteLine("\t@$(CC) $(" + flags + ") $(CFLAGS) $(" + bd_flags_name + ") /c " + dir + "\\" + src + " /Fo" + sub_build + obj);
+ }
+ }
+
+ if (PHP_ONE_SHOT == "yes") {
+ MFO.WriteLine(objs_line + ": " + srcs_line);
+ MFO.WriteLine("\t$(CC) $(" + flags + ") $(CFLAGS) /Fo" + sub_build + " $(" + bd_flags_name + ") /c " + srcs_line);
+ }
+
+ DEFINE(sym, tv);
+}
+
+function REMOVE_TARGET(dllname, flag)
+{
+ var dllname = dllname.replace(/\s/g, "");
+ var EXT = dllname.replace(/php_(\S+)\.dll/, "$1").toUpperCase();
+ var php_flags = configure_subst.Item("CFLAGS_PHP");
+
+ if (configure_subst.Exists(flag)) {
+ var targets = configure_subst.Item(flag);
+
+ if (targets.match(dllname)) {
+ configure_subst.Remove(flag);
+ targets = targets.replace(dllname, "");
+ targets = targets.replace(/\s+/, " ");
+ targets = targets.replace(/\s$/, "");
+ configure_subst.Add(flag, targets);
+ configure_hdr.Add("HAVE_" + EXT, new Array(0, ""));
+ configure_subst.Item("CFLAGS_PHP") = php_flags.replace(" /D COMPILE_DL_" + EXT, "");
+ extensions_enabled.pop();
+ return true;
+ }
+ }
+ return false;
+}
+
+function generate_internal_functions()
+{
+ var infile, outfile;
+ var indata;
+
+ STDOUT.WriteLine("Generating main/internal_functions.c");
+
+ infile = FSO.OpenTextFile("main/internal_functions.c.in", 1);
+ indata = infile.ReadAll();
+ infile.Close();
+
+ indata = indata.replace("@EXT_INCLUDE_CODE@", extension_include_code);
+ indata = indata.replace("@EXT_MODULE_PTRS@", extension_module_ptrs);
+
+ if (FSO.FileExists("main/internal_functions.c")) {
+ var origdata = file_get_contents("main/internal_functions.c");
+
+ if (origdata == indata) {
+ STDOUT.WriteLine("\t[content unchanged; skipping]");
+ return;
+ }
+ }
+
+ outfile = FSO.CreateTextFile("main/internal_functions.c", true);
+ outfile.Write(indata);
+ outfile.Close();
+}
+
+function output_as_table(header, ar_out)
+{
+ var l = header.length;
+ var cols = 80;
+ var fixedlenght = "";
+ var t = 0;
+ var i,j,k,m;
+ var out = "| ";
+ var min = new Array(l);
+ var max = new Array(l);
+
+ if (l != ar_out[0].length) {
+ STDOUT.WriteLine("Invalid header argument, can't output the table " + l + " " + ar_out[0].length );
+ return;
+ }
+
+ for (j=0; j < l; j++) {
+ var tmax, tmin;
+
+ /*Figure out the max length per column */
+ tmin = 0;
+ tmax = 0;
+ for (k = 0; k < ar_out.length; k++) {
+ var t = ar_out[k][j].length;
+ if (t > tmax) tmax = t;
+ else if (t < tmin) tmin = t;
+ }
+ if (tmax > header[j].length) {
+ max[j] = tmax;
+ } else {
+ max[j] = header[j].length;
+ }
+ if (tmin < header[j].length) {
+ min[j] = header[j].length;
+ }
+ }
+
+ sep = "";
+ k = 0;
+ for (i = 0; i < l; i++) {
+ k += max[i] + 3;
+ }
+ k++;
+
+ for (j=0; j < k; j++) {
+ sep += "-";
+ }
+
+ STDOUT.WriteLine(sep);
+ out = "|";
+ for (j=0; j < l; j++) {
+ out += " " + header[j];
+ for (var i = 0; i < (max[j] - header[j].length); i++){
+ out += " ";
+ }
+ out += " |";
+ }
+ STDOUT.WriteLine(out);
+
+ STDOUT.WriteLine(sep);
+
+ out = "|";
+ for (i=0; i < ar_out.length; i++) {
+ line = ar_out[i];
+ for (j=0; j < l; j++) {
+ out += " " + line[j];
+ for (var k = 0; k < (max[j] - line[j].length); k++){
+ out += " ";
+ }
+ out += " |";
+ }
+ STDOUT.WriteLine(out);
+ out = "|";
+ }
+
+ STDOUT.WriteLine(sep);
+}
+
+function write_summary()
+{
+ var ar = new Array();
+
+ STDOUT.WriteBlankLines(2);
+
+ STDOUT.WriteLine("Enabled extensions:");
+ output_as_table(["Extension", "Mode"], extensions_enabled.sort());
+ STDOUT.WriteBlankLines(2);
+
+ STDOUT.WriteLine("Enabled SAPI:");
+ output_as_table(["Sapi Name"], sapi_enabled);
+ STDOUT.WriteBlankLines(2);
+
+ ar[0] = ['Build type', PHP_DEBUG == "yes" ? "Debug" : "Release"];
+ ar[1] = ['Thread Safety', PHP_ZTS == "yes" ? "Yes" : "No"];
+ ar[2] = ['Compiler', VC_VERSIONS[VCVERS]];
+ ar[3] = ['Architecture', X64 ? 'x64' : 'x86'];
+
+ output_as_table(["",""], ar);
+ STDOUT.WriteBlankLines(2);
+}
+
+function generate_files()
+{
+ var i, dir, bd, last;
+
+ STDOUT.WriteBlankLines(1);
+ STDOUT.WriteLine("Creating build dirs...");
+ dir = get_define("BUILD_DIR");
+ build_dirs.sort();
+ last = null;
+
+ if (!FSO.FolderExists(dir)) {
+ FSO.CreateFolder(dir);
+ }
+
+ for (i = 0; i < build_dirs.length; i++) {
+ bd = FSO.BuildPath(dir, build_dirs[i]);
+ if (bd == last) {
+ continue;
+ }
+ last = bd;
+ ADD_FLAG("BUILD_DIRS_SUB", bd.replace(new RegExp('^'+dir+'\\\\'), '$(BUILD_DIR)\\'));
+ if (!FSO.FolderExists(bd)) {
+ FSO.CreateFolder(bd);
+ }
+ }
+
+ if (PHP_DSP != "no") {
+ generate_dsp_file("TSRM", "TSRM", null, false);
+ generate_dsp_file("Zend", "Zend", null, false);
+ generate_dsp_file("win32", "win32", null, false);
+ generate_dsp_file("main", "main", null, false);
+ generate_dsp_file("streams", "main\\streams", null, false);
+ copy_dsp_files();
+ }
+
+ STDOUT.WriteLine("Generating files...");
+ generate_makefile();
+ generate_internal_functions();
+ generate_config_h();
+
+ STDOUT.WriteLine("Done.");
+ STDOUT.WriteBlankLines(1);
+ write_summary();
+
+ if (PHP_SNAPSHOT_BUILD != "no") {
+ STDOUT.WriteLine("Type 'nmake snap' to build a PHP snapshot");
+ } else {
+ STDOUT.WriteLine("Type 'nmake' to build PHP");
+ }
+}
+
+function generate_config_h()
+{
+ var infile, outfile;
+ var indata;
+ var prefix;
+
+ prefix = PHP_PREFIX.replace(new RegExp("\\\\", "g"), "\\\\");
+
+ STDOUT.WriteLine("Generating main/config.w32.h");
+
+ infile = FSO.OpenTextFile("win32/build/config.w32.h.in", 1);
+ indata = infile.ReadAll();
+ infile.Close();
+
+ outfile = FSO.CreateTextFile("main/config.w32.h", true);
+
+ indata = indata.replace(new RegExp("@PREFIX@", "g"), prefix);
+ outfile.Write(indata);
+
+ var keys = (new VBArray(configure_hdr.Keys())).toArray();
+ var i, j;
+ var item;
+ var pieces, stuff_to_crack, chunk;
+
+ outfile.WriteBlankLines(1);
+ outfile.WriteLine("/* values determined by configure.js */");
+
+ for (i in keys) {
+ item = configure_hdr.Item(keys[i]);
+ outfile.WriteBlankLines(1);
+ pieces = item[0];
+
+ if (item[1] != undefined) {
+ outfile.WriteLine("/* " + item[1] + " */");
+ }
+
+ if (typeof(pieces) == "string" && pieces.charCodeAt(0) == 34) {
+ /* quoted string have a maximal length of 2k under vc.
+ * solution is to crack them and let the compiler concat
+ * them implicitly */
+ stuff_to_crack = pieces;
+ pieces = "";
+
+ while (stuff_to_crack.length) {
+ j = 65;
+ while (stuff_to_crack.charCodeAt(j) != 32 && j < stuff_to_crack.length)
+ j++;
+
+ chunk = stuff_to_crack.substr(0, j);
+ pieces += chunk;
+ stuff_to_crack = stuff_to_crack.substr(chunk.length);
+ if (stuff_to_crack.length)
+ pieces += '" "';
+ }
+ }
+
+ outfile.WriteLine("#define " + keys[i] + " " + pieces);
+ }
+
+ outfile.Close();
+}
+
+function generate_makefile()
+{
+ STDOUT.WriteLine("Generating Makefile");
+ var MF = FSO.CreateTextFile("Makefile", true);
+
+ MF.WriteLine("# Generated by configure.js");
+
+ /* spit out variable definitions */
+ var keys = (new VBArray(configure_subst.Keys())).toArray();
+ var i;
+
+ for (i in keys) {
+ // The trailing space is needed to prevent the trailing backslash
+ // that is part of the build dir flags (CFLAGS_BD_XXX) from being
+ // seen as a line continuation character
+ MF.WriteLine(keys[i] + "=" +
+ //word_wrap_and_indent(1, configure_subst.Item(keys[i]), ' \\', '\t') + " "
+ configure_subst.Item(keys[i]) + " "
+ );
+ MF.WriteBlankLines(1);
+ }
+
+ MF.WriteBlankLines(1);
+
+ var TF = FSO.OpenTextFile("win32/build/Makefile", 1);
+ MF.Write(TF.ReadAll());
+ TF.Close();
+
+ MF.WriteBlankLines(2);
+
+ MFO.Close();
+ TF = FSO.OpenTextFile("Makefile.objects", 1);
+ MF.Write(TF.ReadAll());
+ TF.Close();
+
+ MF.Close();
+}
+
+function ADD_FLAG(name, flags, target)
+{
+ if (target != null) {
+ name = target.toUpperCase() + "_" + name;
+ }
+ if (configure_subst.Exists(name)) {
+ var curr_flags = configure_subst.Item(name);
+
+ if (curr_flags.indexOf(flags) >= 0) {
+ return;
+ }
+
+ flags = curr_flags + " " + flags;
+ configure_subst.Remove(name);
+ }
+ configure_subst.Add(name, flags);
+
+ if (PHP_DSP != "no") {
+ if (flags && (name.substr(name.length-3) != "PHP") && (name.substr(0, 7) == "CFLAGS_")) {
+ DSP_FLAGS[DSP_FLAGS.length] = new Array(name, flags);
+ }
+ }
+}
+
+function get_define(name)
+{
+ if (configure_subst.Exists(name)) {
+ return configure_subst.Item(name);
+ }
+ return "";
+}
+
+// Add a .def to the core to export symbols
+function ADD_DEF_FILE(name)
+{
+ if (!configure_subst.Exists("PHPDEF")) {
+ DEFINE("PHPDEF", "$(BUILD_DIR)\\$(PHPDLL).def");
+ ADD_FLAG("PHP_LDFLAGS", "/def:$(PHPDEF)");
+ }
+ ADD_FLAG("PHP_DLL_DEF_SOURCES", name);
+}
+
+function AC_DEFINE(name, value, comment, quote)
+{
+ if (quote == null) {
+ quote = true;
+ }
+ if (quote && typeof(value) == "string") {
+ value = '"' + value.replace(new RegExp('(["\\\\])', "g"), '\\$1') + '"';
+ } else if (value.length == 0) {
+ value = '""';
+ }
+ var item = new Array(value, comment);
+ if (configure_hdr.Exists(name)) {
+ var orig_item = configure_hdr.Item(name);
+ STDOUT.WriteLine("AC_DEFINE[" + name + "]=" + value + ": is already defined to " + orig_item[0]);
+ } else {
+ configure_hdr.Add(name, item);
+ }
+}
+
+function MESSAGE(msg)
+{
+ STDOUT.WriteLine("" + msg);
+}
+
+function ERROR(msg)
+{
+ STDERR.WriteLine("ERROR: " + msg);
+ WScript.Quit(3);
+}
+
+function WARNING(msg)
+{
+ STDERR.WriteLine("WARNING: " + msg);
+ STDERR.WriteBlankLines(1);
+}
+
+function copy_and_subst(srcname, destname, subst_array)
+{
+ if (!FSO.FileExists(srcname)) {
+ srcname = configure_module_dirname + "\\" + srcname;
+ destname = configure_module_dirname + "\\" + destname;
+ }
+
+ var content = file_get_contents(srcname);
+ var i;
+
+ for (i = 0; i < subst_array.length; i+=2) {
+ var re = subst_array[i];
+ var rep = subst_array[i+1];
+
+ content = content.replace(re, rep);
+ }
+
+ var f = FSO.CreateTextFile(destname, true);
+ f.Write(content);
+ f.Close();
+}
+
+// glob using simple filename wildcards
+// returns an array of matches that are found
+// in the filesystem
+function glob(path_pattern)
+{
+ var path_parts = path_pattern.replace(new RegExp("/", "g"), "\\").split("\\");
+ var p;
+ var base = "";
+ var is_pat_re = /\*/;
+
+//STDOUT.WriteLine("glob: " + path_pattern);
+
+ if (FSO.FileExists(path_pattern)) {
+ return new Array(path_pattern);
+ }
+
+ // first, build as much as possible that doesn't have a pattern
+ for (p = 0; p < path_parts.length; p++) {
+ if (path_parts[p].match(is_pat_re))
+ break;
+ if (p)
+ base += "\\";
+ base += path_parts[p];
+ }
+
+ return _inner_glob(base, p, path_parts);
+}
+
+function _inner_glob(base, p, parts)
+{
+ var pat = parts[p];
+ var full_name = base + "\\" + pat;
+ var re = null;
+ var items = null;
+
+ if (p == parts.length) {
+ return false;
+ }
+
+//STDOUT.WriteLine("inner: base=" + base + " p=" + p + " pat=" + pat);
+
+ if (FSO.FileExists(full_name)) {
+ if (p < parts.length - 1) {
+ // we didn't reach the full extent of the pattern
+ return false;
+ }
+ return new Array(full_name);
+ }
+
+ if (FSO.FolderExists(full_name) && p == parts.length - 1) {
+ // we have reached the end of the pattern; no need to recurse
+ return new Array(full_name);
+ }
+
+ // Convert the pattern into a regexp
+ re = new RegExp("^" + pat.replace(/\./g, '\\.').replace(/\*/g, '.*').replace(/\?/g, '.') + "$", "i");
+
+ items = new Array();
+
+ if (!FSO.FolderExists(base)) {
+ return false;
+ }
+
+ var folder = FSO.GetFolder(base);
+ var fc = null;
+ var subitems = null;
+ var item_name = null;
+ var j;
+
+ fc = new Enumerator(folder.SubFolders);
+ for (; !fc.atEnd(); fc.moveNext()) {
+ item_name = FSO.GetFileName(fc.item());
+
+ if (item_name.match(re)) {
+ // got a match; if we are at the end of the pattern, just add these
+ // things to the items array
+ if (p == parts.length - 1) {
+ items[items.length] = fc.item();
+ } else {
+ // we should recurse and do more matches
+ subitems = _inner_glob(base + "\\" + item_name, p + 1, parts);
+ if (subitems) {
+ for (j = 0; j < subitems.length; j++) {
+ items[items.length] = subitems[j];
+ }
+ }
+ }
+ }
+ }
+
+ // if we are at the end of the pattern, we should match
+ // files too
+ if (p == parts.length - 1) {
+ fc = new Enumerator(folder.Files);
+ for (; !fc.atEnd(); fc.moveNext()) {
+ item_name = FSO.GetFileName(fc.item());
+ if (item_name.match(re)) {
+ items[items.length] = fc.item();
+ }
+ }
+ }
+
+ if (items.length == 0)
+ return false;
+
+ return items;
+}
+
+
+// for snapshot builders, this option will attempt to enable everything
+// and you can then build everything, ignoring fatal errors within a module
+// by running "nmake snap"
+PHP_SNAPSHOT_BUILD = "no";
+ARG_ENABLE('snapshot-build', 'Build a snapshot; turns on everything it can and ignores build errors', 'no');
+
+// one-shot build optimizes build by asking compiler to build
+// several objects at once, reducing overhead of starting new
+// compiler processes.
+ARG_ENABLE('one-shot', 'Optimize for fast build - best for release and snapshot builders, not so hot for edit-and-rebuild hacking', 'no');
+
+
diff --git a/win32/build/cvsclean.js b/win32/build/cvsclean.js
index c654bbc6a..c5f92a388 100644
--- a/win32/build/cvsclean.js
+++ b/win32/build/cvsclean.js
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2009 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -13,32 +13,39 @@
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Wez Furlong <wez@thebrainroom.com> |
+ | Pierre A. Joye <pierre@php.net> |
+----------------------------------------------------------------------+
*/
-/* $Id: cvsclean.js,v 1.5.2.1.2.1.2.1 2008/07/20 02:20:31 sfox Exp $ */
-// Cleans up files that do not belong in CVS
+/* $Id$ */
+// Cleans up files that do not belong in the repository
var FSO = WScript.CreateObject("Scripting.FileSystemObject");
+var WshShell = WScript.CreateObject("WScript.Shell");
+var STDOUT = WScript.StdOut;
-function find_cvsignore(dirname)
+/* svn propget svn:ignore dirname */
+function find_ignore(dirname)
{
- if (!FSO.FolderExists(dirname))
+ dirname = "" + dirname;
+ dirname_len = dirname.length;
+
+ if (!FSO.FolderExists(dirname) || (dirname_len >= 4 &&
+ dirname.substring(dirname_len - 4) == ".svn")) {
return;
+ }
var f = FSO.GetFolder(dirname);
var fc = new Enumerator(f.SubFolders);
-
+
for (; !fc.atEnd(); fc.moveNext()) {
- find_cvsignore(fc.item());
+ find_ignore(fc.item());
}
- if (FSO.FileExists(dirname + "\\.cvsignore")) {
- kill_from_cvsignore(dirname + "\\.cvsignore");
- }
+ kill_from_ignore(dirname);
}
-/* recursive remove using cvsignore style wildcard matching;
+/* recursive remove using ignore props style wildcard matching;
* note that FSO.DeleteFolder and FSO.DeleteFile methods both
* accept wildcards, but that they are dangerous to use eg:
* "*.php" will match "*.phpt" */
@@ -66,7 +73,7 @@ function rm_r(filename)
if (foldername == "")
foldername = ".";
-
+
var filename = FSO.GetFileName(filename);
var retext = filename.replace(/\./g, '\\.');
@@ -94,27 +101,20 @@ function rm_r(filename)
}
}
-function kill_from_cvsignore(igfile)
+function kill_from_ignore(dirname)
{
- var dir = FSO.GetParentFolderName(igfile) + "\\";
- var t = FSO.OpenTextFile(igfile, 1);
var l;
-
- if (dir == ".\\") {
- dir = "";
- }
-
- while (!t.atEndOfStream) {
- l = t.ReadLine();
- // don't kill their config.nice file(s)
- if (l.match("config\.nice.*") ||
- l.match("") ||
- l.match("*"))
+ var e = WshShell.Exec("svn propget svn:ignore " + dirname);
+ var re = /^(config\.nice.*)|(\*)$/i;
+
+ while (!e.StdOut.atEndOfStream) {
+ l = e.StdOut.ReadLine();
+ if (l.length == 0 || re.test(l)) {
continue;
- rm_r(dir + l);
+ }
+ rm_r(dirname + l);
}
}
-find_cvsignore(".");
-
+find_ignore(".");
diff --git a/win32/build/deplister.c b/win32/build/deplister.c
index 6d90aa49c..f6f1ce5ad 100644
--- a/win32/build/deplister.c
+++ b/win32/build/deplister.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: deplister.c,v 1.3.2.1.2.1.2.2 2008/12/31 11:15:49 sebastian Exp $ */
+/* $Id: deplister.c 272370 2008-12-31 11:15:49Z sebastian $ */
/* This little application will list the DLL dependencies for a PE
* module to it's stdout for use by distro/installer building tools */
diff --git a/win32/build/mkdist.php b/win32/build/mkdist.php
index 37b46b305..7e3eeee6e 100644
--- a/win32/build/mkdist.php
+++ b/win32/build/mkdist.php
@@ -1,12 +1,13 @@
-<?php # $Id: mkdist.php,v 1.13.4.1.2.15 2009/06/24 11:51:05 pajoye Exp $
+<?php # $Id: mkdist.php 289905 2009-10-24 19:52:23Z pajoye $
/* piece together a windows binary distro */
$build_dir = $argv[1];
-$phpdll = $argv[2];
-$sapi_targets = explode(" ", $argv[3]);
-$ext_targets = explode(" ", $argv[4]);
-$pecl_targets = explode(" ", $argv[5]);
-$snapshot_template = $argv[6];
+$php_build_dir = $argv[2];
+$phpdll = $argv[3];
+$sapi_targets = explode(" ", $argv[4]);
+$ext_targets = explode(" ", $argv[5]);
+$pecl_targets = explode(" ", $argv[6]);
+$snapshot_template = $argv[7];
$is_debug = preg_match("/^debug/i", $build_dir);
@@ -59,6 +60,7 @@ function get_depends($module)
* but the debug version (msvcrtd.dll) and those from visual studio.net
* (msvcrt7x.dll) are not */
'msvcrt.dll',
+ 'msvcr90.dll',
'wldap32.dll'
);
global $build_dir, $extra_dll_deps, $ext_targets, $sapi_targets, $pecl_targets, $phpdll, $per_module_deps, $pecl_dll_deps;
@@ -251,7 +253,7 @@ foreach ($general_files as $src => $dest) {
}
/* include a snapshot identifier */
-$branch = "HEAD"; // TODO - determine this from CVS/Entries
+$branch = "HEAD"; // TODO - determine this from SVN branche name
$fp = fopen("$dist_dir/snapshot.txt", "w");
$now = date("r");
$version = phpversion();
@@ -295,7 +297,7 @@ foreach ($extra_dll_deps as $dll) {
/* try template dir */
$tdll = $snapshot_template . "/dlls/" . basename($dll);
if (!file_exists($tdll)) {
- $tdll = '../deps/bin/' . basename($dll);
+ $tdll = $php_build_dir . '/bin/' . basename($dll);
if (!file_exists($tdll)) {
echo "WARNING: distro depends on $dll, but could not find it on your system\n";
continue;
@@ -309,11 +311,23 @@ foreach ($extra_dll_deps as $dll) {
/* TODO:
add sanity check and test if all required DLLs are present, per version
This version works at least for 3.6, 3.8 and 4.0 (5.3-vc6, 5.3-vc9 and HEAD).
+Add ADD_DLLS to add extra DLLs like dynamic dependencies for standard
+deps. For example, libenchant.dll loads libenchant_myspell.dll or
+libenchant_ispell.dll
*/
-$ICU_DLLS = '../deps/bin/' . 'icu*.dll';
+$ICU_DLLS = $php_build_dir . '/bin/icu*.dll';
foreach (glob($ICU_DLLS) as $filename) {
copy($filename, "$dist_dir/" . basename($filename));
}
+$ENCHANT_DLLS = array(
+ 'glib-2.dll',
+ 'gmodule-2.dll',
+ 'libenchant_myspell.dll',
+ 'libenchant_ispell.dll',
+);
+foreach ($ENCHANT_DLLS as $filename) {
+ copy($php_build_dir . '/bin/' . $filename, "$dist_dir/" . basename($filename));
+}
/* and those for pecl */
foreach ($pecl_dll_deps as $dll) {
@@ -332,6 +346,7 @@ foreach ($pecl_dll_deps as $dll) {
}
copy($dll, "$pecl_dir/" . basename($dll));
}
+
function copy_dir($source, $dest)
{
if (!is_dir($dest)) {
@@ -342,7 +357,7 @@ function copy_dir($source, $dest)
$d = opendir($source);
while (($f = readdir($d)) !== false) {
- if ($f == '.' || $f == '..' || $f == 'CVS' || $f == '.cvsignore') {
+ if ($f == '.' || $f == '..' || $f == '.svn') {
continue;
}
$fs = $source . '/' . $f;
@@ -365,7 +380,9 @@ function copy_test_dir($directory, $dest)
}
if ($directory == 'tests') {
- mkdir($dest . '/tests', 0775, true);
+ if (!is_dir($dest . '/tests')) {
+ mkdir($dest . '/tests', 0775, true);
+ }
copy_dir($directory, $dest . '/tests/');
return false;
@@ -380,7 +397,7 @@ function copy_test_dir($directory, $dest)
while (FALSE !== ($file = readdir($directory_list))) {
$full_path = $directory . '/' . $file;
- if($file != '.' && $file != '..' && $file != 'CVS' && is_dir($full_path)) {
+ if($file != '.' && $file != '..' && $file != '.svn' && is_dir($full_path)) {
if ($file == 'tests') {
if (!is_dir($dest . '/' . $full_path)) {
mkdir($dest . '/' . $full_path , 0775, true);
@@ -439,6 +456,7 @@ $dirs = array(
foreach ($dirs as $dir) {
copy_test_dir($dir, $test_dir);
}
+
/* change this next line to true to use good-old
* hand-assembled go-pear-bundle from the snapshot template */
$use_pear_template = true;
diff --git a/win32/build/svnclean.js b/win32/build/svnclean.js
new file mode 100644
index 000000000..c5f92a388
--- /dev/null
+++ b/win32/build/svnclean.js
@@ -0,0 +1,120 @@
+/*
+ +----------------------------------------------------------------------+
+ | PHP Version 5 |
+ +----------------------------------------------------------------------+
+ | Copyright (c) 1997-2009 The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Author: Wez Furlong <wez@thebrainroom.com> |
+ | Pierre A. Joye <pierre@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $Id$ */
+// Cleans up files that do not belong in the repository
+
+var FSO = WScript.CreateObject("Scripting.FileSystemObject");
+var WshShell = WScript.CreateObject("WScript.Shell");
+var STDOUT = WScript.StdOut;
+
+/* svn propget svn:ignore dirname */
+function find_ignore(dirname)
+{
+ dirname = "" + dirname;
+ dirname_len = dirname.length;
+
+ if (!FSO.FolderExists(dirname) || (dirname_len >= 4 &&
+ dirname.substring(dirname_len - 4) == ".svn")) {
+ return;
+ }
+
+ var f = FSO.GetFolder(dirname);
+ var fc = new Enumerator(f.SubFolders);
+
+ for (; !fc.atEnd(); fc.moveNext()) {
+ find_ignore(fc.item());
+ }
+
+ kill_from_ignore(dirname);
+}
+
+/* recursive remove using ignore props style wildcard matching;
+ * note that FSO.DeleteFolder and FSO.DeleteFile methods both
+ * accept wildcards, but that they are dangerous to use eg:
+ * "*.php" will match "*.phpt" */
+function rm_r(filename)
+{
+ if (FSO.FolderExists(filename)) {
+ var fc = new Enumerator(FSO.GetFolder(filename).SubFolders);
+
+ for (; !fc.atEnd(); fc.moveNext()) {
+ rm_r(fc.item());
+ }
+
+ fc = new Enumerator(FSO.GetFolder(filename).Files);
+
+ for (; !fc.atEnd(); fc.moveNext()) {
+ FSO.DeleteFile(fc.item(), true);
+ }
+
+ FSO.DeleteFolder(filename, true);
+ } else if (FSO.FileExists(filename)) {
+ FSO.DeleteFile(filename, true);
+ } else {
+ /* we need to handle wildcards here */
+ var foldername = FSO.GetParentFolderName(filename);
+
+ if (foldername == "")
+ foldername = ".";
+
+ var filename = FSO.GetFileName(filename);
+
+ var retext = filename.replace(/\./g, '\\.');
+ retext = '^' + retext.replace(/\*/g, '.*') + "$";
+ var re = new RegExp(retext);
+
+ var folder = FSO.GetFolder(foldername);
+ var fc = new Enumerator(folder.SubFolders);
+ for (; !fc.atEnd(); fc.moveNext()) {
+
+ var item = FSO.GetFileName(fc.item());
+
+ if (item.match(re)) {
+ rm_r(fc.item());
+ }
+ }
+ var fc = new Enumerator(folder.Files);
+ for (; !fc.atEnd(); fc.moveNext()) {
+ item = FSO.GetFileName(fc.item());
+
+ if (item.match(re)) {
+ FSO.DeleteFile(fc.item(), true);
+ }
+ }
+ }
+}
+
+function kill_from_ignore(dirname)
+{
+ var l;
+ var e = WshShell.Exec("svn propget svn:ignore " + dirname);
+ var re = /^(config\.nice.*)|(\*)$/i;
+
+ while (!e.StdOut.atEndOfStream) {
+ l = e.StdOut.ReadLine();
+ if (l.length == 0 || re.test(l)) {
+ continue;
+ }
+ rm_r(dirname + l);
+ }
+
+}
+
+find_ignore(".");
diff --git a/win32/build/template.dsw b/win32/build/template.dsw
index a627d028d..ac781664f 100644
--- a/win32/build/template.dsw
+++ b/win32/build/template.dsw
@@ -1,63 +1,63 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "TSRM"=..\TSRM\TSRM.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Zend"=..\Zend\Zend.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name TSRM
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "php5ts"=..\win32\php5ts.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name TSRM
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name Zend
- End Project Dependency
-}}}
-
-###############################################################################
-INSERT
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "TSRM"=..\TSRM\TSRM.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "Zend"=..\Zend\Zend.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name TSRM
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "php5ts"=..\win32\php5ts.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name TSRM
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name Zend
+ End Project Dependency
+}}}
+
+###############################################################################
+INSERT
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/win32/build/template.rc b/win32/build/template.rc
index 40160ac6f..98c2bcb4f 100644
--- a/win32/build/template.rc
+++ b/win32/build/template.rc
@@ -1,5 +1,5 @@
/* This is a template RC file.
- * $Id: template.rc,v 1.7.2.2.2.1.2.3 2009/06/03 01:14:58 kalle Exp $
+ * $Id: template.rc 281570 2009-06-03 01:14:58Z kalle $
* Do not edit with MSVC */
#ifdef APSTUDIO_INVOKED
# error dont edit with MSVC
diff --git a/win32/builddef.bat b/win32/builddef.bat
index 09c1adc8e..f204812ac 100644
--- a/win32/builddef.bat
+++ b/win32/builddef.bat
@@ -2,6 +2,6 @@
rem Generate phpts.def file, which exports symbols from our dll that
rem are present in some of the libraries which are compiled statically
rem into PHP
-rem $Id: builddef.bat,v 1.4 2003/12/08 12:56:47 rrichards Exp $
+rem $Id: builddef.bat,v 1.4 2003-12-08 12:56:47 rrichards Exp $
type ..\ext\sqlite\php_sqlite.def
type ..\ext\libxml\php_libxml2.def
diff --git a/win32/fnmatch.c b/win32/fnmatch.c
index 4d3bc3486..568d5843b 100644
--- a/win32/fnmatch.c
+++ b/win32/fnmatch.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* From FreeBSD fnmatch.c 1.11
- * $Id: fnmatch.c,v 1.1.2.2 2009/01/20 01:37:48 pajoye Exp $
+ * $Id: fnmatch.c 273994 2009-01-20 01:37:48Z pajoye $
*/
#if defined(LIBC_SCCS) && !defined(lint)
diff --git a/win32/fnmatch.h b/win32/fnmatch.h
index 1e13c3b49..530c7c09f 100644
--- a/win32/fnmatch.h
+++ b/win32/fnmatch.h
@@ -33,7 +33,7 @@
* @(#)fnmatch.h 8.1 (Berkeley) 6/2/93
*
* From FreeBSD fnmatch.h 1.7
- * $Id: fnmatch.h,v 1.1.2.2 2009/01/20 01:37:48 pajoye Exp $
+ * $Id: fnmatch.h 273994 2009-01-20 01:37:48Z pajoye $
*/
#ifndef _FNMATCH_H_
diff --git a/win32/glob.c b/win32/glob.c
index f4c469990..0d290c667 100644
--- a/win32/glob.c
+++ b/win32/glob.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*/
-/* $Id: glob.c,v 1.6.6.1.2.1 2009/01/01 12:32:48 pajoye Exp $ */
+/* $Id: glob.c 272473 2009-01-01 12:32:49Z pajoye $ */
/*
* glob(3) -- a superset of the one defined in POSIX 1003.2.
diff --git a/win32/glob.h b/win32/glob.h
index 8dc146470..8548eec25 100644
--- a/win32/glob.h
+++ b/win32/glob.h
@@ -1,4 +1,4 @@
-/* $Id: glob.h,v 1.1.24.2 2009/01/01 12:32:49 pajoye Exp $ */
+/* $Id: glob.h 272473 2009-01-01 12:32:49Z pajoye $ */
/* OpenBSD: glob.h,v 1.7 2002/02/17 19:42:21 millert Exp */
/* NetBSD: glob.h,v 1.5 1994/10/26 00:55:56 cgd Exp */
diff --git a/win32/globals.c b/win32/globals.c
index 741d7ed41..f14380aeb 100755
--- a/win32/globals.c
+++ b/win32/globals.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: globals.c,v 1.5.2.1.2.3.2.2 2008/12/31 11:15:49 sebastian Exp $ */
+/* $Id: globals.c 272370 2008-12-31 11:15:49Z sebastian $ */
#include "php.h"
#include "php_win32_globals.h"
diff --git a/win32/grp.h b/win32/grp.h
index 520a5b536..2d9c014f0 100644
--- a/win32/grp.h
+++ b/win32/grp.h
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: grp.h,v 1.7.2.1.2.1.2.2 2008/12/31 11:15:49 sebastian Exp $ */
+/* $Id: grp.h 272370 2008-12-31 11:15:49Z sebastian $ */
struct group {
char *gr_name;
diff --git a/win32/install.txt b/win32/install.txt
index d77e4f186..c1fc9c20a 100644
--- a/win32/install.txt
+++ b/win32/install.txt
@@ -742,7 +742,7 @@ Apache 2.0.x on Microsoft Windows
http://snaps.php.net/php5-latest.tar.gz or download binaries for
Windows http://snaps.php.net/win32/php5-win32-latest.zip.
* a prerelease version downloadable from http://qa.php.net/.
- * you have always the option to obtain PHP through anonymous CVS.
+ * you have always the option to obtain PHP through SVN.
These versions of PHP are compatible to Apache 2.0.40 and later.
@@ -1211,8 +1211,8 @@ Introduction to PECL Installations
When building PHP modules, it's important to have known-good versions
of the required tools (autoconf, automake, libtool, etc.) See the
- Anonymous CVS Instructions for details on the required tools, and
- required versions.
+ SVN Instructions for details on the required tools, and required
+ versions.
__________________________________________________________________
Downloading PECL extensions
@@ -1228,14 +1228,12 @@ Downloading PECL extensions
PECL extensions that have releases listed on the PECL web site are
available for download and installation using the pecl command.
Specific revisions may also be specified.
- * CVS
- Most PECL extensions also reside in CVS. A web-based view may be
- seen at http://cvs.php.net/pecl/. To download straight from CVS,
- the following sequence of commands may be used. Note that phpfi is
- the password for user cvsread:
+ * SVN
+ Most PECL extensions also reside in SVN. A web-based view may be
+ seen at http://svn.php.net/pecl/. To download straight from SVN,
+ the following sequence of commands may be used.
-$ cvs -d:pserver:cvsread@cvs.php.net:/repository login
-$ cvs -d:pserver:cvsread@cvs.php.net:/repository co pecl/extname
+$ svn co http://svn.php.net/repository/pecl/<extname>/trunk
* Windows downloads
Windows users may find compiled PECL binaries by downloading the
@@ -1283,7 +1281,7 @@ Compiling shared PECL extensions with phpize
Sometimes, using the pecl installer is not an option. This could be
because you're behind a firewall, or it could be because the extension
you want to install is not available as a PECL compatible package, such
- as unreleased extensions from CVS. If you need to build such an
+ as unreleased extensions from SVN. If you need to build such an
extension, you can use the lower-level build tools to perform the build
manually.
@@ -1430,7 +1428,7 @@ The configuration file
directives are documented in the manual though. For a complete list of
directives available in your PHP version, please read your well
commented php.ini file. Alternatively, you may find the the latest
- php.ini from CVS helpful too.
+ php.ini from SVN helpful too.
Example 5-1. php.ini example
; any text on a line after an unquoted semicolon (;) is ignored
diff --git a/win32/php5.dsw b/win32/php5.dsw
index 2e7d26672..d6efc98ee 100644
--- a/win32/php5.dsw
+++ b/win32/php5.dsw
@@ -1,107 +1,107 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "TSRM"=..\TSRM\TSRM.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Zend"=..\Zend\Zend.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name TSRM
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "fastcgi"=..\sapi\fastcgi\fastcgi.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name php5dll
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name TSRM
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name Zend
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "php5"=.\php5.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name php5dll
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name Zend
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name TSRM
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "php5dll"=.\php5dll.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Zend
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name libmysql
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name TSRM
- End Project Dependency
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "TSRM"=..\TSRM\TSRM.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "Zend"=..\Zend\Zend.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name TSRM
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "fastcgi"=..\sapi\fastcgi\fastcgi.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name php5dll
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name TSRM
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name Zend
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "php5"=.\php5.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name php5dll
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name Zend
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name TSRM
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "php5dll"=.\php5dll.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name Zend
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name libmysql
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name TSRM
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/win32/php5dll.dsp b/win32/php5dll.dsp
index b0a26bcfc..b0fad66c2 100644
--- a/win32/php5dll.dsp
+++ b/win32/php5dll.dsp
@@ -567,10 +567,6 @@ SOURCE=..\ext\standard\url.c
# End Source File
# Begin Source File
-SOURCE=..\ext\standard\url_scanner.c
-# End Source File
-# Begin Source File
-
SOURCE=..\ext\standard\url_scanner_ex.c
# ADD CPP /W2
# End Source File
@@ -729,10 +725,6 @@ SOURCE=..\ext\standard\url.h
# End Source File
# Begin Source File
-SOURCE=..\ext\standard\url_scanner.h
-# End Source File
-# Begin Source File
-
SOURCE=..\ext\standard\url_scanner_ex.h
# End Source File
# End Group
diff --git a/win32/php5dllts.dsp b/win32/php5dllts.dsp
index 0faddf954..250d450e3 100644
--- a/win32/php5dllts.dsp
+++ b/win32/php5dllts.dsp
@@ -2001,10 +2001,6 @@ SOURCE=..\ext\standard\url.c
# End Source File
# Begin Source File
-SOURCE=..\ext\standard\url_scanner.c
-# End Source File
-# Begin Source File
-
SOURCE=..\ext\standard\url_scanner_ex.c
# ADD CPP /W2
# End Source File
@@ -2199,10 +2195,6 @@ SOURCE=..\ext\standard\url.h
# End Source File
# Begin Source File
-SOURCE=..\ext\standard\url_scanner.h
-# End Source File
-# Begin Source File
-
SOURCE=..\ext\standard\url_scanner_ex.h
# End Source File
# End Group
diff --git a/win32/php5dllts.rc2 b/win32/php5dllts.rc2
index af098b089..b05f0af0d 100644
--- a/win32/php5dllts.rc2
+++ b/win32/php5dllts.rc2
@@ -1,61 +1,61 @@
-//
-// php5dllts.RC2 - resources Microsoft Visual C++ does not edit directly
-//
-
-#ifdef APSTUDIO_INVOKED
- #error this file is not editable by Microsoft Visual C++
-#endif //APSTUDIO_INVOKED
-
-
-/////////////////////////////////////////////////////////////////////////////
-// Add manually edited resources here...
-#include "../main/php_version.h"
-
-#define XSTRVER4(maj, min, rel, build) #maj "." #min "." #rel "." #build
-#define XSTRVER3(maj, min, rel) #maj "." #min "." #rel
-#define STRVER4(maj, min, rel, build) XSTRVER4(maj, min, rel, build)
-#define STRVER3(maj, min, rel) XSTRVER3(maj, min, rel)
-
-#ifndef _MAC
-//Version
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION PHP_MAJOR_VERSION,PHP_MINOR_VERSION,PHP_RELEASE_VERSION,PHP_RELEASE_VERSION
- PRODUCTVERSION PHP_MAJOR_VERSION,PHP_MINOR_VERSION,PHP_RELEASE_VERSION,0
- FILEFLAGSMASK 0x3fL
-#ifdef _DEBUG
- FILEFLAGS VS_FF_DEBUG
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS VOS__WINDOWS32
- FILETYPE VFT_DLL
- FILESUBTYPE VFT2_UNKNOWN
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "040904b0"
- BEGIN
- VALUE "Comments", "\0"
- VALUE "CompanyName", "The PHP Group\0"
- VALUE "FileDescription", "PHP Script Interpreter\0"
- VALUE "FileVersion", STRVER4(PHP_MAJOR_VERSION, PHP_MINOR_VERSION, PHP_RELEASE_VERSION, PHP_RELEASE_VERSION)
- VALUE "InternalName", "php\0"
- VALUE "LegalCopyright", "Copyright © 1997-2007 The PHP Group\0"
- VALUE "LegalTrademarks", "php\0"
- VALUE "OriginalFilename", "php5ts.dll\0"
- VALUE "PrivateBuild", "\0"
- VALUE "ProductName", "PHP Thread Safe\0"
- VALUE "ProductVersion", STRVER3(PHP_MAJOR_VERSION, PHP_MINOR_VERSION, PHP_RELEASE_VERSION)
- VALUE "SpecialBuild", PHP_EXTRA_VERSION "\0"
- VALUE "URL", "http://www.php.net"
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x409, 1200
- END
-END
-
-#endif // !_MAC
-
-/////////////////////////////////////////////////////////////////////////////
+//
+// php5dllts.RC2 - resources Microsoft Visual C++ does not edit directly
+//
+
+#ifdef APSTUDIO_INVOKED
+ #error this file is not editable by Microsoft Visual C++
+#endif //APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Add manually edited resources here...
+#include "../main/php_version.h"
+
+#define XSTRVER4(maj, min, rel, build) #maj "." #min "." #rel "." #build
+#define XSTRVER3(maj, min, rel) #maj "." #min "." #rel
+#define STRVER4(maj, min, rel, build) XSTRVER4(maj, min, rel, build)
+#define STRVER3(maj, min, rel) XSTRVER3(maj, min, rel)
+
+#ifndef _MAC
+//Version
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION PHP_MAJOR_VERSION,PHP_MINOR_VERSION,PHP_RELEASE_VERSION,PHP_RELEASE_VERSION
+ PRODUCTVERSION PHP_MAJOR_VERSION,PHP_MINOR_VERSION,PHP_RELEASE_VERSION,0
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS VS_FF_DEBUG
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS VOS__WINDOWS32
+ FILETYPE VFT_DLL
+ FILESUBTYPE VFT2_UNKNOWN
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "Comments", "\0"
+ VALUE "CompanyName", "The PHP Group\0"
+ VALUE "FileDescription", "PHP Script Interpreter\0"
+ VALUE "FileVersion", STRVER4(PHP_MAJOR_VERSION, PHP_MINOR_VERSION, PHP_RELEASE_VERSION, PHP_RELEASE_VERSION)
+ VALUE "InternalName", "php\0"
+ VALUE "LegalCopyright", "Copyright © 1997-2007 The PHP Group\0"
+ VALUE "LegalTrademarks", "php\0"
+ VALUE "OriginalFilename", "php5ts.dll\0"
+ VALUE "PrivateBuild", "\0"
+ VALUE "ProductName", "PHP Thread Safe\0"
+ VALUE "ProductVersion", STRVER3(PHP_MAJOR_VERSION, PHP_MINOR_VERSION, PHP_RELEASE_VERSION)
+ VALUE "SpecialBuild", PHP_EXTRA_VERSION "\0"
+ VALUE "URL", "http://www.php.net"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+#endif // !_MAC
+
+/////////////////////////////////////////////////////////////////////////////
diff --git a/win32/php5ts_cli.rc2 b/win32/php5ts_cli.rc2
index 130759ab6..517bd4ab3 100644
--- a/win32/php5ts_cli.rc2
+++ b/win32/php5ts_cli.rc2
@@ -1,61 +1,61 @@
-//
-// php5dllts.RC2 - resources Microsoft Visual C++ does not edit directly
-//
-
-#ifdef APSTUDIO_INVOKED
- #error this file is not editable by Microsoft Visual C++
-#endif //APSTUDIO_INVOKED
-
-
-/////////////////////////////////////////////////////////////////////////////
-// Add manually edited resources here...
-#include "../main/php_version.h"
-
-#define XSTRVER4(maj, min, rel, build) #maj "." #min "." #rel "." #build
-#define XSTRVER3(maj, min, rel) #maj "." #min "." #rel
-#define STRVER4(maj, min, rel, build) XSTRVER4(maj, min, rel, build)
-#define STRVER3(maj, min, rel) XSTRVER3(maj, min, rel)
-
-#ifndef _MAC
-//Version
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION PHP_MAJOR_VERSION,PHP_MINOR_VERSION,PHP_RELEASE_VERSION,PHP_RELEASE_VERSION
- PRODUCTVERSION PHP_MAJOR_VERSION,PHP_MINOR_VERSION,PHP_RELEASE_VERSION,0
- FILEFLAGSMASK 0x3fL
-#ifdef _DEBUG
- FILEFLAGS VS_FF_DEBUG
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS VOS__WINDOWS32
- FILETYPE VFT_APP
- FILESUBTYPE VFT2_UNKNOWN
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "040904b0"
- BEGIN
- VALUE "Comments", "\0"
- VALUE "CompanyName", "The PHP Group\0"
- VALUE "FileDescription", "PHP Script Interpreter\0"
- VALUE "FileVersion", STRVER4(PHP_MAJOR_VERSION, PHP_MINOR_VERSION, PHP_RELEASE_VERSION, PHP_RELEASE_VERSION)
- VALUE "InternalName", "php-cli\0"
- VALUE "LegalCopyright", "Copyright © 1997-2006 The PHP Group\0"
- VALUE "LegalTrademarks", "php\0"
- VALUE "OriginalFilename", "php.exe\0"
- VALUE "PrivateBuild", "\0"
- VALUE "ProductName", "PHP Thread Safe Command Line Interface\0"
- VALUE "ProductVersion", STRVER3(PHP_MAJOR_VERSION, PHP_MINOR_VERSION, PHP_RELEASE_VERSION)
- VALUE "SpecialBuild", PHP_EXTRA_VERSION "\0"
- VALUE "URL", "http://www.php.net"
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x409, 1200
- END
-END
-
-#endif // !_MAC
-
-/////////////////////////////////////////////////////////////////////////////
+//
+// php5dllts.RC2 - resources Microsoft Visual C++ does not edit directly
+//
+
+#ifdef APSTUDIO_INVOKED
+ #error this file is not editable by Microsoft Visual C++
+#endif //APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Add manually edited resources here...
+#include "../main/php_version.h"
+
+#define XSTRVER4(maj, min, rel, build) #maj "." #min "." #rel "." #build
+#define XSTRVER3(maj, min, rel) #maj "." #min "." #rel
+#define STRVER4(maj, min, rel, build) XSTRVER4(maj, min, rel, build)
+#define STRVER3(maj, min, rel) XSTRVER3(maj, min, rel)
+
+#ifndef _MAC
+//Version
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION PHP_MAJOR_VERSION,PHP_MINOR_VERSION,PHP_RELEASE_VERSION,PHP_RELEASE_VERSION
+ PRODUCTVERSION PHP_MAJOR_VERSION,PHP_MINOR_VERSION,PHP_RELEASE_VERSION,0
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS VS_FF_DEBUG
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS VOS__WINDOWS32
+ FILETYPE VFT_APP
+ FILESUBTYPE VFT2_UNKNOWN
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "Comments", "\0"
+ VALUE "CompanyName", "The PHP Group\0"
+ VALUE "FileDescription", "PHP Script Interpreter\0"
+ VALUE "FileVersion", STRVER4(PHP_MAJOR_VERSION, PHP_MINOR_VERSION, PHP_RELEASE_VERSION, PHP_RELEASE_VERSION)
+ VALUE "InternalName", "php-cli\0"
+ VALUE "LegalCopyright", "Copyright © 1997-2006 The PHP Group\0"
+ VALUE "LegalTrademarks", "php\0"
+ VALUE "OriginalFilename", "php.exe\0"
+ VALUE "PrivateBuild", "\0"
+ VALUE "ProductName", "PHP Thread Safe Command Line Interface\0"
+ VALUE "ProductVersion", STRVER3(PHP_MAJOR_VERSION, PHP_MINOR_VERSION, PHP_RELEASE_VERSION)
+ VALUE "SpecialBuild", PHP_EXTRA_VERSION "\0"
+ VALUE "URL", "http://www.php.net"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+#endif // !_MAC
+
+/////////////////////////////////////////////////////////////////////////////
diff --git a/win32/php_win32_globals.h b/win32/php_win32_globals.h
index a7cb068f5..9d0d653b1 100755
--- a/win32/php_win32_globals.h
+++ b/win32/php_win32_globals.h
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_win32_globals.h,v 1.4.2.1.2.3.2.2 2008/12/31 11:15:49 sebastian Exp $ */
+/* $Id: php_win32_globals.h 272370 2008-12-31 11:15:49Z sebastian $ */
#ifndef PHP_WIN32_GLOBALS_H
#define PHP_WIN32_GLOBALS_H
diff --git a/win32/readdir.c b/win32/readdir.c
index 67bb8ee73..52ebe2fd0 100644
--- a/win32/readdir.c
+++ b/win32/readdir.c
@@ -4,7 +4,7 @@
#include "php.h"
#include "readdir.h"
-
+#include "TSRM.h"
/**********************************************************************
* Implement dirent-style opendir/readdir/rewinddir/closedir on Win32
*
@@ -25,14 +25,20 @@ DIR *opendir(const char *dir)
char *filespec;
HANDLE handle;
int index;
+ char resolved_path_buff[MAXPATHLEN];
+ TSRMLS_FETCH();
+
+ if (!VCWD_REALPATH(dir, resolved_path_buff)) {
+ return NULL;
+ }
- filespec = (char *)malloc(strlen(dir) + 2 + 1);
- strcpy(filespec, dir);
+ filespec = (char *)malloc(strlen(resolved_path_buff) + 2 + 1);
+ strcpy(filespec, resolved_path_buff);
index = strlen(filespec) - 1;
if (index >= 0 && (filespec[index] == '/' ||
(filespec[index] == '\\' && (index == 0 || !IsDBCSLeadByte(filespec[index-1])))))
filespec[index] = '\0';
- strcat(filespec, "/*");
+ strcat(filespec, "\\*");
dp = (DIR *) malloc(sizeof(DIR));
dp->offset = 0;
@@ -40,7 +46,7 @@ DIR *opendir(const char *dir)
if ((handle = FindFirstFile(filespec, &(dp->fileinfo))) == INVALID_HANDLE_VALUE) {
DWORD err = GetLastError();
- if (err == ERROR_NO_MORE_FILES) {
+ if (err == ERROR_NO_MORE_FILES || err == ERROR_FILE_NOT_FOUND) {
dp->finished = 1;
} else {
free(dp);
@@ -48,7 +54,7 @@ DIR *opendir(const char *dir)
return NULL;
}
}
- dp->dir = strdup(dir);
+ dp->dir = strdup(resolved_path_buff);
dp->handle = handle;
free(filespec);
@@ -108,7 +114,11 @@ int closedir(DIR *dp)
{
if (!dp)
return 0;
- FindClose(dp->handle);
+ /* It is valid to scan an empty directory but we have an invalid
+ handle in this case (no first file found). */
+ if (dp->handle != INVALID_HANDLE_VALUE) {
+ FindClose(dp->handle);
+ }
if (dp->dir)
free(dp->dir);
if (dp)
diff --git a/win32/registry.c b/win32/registry.c
index d5f84af59..77089ba6a 100644
--- a/win32/registry.c
+++ b/win32/registry.c
@@ -168,6 +168,10 @@ void UpdateIniFromRegistry(char *path TSRMLS_DC)
int path_len;
HashTable **pht;
+ if(!path) {
+ return;
+ }
+
if (!PW32G(registry_directories)) {
PW32G(registry_directories) = (HashTable*)malloc(sizeof(HashTable));
zend_hash_init(PW32G(registry_directories), 0, NULL, delete_internal_hashtable, 1);
diff --git a/win32/resource.h b/win32/resource.h
index 0c58f6908..3e7e4c0ed 100644
--- a/win32/resource.h
+++ b/win32/resource.h
@@ -1,15 +1,15 @@
-//{{NO_DEPENDENCIES}}
-// Microsoft Developer Studio generated include file.
-// Used by php5dllts.rc
-//
-
-// Next default values for new objects
-//
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 101
-#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1000
-#define _APS_NEXT_SYMED_VALUE 101
-#endif
-#endif
+//{{NO_DEPENDENCIES}}
+// Microsoft Developer Studio generated include file.
+// Used by php5dllts.rc
+//
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 101
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1000
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/win32/select.c b/win32/select.c
index 073e1b0ce..26f729462 100644
--- a/win32/select.c
+++ b/win32/select.c
@@ -21,7 +21,7 @@
#ifdef PHP_WIN32
-/* $Id: select.c,v 1.10.2.2.2.2.2.2 2008/12/31 11:15:49 sebastian Exp $ */
+/* $Id: select.c 272370 2008-12-31 11:15:49Z sebastian $ */
/* Win32 select() will only work with sockets, so we roll our own implementation here.
* - If you supply only sockets, this simply passes through to winsock select().
diff --git a/win32/select.h b/win32/select.h
index b6d632d1a..7670f57ea 100644
--- a/win32/select.h
+++ b/win32/select.h
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: select.h,v 1.4.2.1.2.1.2.2 2008/12/31 11:15:49 sebastian Exp $ */
+/* $Id: select.h 272370 2008-12-31 11:15:49Z sebastian $ */
PHPAPI int php_select(int max_fd, fd_set *rfds, fd_set *wfds, fd_set *efds, struct timeval *tv);
diff --git a/win32/sendmail.c b/win32/sendmail.c
index 4109d57cf..13d425d17 100644
--- a/win32/sendmail.c
+++ b/win32/sendmail.c
@@ -17,7 +17,7 @@
*
*/
-/* $Id: sendmail.c,v 1.65.2.2.2.1 2007/02/24 02:17:28 helly Exp $ */
+/* $Id: sendmail.c 287783 2009-08-26 21:59:54Z pajoye $ */
#include "php.h" /*php specific */
#include <stdio.h>
@@ -37,6 +37,7 @@
#endif /* NETWARE */
#include "sendmail.h"
#include "php_ini.h"
+#include "inet.h"
#if HAVE_PCRE || HAVE_BUNDLED_PCRE
#include "ext/pcre/php_pcre.h"
@@ -421,7 +422,7 @@ static int SendText(char *RPath, char *Subject, char *mailTo, char *mailCc, char
}
SMTP_SKIP_SPACE(RPath);
- snprintf(Buffer, MAIL_BUFFER_SIZE, "MAIL FROM:<%s>\r\n", RPath);
+ FormatEmailAddress(Buffer, RPath, "MAIL FROM:<%s>\r\n");
if ((res = Post(Buffer)) != SUCCESS) {
return (res);
}
@@ -436,7 +437,7 @@ static int SendText(char *RPath, char *Subject, char *mailTo, char *mailCc, char
while (token != NULL)
{
SMTP_SKIP_SPACE(token);
- snprintf(Buffer, MAIL_BUFFER_SIZE, "RCPT TO:<%s>\r\n", token);
+ FormatEmailAddress(Buffer, token, "RCPT TO:<%s>\r\n");
if ((res = Post(Buffer)) != SUCCESS) {
efree(tempMailTo);
return (res);
@@ -457,7 +458,7 @@ static int SendText(char *RPath, char *Subject, char *mailTo, char *mailCc, char
while (token != NULL)
{
SMTP_SKIP_SPACE(token);
- snprintf(Buffer, MAIL_BUFFER_SIZE, "RCPT TO:<%s>\r\n", token);
+ FormatEmailAddress(Buffer, token, "RCPT TO:<%s>\r\n");
if ((res = Post(Buffer)) != SUCCESS) {
efree(tempMailTo);
return (res);
@@ -487,7 +488,7 @@ static int SendText(char *RPath, char *Subject, char *mailTo, char *mailCc, char
while (token != NULL)
{
SMTP_SKIP_SPACE(token);
- snprintf(Buffer, MAIL_BUFFER_SIZE, "RCPT TO:<%s>\r\n", token);
+ FormatEmailAddress(Buffer, token, "RCPT TO:<%s>\r\n");
if ((res = Post(Buffer)) != SUCCESS) {
efree(tempMailTo);
return (res);
@@ -512,7 +513,7 @@ static int SendText(char *RPath, char *Subject, char *mailTo, char *mailCc, char
while (token != NULL)
{
SMTP_SKIP_SPACE(token);
- snprintf(Buffer, MAIL_BUFFER_SIZE, "RCPT TO:<%s>\r\n", token);
+ FormatEmailAddress(Buffer, token, "RCPT TO:<%s>\r\n");
if ((res = Post(Buffer)) != SUCCESS) {
efree(tempMailTo);
return (res);
@@ -545,7 +546,7 @@ static int SendText(char *RPath, char *Subject, char *mailTo, char *mailCc, char
while (token != NULL)
{
SMTP_SKIP_SPACE(token);
- snprintf(Buffer, MAIL_BUFFER_SIZE, "RCPT TO:<%s>\r\n", token);
+ FormatEmailAddress(Buffer, token, "RCPT TO:<%s>\r\n");
if ((res = Post(Buffer)) != SUCCESS) {
efree(tempMailTo);
return (res);
@@ -765,16 +766,52 @@ PostHeader_outofmem:
static int MailConnect()
{
- int res;
+ int res, namelen;
short portnum;
+ struct hostent *ent;
+ IN_ADDR addr;
+#ifdef HAVE_IPV6
+ IN6_ADDR addr6;
+#endif
/* Create Socket */
- if ((sc = socket(PF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET)
+ if ((sc = socket(PF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET) {
return (FAILED_TO_OBTAIN_SOCKET_HANDLE);
+ }
/* Get our own host name */
- if (gethostname(LocalHost, HOST_NAME_LEN))
+ if (gethostname(LocalHost, HOST_NAME_LEN)) {
+ return (FAILED_TO_GET_HOSTNAME);
+ }
+
+ ent = gethostbyname(LocalHost);
+
+ if (!ent) {
return (FAILED_TO_GET_HOSTNAME);
+ }
+
+ namelen = strlen(ent->h_name);
+
+#ifdef HAVE_IPV6
+ if (inet_pton(AF_INET, ent->h_name, &addr) == 1 || inet_pton(AF_INET6, ent->h_name, &addr6) == 1)
+#else
+ if (inet_pton(AF_INET, ent->h_name, &addr) == 1)
+#endif
+ {
+ if (namelen + 2 >= HOST_NAME_LEN) {
+ return (FAILED_TO_GET_HOSTNAME);
+ }
+
+ strcpy(LocalHost, "[");
+ strcpy(LocalHost + 1, ent->h_name);
+ strcpy(LocalHost + namelen + 1, "]");
+ } else {
+ if (namelen >= HOST_NAME_LEN) {
+ return (FAILED_TO_GET_HOSTNAME);
+ }
+
+ strcpy(LocalHost, ent->h_name);
+ }
/* Resolve the servers IP */
/*
@@ -794,8 +831,9 @@ static int MailConnect()
sock_in.sin_port = htons(portnum);
sock_in.sin_addr.S_un.S_addr = GetAddr(MailHost);
- if (connect(sc, (LPSOCKADDR) & sock_in, sizeof(sock_in)))
+ if (connect(sc, (LPSOCKADDR) & sock_in, sizeof(sock_in))) {
return (FAILED_TO_CONNECT);
+ }
/* receive Server welcome message */
res = Ack(NULL);
@@ -922,3 +960,30 @@ static unsigned long GetAddr(LPSTR szHost)
}
return (lAddr);
} /* end GetAddr() */
+
+
+/*********************************************************************
+// Name: int FormatEmailAddress
+// Input:
+// Output:
+// Description: Formats the email address to remove any content ouside
+// of the angle brackets < > as per RFC 2821.
+//
+// Returns the invalidly formatted mail address if the < > are
+// unbalanced (the SMTP server should reject it if it's out of spec.)
+//
+// Author/Date: garretts 08/18/2009
+// History:
+//********************************************************************/
+static int FormatEmailAddress(char* Buf, char* EmailAddress, char* FormatString) {
+ char *tmpAddress1, *tmpAddress2;
+ int result;
+
+ if( (tmpAddress1 = strchr(EmailAddress, '<')) && (tmpAddress2 = strchr(tmpAddress1, '>')) ) {
+ *tmpAddress2 = 0; // terminate the string temporarily.
+ result = snprintf(Buf, MAIL_BUFFER_SIZE, FormatString , tmpAddress1+1);
+ *tmpAddress2 = '>'; // put it back the way it was.
+ return result;
+ }
+ return snprintf(Buf, MAIL_BUFFER_SIZE , FormatString , EmailAddress );
+} /* end FormatEmailAddress() */
diff --git a/win32/sendmail.h b/win32/sendmail.h
index 0ec916d6c..0a7698e2f 100644
--- a/win32/sendmail.h
+++ b/win32/sendmail.h
@@ -47,4 +47,5 @@ static int PostHeader(char *RPath, char *Subject, char *mailTo, char *xheaders T
static int Post(LPCSTR msg);
static int Ack(char **server_response);
static unsigned long GetAddr(LPSTR szHost);
+static int FormatEmailAddress(char* Buf, char* EmailAddress, char* FormatString);
#endif /* sendmail_h */
diff --git a/win32/sockets.c b/win32/sockets.c
index 003f25baf..4b3d274e0 100644
--- a/win32/sockets.c
+++ b/win32/sockets.c
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: sockets.c,v 1.1.2.2 2009/01/23 15:49:49 kalle Exp $ */
+/* $Id: sockets.c 274392 2009-01-23 15:49:49Z kalle $ */
/* Code originally from ext/sockets */
diff --git a/win32/sockets.h b/win32/sockets.h
index 8614614f3..633137dd9 100644
--- a/win32/sockets.h
+++ b/win32/sockets.h
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: sockets.h,v 1.1.2.2 2009/01/23 15:49:49 kalle Exp $ */
+/* $Id: sockets.h 274392 2009-01-23 15:49:49Z kalle $ */
/* Code originally from ext/sockets */
diff --git a/win32/syslog.h b/win32/syslog.h
index 05ef02f41..1270a9524 100644
--- a/win32/syslog.h
+++ b/win32/syslog.h
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: syslog.h,v 1.10.2.1.2.1.2.2 2008/12/31 11:15:49 sebastian Exp $ */
+/* $Id: syslog.h 272370 2008-12-31 11:15:49Z sebastian $ */
#ifndef SYSLOG_H
#define SYSLOG_H
diff --git a/win32/time.c b/win32/time.c
index b89064e03..cfd4394d1 100644
--- a/win32/time.c
+++ b/win32/time.c
@@ -11,7 +11,7 @@
*
*****************************************************************************/
-/* $Id: time.c,v 1.10.6.3 2009/01/19 02:35:21 pajoye Exp $ */
+/* $Id: time.c 273823 2009-01-19 02:35:22Z pajoye $ */
/**
*
diff --git a/win32/winutil.c b/win32/winutil.c
index ee1e700ce..244ecff3d 100644
--- a/win32/winutil.c
+++ b/win32/winutil.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: winutil.c,v 1.16.2.1.2.1.2.2 2008/12/31 11:15:49 sebastian Exp $ */
+/* $Id: winutil.c 272370 2008-12-31 11:15:49Z sebastian $ */
#include "php.h"