diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2013-03-14 05:42:27 +0000 |
---|---|---|
committer | <> | 2013-04-03 16:25:08 +0000 |
commit | c4dd7a1a684490673e25aaf4fabec5df138854c4 (patch) | |
tree | 4d57c44caae4480efff02b90b9be86f44bf25409 /win32/build | |
download | php2-master.tar.gz |
Imported from /home/lorry/working-area/delta_php2/php-5.4.13.tar.bz2.HEADphp-5.4.13master
Diffstat (limited to 'win32/build')
-rw-r--r-- | win32/build/DSP.README | 37 | ||||
-rw-r--r-- | win32/build/Makefile | 214 | ||||
-rw-r--r-- | win32/build/Makefile.phpize | 38 | ||||
-rw-r--r-- | win32/build/block.template.dsw | 15 | ||||
-rw-r--r-- | win32/build/buildconf.js | 274 | ||||
-rw-r--r-- | win32/build/config.w32 | 446 | ||||
-rw-r--r-- | win32/build/config.w32.h.in | 176 | ||||
-rw-r--r-- | win32/build/config.w32.phpize.in | 358 | ||||
-rw-r--r-- | win32/build/configure.bat | 2 | ||||
-rw-r--r-- | win32/build/configure.tail | 11 | ||||
-rw-r--r-- | win32/build/confutils.js | 2048 | ||||
-rw-r--r-- | win32/build/cvsclean.js | 120 | ||||
-rw-r--r-- | win32/build/deplister.c | 60 | ||||
-rw-r--r-- | win32/build/libs_version.txt | 16 | ||||
-rw-r--r-- | win32/build/mkdist.php | 548 | ||||
-rw-r--r-- | win32/build/php.ico | bin | 0 -> 1718 bytes | |||
-rw-r--r-- | win32/build/phpize.bat | 6 | ||||
-rw-r--r-- | win32/build/phpize.js.in | 260 | ||||
-rw-r--r-- | win32/build/projectgen.js | 625 | ||||
-rwxr-xr-x | win32/build/registersyslog.php | 44 | ||||
-rw-r--r-- | win32/build/svnclean.js | 120 | ||||
-rw-r--r-- | win32/build/template.dsp | 81 | ||||
-rw-r--r-- | win32/build/template.dsw | 63 | ||||
-rw-r--r-- | win32/build/template.rc | 87 | ||||
-rwxr-xr-x | win32/build/wsyslog.mc | 28 |
25 files changed, 5677 insertions, 0 deletions
diff --git a/win32/build/DSP.README b/win32/build/DSP.README new file mode 100644 index 0000000..c673657 --- /dev/null +++ b/win32/build/DSP.README @@ -0,0 +1,37 @@ +MSVC++ project file generation +============================== + +These files are only intended for use in debugging and profiling, +but can be used to create working binaries. However, they are very +unlikely to match the official PHP distributed binaries. + +With this in mind, the script will only generate basic .dsp files +for the modules that are currently configured. + +The switch for project file generation is a buildconf switch and +not a configure switch: + +> buildconf --add-project-files +> configure ... + +The resulting workspace files should appear at /win32/phpdll[ts].dsw +and (if any shared modules are configured) at /win32/php_modules.dsw, +after configure is run. + +If the .dsw files haven't generated in a sane way, the most likely reason +will be that the template files have become corrupted. They need DOS +line endings (CR/LF) in order to function. The affected files are: + +/win32/build/block.template.dsw +/win32/build/template.dsp +/win32/build/template.dsw + +Simply save them with DOS line endings, and bug it to me if basic +project file generation still fails (as in, you ran the command and +configure again after saving, and you have a working copy of MSVS +installed, but clicking on the workspace(s) doesn't give you anything). + +- Steph +sfox@php.net + +July 2008 diff --git a/win32/build/Makefile b/win32/build/Makefile new file mode 100644 index 0000000..e2d6254 --- /dev/null +++ b/win32/build/Makefile @@ -0,0 +1,214 @@ +# +----------------------------------------------------------------------+ +# | 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$ +# This is the makefile template for the win32 build + +CC="$(PHP_CL)" +LD="$(LINK)" +MC="$(MC)" +MT="$(MT)" +RE2C="$(RE2C)" +PGOMGR="$(PGOMGR)" +PHP_BUILD=$(PHP_BUILD) + +MCFILE=$(BUILD_DIR)\wsyslog.rc +BUILD_DIR_DEV_NAME=php-$(PHP_VERSION_STRING)-devel-$(PHP_COMPILER_SHORT)-$(PHP_ARCHITECTURE) +BUILD_DIR_DEV=$(BUILD_DIR)\$(BUILD_DIR_DEV_NAME) + +all: generated_files $(EXT_TARGETS) $(PECL_TARGETS) $(SAPI_TARGETS) + +build_dirs: $(BUILD_DIR) $(BUILD_DIRS_SUB) $(BUILD_DIR_DEV) + +!if $(RE2C) == "" +generated_files: build_dirs Zend\zend_ini_parser.c \ + Zend\zend_language_parser.c \ + $(PHPDEF) $(MCFILE) +!else +generated_files: build_dirs Zend\zend_ini_parser.c \ + Zend\zend_language_parser.c Zend\zend_ini_scanner.c \ + Zend\zend_language_scanner.c \ + $(PHPDEF) $(MCFILE) +!endif + +$(BUILD_DIR)\$(PHPDLL).def: $(PHP_DLL_DEF_SOURCES) + type $(PHP_DLL_DEF_SOURCES) > $(BUILD_DIR)\$(PHPDLL).def + +Zend\zend_ini_parser.c Zend\zend_ini_parser.h: Zend\zend_ini_parser.y + $(BISON) --output=Zend/zend_ini_parser.c -v -d -p ini_ Zend/zend_ini_parser.y + +Zend\zend_language_parser.c Zend\zend_language_parser.h: Zend\zend_language_parser.y + $(BISON) --output=Zend/zend_language_parser.c -v -d -p zend Zend/zend_language_parser.y + +!if $(RE2C) != "" +Zend\zend_ini_scanner.c: Zend\zend_ini_scanner.l + $(RE2C) $(RE2C_FLAGS) --case-inverted -cbdFt Zend/zend_ini_scanner_defs.h -oZend/zend_ini_scanner.c Zend/zend_ini_scanner.l + +Zend\zend_language_scanner.c: Zend\zend_language_scanner.l + $(RE2C) $(RE2C_FLAGS) --case-inverted -cbdFt Zend/zend_language_scanner_defs.h -oZend/zend_language_scanner.c Zend/zend_language_scanner.l +!endif + +!if $(PGOMGR) != "" +PHP5_PGD_OPTION=/PGD:$(PGOPGD_DIR)\php5.pgd +!else +PHP5_PGD_OPTION= +!endif + +PHPDLL_RES=$(BUILD_DIR)\$(PHPDLL).res + +$(MCFILE): win32\build\wsyslog.mc + $(MC) -h win32\ -r $(BUILD_DIR)\ -x $(BUILD_DIR)\ win32\build\wsyslog.mc + +# $(RC) /fo $(MCFILE) $(BUILD_DIR)\wsyslog.rc + +!if $(MT) == "" +_VC_MANIFEST_EMBED_EXE= +_VC_MANIFEST_EMBED_DLL= +!else +_VC_MANIFEST_EMBED_EXE= if exist $@.manifest $(MT) -nologo -manifest $@.manifest -outputresource:$@;1 +_VC_MANIFEST_EMBED_DLL= if exist $@.manifest $(MT) -nologo -manifest $@.manifest -outputresource:$@;2 +!endif + +$(PHPDLL_RES): win32\build\template.rc + $(RC) /fo $(PHPDLL_RES) /d FILE_DESCRIPTION="\"PHP Script Interpreter\"" \ + /d FILE_NAME="\"$(PHPDLL)\"" /d PRODUCT_NAME="\"PHP Script Interpreter\"" \ + /I$(BUILD_DIR) /d MC_INCLUDE="\"$(MCFILE)\"" \ + win32\build\template.rc + +$(BUILD_DIR)\$(PHPDLL): generated_files $(PHPDEF) $(PHP_GLOBAL_OBJS) $(STATIC_EXT_OBJS) $(PHPDLL_RES) $(MCFILE) + @$(CC) $(PHP_GLOBAL_OBJS) $(STATIC_EXT_OBJS) $(STATIC_EXT_LIBS) $(LIBS) $(PHPDLL_RES) /link /out:$(BUILD_DIR)\$(PHPDLL) $(PHP5_PGD_OPTION) $(PHP_LDFLAGS) $(LDFLAGS) $(STATIC_EXT_LDFLAGS) + -@$(_VC_MANIFEST_EMBED_DLL) + +$(BUILD_DIR)\$(PHPLIB): $(BUILD_DIR)\$(PHPDLL) + +$(BUILD_DIR) $(BUILD_DIRS_SUB) $(BUILD_DIR_DEV): + @echo Recreating build dirs + @if not exist $(BUILD_DIR) mkdir $(BUILD_DIR) + @cd $(BUILD_DIR) + @for %D in ($(BUILD_DIRS_SUB)) do @if not exist %D @mkdir %D > NUL + @if not exist $(BUILD_DIR_DEV) @mkdir $(BUILD_DIR_DEV) > NUL + @cd "$(PHP_SRC_DIR)" + + +clean-sapi: + @echo Cleaning SAPI + @for %D in (_x $(EXT_TARGETS)) do @if exist $(BUILD_DIR)\%D @del /F /Q $(BUILD_DIR)\%D > NUL + @for %D in (_x $(PECL_TARGETS)) do @if exist $(BUILD_DIR)\%D @del /F /Q $(BUILD_DIR)\%D > NUL + @for %D in (_x $(SAPI_TARGETS)) do @if exist $(BUILD_DIR)\%D @del /F /Q $(BUILD_DIR)\%D > NUL + -@del /F /Q $(BUILD_DIR)\$(PHPDLL) + +clean: clean-sapi + @echo Cleaning distribution build dirs + @cd $(BUILD_DIR) + @for %D in (_x $(BUILD_DIRS_SUB)) do @if exist %D @del /F /Q %D\*.* > NUL + @cd "$(PHP_SRC_DIR)" + -@del /F /Q $(BUILD_DIR)\*.res $(BUILD_DIR)\*.lib $(BUILD_DIR)\*.ilk $(BUILD_DIR)\*.pdb $(BUILD_DIR)\*.exp $(PHPDEF) $(BUILD_DIR)\php-$(PHP_VERSION_STRING)-Win32.zip $(BUILD_DIR)\pecl-$(PHP_VERSION_STRING)-Win32.zip > NUL + -rd /s /q $(BUILD_DIR)\php-$(PHP_VERSION_STRING) + +clean-pecl: + @echo Cleaning PECL targets only + -rd /s /q $(BUILD_DIR)\pecl + +clean-all: + @echo Cleaning standard build dirs + @cd $(BUILD_DIR) + @for %D in (_x $(BUILD_DIRS_SUB)) do @if exist %D @rd /s /q %D + @cd "$(PHP_SRC_DIR)" + -@del /f /q $(BUILD_DIR)\*.res $(BUILD_DIR)\*.lib $(BUILD_DIR)\*.ilk $(BUILD_DIR)\*.pdb $(BUILD_DIR)\*.exp $(PHPDEF) $(BUILD_DIR)\*.rc $(BUILD_DIR)\*.manifest $(BUILD_DIR)\*.dbg $(BUILD_DIR)\*.bin $(BUILD_DIR)\php*.dll $(BUILD_DIR)\php*.exe > NUL + +clean-pgo: clean-all + -rd /s /q $(BUILD_DIR)\php-$(PHP_VERSION_STRING) + -rd /s /q $(BUILD_DIR)\pecl-$(PHP_VERSION_STRING) + -rd /s /q $(BUILD_DIR)\php-test-pack-$(PHP_VERSION_STRING) + -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 + -del /f /q $(BUILD_DIR)\php-test-pack-$(PHP_VERSION_STRING).zip + +test: + "$(BUILD_DIR)\php.exe" -d open_basedir= -d output_buffering=0 run-tests.php $(TESTS) -p "$(BUILD_DIR)\php.exe" + +build-snap: generated_files + SET PATH=$(PATH);$(PHP_BUILD)\bin + @$(MAKE) "$(BUILD_DIR)\$(PHPDLL)" + -for %T in ($(SAPI_TARGETS)) do $(MAKE) /I /nologo "%T" + -for %T in ($(EXT_TARGETS)) do $(MAKE) /I /nologo "%T" + -for %T in ($(PECL_TARGETS)) do $(MAKE) /I /nologo "%T" + +build-dist: $(BUILD_DIR)\deplister.exe + -rd /s /q $(BUILD_DIR)\php-$(PHP_VERSION_STRING) + -rd /s /q $(BUILD_DIR)\pecl-$(PHP_VERSION_STRING) + -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)" "$(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 ..\.. + cd $(BUILD_DIR)\pecl-$(PHP_VERSION_STRING) + -$(ZIP) -9 -q -r ..\pecl-$(PHP_VERSION_STRING)$(PHP_ZTS_ARCHIVE_POSTFIX)-Win32-$(PHP_COMPILER_SHORT)-$(PHP_ARCHITECTURE).zip . + cd ..\.. + cd $(BUILD_DIR)\php-test-pack-$(PHP_VERSION_STRING) + -$(ZIP) -9 -q -r ..\php-test-pack-$(PHP_VERSION_STRING).zip . + cd ..\.. + cd $(BUILD_DIR) + -$(ZIP) -9 -q php-debug-pack-$(PHP_VERSION_STRING)$(PHP_ZTS_ARCHIVE_POSTFIX)-Win32-$(PHP_COMPILER_SHORT)-$(PHP_ARCHITECTURE).zip *.pdb + cd + cd + -$(ZIP) -9 -q -r php-devel-pack-$(PHP_VERSION_STRING)$(PHP_ZTS_ARCHIVE_POSTFIX)-Win32-$(PHP_COMPILER_SHORT)-$(PHP_ARCHITECTURE).zip $(BUILD_DIR_DEV_NAME) + cd ..\.. + +dist: all build-dist +snap: build-snap build-devel build-dist + +$(BUILD_DIR)\deplister.exe: win32\build\deplister.c + $(PHP_CL) /Fo$(BUILD_DIR)\ /Fd$(BUILD_DIR)\ /Fp$(BUILD_DIR)\ /FR$(BUILD_DIR) /Fe$(BUILD_DIR)\deplister.exe win32\build\deplister.c imagehlp.lib + +msi-installer: dist + $(BUILD_DIR)\php.exe ..\php-installer\build-installer.php "$(BUILD_DIR)" "$(PHPDLL)" "$(SAPI_TARGETS)" "$(EXT_TARGETS)" "$(PECL_TARGETS)" + +# need to redirect, since INSTALL is a file in the root... +install: really-install install-sdk + +build-lib: + @if not exist $(BUILD_DIR_DEV)\lib mkdir $(BUILD_DIR_DEV)\lib >nul + @copy $(BUILD_DIR)\$(PHPLIB) $(BUILD_DIR_DEV)\lib /y >nul + +build-devel: build-headers build-lib + @if not exist $(BUILD_DIR_DEV)\script mkdir $(BUILD_DIR_DEV)\script >nul + @if not exist $(BUILD_DIR_DEV)\build mkdir $(BUILD_DIR_DEV)\build >nul + @copy win32\build\confutils.js $(BUILD_DIR_DEV)\script\ /y >nul + @copy win32\build\configure.tail $(BUILD_DIR_DEV)\script\ /y >nul + @copy win32\build\config.w32.phpize.in $(BUILD_DIR_DEV)\script\ /y >nul + @copy win32\build\Makefile.phpize $(BUILD_DIR_DEV)\script\ /y >nul + @copy win32\build\phpize.bat $(BUILD_DIR_DEV)\ /y >nul + @copy win32\build\template.rc $(BUILD_DIR_DEV)\build\ /y >nul + @copy $(BUILD_DIR)\devel\config.phpize.js $(BUILD_DIR_DEV)\script\ /y >nul + @copy $(BUILD_DIR)\devel\phpize.js $(BUILD_DIR_DEV)\script\ /y >nul + @copy $(BUILD_DIR)\devel\ext_deps.js $(BUILD_DIR_DEV)\script\ /y >nul + +install-sdk: build-devel + @xcopy /Q /Y /E /I $(BUILD_DIR_DEV)\* $(PHP_PREFIX)\SDK + +really-install: + @if not exist $(PHP_PREFIX) mkdir $(PHP_PREFIX) + @echo Installing files under $(PHP_PREFIX) + @copy $(BUILD_DIR)\*.exe $(PHP_PREFIX) /y >nul + @copy $(BUILD_DIR)\*.dll $(PHP_PREFIX) /y >nul + @echo Registering event source with syslog (requires admin rights) + @echo It's okay for this step to fail: + -$(PHP_PREFIX)\php.exe -n -dextension_dir=$(PHP_PREFIX) win32/build/registersyslog.php $(PHP_PREFIX)\$(PHPDLL) + diff --git a/win32/build/Makefile.phpize b/win32/build/Makefile.phpize new file mode 100644 index 0000000..17cfc90 --- /dev/null +++ b/win32/build/Makefile.phpize @@ -0,0 +1,38 @@ +CC="$(PHP_CL)"
+LD="$(LINK)"
+MC="$(MC)"
+MT="$(MT)"
+
+PHPSDK_DIR=$(PHP_DIR)
+PHPLIB=$(PHPSDK_DIR)\lib\$(PHPLIB)
+LDFLAGS=/libpath:"$(PHPSDK_DIR)\lib\;$(PHPSDK_DIR)"
+
+CFLAGS=/nologo /FD $(BASE_INCLUDES) /D _WINDOWS /D ZEND_WIN32=1 /D PHP_WIN32=1 /D WIN32 /D_USE_32BIT_TIME_T=1 /D ZEND_WIN32_FORCE_INLINE /GF /D ZEND_DEBUG=0 /D ZTS=1 /D FD_SETSIZE=256
+CFLAGS_PHP=/D _USRDLL /D PHP5DLLTS_EXPORTS /D PHP_EXPORTS /D TSRM_EXPORTS /D SAPI_EXPORTS /D WINVER=0x500 /D COMPILE_DL_AJAXMIN
+
+all: $(EXT_TARGETS) $(PECL_TARGETS)
+
+build_dirs: $(BUILD_DIR) $(BUILD_DIRS_SUB)
+
+clean-pecl:
+ @echo Cleaning PECL targets only
+ -rd /s /q $(BUILD_DIR)\pecl
+
+clean-all:
+ @echo Cleaning standard build dirs
+ @for %D in (_x $(BUILD_DIRS_SUB)) do @if exist %D @rd /s /q %D
+ -@del /f /q $(BUILD_DIR)\*.res $(BUILD_DIR)\*.manifest $(BUILD_DIR)\*.lib $(BUILD_DIR)\*.ilk $(BUILD_DIR)\*.pdb $(BUILD_DIR)\*.exp $(PHPDEF) $(BUILD_DIR)\*.rc $(BUILD_DIR)\*.dbg $(BUILD_DIR)\*.bin $(BUILD_DIR)\php*.dll $(BUILD_DIR)\php*.exe > NUL
+
+clean: clean-pecl
+ @echo Cleaning distribution build dirs
+ @for %D in (_x $(BUILD_DIRS_SUB)) do @if exist %D @del /F /Q %D\*.* > NUL
+ -@del /F /Q $(BUILD_DIR)\*.res $(BUILD_DIR)\*.lib $(BUILD_DIR)\*.ilk $(BUILD_DIR)\*.pdb $(BUILD_DIR)\*.exp $(PHPDEF) $(BUILD_DIR)\php-$(PHP_VERSION_STRING)-Win32.zip $(BUILD_DIR)\pecl-$(PHP_VERSION_STRING)-Win32.zip > NUL
+
+!if $(MT) == ""
+_VC_MANIFEST_EMBED_EXE=
+_VC_MANIFEST_EMBED_DLL=
+!else
+_VC_MANIFEST_EMBED_EXE= if exist $@.manifest $(MT) -nologo -manifest $@.manifest -outputresource:$@;1
+_VC_MANIFEST_EMBED_DLL= if exist $@.manifest $(MT) -nologo -manifest $@.manifest -outputresource:$@;2
+!endif
+
diff --git a/win32/build/block.template.dsw b/win32/build/block.template.dsw new file mode 100644 index 0000000..2f2682d --- /dev/null +++ b/win32/build/block.template.dsw @@ -0,0 +1,15 @@ + +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 new file mode 100644 index 0000000..b4194ad --- /dev/null +++ b/win32/build/buildconf.js @@ -0,0 +1,274 @@ +/*
+ +----------------------------------------------------------------------+
+ | 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.WriteLine("MODE_PHPIZE=false;");
+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 new file mode 100644 index 0000000..1a4b834 --- /dev/null +++ b/win32/build/config.w32 @@ -0,0 +1,446 @@ +// vim:ft=javascript +// $Id$ +// "Master" config file; think of it as a configure.in +// equivalent. + +ARG_WITH('cygwin', 'Path to cygwin utilities on your system', '\\cygwin'); +PHP_CL = PATH_PROG('cl', null, 'PHP_CL'); +if (!PHP_CL) { + ERROR("MS C++ compiler is required"); +} + +/* For the record here: */ +// 1200 is VC6 +// 1300 is vs.net 2002 +// 1310 is vs.net 2003 +// 1400 is vs.net 2005 +// 1500 is vs.net 2008 +// 1600 is vs.net 2010 +// Which version of the compiler do we have? +VCVERS = probe_binary(PHP_CL).substr(0, 5).replace('.', ''); +STDOUT.WriteLine(" Detected compiler " + VC_VERSIONS[VCVERS]); + +if (VCVERS < 1500) { + ERROR("Unsupported MS C++ Compiler, VC9 (2008) minimum is required"); +} + +AC_DEFINE('COMPILER', VC_VERSIONS[VCVERS], "Detected compiler version"); +DEFINE("PHP_COMPILER_SHORT", VC_VERSIONS_SHORT[VCVERS]); +AC_DEFINE('PHP_COMPILER_ID', VC_VERSIONS_SHORT[VCVERS], "Compiler compatibility ID"); + +// do we use x64 or 80x86 version of compiler? +X64 = probe_binary(PHP_CL, 64, null, 'PHP_CL'); +if (X64) { + STDOUT.WriteLine(" Detected 64-bit compiler"); +} else { + STDOUT.WriteLine(" Detected 32-bit compiler"); +} +AC_DEFINE('ARCHITECTURE', X64 ? 'x64' : 'x86', "Detected compiler architecture"); +DEFINE("PHP_ARCHITECTURE", X64 ? 'x64' : 'x86'); + +// cygwin now ships with link.exe. Avoid searching the cygwin path +// for this, as we want the MS linker, not the fileutil +PATH_PROG('link', WshShell.Environment("Process").Item("PATH")); +PATH_PROG('nmake'); + +// we don't want to define LIB, as that will override the default library path +// that is set in that env var +PATH_PROG('lib', null, 'MAKE_LIB'); +if (!PATH_PROG('bison')) { + ERROR('bison is required') +} + +// There's a minimum requirement for re2c.. +MINRE2C = "0.13.4"; + +RE2C = PATH_PROG('re2c'); +if (RE2C) { + var intvers, intmin; + var pattern = /\./g; + + RE2CVERS = probe_binary(RE2C, "version"); + STDOUT.WriteLine(' Detected re2c version ' + RE2CVERS); + + intvers = RE2CVERS.replace(pattern, '') - 0; + intmin = MINRE2C.replace(pattern, '') - 0; + + if (intvers < intmin) { + STDOUT.WriteLine('WARNING: The minimum RE2C version requirement is ' + MINRE2C); + STDOUT.WriteLine('Parsers will not be generated. Upgrade your copy at http://sf.net/projects/re2c'); + DEFINE('RE2C', ''); + } else { + DEFINE('RE2C_FLAGS', ''); + } +} else { + STDOUT.WriteLine('Parsers will not be regenerated'); +} +PATH_PROG('zip'); +PATH_PROG('lemon'); + +// avoid picking up midnight commander from cygwin +PATH_PROG('mc', WshShell.Environment("Process").Item("PATH")); + +// Try locating manifest tool +if (VCVERS > 1200) { + PATH_PROG('mt', WshShell.Environment("Process").Item("PATH")); +} + +// 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'); + } + PHP_OBJECT_OUT_DIR += '\\'; +} else if (X64) { + if (!FSO.FolderExists("x64")) { + FSO.CreateFolder("x64"); + } + PHP_OBJECT_OUT_DIR = 'x64\\'; +} + +ARG_ENABLE('debug', 'Compile with debugging symbols', "no"); +ARG_ENABLE('debug-pack', 'Release binaries with external debug symbols (--enable-debug must not be specified)', 'no'); +if (PHP_DEBUG == "yes" && PHP_DEBUG_PACK == "yes") { + ERROR("Use of both --enable-debug and --enable-debug-pack not allowed."); +} + +ARG_ENABLE('pgi', 'Generate PGO instrumented binaries', 'no'); +ARG_WITH('pgo', 'Compile optimized binaries using training data from folder', 'no'); +if (PHP_PGI == "yes" || PHP_PGO != "no") { + PGOMGR = PATH_PROG('pgomgr', WshShell.Environment("Process").Item("PATH")); + if (!PGOMGR) { + ERROR("--enable-pgi and --with-pgo options can only be used if PGO capable compiler is present."); + } + if (PHP_PGI == "yes" && PHP_PGO != "no") { + ERROR("Use of both --enable-pgi and --with-pgo not allowed."); + } +} + +ARG_ENABLE('zts', 'Thread safety', 'yes'); +// Configures the hard-coded installation dir +ARG_WITH('prefix', 'where PHP will be installed', ''); +if (PHP_PREFIX == '') { + PHP_PREFIX = "C:\\php"; + if (PHP_DEBUG == "yes") + PHP_PREFIX += "\\debug"; +} +DEFINE('PHP_PREFIX', PHP_PREFIX); + +DEFINE("BASE_INCLUDES", "/I . /I main /I Zend /I TSRM /I ext "); + +// CFLAGS for building the PHP dll +DEFINE("CFLAGS_PHP", "/D _USRDLL /D PHP5DLLTS_EXPORTS /D PHP_EXPORTS \ +/D LIBZEND_EXPORTS /D TSRM_EXPORTS /D SAPI_EXPORTS /D WINVER=0x500"); + +DEFINE('CFLAGS_PHP_OBJ', '$(CFLAGS_PHP) $(STATIC_EXT_CFLAGS)'); + +// General CFLAGS for building objects +DEFINE("CFLAGS", "/nologo /FD $(BASE_INCLUDES) /D _WINDOWS \ +/D ZEND_WIN32=1 /D PHP_WIN32=1 /D WIN32 /D _MBCS /W3 "); + +if (VCVERS < 1400) { + // Enable automatic precompiled headers + ADD_FLAG('CFLAGS', ' /YX '); + + if (PHP_DEBUG == "yes") { + // Set some debug/release specific options + ADD_FLAG('CFLAGS', ' /GZ '); + } +} + +if (VCVERS >= 1400) { + // fun stuff: MS deprecated ANSI stdio and similar functions + // disable annoying warnings. In addition, time_t defaults + // to 64-bit. Ask for 32-bit. + if (X64) { + ADD_FLAG('CFLAGS', ' /wd4996 /Wp64 '); + } else { + ADD_FLAG('CFLAGS', ' /wd4996 /D_USE_32BIT_TIME_T=1 '); + } + + if (PHP_DEBUG == "yes") { + // Set some debug/release specific options + ADD_FLAG('CFLAGS', ' /RTC1 '); + } +} + +ARG_WITH('mp', 'Tell VC9+ use up to [n,auto,disable] processes for compilation', 'auto'); +if (VCVERS >= 1500 && PHP_MP != 'disable') { + // no from disable-all + if(PHP_MP == 'auto' || PHP_MP == 'no') { + ADD_FLAG('CFLAGS', ' /MP '); + } else { + if(parseInt(PHP_MP) != 0) { + ADD_FLAG('CFLAGS', ' /MP'+ PHP_MP +' '); + } else { + STDOUT.WriteLine('WARNING: Invalid argument for MP: ' + PHP_MP); + } + } +} + +// General link flags +DEFINE("LDFLAGS", "/nologo /version:" + + PHP_VERSION + "." + PHP_MINOR_VERSION + "." + PHP_RELEASE_VERSION); + +// General DLL link flags +DEFINE("DLL_LDFLAGS", "/dll "); + +// PHP DLL link flags +DEFINE("PHP_LDFLAGS", "$(DLL_LDFLAGS)"); + +// General libs +// urlmon.lib ole32.lib oleaut32.lib uuid.lib gdi32.lib winspool.lib comdlg32.lib +DEFINE("LIBS", "kernel32.lib ole32.lib user32.lib advapi32.lib shell32.lib ws2_32.lib Dnsapi.lib"); + +// Set some debug/release specific options +if (PHP_DEBUG == "yes") { + ADD_FLAG("CFLAGS", "/LDd /MDd /W3 /Gm /Od /D _DEBUG /D ZEND_DEBUG=1 " + + (X64?"/Zi":"/ZI")); + ADD_FLAG("LDFLAGS", "/debug"); + // Avoid problems when linking to release libraries that use the release + // version of the libc + ADD_FLAG("PHP_LDFLAGS", "/nodefaultlib:msvcrt"); +} else { + // Generate external debug files when --enable-debug-pack is specified + if (PHP_DEBUG_PACK == "yes") { + ADD_FLAG("CFLAGS", "/Zi"); + ADD_FLAG("LDFLAGS", "/incremental:no /debug /opt:ref,icf"); + } + // Equivalent to Release_TSInline build -> best optimization + ADD_FLAG("CFLAGS", "/LD /MD /W3 /Ox /D NDebug /D NDEBUG /D ZEND_WIN32_FORCE_INLINE /GF /D ZEND_DEBUG=0"); + + // if you have VS.Net /GS hardens the binary against buffer overruns + // ADD_FLAG("CFLAGS", "/GS"); +} + +if (PHP_ZTS == "yes") { + ADD_FLAG("CFLAGS", "/D ZTS=1"); + ADD_FLAG("ZTS", "1"); +} else { + ADD_FLAG("ZTS", "0"); +} + +DEFINE("PHP_ZTS_ARCHIVE_POSTFIX", PHP_ZTS == "yes" ? '' : "-nts"); + + +// we want msvcrt in the PHP DLL +ADD_FLAG("PHP_LDFLAGS", "/nodefaultlib:libcmt"); + +// set up the build dir and DLL name +if (PHP_DEBUG == "yes" && PHP_ZTS == "yes") { + DEFINE("BUILD_DIR", PHP_OBJECT_OUT_DIR + "Debug_TS"); + DEFINE("PHPDLL", "php" + PHP_VERSION + "ts_debug.dll"); + DEFINE("PHPLIB", "php" + PHP_VERSION + "ts_debug.lib"); +} else if (PHP_DEBUG == "yes" && PHP_ZTS == "no") { + DEFINE("BUILD_DIR", PHP_OBJECT_OUT_DIR + "Debug"); + DEFINE("PHPDLL", "php" + PHP_VERSION + "_debug.dll"); + DEFINE("PHPLIB", "php" + PHP_VERSION + "_debug.lib"); +} else if (PHP_DEBUG == "no" && PHP_ZTS == "yes") { + DEFINE("BUILD_DIR", PHP_OBJECT_OUT_DIR + "Release_TS"); + DEFINE("PHPDLL", "php" + PHP_VERSION + "ts.dll"); + DEFINE("PHPLIB", "php" + PHP_VERSION + "ts.lib"); +} else if (PHP_DEBUG == "no" && PHP_ZTS == "no") { + DEFINE("BUILD_DIR", PHP_OBJECT_OUT_DIR + "Release"); + DEFINE("PHPDLL", "php" + PHP_VERSION + ".dll"); + DEFINE("PHPLIB", "php" + PHP_VERSION + ".lib"); +} + +// CFLAGS, LDFLAGS and BUILD_DIR are defined +// Add compiler and link flags if PGO options are selected +if (PHP_DEBUG != "yes" && PHP_PGI == "yes") { + ADD_FLAG('CFLAGS', "/GL /O2"); + ADD_FLAG('LDFLAGS', "/LTCG:PGINSTRUMENT"); + DEFINE("PGOPGD_DIR", "$(BUILD_DIR)"); +} +else if (PHP_DEBUG != "yes" && PHP_PGO != "no") { + ADD_FLAG('CFLAGS', "/GL /O2"); + ADD_FLAG('LDFLAGS', "/LTCG:PGUPDATE"); + DEFINE("PGOPGD_DIR", ((PHP_PGO.length == 0 || PHP_PGO == "yes") ? "$(BUILD_DIR)" : PHP_PGO)); +} + +// Find the php_build dir - it contains headers and libraries +// that we need +ARG_WITH('php-build', 'Path to where you extracted the development libraries (http://wiki.php.net/internals/windows/libs). Assumes that it is a sibling of this source dir (..\\deps) if not specified', 'no'); + +if (PHP_PHP_BUILD == 'no') { + if (FSO.FolderExists("..\\deps")) { + PHP_PHP_BUILD = "..\\deps"; + } else { + if (FSO.FolderExists("..\\php_build")) { + PHP_PHP_BUILD = "..\\php_build"; + } else { + if (X64) { + if (FSO.FolderExists("..\\win64build")) { + PHP_PHP_BUILD = "..\\win64build"; + } else if (FSO.FolderExists("..\\php-win64-dev\\php_build")) { + PHP_PHP_BUILD = "..\\php-win64-dev\\php_build"; + } + } else { + if (FSO.FolderExists("..\\win32build")) { + PHP_PHP_BUILD = "..\\win32build"; + } else if (FSO.FolderExists("..\\php-win32-dev\\php_build")) { + PHP_PHP_BUILD = "..\\php-win32-dev\\php_build"; + } + } + } + } + PHP_PHP_BUILD = FSO.GetAbsolutePathName(PHP_PHP_BUILD); +} +DEFINE("PHP_BUILD", PHP_PHP_BUILD); + +ARG_WITH('extra-includes', 'Extra include path to use when building everything', ''); +ARG_WITH('extra-libs', 'Extra library path to use when linking everything', ''); + +var php_usual_include_suspects = PHP_PHP_BUILD+"\\include"; +var php_usual_lib_suspects = PHP_PHP_BUILD+"\\lib"; + +ADD_FLAG("CFLAGS", '/I "' + php_usual_include_suspects + '" '); +ADD_FLAG("LDFLAGS", '/libpath:"' + php_usual_lib_suspects + '" '); + +// Poke around for some headers +function probe_basic_headers() +{ + var p; + + if (PHP_PHP_BUILD != "no") { + php_usual_include_suspects += ";" + PHP_PHP_BUILD + "\\include"; + php_usual_lib_suspects += ";" + PHP_PHP_BUILD + "\\lib"; + } +} + +function add_extra_dirs() +{ + var path, i, f; + + if (PHP_EXTRA_INCLUDES.length) { + path = PHP_EXTRA_INCLUDES.split(';'); + for (i = 0; i < path.length; i++) { + f = FSO.GetAbsolutePathName(path[i]); + if (FSO.FolderExists(f)) { + ADD_FLAG("CFLAGS", '/I "' + f + '" '); + } + } + } + if (PHP_EXTRA_LIBS.length) { + path = PHP_EXTRA_LIBS.split(';'); + for (i = 0; i < path.length; i++) { + f = FSO.GetAbsolutePathName(path[i]); + if (FSO.FolderExists(f)) { + if (VCVERS <= 1200 && f.indexOf(" ") >= 0) { + ADD_FLAG("LDFLAGS", '/libpath:"\\"' + f + '\\"" '); + } else { + ADD_FLAG("LDFLAGS", '/libpath:"' + f + '" '); + } + } + } + } + +} + +probe_basic_headers(); +add_extra_dirs(); + +//DEFINE("PHP_BUILD", PHP_PHP_BUILD); + +STDOUT.WriteBlankLines(1); +STDOUT.WriteLine("Build dir: " + get_define('BUILD_DIR')); +STDOUT.WriteLine("PHP Core: " + get_define('PHPDLL') + " and " + get_define('PHPLIB')); + +ADD_SOURCES("Zend", "zend_language_parser.c zend_language_scanner.c \ + zend_ini_parser.c zend_ini_scanner.c zend_alloc.c zend_compile.c \ + zend_constants.c zend_dynamic_array.c zend_exceptions.c \ + zend_execute_API.c zend_highlight.c \ + zend_llist.c zend_opcode.c zend_operators.c zend_ptr_stack.c \ + zend_stack.c zend_variables.c zend.c zend_API.c zend_extensions.c \ + zend_hash.c zend_list.c zend_indent.c zend_builtin_functions.c \ + zend_sprintf.c zend_ini.c zend_qsort.c zend_multibyte.c zend_ts_hash.c \ + zend_stream.c zend_iterators.c zend_interfaces.c zend_objects.c \ + zend_object_handlers.c zend_objects_API.c \ + zend_default_classes.c zend_execute.c zend_strtod.c zend_gc.c zend_closures.c \ + zend_float.c zend_string.c"); + +if (VCVERS == 1200) { + AC_DEFINE('ZEND_DVAL_TO_LVAL_CAST_OK', 1); +} + +ADD_SOURCES("main", "main.c snprintf.c spprintf.c getopt.c fopen_wrappers.c \ + php_scandir.c php_ini.c SAPI.c rfc1867.c php_content_types.c strlcpy.c \ + strlcat.c mergesort.c reentrancy.c php_variables.c php_ticks.c network.c \ + php_open_temporary_file.c php_logos.c output.c internal_functions.c php_sprintf.c"); +ADD_SOURCES("win32", "inet.c fnmatch.c sockets.c"); + +// Newer versions have it +if (VCVERS <= 1300) { + ADD_SOURCES("win32", "strtoi64.c"); +} +if (VCVERS >= 1400) { + AC_DEFINE('HAVE_STRNLEN', 1); +} + +ADD_SOURCES("main/streams", "streams.c cast.c memory.c filter.c plain_wrapper.c \ + userspace.c transports.c xp_socket.c mmap.c glob_wrapper.c"); + +ADD_SOURCES("win32", "glob.c readdir.c \ + registry.c select.c sendmail.c time.c winutil.c wsyslog.c globals.c"); + +PHP_INSTALL_HEADERS("", "Zend/ TSRM/ main/ main/streams/ win32/"); + +STDOUT.WriteBlankLines(1); + + +/* Can we build with IPv6 support? */ +ARG_ENABLE("ipv6", "Disable IPv6 support (default is turn it on if available)", "yes"); + +var main_network_has_ipv6 = 0; +if (PHP_IPV6 == "yes") { + main_network_has_ipv6 = CHECK_HEADER_ADD_INCLUDE("wspiapi.h", "CFLAGS") ? 1 : 0; +} +if (main_network_has_ipv6) { + STDOUT.WriteLine("Enabling IPv6 support"); +} +AC_DEFINE('HAVE_GETADDRINFO', main_network_has_ipv6); +AC_DEFINE('HAVE_GAI_STRERROR', main_network_has_ipv6); +AC_DEFINE('HAVE_IPV6', main_network_has_ipv6); + +/* this allows up to 256 sockets to be select()ed in a single + * call to select(), instead of the usual 64 */ +ARG_ENABLE('fd-setsize', "Set maximum number of sockets for select(2)", "256"); +ADD_FLAG("CFLAGS", "/D FD_SETSIZE=" + parseInt(PHP_FD_SETSIZE)); + +AC_DEFINE('HAVE_USLEEP', 1); +AC_DEFINE('HAVE_STRCOLL', 1); + +/* For snapshot builders, where can we find the additional + * files that make up the snapshot template? */ +ARG_WITH("snapshot-template", "Path to snapshot builder template dir", "no"); + +if (PHP_SNAPSHOT_TEMPLATE == "no") { + /* default is as a sibling of the php_build dir */ + if (FSO.FolderExists(PHP_PHP_BUILD + "\\template")) { + PHP_SNAPSHOT_TEMPLATE = FSO.GetAbsolutePathName(PHP_PHP_BUILD + "\\template"); + } else if (FSO.FolderExists(PHP_PHP_BUILD + "\\..\\template")) { + PHP_SNAPSHOT_TEMPLATE = FSO.GetAbsolutePathName(PHP_PHP_BUILD + "\\..\\template"); + } +} + +DEFINE('SNAPSHOT_TEMPLATE', PHP_SNAPSHOT_TEMPLATE); + +if (PHP_DSP != "no") { + if (FSO.FolderExists("tmp")) { + FSO.DeleteFolder("tmp"); + } + FSO.CreateFolder("tmp"); +} + +ARG_ENABLE("security-flags", "Disable the compiler security flags", "yes"); +if (PHP_SECURITY_FLAGS == "yes") { + ADD_FLAG("LDFLAGS", "/NXCOMPAT /DYNAMICBASE "); +} + +ARG_ENABLE("static-analyze", "Enable the VC compiler static analyze", "no"); +if (PHP_STATIC_ANALYZE == "yes") { + ADD_FLAG("CFLAGS", " /analyze "); + ADD_FLAG("CFLAGS", " /wd6308 "); +} diff --git a/win32/build/config.w32.h.in b/win32/build/config.w32.h.in new file mode 100644 index 0000000..c6cf076 --- /dev/null +++ b/win32/build/config.w32.h.in @@ -0,0 +1,176 @@ +/* + Build Configuration Template for Win32. + $Id$ +*/ + +/* Define the minimum supported version */ +#undef _WIN32_WINNT +#undef NTDDI_VERSION +#define _WIN32_WINNT 0x0501 +#define NTDDI_VERSION 0x05010200 + +/* Default PHP / PEAR directories */ +#define PHP_CONFIG_FILE_PATH (getenv("SystemRoot"))?getenv("SystemRoot"):"" +#define CONFIGURATION_FILE_PATH "php.ini" +#define PEAR_INSTALLDIR "@PREFIX@\\pear" +#define PHP_BINDIR "@PREFIX@" +#define PHP_DATADIR "@PREFIX@" +#define PHP_EXTENSION_DIR "@PREFIX@" +#define PHP_INCLUDE_PATH ".;@PREFIX@\\pear" +#define PHP_LIBDIR "@PREFIX@" +#define PHP_LOCALSTATEDIR "@PREFIX@" +#define PHP_PREFIX "@PREFIX@" +#define PHP_SYSCONFDIR "@PREFIX@" + +/* Enable / Disable crypt() function (default: enabled) */ +#define HAVE_CRYPT 1 +#define PHP_STD_DES_CRYPT 1 +#define PHP_EXT_DES_CRYPT 1 +#define PHP_MD5_CRYPT 1 +#define PHP_BLOWFISH_CRYPT 1 +#define PHP_SHA512_CRYPT 1 +#define PHP_SHA256_CRYPT 1 + +/* PHP Runtime Configuration */ +#define PHP_URL_FOPEN 1 +#define USE_CONFIG_FILE 1 +#define DEFAULT_SHORT_OPEN_TAG "1" + +/* Platform-Specific Configuration. Should not be changed. */ +#define PHP_SIGCHILD 0 +#define HAVE_LIBBIND 1 +#define HAVE_GETSERVBYNAME 1 +#define HAVE_GETSERVBYPORT 1 +#define HAVE_GETPROTOBYNAME 1 +#define HAVE_GETPROTOBYNUMBER 1 +#define HAVE_GETHOSTNAME 1 +#define STDIN_FILENO 0 +#define STDOUT_FILENO 1 +#define STDERR_FILENO 2 +#define HAVE_ERRMSG_H 0 +#undef HAVE_ADABAS +#undef HAVE_SOLID +#undef HAVE_LINK +#undef HAVE_SYMLINK + +/* its in win32/time.c */ +#define HAVE_USLEEP 1 +#define HAVE_NANOSLEEP 1 +#define PHP_SLEEP_NON_VOID 1 + +#define HAVE_GETHOSTNAME 1 +#define HAVE_GETCWD 1 +#define HAVE_POSIX_READDIR_R 1 +#define NEED_ISBLANK 1 +#define DISCARD_PATH 0 +#undef HAVE_SETITIMER +#undef HAVE_SIGSETJMP +#undef HAVE_IODBC +#define HAVE_LIBDL 1 +#define HAVE_GETTIMEOFDAY 1 +#define HAVE_PUTENV 1 +#define HAVE_LIMITS_H 1 +#define HAVE_TZSET 1 +#define HAVE_TZNAME 1 +#undef HAVE_FLOCK +#define HAVE_ALLOCA 1 +#undef HAVE_SYS_TIME_H +#define HAVE_SIGNAL_H 1 +#undef HAVE_ST_BLKSIZE +#undef HAVE_ST_BLOCKS +#define HAVE_ST_RDEV 1 +#define HAVE_UTIME_NULL 1 +#define HAVE_VPRINTF 1 +#define STDC_HEADERS 1 +#define REGEX 1 +#define HSREGEX 1 +#define HAVE_GCVT 1 +#define HAVE_GETLOGIN 1 +#define HAVE_GETTIMEOFDAY 1 +#define HAVE_MEMCPY 1 +#define HAVE_MEMMOVE 1 +#define HAVE_PUTENV 1 +#define HAVE_REGCOMP 1 +#define HAVE_SETLOCALE 1 +#define HAVE_LOCALECONV 1 +#define HAVE_LOCALE_H 1 +#ifndef HAVE_LIBBIND +# define HAVE_SETVBUF 1 +#endif +#define HAVE_SHUTDOWN 1 +#define HAVE_SNPRINTF 1 +#define HAVE_VSNPRINTF 1 +#define HAVE_STRCASECMP 1 +#define HAVE_STRDUP 1 +#define HAVE_STRERROR 1 +#define HAVE_STRSTR 1 +#define HAVE_TEMPNAM 1 +#define HAVE_UTIME 1 +#undef HAVE_DIRENT_H +#define HAVE_ASSERT_H 1 +#define HAVE_FCNTL_H 1 +#define HAVE_GRP_H 0 +#undef HAVE_PWD_H +#define HAVE_STRING_H 1 +#undef HAVE_SYS_FILE_H +#undef HAVE_SYS_SOCKET_H +#undef HAVE_SYS_WAIT_H +#define HAVE_SYSLOG_H 1 +#undef HAVE_UNISTD_H +#define HAVE_SYS_TYPES_H 1 +#define HAVE_STDARG_H 1 +#undef HAVE_ALLOCA_H +#undef HAVE_KILL +#define HAVE_GETPID 1 +#define HAVE_LIBM 1 +#define HAVE_CUSERID 0 +#undef HAVE_RINT +#define HAVE_STRFTIME 1 +#define SIZEOF_SHORT 2 +/* int and long are stll 32bit in 64bit compiles */ +#define SIZEOF_INT 4 +#define SIZEOF_LONG 4 +/* MSVC.6/NET don't allow 'long long' or know 'intmax_t' */ +#define SIZEOF_LONG_LONG_INT 0 +#define SIZEOF_LONG_LONG 8 /* defined as __int64 */ +#define SIZEOF_INTMAX_T 0 +#define ssize_t SSIZE_T +#ifdef _WIN64 +# define SIZEOF_SIZE_T 8 +# define SIZEOF_PTRDIFF_T 8 +#else +# define SIZEOF_SIZE_T 4 +# define SIZEOF_PTRDIFF_T 4 +#endif +#define HAVE_FNMATCH +#define HAVE_GLOB +#define PHP_SHLIB_SUFFIX "dll" +#define HAVE_SQLDATASOURCES + +/* Win32 supports strcoll */ +#define HAVE_STRCOLL 1 + +/* Win32 supports socketpair by the emulation in win32/sockets.c */ +#define HAVE_SOCKETPAIR 1 +#define HAVE_SOCKLEN_T 1 + +/* Win32 support proc_open */ +#define PHP_CAN_SUPPORT_PROC_OPEN 1 + +/* inet_ntop() / inet_pton() */ +#define HAVE_INET_PTON 1 +#define HAVE_INET_NTOP 1 + +#define HAVE_MBLEN + +#undef HAVE_ATOF_ACCEPTS_NAN +#undef HAVE_ATOF_ACCEPTS_INF +#define HAVE_HUGE_VAL_NAN 0 + +/* vs.net 2005 has a 64-bit time_t. This will likely break + * 3rdParty libs that were built with older compilers; switch + * back to 32-bit */ +#ifndef _WIN64 +# define _USE_32BIT_TIME_T 1 +#endif +#define HAVE_STDLIB_H 1 diff --git a/win32/build/config.w32.phpize.in b/win32/build/config.w32.phpize.in new file mode 100644 index 0000000..b8bf45e --- /dev/null +++ b/win32/build/config.w32.phpize.in @@ -0,0 +1,358 @@ +// vim:ft=javascript
+// $Id: config.w32 306241 2010-12-11 22:18:10Z pajoye $
+// "Master" config file; think of it as a configure.in
+// equivalent.
+
+var PHP_CYGWIN="notset";
+PHP_CL = PATH_PROG('cl', null, 'PHP_CL');
+if (!PHP_CL) {
+ ERROR("MS C++ compiler is required");
+}
+/* For the record here: */
+// 1200 is VC6
+// 1300 is vs.net 2002
+// 1310 is vs.net 2003
+// 1400 is vs.net 2005
+// 1500 is vs.net 2008
+// 1600 is vs.net 2010
+// Which version of the compiler do we have?
+VCVERS = probe_binary(PHP_CL).substr(0, 5).replace('.', '');
+STDOUT.WriteLine(" Detected compiler " + VC_VERSIONS[VCVERS]);
+
+if (VCVERS < 1500) {
+ ERROR("Unsupported MS C++ Compiler, VC9 (2008) minimum is required");
+}
+
+AC_DEFINE('COMPILER', VC_VERSIONS[VCVERS], "Detected compiler version");
+DEFINE("PHP_COMPILER_SHORT", VC_VERSIONS_SHORT[VCVERS]);
+AC_DEFINE('PHP_COMPILER_ID', VC_VERSIONS_SHORT[VCVERS], "Compiler compatibility ID");
+
+// do we use x64 or 80x86 version of compiler?
+X64 = probe_binary(PHP_CL, 64, null, 'PHP_CL');
+if (X64) {
+ STDOUT.WriteLine(" Detected 64-bit compiler");
+} else {
+ STDOUT.WriteLine(" Detected 32-bit compiler");
+}
+AC_DEFINE('ARCHITECTURE', X64 ? 'x64' : 'x86', "Detected compiler architecture");
+DEFINE("PHP_ARCHITECTURE", X64 ? 'x64' : 'x86');
+
+// cygwin now ships with link.exe. Avoid searching the cygwin path
+// for this, as we want the MS linker, not the fileutil
+PATH_PROG('link', WshShell.Environment("Process").Item("PATH"));
+PATH_PROG('nmake');
+
+// we don't want to define LIB, as that will override the default library path
+// that is set in that env var
+PATH_PROG('lib', null, 'MAKE_LIB');
+if (!PATH_PROG('bison')) {
+ ERROR('bison is required')
+}
+
+// There's a minimum requirement for re2c..
+MINRE2C = "0.13.4";
+
+RE2C = PATH_PROG('re2c');
+if (RE2C) {
+ var intvers, intmin;
+ var pattern = /\./g;
+
+ RE2CVERS = probe_binary(RE2C, "version");
+ STDOUT.WriteLine(' Detected re2c version ' + RE2CVERS);
+
+ intvers = RE2CVERS.replace(pattern, '') - 0;
+ intmin = MINRE2C.replace(pattern, '') - 0;
+
+ if (intvers < intmin) {
+ STDOUT.WriteLine('WARNING: The minimum RE2C version requirement is ' + MINRE2C);
+ STDOUT.WriteLine('Parsers will not be generated. Upgrade your copy at http://sf.net/projects/re2c');
+ DEFINE('RE2C', '');
+ } else {
+ DEFINE('RE2C_FLAGS', '');
+ }
+} else {
+ STDOUT.WriteLine('Parsers will not be regenerated');
+}
+PATH_PROG('zip');
+PATH_PROG('lemon');
+
+// avoid picking up midnight commander from cygwin
+PATH_PROG('mc', WshShell.Environment("Process").Item("PATH"));
+
+// Try locating manifest tool
+if (VCVERS > 1200) {
+ PATH_PROG('mt', WshShell.Environment("Process").Item("PATH"));
+}
+
+// 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');
+ }
+ PHP_OBJECT_OUT_DIR += '\\';
+} else if (X64) {
+ if (!FSO.FolderExists("x64")) {
+ FSO.CreateFolder("x64");
+ }
+ PHP_OBJECT_OUT_DIR = 'x64\\';
+}
+
+ARG_ENABLE('debug', 'Compile with debugging symbols', "no");
+ARG_ENABLE('debug-pack', 'Release binaries with external debug symbols (--enable-debug must not be specified)', 'no');
+if (PHP_DEBUG == "yes" && PHP_DEBUG_PACK == "yes") {
+ ERROR("Use of both --enable-debug and --enable-debug-pack not allowed.");
+}
+
+DEFINE('PHP_PREFIX', PHP_PREFIX);
+
+DEFINE("BASE_INCLUDES", "/I " + PHP_DIR + "/include /I " + PHP_DIR + "/include/main /I " + PHP_DIR + "/include/Zend /I " + PHP_DIR + "/include/TSRM /I " + PHP_DIR + "/include/ext ");
+
+// CFLAGS for building the PHP dll
+DEFINE("CFLAGS_PHP", "/D _USRDLL /D PHP5DLLTS_EXPORTS /D PHP_EXPORTS \
+/D LIBZEND_EXPORTS /D TSRM_EXPORTS /D SAPI_EXPORTS /D WINVER=0x500");
+
+DEFINE('CFLAGS_PHP_OBJ', '$(CFLAGS_PHP) $(STATIC_EXT_CFLAGS)');
+
+// General CFLAGS for building objects
+DEFINE("CFLAGS", "/nologo /FD $(BASE_INCLUDES) /D _WINDOWS \
+/D ZEND_WIN32=1 /D PHP_WIN32=1 /D WIN32 /D _MBCS /W3 ");
+
+if (VCVERS < 1400) {
+ // Enable automatic precompiled headers
+ ADD_FLAG('CFLAGS', ' /YX ');
+
+ if (PHP_DEBUG == "yes") {
+ // Set some debug/release specific options
+ ADD_FLAG('CFLAGS', ' /GZ ');
+ }
+}
+
+if (VCVERS >= 1400) {
+ // fun stuff: MS deprecated ANSI stdio and similar functions
+ // disable annoying warnings. In addition, time_t defaults
+ // to 64-bit. Ask for 32-bit.
+ if (X64) {
+ ADD_FLAG('CFLAGS', ' /wd4996 /Wp64 ');
+ } else {
+ ADD_FLAG('CFLAGS', ' /wd4996 /D_USE_32BIT_TIME_T=1 ');
+ }
+
+ if (PHP_DEBUG == "yes") {
+ // Set some debug/release specific options
+ ADD_FLAG('CFLAGS', ' /RTC1 ');
+ }
+}
+
+ARG_WITH('prefix', 'PHP installation prefix', '');
+ARG_WITH('mp', 'Tell VC9+ use up to [n,auto,disable] processes for compilation', 'auto');
+if (VCVERS >= 1500 && PHP_MP != 'disable') {
+ // no from disable-all
+ if(PHP_MP == 'auto' || PHP_MP == 'no') {
+ ADD_FLAG('CFLAGS', ' /MP ');
+ } else {
+ if(parseInt(PHP_MP) != 0) {
+ ADD_FLAG('CFLAGS', ' /MP'+ PHP_MP +' ');
+ } else {
+ STDOUT.WriteLine('WARNING: Invalid argument for MP: ' + PHP_MP);
+ }
+ }
+}
+
+/* For snapshot builders, where can we find the additional
+ * files that make up the snapshot template? */
+ARG_WITH("snapshot-template", "Path to snapshot builder template dir", "no");
+
+// General DLL link flags
+DEFINE("DLL_LDFLAGS", "/dll ");
+
+// PHP DLL link flags
+DEFINE("PHP_LDFLAGS", "$(DLL_LDFLAGS)");
+
+// General libs
+// urlmon.lib ole32.lib oleaut32.lib uuid.lib gdi32.lib winspool.lib comdlg32.lib
+DEFINE("LIBS", "kernel32.lib ole32.lib user32.lib advapi32.lib shell32.lib ws2_32.lib Dnsapi.lib");
+
+// Set some debug/release specific options
+if (PHP_DEBUG == "yes") {
+ ADD_FLAG("CFLAGS", "/LDd /MDd /W3 /Gm /Od /D _DEBUG /D ZEND_DEBUG=1 " +
+ (X64?"/Zi":"/ZI"));
+ ADD_FLAG("LDFLAGS", "/debug");
+ // Avoid problems when linking to release libraries that use the release
+ // version of the libc
+ ADD_FLAG("PHP_LDFLAGS", "/nodefaultlib:msvcrt");
+} else {
+ // Generate external debug files when --enable-debug-pack is specified
+ if (PHP_DEBUG_PACK == "yes") {
+ ADD_FLAG("CFLAGS", "/Zi");
+ ADD_FLAG("LDFLAGS", "/incremental:no /debug /opt:ref,icf");
+ }
+ // Equivalent to Release_TSInline build -> best optimization
+ ADD_FLAG("CFLAGS", "/LD /MD /W3 /Ox /D NDebug /D NDEBUG /D ZEND_WIN32_FORCE_INLINE /GF /D ZEND_DEBUG=0");
+
+ // if you have VS.Net /GS hardens the binary against buffer overruns
+ // ADD_FLAG("CFLAGS", "/GS");
+}
+
+if (PHP_ZTS == "yes") {
+ ADD_FLAG("CFLAGS", "/D ZTS=1");
+}
+
+DEFINE("PHP_ZTS_ARCHIVE_POSTFIX", PHP_ZTS == "yes" ? '' : "-nts");
+
+
+// we want msvcrt in the PHP DLL
+ADD_FLAG("PHP_LDFLAGS", "/nodefaultlib:libcmt");
+
+// set up the build dir and DLL name
+if (PHP_DEBUG == "yes" && PHP_ZTS == "yes") {
+ DEFINE("BUILD_DIR", PHP_OBJECT_OUT_DIR + "Debug_TS");
+ if (!MODE_PHPIZE) {
+ DEFINE("PHPDLL", "php" + PHP_VERSION + "ts_debug.dll");
+ DEFINE("PHPLIB", "php" + PHP_VERSION + "ts_debug.lib");
+ }
+} else if (PHP_DEBUG == "yes" && PHP_ZTS == "no") {
+ DEFINE("BUILD_DIR", PHP_OBJECT_OUT_DIR + "Debug");
+ if (!MODE_PHPIZE) {
+ DEFINE("PHPDLL", "php" + PHP_VERSION + "_debug.dll");
+ DEFINE("PHPLIB", "php" + PHP_VERSION + "_debug.lib");
+ }
+} else if (PHP_DEBUG == "no" && PHP_ZTS == "yes") {
+ DEFINE("BUILD_DIR", PHP_OBJECT_OUT_DIR + "Release_TS");
+ if (!MODE_PHPIZE) {
+ DEFINE("PHPDLL", "php" + PHP_VERSION + "ts.dll");
+ DEFINE("PHPLIB", "php" + PHP_VERSION + "ts.lib");
+ }
+} else if (PHP_DEBUG == "no" && PHP_ZTS == "no") {
+ DEFINE("BUILD_DIR", PHP_OBJECT_OUT_DIR + "Release");
+ if (!MODE_PHPIZE) {
+ DEFINE("PHPDLL", "php" + PHP_VERSION + ".dll");
+ DEFINE("PHPLIB", "php" + PHP_VERSION + ".lib");
+ }
+}
+
+if (MODE_PHPIZE) {
+ DEFINE("PHPDLL", PHP_DLL);
+ DEFINE("PHPLIB", PHP_DLL_LIB);
+}
+
+// Find the php_build dir - it contains headers and libraries
+// that we need
+ARG_WITH('php-build', 'Path to where you extracted the development libraries (http://wiki.php.net/internals/windows/libs). Assumes that it is a sibling of this source dir (..\\deps) if not specified', 'no');
+
+if (PHP_PHP_BUILD == 'no') {
+ if (FSO.FolderExists("..\\deps")) {
+ PHP_PHP_BUILD = "..\\deps";
+ } else {
+ if (FSO.FolderExists("..\\php_build")) {
+ PHP_PHP_BUILD = "..\\php_build";
+ } else {
+ if (X64) {
+ if (FSO.FolderExists("..\\win64build")) {
+ PHP_PHP_BUILD = "..\\win64build";
+ } else if (FSO.FolderExists("..\\php-win64-dev\\php_build")) {
+ PHP_PHP_BUILD = "..\\php-win64-dev\\php_build";
+ }
+ } else {
+ if (FSO.FolderExists("..\\win32build")) {
+ PHP_PHP_BUILD = "..\\win32build";
+ } else if (FSO.FolderExists("..\\php-win32-dev\\php_build")) {
+ PHP_PHP_BUILD = "..\\php-win32-dev\\php_build";
+ }
+ }
+ }
+ }
+ PHP_PHP_BUILD = FSO.GetAbsolutePathName(PHP_PHP_BUILD);
+}
+DEFINE("PHP_BUILD", PHP_PHP_BUILD);
+
+ARG_WITH('extra-includes', 'Extra include path to use when building everything', '');
+ARG_WITH('extra-libs', 'Extra library path to use when linking everything', '');
+
+var php_usual_include_suspects = PHP_PHP_BUILD+"\\include";
+var php_usual_lib_suspects = PHP_PHP_BUILD+"\\lib";
+
+ADD_FLAG("CFLAGS", '/I "' + php_usual_include_suspects + '" ');
+ADD_FLAG("LDFLAGS", '/libpath:"\\"' + php_usual_lib_suspects + '\\"" ');
+
+// Poke around for some headers
+function probe_basic_headers()
+{
+ var p;
+
+ if (PHP_PHP_BUILD != "no") {
+ php_usual_include_suspects += ";" + PHP_PHP_BUILD + "\\include";
+ php_usual_lib_suspects += ";" + PHP_PHP_BUILD + "\\lib";
+ }
+}
+
+function add_extra_dirs()
+{
+ var path, i, f;
+
+ if (PHP_EXTRA_INCLUDES.length) {
+ path = PHP_EXTRA_INCLUDES.split(';');
+ for (i = 0; i < path.length; i++) {
+ f = FSO.GetAbsolutePathName(path[i]);
+ if (FSO.FolderExists(f)) {
+ ADD_FLAG("CFLAGS", '/I "' + f + '" ');
+ }
+ }
+ }
+ if (PHP_EXTRA_LIBS.length) {
+ path = PHP_EXTRA_LIBS.split(';');
+ for (i = 0; i < path.length; i++) {
+ f = FSO.GetAbsolutePathName(path[i]);
+ if (FSO.FolderExists(f)) {
+ if (VCVERS <= 1200 && f.indexOf(" ") >= 0) {
+ ADD_FLAG("LDFLAGS", '/libpath:"\\"' + f + '\\"" ');
+ } else {
+ ADD_FLAG("LDFLAGS", '/libpath:"' + f + '" ');
+ }
+ }
+ }
+ }
+
+}
+
+probe_basic_headers();
+add_extra_dirs();
+
+//DEFINE("PHP_BUILD", PHP_PHP_BUILD);
+
+STDOUT.WriteBlankLines(1);
+STDOUT.WriteLine("Build dir: " + get_define('BUILD_DIR'));
+STDOUT.WriteLine("PHP Core: " + get_define('PHPDLL') + " and " + get_define('PHPLIB'));
+
+
+if (VCVERS == 1200) {
+ AC_DEFINE('ZEND_DVAL_TO_LVAL_CAST_OK', 1);
+}
+
+if (VCVERS >= 1400) {
+ AC_DEFINE('HAVE_STRNLEN', 1);
+}
+
+STDOUT.WriteBlankLines(1);
+
+if (PHP_SNAPSHOT_TEMPLATE == "no") {
+ /* default is as a sibling of the php_build dir */
+ if (FSO.FolderExists(PHP_PHP_BUILD + "\\template")) {
+ PHP_SNAPSHOT_TEMPLATE = FSO.GetAbsolutePathName(PHP_PHP_BUILD + "\\template");
+ } else if (FSO.FolderExists(PHP_PHP_BUILD + "\\..\\template")) {
+ PHP_SNAPSHOT_TEMPLATE = FSO.GetAbsolutePathName(PHP_PHP_BUILD + "\\..\\template");
+ }
+}
+
+DEFINE('SNAPSHOT_TEMPLATE', PHP_SNAPSHOT_TEMPLATE);
+
+if (PHP_DSP != "no") {
+ if (FSO.FolderExists("tmp")) {
+ FSO.DeleteFolder("tmp");
+ }
+ FSO.CreateFolder("tmp");
+}
+
+AC_DEFINE("PHP_DIR", PHP_DIR);
+DEFINE("PHP_DIR", PHP_DIR);
diff --git a/win32/build/configure.bat b/win32/build/configure.bat new file mode 100644 index 0000000..45d273d --- /dev/null +++ b/win32/build/configure.bat @@ -0,0 +1,2 @@ +@echo off +cscript /nologo configure.js %* diff --git a/win32/build/configure.tail b/win32/build/configure.tail new file mode 100644 index 0000000..70625a4 --- /dev/null +++ b/win32/build/configure.tail @@ -0,0 +1,11 @@ +// vim:ft=javascript +// $Id$ +// tail end of configure + +if (!MODE_PHPIZE && sapi_enabled.length < 1) { + MESSAGE(""); + ERROR("No SAPI selected, please enable at least one SAPI."); +} + +generate_files(); + diff --git a/win32/build/confutils.js b/win32/build/confutils.js new file mode 100644 index 0000000..c0a1ce8 --- /dev/null +++ b/win32/build/confutils.js @@ -0,0 +1,2048 @@ +// 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();
+var PHP_SRC_DIR=FSO.GetParentFolderName(WScript.ScriptFullName);
+
+/* Store the enabled extensions (summary + QA check) */
+var extensions_enabled = new Array();
+
+/* Store the SAPI enabled (summary + QA check) */
+var sapi_enabled = new Array();
+
+/* Store the headers to install */
+var headers_install = 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)';
+VC_VERSIONS[1600] = 'MSVC10 (Visual C++ 2010)';
+
+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';
+VC_VERSIONS_SHORT[1600] = 'VC10';
+
+if (PROGRAM_FILES == null) {
+ PROGRAM_FILES = "C:\\Program Files";
+}
+
+if (MODE_PHPIZE) {
+ if (!FSO.FileExists("config.w32")) {
+ STDERR.WriteLine("Must be run from the root of the extension source");
+ WScript.Quit(10);
+ }
+} else {
+ if (!FSO.FileExists("README.GIT-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.GIT-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 = "";
+
+if (!MODE_PHPIZE) {
+ 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);
+
+ /* Force shared when called after phpize */
+ if (MODE_PHPIZE) {
+ shared = "shared";
+ } else {
+ 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', 'pgi', 'pgo'
+ );
+ 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;
+ }
+ if (MODE_PHPIZE) {
+ MFO.WriteLine("$(BUILD_DIR)\\" + resname + ": $(PHP_DIR)\\build\\template.rc");
+ MFO.WriteLine("\t$(RC) /I $(PHP_DIR)/include /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 + '\\"" $(PHP_DIR)\\build\\template.rc');
+ } else {
+ 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");
+ if (MODE_PHPIZE) {
+ MFO.WriteLine("$(BUILD_DIR)\\" + makefiletarget + ": $(DEPS_" + SAPI + ") $(" + SAPI + "_GLOBAL_OBJS) $(PHPLIB) $(BUILD_DIR)\\" + resname);
+ } else {
+ 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(PHP_PGI == "yes" || PHP_PGO != "no") {
+ ldflags += " /PGD:$(PGOPGD_DIR)\\" + makefiletarget.substring(0, makefiletarget.indexOf(".")) + ".pgd";
+ }
+
+ if (MODE_PHPIZE) {
+ if (ld) {
+ MFO.WriteLine("\t" + ld + " /nologo /out:$(BUILD_DIR)\\" + makefiletarget + " " + ldflags + " $(" + SAPI + "_GLOBAL_OBJS) $(PHPLIB) $(LDFLAGS_" + SAPI + ") $(LIBS_" + SAPI + ") $(BUILD_DIR)\\" + resname);
+ } else {
+ ld = "@$(CC)";
+ MFO.WriteLine("\t" + ld + " /nologo " + " $(" + SAPI + "_GLOBAL_OBJS) $(PHPLIB) $(LIBS_" + SAPI + ") $(BUILD_DIR)\\" + resname + " /link /out:$(BUILD_DIR)\\" + makefiletarget + " " + ldflags + " $(LDFLAGS_" + SAPI + ")");
+ }
+ } else {
+ 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;
+
+ if (MODE_PHPIZE) {
+ ext_deps_js = file_get_contents(PHP_DIR + "\\script\\ext_deps.js");
+ eval(ext_deps_js);
+ }
+
+ 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;
+ var ldflags;
+
+ 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)";
+
+ ldflags = "";
+ if (PHP_PGI == "yes" || PHP_PGO != "no") {
+ ldflags = " /PGD:$(PGOPGD_DIR)\\" + dllname.substring(0, dllname.indexOf(".")) + ".pgd";
+ }
+
+ MFO.WriteLine("$(BUILD_DIR)\\" + libname + ": $(BUILD_DIR)\\" + dllname);
+ MFO.WriteBlankLines(1);
+ if (MODE_PHPIZE) {
+ MFO.WriteLine("$(BUILD_DIR)\\" + dllname + ": $(DEPS_" + EXT + ") $(" + EXT + "_GLOBAL_OBJS) $(PHPLIB) $(BUILD_DIR)\\" + resname);
+ MFO.WriteLine("\t" + ld + " $(" + EXT + "_GLOBAL_OBJS) $(PHPLIB) $(LIBS_" + EXT + ") $(LIBS) $(BUILD_DIR)\\" + resname + " /link /out:$(BUILD_DIR)\\" + dllname + " $(DLL_LDFLAGS) $(LDFLAGS) $(LDFLAGS_" + EXT + ")");
+ } else {
+ 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 + ldflags + " $(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 (!MODE_PHPIZE && 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 (!MODE_PHPIZE && 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);
+ if (!MODE_PHPIZE) {
+ 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;
+
+ build_dir = get_define('BUILD_DIR');
+ build_dir = build_dir.replace(new RegExp("\\\\", "g"), "\\\\");
+ if (build_dir.substr(build_dir.Length - 2, 2) != '\\\\') {
+ build_dir += '\\\\';
+ }
+ ADD_FLAG("BUILD_DIRS_SUB", bd.replace(new RegExp(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();
+ if (!MODE_PHPIZE) {
+ generate_internal_functions();
+ generate_config_h();
+ generate_phpize();
+ }
+ 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_phpize()
+{
+ STDOUT.WriteLine("Generating phpize");
+ dest = get_define("BUILD_DIR") + '/devel';
+
+ if (!FSO.FolderExists(dest)) {
+ FSO.CreateFolder(dest);
+ }
+
+ var MF = FSO.CreateTextFile(dest + "/phpize.js", true);
+ var DEPS = FSO.CreateTextFile(dest + "/ext_deps.js", true);
+ prefix = get_define("PHP_PREFIX");
+ prefix = prefix.replace(new RegExp("/", "g"), "\\");
+ prefix = prefix.replace(new RegExp("\\\\", "g"), "\\\\");
+ MF.WriteLine("var PHP_PREFIX=" + '"' + prefix + '"');
+ MF.WriteLine("var PHP_ZTS=" + '"' + (PHP_ZTS.toLowerCase() == "yes" ? "Yes" : "No") + '"');
+ MF.WriteLine("var VC_VERSION=" + VCVERS);
+ MF.WriteLine("var PHP_VERSION=" + PHP_VERSION);
+ MF.WriteLine("var PHP_MINOR_VERSION=" + PHP_MINOR_VERSION);
+ MF.WriteLine("var PHP_RELEASE_VERSION=" + PHP_RELEASE_VERSION);
+ MF.WriteBlankLines(1);
+ MF.WriteLine("/* Genereted extensions list with mode (static/shared) */");
+
+ var count = extensions_enabled.length;
+ for (i in extensions_enabled) {
+ out = "PHP_" + extensions_enabled[i][0].toUpperCase() + "_SHARED=" + (extensions_enabled[i][1] == 'shared' ? 'true' : 'false') + ";";
+ DEPS.WriteLine("PHP_" + extensions_enabled[i][0].toUpperCase() + "=true;");
+ DEPS.WriteLine(out);
+ MF.WriteLine(out);
+ }
+
+ MF.WriteBlankLines(2);
+ MF.WriteLine("/* Genereted win32/build/phpize.js.in */");
+ MF.WriteBlankLines(1);
+ MF.Write(file_get_contents("win32/build/phpize.js.in"));
+ MF.Close();
+ DEPS.Close();
+
+ /* Generate flags file */
+ /* spit out variable definitions */
+ CJ = FSO.CreateTextFile(dest + "/config.phpize.js");
+
+ CJ.WriteLine("var PHP_ZTS =" + '"' + PHP_ZTS + '"');
+ CJ.WriteLine("var PHP_DLL_LIB =" + '"' + get_define('PHPLIB') + '"');
+ CJ.WriteLine("var PHP_DLL =" + '"' + get_define('PHPDLL') + '"');
+ CJ.WriteBlankLines(1);
+ CJ.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;
+ MF.WriteLine("PHP_SRC_DIR =" + PHP_SRC_DIR);
+ 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);
+ if (MODE_PHPIZE) {
+ var TF = FSO.OpenTextFile(PHP_DIR + "/script/Makefile.phpize", 1);
+ } else {
+ var TF = FSO.OpenTextFile("win32/build/Makefile", 1);
+ }
+
+ MF.Write(TF.ReadAll());
+
+ MF.WriteLine("build-headers:");
+ MF.WriteLine(" @if not exist $(BUILD_DIR_DEV)\\include mkdir $(BUILD_DIR_DEV)\\include >nul");
+ MF.WriteLine(" @for %D in ($(INSTALL_HEADERS_DIR)) do @if not exist $(BUILD_DIR_DEV)\\include\\%D mkdir $(BUILD_DIR_DEV)\\include\\%D >nul");
+ for (i in headers_install) {
+ if (headers_install[i][2] != "") {
+ MF.WriteLine(" @if not exist $(BUILD_DIR_DEV)\\include\\" + headers_install[i][2] + " mkdir $(BUILD_DIR_DEV)\\include\\" +
+ headers_install[i][2] + ">nul");
+ MF.WriteLine(" @copy " + headers_install[i][0] + " " + "$(BUILD_DIR_DEV)\\include\\" + headers_install[i][2] + " /y >nul");
+ }
+ }
+ MF.WriteLine(" @for %D in ($(INSTALL_HEADERS_DIR)) do @copy %D*.h $(BUILD_DIR_DEV)\\include\\%D /y >nul");
+ 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;
+}
+
+function PHP_INSTALL_HEADERS(dir, headers_list)
+{
+ headers_list = headers_list.split(new RegExp("\\s+"));
+ headers_list.sort();
+ if (dir.length > 0 && dir.substr(dir.length - 1) != '/' && dir.substr(dir.length - 1) != '\\') {
+ dir += '/';
+ }
+ dir = dir.replace(new RegExp("/", "g"), "\\");
+
+ for (i in headers_list) {
+ found = false;
+ src = headers_list[i];
+ src = src.replace(new RegExp("/", "g"), "\\");
+ isdir = FSO.FolderExists(dir + src);
+ isfile = FSO.FileExists(dir + src);
+ if (isdir) {
+ if (src.length > 0 && src.substr(src.length - 1) != '/' && src.substr(src.length - 1) != '\\') {
+ src += '\\';
+ }
+ headers_install[headers_install.length] = [dir + src, 'dir',''];
+ ADD_FLAG("INSTALL_HEADERS_DIR", dir + src);
+ found = true;
+ } else if (isfile) {
+ dirname = FSO.GetParentFolderName(dir + src);
+ headers_install[headers_install.length] = [dir + src, 'file', dirname];
+ ADD_FLAG("INSTALL_HEADERS", dir + src);
+ found = true;
+ } else {
+ path = configure_module_dirname + "\\"+ src;
+ isdir = FSO.FolderExists(path);
+ isfile = FSO.FileExists(path);
+ if (isdir) {
+ if (src.length > 0 && src.substr(src.length - 1) != '/' && src.substr(src.length - 1) != '\\') {
+ src += '\\';
+ }
+ headers_install[headers_install.length] = [path, 'dir',''];
+ ADD_FLAG("INSTALL_HEADERS_DIR", path);
+ } else if (isfile) {
+ dirname = FSO.GetParentFolderName(path);
+ headers_install[headers_install.length] = [path, 'file', dir];
+ ADD_FLAG("INSTALL_HEADERS", dir + src);
+ found = true;
+ }
+ }
+
+ if (found == false) {
+ STDOUT.WriteLine(headers_list);
+ ERROR("Cannot find header " + dir + src);
+ }
+ }
+}
+
+// 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";
+if (!MODE_PHPIZE) {
+ 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 new file mode 100644 index 0000000..c5f92a3 --- /dev/null +++ b/win32/build/cvsclean.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/deplister.c b/win32/build/deplister.c new file mode 100644 index 0000000..8da65ba --- /dev/null +++ b/win32/build/deplister.c @@ -0,0 +1,60 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 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$ */ + +/* This little application will list the DLL dependencies for a PE + * module to it's stdout for use by distro/installer building tools */ + +#include <windows.h> +#include <imagehlp.h> + +BOOL CALLBACK StatusRoutine(IMAGEHLP_STATUS_REASON reason, + PSTR image_name, PSTR dll_name, + ULONG va, ULONG param) +{ + switch (reason) { + case BindImportModuleFailed: + printf("%s,NOTFOUND\n", dll_name); + return TRUE; + + case BindImportModule: + printf("%s,OK\n", dll_name); + return TRUE; + } + return TRUE; +} + +/* usage: + * deplister.exe path\to\module.exe path\to\symbols\root + * */ + +int main(int argc, char *argv[]) +{ + return BindImageEx(BIND_NO_BOUND_IMPORTS | BIND_NO_UPDATE | BIND_ALL_IMAGES, + argv[1], NULL, argv[2], StatusRoutine); +} + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: noet sw=4 ts=4 fdm=marker + * vim<600: noet sw=4 ts=4 + */ diff --git a/win32/build/libs_version.txt b/win32/build/libs_version.txt new file mode 100644 index 0000000..decae8f --- /dev/null +++ b/win32/build/libs_version.txt @@ -0,0 +1,16 @@ +bz2-1.0.6
+cclient-2007e
+freetype-2.4.3
+icu-49.1.2
+jpeglib-8
+libcurl-7.29.0
+libiconv-1.14
+libmcrypt-2.5.8
+libmpir-2.5.1
+libpng-1.2.50
+libpq-8.3.6
+libssh2-1.4.2
+libtidy-20090325
+libxslt-1.1.27
+libxml-2.7.8
+openssl-0.9.8y
diff --git a/win32/build/mkdist.php b/win32/build/mkdist.php new file mode 100644 index 0000000..5ed9bdc --- /dev/null +++ b/win32/build/mkdist.php @@ -0,0 +1,548 @@ +<?php # $Id$ +/* piece together a windows binary distro */ + +$build_dir = $argv[1]; +$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); + +echo "Making dist for $build_dir\n"; + +$dist_dir = $build_dir . "/php-" . phpversion(); +$test_dir = $build_dir . "/php-test-pack-" . phpversion(); +$pecl_dir = $build_dir . "/pecl-" . phpversion(); + +@mkdir($dist_dir); +@mkdir("$dist_dir/ext"); +@mkdir("$dist_dir/dev"); +@mkdir("$dist_dir/extras"); +@mkdir($pecl_dir); + +/* figure out additional DLL's that are required */ +$extra_dll_deps = array(); +$per_module_deps = array(); +$pecl_dll_deps = array(); + +function get_depends($module) +{ + static $no_dist = array( + /* windows system dlls that should not be bundled */ + 'advapi32.dll', 'comdlg32.dll', 'crypt32.dll', 'gdi32.dll', 'kernel32.dll', 'ntdll.dll', + 'odbc32.dll', 'ole32.dll', 'oleaut32.dll', 'rpcrt4.dll', + 'shell32.dll', 'shlwapi.dll', 'user32.dll', 'ws2_32.dll', 'ws2help.dll', + 'comctl32.dll', 'winmm.dll', 'wsock32.dll', 'winspool.drv', 'msasn1.dll', + 'secur32.dll', 'netapi32.dll', + + /* apache */ + 'apachecore.dll', + + /* apache 2 */ + 'libhttpd.dll', 'libapr.dll', 'libaprutil.dll','libapr-1.dll', 'libaprutil-1.dll', + + /* pi3web */ + 'piapi.dll', 'pi3api.dll', + + /* nsapi */ + 'ns-httpd30.dll', 'ns-httpd35.dll', 'ns-httpd36.dll', 'ns-httpd40.dll', + + /* oracle */ + 'oci.dll', 'ociw32.dll', + + /* sybase */ + 'libcs.dll', 'libct.dll', + + /* firebird */ + 'fbclient.dll', + + /* visual C++; mscvrt.dll is present on everyones system, + * 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; + + $bd = strtolower(realpath($build_dir)); + + $is_pecl = in_array($module, $pecl_targets); + + $cmd = "$GLOBALS[build_dir]\\deplister.exe \"$module\" \"$GLOBALS[build_dir]\""; + $proc = proc_open($cmd, + array(1 => array("pipe", "w")), + $pipes); + + $n = 0; + while (($line = fgetcsv($pipes[1]))) { + $n++; + + $dep = strtolower($line[0]); + $depbase = basename($dep); + /* ignore stuff in our build dir, but only if it is + * one of our targets */ + if (((in_array($depbase, $sapi_targets) || + in_array($depbase, $ext_targets) || in_array($depbase, $pecl_targets)) || + $depbase == $phpdll) && file_exists($GLOBALS['build_dir'] . "/$depbase")) { + continue; + } + /* ignore some well-known system dlls */ + if (in_array(basename($dep), $no_dist)) { + continue; + } + + if ($is_pecl) { + if (!in_array($dep, $pecl_dll_deps)) { + $pecl_dll_deps[] = $dep; + } + } else { + if (!in_array($dep, $extra_dll_deps)) { + $extra_dll_deps[] = $dep; + } + } + + $per_module_deps[basename($module)][] = $dep; + } + fclose($pipes[1]); + proc_close($proc); +//echo "Module $module [$n lines]\n"; +} + +function copy_file_list($source_dir, $dest_dir, $list) +{ + global $is_debug, $dist_dir; + + foreach ($list as $item) { + if (empty($item)) { + continue; + } elseif (!is_file($source_dir . DIRECTORY_SEPARATOR . $item)) { + echo "WARNING: $item not found\n"; + continue; + } + + echo "Copying $item from $source_dir to $dest_dir\n"; + copy($source_dir . DIRECTORY_SEPARATOR . $item, $dest_dir . DIRECTORY_SEPARATOR . $item); + if ($is_debug) { + $itemdb = preg_replace("/\.(exe|dll|lib)$/i", ".pdb", $item); + if (file_exists("$source_dir/$itemdb")) { + copy("$source_dir/$itemdb", "$dist_dir/dev/$itemdb"); + } + } + if (preg_match("/\.(exe|dll)$/i", $item)) { + get_depends($source_dir . '/' . $item); + } + } +} + +function copy_text_file($source, $dest) +{ + $text = file_get_contents($source); + $text = preg_replace("/(\r\n?)|\n/", "\r\n", $text); + $fp = fopen($dest, "w"); + fwrite($fp, $text); + fclose($fp); +} + +/* very light-weight function to extract a single named file from + * a gzipped tarball. This makes assumptions about the files + * based on the PEAR info set in $packages. */ +function extract_file_from_tarball($pkg, $filename, $dest_dir) /* {{{ */ +{ + global $packages; + + $name = $pkg . '-' . $packages[$pkg]; + $tarball = $dest_dir . "/" . $name . '.tgz'; + $filename = $name . '/' . $filename; + $destfilename = $dest_dir . "/" . basename($filename); + + $fp = gzopen($tarball, 'rb'); + + $done = false; + do { + /* read the header */ + $hdr_data = gzread($fp, 512); + if (strlen($hdr_data) == 0) + break; + $checksum = 0; + for ($i = 0; $i < 148; $i++) + $checksum += ord($hdr_data{$i}); + for ($i = 148; $i < 156; $i++) + $checksum += 32; + for ($i = 156; $i < 512; $i++) + $checksum += ord($hdr_data{$i}); + + $hdr = unpack("a100filename/a8mode/a8uid/a8gid/a12size/a12mtime/a8checksum/a1typeflag/a100link/a6magic/a2version/a32uname/a32gname/a8devmajor/a8devminor", $hdr_data); + + $hdr['checksum'] = octdec(trim($hdr['checksum'])); + + if ($hdr['checksum'] != $checksum) { + echo "Checksum for $tarball $hdr[filename] is invalid\n"; + print_r($hdr); + return; + } + + $hdr['size'] = octdec(trim($hdr['size'])); + echo "File: $hdr[filename] $hdr[size]\n"; + + if ($filename == $hdr['filename']) { + echo "Found the file we want\n"; + $dest = fopen($destfilename, 'wb'); + $x = stream_copy_to_stream($fp, $dest, $hdr['size']); + fclose($dest); + echo "Wrote $x bytes into $destfilename\n"; + break; + } + + /* skip body of the file */ + $size = 512 * ceil((int)$hdr['size'] / 512); + echo "Skipping $size bytes\n"; + gzseek($fp, gztell($fp) + $size); + + } while (!$done); + +} /* }}} */ + + +/* the core dll */ +copy("$build_dir/php.exe", "$dist_dir/php.exe"); +copy("$build_dir/$phpdll", "$dist_dir/$phpdll"); + +/* and the .lib goes into dev */ +$phplib = str_replace(".dll", ".lib", $phpdll); +copy("$build_dir/$phplib", "$dist_dir/dev/$phplib"); +/* debug builds; copy the symbols too */ +if ($is_debug) { + $phppdb = str_replace(".dll", ".pdb", $phpdll); + copy("$build_dir/$phppdb", "$dist_dir/dev/$phppdb"); +} +/* copy the sapi */ +copy_file_list($build_dir, "$dist_dir", $sapi_targets); + +/* copy the extensions */ +copy_file_list($build_dir, "$dist_dir/ext", $ext_targets); + +/* pecl sapi and extensions */ +if(sizeof($pecl_targets)) { + copy_file_list($build_dir, $pecl_dir, $pecl_targets); +} + +/* populate reading material */ +$text_files = array( + "LICENSE" => "license.txt", + "NEWS" => "news.txt", + "README.REDIST.BINS" => "readme-redist-bins.txt", + "php.ini-development" => "php.ini-development", + "php.ini-production" => "php.ini-production", + "win32/install.txt" => "install.txt", + "win32/pws-php5cgi.reg" => "pws-php5cgi.reg", + "win32/pws-php5isapi.reg" => "pws-php5isapi.reg", +); + +foreach ($text_files as $src => $dest) { + copy_text_file($src, $dist_dir . '/' . $dest); +} + +/* general other files */ +$general_files = array( + "php.gif" => "php.gif", +); + +foreach ($general_files as $src => $dest) { + copy($src, $dist_dir . '/' . $dest); +} + +/* include a snapshot identifier */ +$branch = "HEAD"; // TODO - determine this from SVN branche name +$fp = fopen("$dist_dir/snapshot.txt", "w"); +$now = date("r"); +$version = phpversion(); +fwrite($fp, <<<EOT +This snapshot was automatically generated on +$now + +Version: $version +Branch: $branch +Build: $build_dir + +EOT +); +/* list build-in extensions */ +$exts = get_loaded_extensions(); +fprintf($fp, "\r\nBuilt-in Extensions\r\n"); +fwrite($fp, "===========================\r\n"); +foreach ($exts as $ext) { + fprintf($fp, "%s\r\n", $ext); +} +fwrite($fp, "\r\n\r\n"); + +/* list dependencies */ +fprintf($fp, "Dependency information:\r\n"); +foreach ($per_module_deps as $modulename => $deps) { + if (in_array($modulename, $pecl_targets)) + continue; + + fprintf($fp, "Module: %s\r\n", $modulename); + fwrite($fp, "===========================\r\n"); + foreach ($deps as $dll) { + fprintf($fp, "\t%s\r\n", basename($dll)); + } + fwrite($fp, "\r\n"); +} +fclose($fp); + +/* Now add those dependencies */ +foreach ($extra_dll_deps as $dll) { + if (!file_exists($dll)) { + /* try template dir */ + $tdll = $snapshot_template . "/dlls/" . basename($dll); + if (!file_exists($tdll)) { + $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; + } + } + $dll = $tdll; + } + copy($dll, "$dist_dir/" . basename($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 = $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) { + if (in_array($dll, $extra_dll_deps)) { + /* already in main distro */ + continue; + } + if (!file_exists($dll)) { + /* try template dir */ + $tdll = $snapshot_template . "/dlls/" . basename($dll); + if (!file_exists($tdll)) { + echo "WARNING: distro depends on $dll, but could not find it on your system\n"; + continue; + } + $dll = $tdll; + } + copy($dll, "$pecl_dir/" . basename($dll)); +} + +function copy_dir($source, $dest) +{ + if (!is_dir($dest)) { + if (!mkdir($dest)) { + return false; + } + } + + $d = opendir($source); + while (($f = readdir($d)) !== false) { + if ($f == '.' || $f == '..' || $f == '.svn') { + continue; + } + $fs = $source . '/' . $f; + $fd = $dest . '/' . $f; + if (is_dir($fs)) { + copy_dir($fs, $fd); + } else { + copy($fs, $fd); + } + } + closedir($d); +} + + + +function copy_test_dir($directory, $dest) +{ + if(substr($directory,-1) == '/') { + $directory = substr($directory,0,-1); + } + + if ($directory == 'tests' || $directory == 'examples') { + if (!is_dir($dest . '/tests')) { + mkdir($dest . '/tests', 0775, true); + } + copy_dir($directory, $dest . '/tests/'); + + return false; + } + + if(!file_exists($directory) || !is_dir($directory)) { + echo "failed... $directory\n"; + return FALSE; + } + + $directory_list = opendir($directory); + + while (FALSE !== ($file = readdir($directory_list))) { + $full_path = $directory . '/' . $file; + if($file != '.' && $file != '..' && $file != '.svn' && is_dir($full_path)) { + if ($file == 'tests' || $file == 'examples') { + if (!is_dir($dest . '/' . $full_path)) { + mkdir($dest . '/' . $full_path , 0775, true); + } + copy_dir($full_path, $dest . '/' . $full_path . '/'); + continue; + } else { + copy_test_dir($full_path, $dest); + } + } + } + + closedir($directory_list); +} + +function make_phar_dot_phar($dist_dir) +{ + if (!extension_loaded('phar')) { + return; + } + + $path_to_phar = realpath(__DIR__ . '/../../ext/phar'); + + echo "Generating pharcommand.phar\n"; + $phar = new Phar($dist_dir . '/pharcommand.phar', 0, 'pharcommand'); + + foreach (new DirectoryIterator($path_to_phar . '/phar') as $file) { + if ($file->isDir() || $file == 'phar.php') { + continue; + } + + echo 'adding ', $file, "\n"; + $phar[(string) $file] = file_get_contents($path_to_phar. '/phar/' . $file); + } + + $phar->setSignatureAlgorithm(Phar::SHA1); + $stub = file($path_to_phar . '/phar/phar.php'); + + unset($stub[0]); // remove hashbang + $phar->setStub(implode('', $stub)); + + echo "Creating phar.phar.bat\n"; + file_put_contents($dist_dir . '/phar.phar.bat', "%~dp0php.exe %~dp0pharcommand.phar %*\r\n"); +} + +if (!is_dir($test_dir)) { + mkdir($test_dir); +} + +$dirs = array( + 'ext', + 'Sapi', + 'Zend', + 'tests' +); +foreach ($dirs as $dir) { + copy_test_dir($dir, $test_dir); +} +copy('run-tests.php', $test_dir . '/run-test.php'); + +/* change this next line to true to use good-old + * hand-assembled go-pear-bundle from the snapshot template */ +$use_pear_template = true; + +if (!$use_pear_template) { + /* Let's do a PEAR-less pear setup */ + mkdir("$dist_dir/PEAR"); + mkdir("$dist_dir/PEAR/go-pear-bundle"); + + /* grab the bootstrap script */ + echo "Downloading go-pear\n"; + copy("http://pear.php.net/go-pear", "$dist_dir/PEAR/go-pear.php"); + + /* import the package list -- sets $packages variable */ + include "pear/go-pear-list.php"; + + /* download the packages into the destination */ + echo "Fetching packages\n"; + + foreach ($packages as $name => $version) { + $filename = "$name-$version.tgz"; + $destfilename = "$dist_dir/PEAR/go-pear-bundle/$filename"; + if (file_exists($destfilename)) + continue; + $url = "http://pear.php.net/get/$filename"; + echo "Downloading $name from $url\n"; + flush(); + copy($url, $destfilename); + } + + echo "Download complete. Extracting bootstrap files\n"; + + /* Now, we want PEAR.php, Getopt.php (Console_Getopt) and Tar.php (Archive_Tar) + * broken out of the tarballs */ + extract_file_from_tarball('PEAR', 'PEAR.php', "$dist_dir/PEAR/go-pear-bundle"); + extract_file_from_tarball('Archive_Tar', 'Archive/Tar.php', "$dist_dir/PEAR/go-pear-bundle"); + extract_file_from_tarball('Console_Getopt', 'Console/Getopt.php', "$dist_dir/PEAR/go-pear-bundle"); +} + +/* add extras from the template dir */ +if (file_exists($snapshot_template)) { + $items = glob("$snapshot_template/*"); + print_r($items); + + foreach ($items as $item) { + $bi = basename($item); + if (is_dir($item)) { + if ($bi == 'dlls' || $bi == 'symbols') { + continue; + } else if ($bi == 'PEAR') { + if ($use_pear_template) { + /* copy to top level */ + copy_dir($item, "$dist_dir/$bi"); + } + } else { + /* copy that dir into extras */ + copy_dir($item, "$dist_dir/extras/$bi"); + } + } else { + if ($bi == 'go-pear.bat') { + /* copy to top level */ + copy($item, "$dist_dir/$bi"); + } else { + /* copy to extras */ + copy($item, "$dist_dir/extras/$bi"); + } + } + } + + /* copy c++ runtime */ + $items = glob("$snapshot_template/dlls/*.CRT"); + + foreach ($items as $item) { + $bi = basename($item); + if (is_dir($item)) { + copy_dir($item, "$dist_dir/$bi"); + copy_dir($item, "$dist_dir/ext/$bi"); + } + } +} else { + echo "WARNING: you don't have a snapshot template, your dist will not be complete\n"; +} + +make_phar_dot_phar($dist_dir); +?> diff --git a/win32/build/php.ico b/win32/build/php.ico Binary files differnew file mode 100644 index 0000000..43bf002 --- /dev/null +++ b/win32/build/php.ico diff --git a/win32/build/phpize.bat b/win32/build/phpize.bat new file mode 100644 index 0000000..c8840d3 --- /dev/null +++ b/win32/build/phpize.bat @@ -0,0 +1,6 @@ +@echo off +SET PHP_BUILDCONF_PATH=%~dp0 +cscript /nologo %PHP_BUILDCONF_PATH%\script\phpize.js %* +copy %PHP_BUILDCONF_PATH%\win32\build\configure.bat %PHP_BUILDCONF_PATH% > nul +IF NOT EXIST %PHP_BUILDCONF_PATH% (echo Error generating configure script, configure script was not copied) ELSE (echo Now run 'configure --help') +SET PHP_BUILDCONF_PATH= diff --git a/win32/build/phpize.js.in b/win32/build/phpize.js.in new file mode 100644 index 0000000..4813ec0 --- /dev/null +++ b/win32/build/phpize.js.in @@ -0,0 +1,260 @@ +/*
+ +----------------------------------------------------------------------+
+ | 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: Pierre Joye <pierre1@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $Id$ */
+// This generates a configure script for win32 build
+
+var STDOUT = WScript.StdOut;
+
+var FSO = WScript.CreateObject("Scripting.FileSystemObject");
+var C = FSO.CreateTextFile("configure.js", true);
+var B = FSO.CreateTextFile("configure.bat", true);
+var DSP = false;
+re = /\\script/i;
+var PHP_DIR=FSO.GetParentFolderName(WScript.ScriptFullName).replace(re,"");
+
+var modules = "";
+var MODULES = WScript.CreateObject("Scripting.Dictionary");
+var module_dirs = new Array();
+
+function ERROR(msg)
+{
+ STDERR.WriteLine("ERROR: " + msg);
+ WScript.Quit(3);
+}
+
+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 get_module_dep(contents)
+{
+ var re_dep_line = new RegExp("ADD_EXTENSION_DEP\\([^,]*\\s*,\\s*['\"]([^'\"]+)['\"].*\\)", "gm");
+ var calls = contents.match(re_dep_line);
+ var deps = new Array();
+ 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)) {
+ deps[deps.length] = RegExp.$1;
+
+ }
+ }
+ }
+ return deps;
+}
+
+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;
+
+ c = dirname + "\\config.w32";
+ if (FSO.FileExists(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);
+
+ deps = get_module_dep(contents);
+
+ item = new Module_Item(n, c, dir_line, deps, contents);
+ MODULES.Add(n, item);
+ }
+
+ for (; !fc.atEnd(); fc.moveNext()) {
+ /* 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' || n == '.git') {
+ continue;
+ }
+
+ c = FSO.BuildPath(fc.item(), "config.w32");
+ if (FSO.FileExists(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);
+
+ deps = get_module_dep(contents);
+
+ item = new Module_Item(n, c, dir_line, deps, contents);
+ MODULES.Add(n, item);
+ }
+ }
+}
+
+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) {
+ STDOUT.WriteLine("module ... " + 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 == '--clean' && argval != null) {
+ STDOUT.WriteLine("Cleaning...");
+ return 0;
+ }
+
+ if (argname == '--help') {
+ STDOUT.WriteLine("Usage: phpize [--clean|--help|--version|-v]");
+ return 0;
+ }
+ return 1;
+ }
+}
+
+if (buildconf_process_args() == 0) {
+ WScript.Quit(3);
+}
+STDOUT.WriteLine("Rebuilding configure.js");
+STDOUT.WriteLine(PHP_DIR);
+
+// Write the head of the configure script
+C.WriteLine("/* This file automatically generated from script/confutils.js */");
+C.WriteLine("var MODE_PHPIZE = true;");
+C.WriteLine("var PHP_DIR = " + '"' + PHP_DIR.replace(new RegExp('(["\\\\])', "g"), '\\$1') + '"');
+
+C.Write(file_get_contents(PHP_DIR + "/script/confutils.js"));
+C.Write(file_get_contents(PHP_DIR + "/script/config.phpize.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(PHP_DIR + "win32/build/projectgen.js"));
+} else {
+ C.WriteLine('PHP_DSP="no"');
+ C.WriteBlankLines(1);
+}
+
+// Pull in code for the base detection
+modules = file_get_contents(PHP_DIR + "/script/config.w32.phpize.in");
+
+C.WriteLine("ARG_ENABLE('debug', 'Compile with debugging symbols', \"no\");");
+find_config_w32(".");
+
+// 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(PHP_DIR + "\\script\\configure.tail"));
+
+B.WriteLine("@echo off");
+B.WriteLine("cscript /nologo configure.js %*");
diff --git a/win32/build/projectgen.js b/win32/build/projectgen.js new file mode 100644 index 0000000..390a303 --- /dev/null +++ b/win32/build/projectgen.js @@ -0,0 +1,625 @@ +/* check for duplicate entries */ +function check_duplicates(local, core) +{ + if (!local) { + return core; + } + + arr = local.split(" "); + + for(i = 0; i < arr.length; i++) { + if (core.match(arr[i])) { + continue; + } + core += " " + arr[i]; + } + + return core; +} + +/* read .dsp source blocks */ +function read_src_files(ext, tmpl, path) +{ + sources = file_get_contents("tmp\\src\\" + ext + ".sources.tmp"); + sources = (path ? sources.replace(/\.\//g, path) : sources); + tmpl = tmpl.replace("SOURCEFILES", sources); + FSO.DeleteFile("tmp\\src\\" + ext + ".sources.tmp"); + + headers = file_get_contents("tmp\\src\\" + ext + ".headers.tmp"); + headers = (path ? headers.replace(/\.\//g, path) : headers); + tmpl = tmpl.replace("HEADERFILES", headers); + FSO.DeleteFile("tmp\\src\\" + ext + ".headers.tmp"); + + return tmpl; +} + +/* write a .dsp source block */ +function write_src_file(fname, path, intpath, arr) +{ + FSO.FolderExists("tmp\\src") ? "" : FSO.CreateFolder("tmp\\src"); + var src = FSO.CreateTextFile("tmp\\src\\" + fname, true); + var out = get_define("BUILD_DIR"); + var libpath = ""; + + for (i = 0; i < arr.length; i++) { + if (arr[i].length > 1) { + if (arr[i].match('alloca.c') || + arr[i].match(/internal_functions_(nw|win32)\.c/) || + arr[i].match(/flock\.(c|h)/) || + arr[i].match(/zend_static_allocator\.(c|h)/) || + arr[i].match(/zend_(ini|language)_scanner_defs\.h/)) { + continue; + } + + libpath = arr[i].substr(2, arr[i].lastIndexOf("\\") - 2); + if (libpath) { + libpath = "\\" + libpath; + } + + src.WriteLine("# Begin Source File"); + src.WriteLine("SOURCE=" + arr[i]); + src.WriteLine('# PROP Intermediate_Dir "' + intpath + out + '\\' + path + libpath + '"'); + src.WriteLine("# End Source File"); + src.WriteBlankLines(1); + } + } + + src.Close(); + return; +} + +/* generate list of text files */ +function generate_text_filelist(ext, ext_dir) +{ + var txtdir = FSO.GetFolder(ext_dir); + + block = '# Begin Group "Text Files"\r\n\# PROP Default_Filter ""\r\n\r\n'; + txt = new Enumerator(txtdir.Files); + + for (; !txt.atEnd(); txt.moveNext()) { + fname = FSO.GetFileName(txt.item()); + munged = fname.replace(ext, ""); /* TSRM...! */ + + if (munged.match(/[A-Z]{4}/)){ + block += "# Begin Source File\r\n"; + block += "SOURCE=./" + fname + "\r\n"; + block += "# End Source File\r\n\r\n"; + } + } + + block += "# End Group\r\n"; + return block; +} + +/* generate list of resource files */ +function generate_resource_filelist(ext, ext_dir) +{ + var resdir = FSO.GetFolder(ext_dir); + res = new Enumerator(resdir.Files); + block = ""; + + for (; !res.atEnd(); res.moveNext()) { + fname = FSO.GetFileName(res.item()); + + if (fname.match(/\.(ico|rc)/)) { + block += "# Begin Source File\r\n"; + block += "SOURCE=./" + fname + "\r\n"; + block += "# End Source File\r\n\r\n"; + } + } + + return block; +} + +/* generate parser and scanner files for Zend */ +function generate_parsers_or_scanners(arr, type) +{ + var filter = (type.match("Parsers") ? "y" : "l"); + + ret = '# Begin Group "' + type + '"\r\n# PROP Default_Filter "' + filter + '"\r\n\r\n'; + + for (i = 0; i < arr.length; i++) { + + fl = "zend_" + arr[i] + "_" + type.toLowerCase().substr(0, type.length - 1); + ret += "# Begin Source File\r\n"; + ret += "SOURCE=.\\" + fl + "." + filter + "\r\n\r\n"; + ret += '# Begin Custom Build\r\n\r\n'; + + if (type.match("Parsers")) { + pre = (arr[i].match(/ini/) ? "ini_ " : "zend "); + ret += fl + ".c " + fl + ".h: " + fl + ".y\r\n"; + ret += "\tbison --output=" + fl + ".c -v -d -p " + pre + fl + ".y\r\n\r\n"; + } else { + ret += fl + ".c: " + fl + ".l\r\n"; + ret += "\tre2c --case-inverted -cbdFt " + fl + "_defs.h -o" + fl + ".c " + fl + ".l\r\n\r\n"; + } + + ret += "# End Custom Build\r\n"; + ret += "# End Source File\r\n"; + } + + ret += "# End Group\r\n\r\n"; + return ret; +} + +/* generate .defs file for php5[ts].dll */ +function generate_php_defs() +{ + var defs = get_define("PHP_DLL_DEF_SOURCES").split(" "); + var bdir = get_define("BUILD_DIR") + "\\"; + var file = get_define("PHPLIB").replace("lib", "def"); + var path = "..\\" + bdir + file; + var deps = "USERDEP__PHP5TS="; + var cmds = "BuildCmds= \\\r\n"; + var cmd = '$(SOURCE) "$(INTDIR)" "$(OUTDIR)"\r\n\t$(BuildCmds)\r\n'; + + for (i = 0; i < defs.length; i++) { + deps += '"..\\' + defs[i] + '" '; + cmds += "\ttype ..\\" + defs[i] + (i == 0 ? " > " : " >> ") + path + " \\\r\n"; + } + + ret = '# Begin Group "Defs Files"\r\n\r\n'; + ret += "# Begin Source File\r\nSOURCE=" + path + "\r\n\r\n"; + ret += deps.substr(0, deps.length-1) + "\r\n# Begin Custom Build - "; + ret += "Generating $(InputPath)\r\nInputPath=" + path + "\r\n\r\n"; + ret += cmds + '\r\n\"' + path + '" : ' + cmd + "\r\n"; + ret += "# End Custom Build\r\n# End Source File\r\n\r\n"; + ret += "# End Group\r\n"; + return ret; +} + +/* generate win32\wsyslog.h for php5[ts].dll */ +function generate_wsyslog() +{ + var path = ".\\build\\wsyslog.mc\r\n\r\n"; + var intdir = "..\\" + get_define("BUILD_DIR"); + + ret = "# Begin Source File\r\nSOURCE=" + path; + ret += "# Begin Custom Build\r\nInputDir=.\\build\r\n"; + ret += "IntDir=" + intdir + "\r\nInputPath=" + path; + ret += '"wsyslog.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"\r\n'; + ret += "\tmc -h $(InputDir)/.. -r $(InputDir) -x $(IntDir) $(InputPath)\r\n\r\n"; + ret += "# End Custom Build\r\n# End Source File\r\n"; + return ret; +} + +/* generate ext\date\lib\timelib_config.h for php5[ts].dll */ +function generate_timelib_conf(headers) +{ + var file = "timelib_config.h"; + var path = "..\\ext\\date\\lib\\timelib_config.h"; + var pos = headers.search(file); + var entry = headers.slice(pos, pos + 64); + + replace = entry.replace(file, file + ".win32"); + replace += "\r\n\r\n# Begin Custom Build\r\nInputDir=..\\ext\\date\\lib\r\n"; + replace += "InputPath=" + path + ".win32\r\n\r\n"; + replace += '"' + path + '" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"\r\n'; + replace += "\tcopy $(InputPath) $(InputDir)\\" + file + "\r\n\r\n"; + replace += "# End Custom Build"; + + headers = headers.replace(entry, replace); + return headers; +} + +/* generate php5[ts].dsp */ +function generate_core_dsp(core_headers, core_sources, headers, sources, cflags, ldflags, libs) +{ + var ts = (PHP_ZTS != "no" ? "ts" : ""); + var extname = "php5" + ts; + var tmpl = generate_dsp_file(extname, ".", false, false); + + cflags += get_define("CFLAGS_PHP").replace("/D _USRDLL", ""); + cflags = cflags.replace(/\/(I|D)(\S)/g, "/$1 $2"); + ldflags += get_define("LDFLAGS_PHP"); + libs += get_define("LIBS_PHP"); + + tmpl = tmpl.replace(/LOCALCPP/, cflags.replace(/\"ext/g, '"../ext') + " /c"); + tmpl = tmpl.replace(/LOCALLIBS/, libs); + tmpl = tmpl.replace(/LOCALLDFLAGS/, ldflags); + tmpl = tmpl.replace(extname + ".dll", get_define("PHPDLL")); + + wsyslog = (core_headers.match("wsyslog.h") ? "" : generate_wsyslog(core_headers)); + core_sources = '# Begin Group "CORE"\r\n' + core_sources + "# End Group\r\n"; + tmpl = tmpl.replace(/CORESOURCES/, core_sources); + core_headers = '# Begin Group "CORE "\r\n' + core_headers + "# End Group\r\n"; + tmpl = tmpl.replace(/COREHEADERS/, core_headers + wsyslog); + + headers = generate_timelib_conf(headers); + tmpl = tmpl.replace(/SOURCEFILES/, sources); + tmpl = tmpl.replace(/HEADERFILES/, headers); + + defs = generate_php_defs(); + tmpl = tmpl.replace(/DEFS/, defs); + + dsp = FSO.CreateTextFile("win32\\php5" + ts + ".dsp", true); + STDOUT.WriteLine("\tGenerating win32\\php5" + ts + ".dsp"); + dsp.Write(tmpl); + dsp.Close(); + + return; +} + +/* generate .dsw files */ +function generate_dsw_files(sblocks, mblocks) +{ + var stmpl = file_get_contents("win32\\build\\template.dsw"); + var mtmpl = file_get_contents("win32\\build\\template.dsw"); + var ts = (PHP_ZTS != "no" ? "ts" : ""); + + /* push all the sapi blocks to the same tag */ + stmpl = stmpl.replace("INSERT", sblocks); + stmpl = (PHP_ZTS != "no" ? stmpl : stmpl.replace(/dllts/g, "dll")); + sdsw = FSO.CreateTextFile("win32\\php5" + ts + ".dsw", true); + STDOUT.WriteLine("\tGenerating win32\\php5" + ts + ".dsw"); + sdsw.Write(stmpl); + sdsw.Close(); + + /* same for shared modules - except that nothing else goes in here */ + garbage = mtmpl.slice(200, mtmpl.search("INSERT")); + mtmpl = mtmpl.replace(garbage, "\r\n"); + mtmpl = mtmpl.replace("INSERT", mblocks); + mtmpl = (PHP_ZTS != "no" ? mtmpl : mtmpl.replace(/dllts/g, "dll")); + mdsw = FSO.CreateTextFile("win32\\php_modules.dsw", true); + STDOUT.WriteLine("\tGenerating win32\\php_modules.dsw"); + mdsw.Write(mtmpl); + mdsw.Close(); + + return; +} + +/* finalize .dsp files and copy to final destination */ +function copy_dsp_files() +{ + var tmp = FSO.GetFolder("tmp"); + var CORE_HEADERS = ""; + var CORE_SOURCES = ""; + var EXT_HEADERS = ""; + var EXT_SOURCES = ""; + var EXT_CFLAGS = ""; + var EXT_LDFLAGS = ""; + var EXT_LIBS = ""; + var sblocks = ""; /* for sapis */ + var mblocks = ""; /* for modules */ + + f = new Enumerator(tmp.Files); + + for (; !f.atEnd(); f.moveNext()) { + /* retrieve the path */ + contents = file_get_contents(f.item()); + address = contents.slice(0, contents.indexOf("#")); + contents = contents.slice(contents.indexOf("#")+1); + shared = contents.slice(0, contents.indexOf("#")); + contents = contents.slice(contents.indexOf("#")); + + /* pick up module name and path */ + path = address.slice(0, address.lastIndexOf("\\")+1); + ext = address.slice(address.lastIndexOf("\\")+1, address.length-4); + EXT = ext.toUpperCase(); + + if (path.match(/(sapi|ext)/)) { + rel = "..\\..\\"; + } else { + rel = "..\\"; + } + + /* pick up local flags and libs */ + cflags = get_define("CFLAGS_" + EXT); + cflags += (ext.match(/(TSRM|Zend)/) ? "/D TSRM_EXPORTS " : ""); + cflags += (ext.match(/Zend/) ? "/D LIBZEND_EXPORTS " : ""); + libs = get_define("LIBS_" + EXT); + ldflags = get_define("LDFLAGS_" + EXT); + ldflags = ldflags.replace(/(\.\.\\)/g, rel + "$1"); + contents = contents.replace(/LOCALCPP/, cflags + " /c"); + contents = contents.replace(/LOCALLIBS/, libs); + contents = contents.replace(/LOCALLDFLAGS/, ldflags); + + if (ext.match("Zend")) { + arr = new Array("ini", "language"); + parsers = generate_parsers_or_scanners(arr, "Parsers"); + scanners = generate_parsers_or_scanners(arr, "Scanners"); + contents = contents.replace(/DEFS/, parsers + scanners); + } + + /* none of these are core... */ + contents = contents.replace(/\r\n(CORESOURCES|COREHEADERS|EXTSOURCES|EXTHEADERS|DEFS)\r\n/g, ""); + + if (address.match("sapi")) { + /* most sapis are .dlls, just not cgi, cli, embed */ + + if (ext == "cli") { + + /* change of address: php.dsp */ + newext = "cli"; + address = "win32\\php.dsp"; + srcpath = "..\\" + path; + contents = contents.replace(/cli\.exe/g, "php.exe"); + + } else if (ext == "cgi") { + + /* change of address: php-cgi.dsp */ + newext = "cgi"; + address = "win32\\php-cgi.dsp"; + srcpath = "..\\" + path; + contents = contents.replace(/cgi\.exe/g, "php-cgi.exe"); + + } else { + + /* there's always one... most sapis just get a 'php5' prefix */ + newext = (ext.match(/apache2handler/) ? "php5apache2" : "php5" + ext); + address = address.replace(ext + ".dsp", newext + ".dsp"); + srcpath = ".\\"; + oldext = new RegExp(('[^=\\\\]'+ext), "g"); + contents = contents.replace(oldext, newext); + contents = contents.replace(ext + ".dll", newext + ".dll"); + contents = contents.replace("CFG=" + ext, "CFG=" + newext); + } + + contents = read_src_files(ext, contents, (srcpath ? srcpath : false)); + dsp = FSO.CreateTextFile(address, true); + STDOUT.WriteLine("\tGenerating " + address); + dsp.Write(contents); + dsp.Close(); + + /* add all configured sapis to the list in php5ts.dsw */ + sblocks += file_get_contents("win32\\build\\block.template.dsw"); + sblocks = sblocks.replace("ADDRESS", address); + sblocks = sblocks.replace("EXTNAME", newext); + + } else if (address.match("ext") && shared == "true") { + + /* independent modules with their own .dsp */ + contents = read_src_files(ext, contents, false); + dsp = FSO.CreateTextFile(address, true); + STDOUT.WriteLine("\tGenerating " + address); + dsp.Write(contents); + dsp.Close(); + + mblocks += file_get_contents("win32\\build\\block.template.dsw"); + mblocks = mblocks.replace("ADDRESS", address); + mblocks = mblocks.replace("EXTNAME", ext); + + } else if (ext.match(/(TSRM|Zend)/)) { + + contents = read_src_files(ext, contents, false); + dsp = FSO.CreateTextFile(address, true); + STDOUT.WriteLine("\tGenerating " + address); + dsp.Write(contents); + dsp.Close(); + + } else { + + /* bound for php5[ts].dsp */ + cflags = get_define("CFLAGS_" + EXT); + cflags = cflags ? cflags.replace(/-(I|D)/g, " /$1") : ""; + cflags = cflags? cflags.replace(/\/(I|D)\s+/g, "/$1") : ""; + cflags = cflags ? cflags.replace(/\/I(?!\")(\S+)/g, '/I"$1"') : ""; + + EXT_CFLAGS = check_duplicates(cflags, EXT_CFLAGS); + EXT_LDFLAGS = check_duplicates(ldflags, EXT_LDFLAGS); + EXT_LIBS = check_duplicates(libs, EXT_LIBS); + + beginh = '# Begin Group "' + ext + ' "\r\n'; + begins = '# Begin Group "' + ext + '"\r\n'; + + hdr = file_get_contents("tmp\\src\\" + ext + ".headers.tmp"); + hdr = hdr.replace(/\.\//g, "..\\" + path); + hdr = hdr.replace(/\.\.\\\.\.\\/g, "..\\"); + + src = file_get_contents("tmp\\src\\" + ext + ".sources.tmp"); + src = src.replace(/\.\//g, "..\\" + path); + src = src.replace(/\.\.\\\.\.\\/g, "..\\"); + + if (ext.match(/(main|standard|streams|win32)/)) { + CORE_HEADERS += beginh + hdr + "# End Group\r\n"; + CORE_SOURCES += begins + src + "# End Group\r\n"; + } else { + EXT_HEADERS += beginh + hdr + "# End Group\r\n"; + EXT_SOURCES += begins + src + "# End Group\r\n"; + } + + FSO.DeleteFile("tmp\\src\\" + ext + ".headers.tmp"); + FSO.DeleteFile("tmp\\src\\" + ext + ".sources.tmp"); + } + + FSO.DeleteFile(f.item()); + } + + generate_core_dsp(CORE_HEADERS, CORE_SOURCES, EXT_HEADERS, EXT_SOURCES, EXT_CFLAGS, EXT_LDFLAGS, EXT_LIBS); + generate_dsw_files(sblocks, mblocks); + + /* goodnight vienna */ + FSO.DeleteFolder("tmp\\src"); + FSO.DeleteFolder("tmp"); +} + +/* generate source and header entries for .dsp files */ +function generate_dsp_filelist(ext, ext_dir, files, intpath) +{ + var EXT = ext.toUpperCase(); + var tabs = new RegExp("[\t\r\n\'\"]", "gm"); + var ws = new RegExp("\\s+", "g"); + var dir = FSO.GetFolder(ext_dir); + var configfile = FSO.BuildPath(ext_dir, "config.w32"); + var headers = ""; + var path = ""; + + if (!files) { + /* module either lacks a config.w32 or is core + * either way, we know nothing about its sources + */ + files = ""; + f = new Enumerator(dir.Files); + + for (; !f.atEnd(); f.moveNext()) { + name = FSO.GetFileName(f.item()); + + if (name.substr(name.length-2) == ".c") { + files += " ./" + name; + } + } + } else { + files = files.replace(tabs, ""); + files = "./" + files.replace(/ /g, " ./"); + } + + DSP_SOURCES = files.split(" "); + + /* pick up headers (all modules) */ + f = new Enumerator(dir.Files); + + for (; !f.atEnd(); f.moveNext()) { + name = FSO.GetFileName(f.item()); + + if (name.substr(name.length-2) == ".h") { + headers += " ./" + name; + } + } + + DSP_HEADERS = headers.split(" "); + + /* check for bundled library paths and sourcefiles */ + if (FSO.FileExists(configfile)) { + config = file_get_contents(configfile); + + if (config.match("ADD_SOURCES")) { + sources = new RegExp("ADD_SOURCES\\([^,]*\\s*,\\s*['\"]([^'\"]+)['\"].*\\)", "gm"); + arr = config.match(sources); + line = arr[0].replace(tabs, ""); + line = line.replace(/ADD_SOURCES\((.+)\)/, "$1"); + newarr = line.split(','); + orig_path = newarr[0].replace(/\//g, "\\"); + orig_path = orig_path.replace(/configure_module_dirname(\s?\+\s?)?/, ext_dir); + path = orig_path.replace(ext_dir + '\\', ""); + + if (path.length > 0 && path != ext_dir) { + subdir = FSO.GetFolder(orig_path); + lib = new Enumerator(subdir.Files); + libheaders = ""; + + for (; !lib.atEnd(); lib.moveNext()) { + name = FSO.GetFileName(lib.item()); + + if (name.substr(name.length-2) == ".h") { + libheaders += " ./" + path + "\\" + name; + } + } + + DSP_HEADERS = DSP_HEADERS.concat(libheaders.split(" ")); + + } else { + path = ""; + } + + sources = newarr[1].replace(/\\/g, ""); /* continuation lines */ + sources = sources.replace(ws, " "); + sources = sources.replace(/\s/g, (path ? " ./" + path + "\\" : " ./")); + sources = check_duplicates(DSP_SOURCES.join(" "), sources); + DSP_SOURCES = sources.split(" "); + } + } + + /* store the array contents in temp files for now */ + write_src_file(ext + ".headers.tmp", ext_dir, intpath, DSP_HEADERS); + write_src_file(ext + ".sources.tmp", ext_dir, intpath, DSP_SOURCES); + + return; +} + +/* entry point. Called from EXTENSION(), SAPI() and generate_files() (confutils.js) */ +function generate_dsp_file(ext, ext_dir, files, shared) +{ + var dsp = FSO.CreateTextFile("tmp\\" + ext + ".dsp", true); + var tmpl = file_get_contents("win32\\build\\template.dsp"); + var ts = (PHP_ZTS != "no" ? "ts" : ""); + var debug = (PHP_DEBUG != "no" ? " /debug" : ""); + var ld = (debug ? "/LDd" : "/LD"); + var status = (PHP_DEBUG == "no" ? 'Release' : 'Debug'); + var statusts = status + (ts ? "_" + ts.toUpperCase() : ""); + var baseflags = ""; + + /* store the final path and value of shared in the tmp file */ + if (!ext.match("php5")) { + tmpl = ext_dir + "\\" + ext + ".dsp#" + shared + tmpl; + } + + tmpl = tmpl.replace(/extname/g, ext); + tmpl = tmpl.replace(/Status_TS/g, statusts); + + if (debug) { + tmpl = tmpl.replace(/Use_Debug_Libraries 0/g, "Use_Debug_Libraries 1"); + tmpl = tmpl.replace(/NDEBUG/g, "_DEBUG"); + } + + if (ext == "cli" || ext == "cgi") { + tmpl = tmpl.replace(/Dynamic-Link Library/g, "Console Application"); + tmpl = tmpl.replace(/0x0102/, "0x0103"); + path = "..\\"; + type = ".exe"; + } else if (ext == "embed" || ext == "TSRM" || ext == "Zend") { + tmpl = tmpl.replace(/Dynamic-Link/g, "Static"); + tmpl = tmpl.replace(/0x0102/, "0x0104"); + tmpl = tmpl.replace(/LINK32/g, "LIB32"); + tmpl = tmpl.replace("link.exe", "link.exe -lib"); + tmpl = tmpl.replace(/BASELIBS/g, "/nologo"); + tmpl = tmpl.replace(/\s(LOCALLIBS|BASELDFLAGS|LOCALLDFLAGS|OUTPATH)/g, ""); + path = "..\\"; + if (ext == "embed") { + path += "..\\"; + } + type = ".lib"; + } else if (ext.match("php5")) { + path = "..\\"; + type = ".dll"; + } else { + path = "..\\..\\"; + type = ".dll"; + } + + outpath = path + get_define("BUILD_DIR"); + tmpl = tmpl.replace(/OUTPUTDIR/g, outpath); + + /* populate the baseline CFLAGS and libs */ + cflags = get_define("CFLAGS").replace(/\s+/g, " "); + cflags = cflags.replace('/I "..\\bindlib_w32" ', ""); + bcflags = (cflags.replace(/\/([A-Z])\s/g, "/$1")).split(" "); + + for (i= 0; i < bcflags.length; i++) { + baseflags += (bcflags[i].match(/(PHP|ZEND|ZTS|BASE|FD|WINDOWS)/) ? "" : bcflags[i]); + } + + baseflags = baseflags.replace(/\//g, " /"); + baseflags = baseflags.substr(1).replace(/(\/D)/g, "$1 ") + " /c"; + tmpl = tmpl.replace(/BASECPP/, (type == ".dll" ? baseflags : baseflags.replace(ld + " ", ""))); + + tmpl = tmpl.replace(/BASELIBS/, "/nologo " + get_define("LIBS").replace(/\sresolv.lib/, "")); + + /* now populate the bases in the 'local' lines */ + incs = get_define("BASE_INCLUDES").replace(/\/I (\S+)/g, '/I "' + path + '$1"'); + incs = incs.replace('"' + path + '."', '".."'); + lcflags = cflags.replace(/\$\(BASE_INCLUDES\)/, incs + (type == ".exe" ? '/I "..\\sapi" ' : "") + '/I "' + path + '..\\bindlib_w32"'); + tmpl = tmpl.replace(/BASECPP/, (type == ".dll" ? lcflags : lcflags.replace(ld + " ", ""))); + tmpl = tmpl.replace(/BASELIBS/, "/nologo " + get_define("LIBS") + " " + (ext.match("php5") ? "" : get_define("PHPLIB"))); + ldflags = get_define("LDFLAGS").replace(/\s?(\/nologo|\/libpath:\S+)\s?/g, ""); + tmpl = tmpl.replace(/BASELDFLAGS/, ldflags + (type == ".dll" ? " " + get_define("DLL_LDFLAGS") : "") + (debug ? ' /nodefaultlib:"msvcrt"' : "")); + out = '/out:"' + outpath + "\\" + ext + type + '"' + ' /libpath:"' + outpath + '"' + ' /libpath:"..\\' + path + 'bindlib_w32\\' + status + '"'; + tmpl = tmpl.replace(/OUTPATH/, out); + + txt = generate_text_filelist(ext, ext_dir); + res = generate_resource_filelist(ext, ext_dir); + + tmpl = tmpl.replace(/TEXTFILES/, txt); + tmpl = tmpl.replace(/RESOURCEFILES/, res); + + if (ext.match("php5")) { + return tmpl; + } + + /* generate source and header blocks for .dsp */ + generate_dsp_filelist(ext, ext_dir, files, path); + + dsp.Write(tmpl); + dsp.Close(); + + return; +} diff --git a/win32/build/registersyslog.php b/win32/build/registersyslog.php new file mode 100755 index 0000000..ce28cbf --- /dev/null +++ b/win32/build/registersyslog.php @@ -0,0 +1,44 @@ +<?php + +/* This script sets up an event source for use by the php syslog() function. */ + +if (!extension_loaded("win32std")) { + @dl("php_win32std.dll"); +} + +$PATH = "SYSTEM\\CurrentControlSet\\Services\\Eventlog\\Application\\PHP-" . phpversion(); + +$dll = $argv[1]; + +if (extension_loaded("win32std")) { + $key = @reg_create_key(HKEY_LOCAL_MACHINE, $PATH, KEY_ALL_ACCESS); + + if (!$key) + $key = reg_open_key(HKEY_LOCAL_MACHINE, $PATH, KEY_ALL_ACCESS); + + if ($key) { + reg_set_value($key, "TypesSupported", REG_DWORD, 7) or die("Types"); + reg_set_value($key, "EventMessageFile", REG_SZ, $dll) or die("EventMessageFile"); + + syslog(LOG_NOTICE, "Registered PHP Event source"); + } else { + echo "Could not register event source\n"; + } +} + +/* let's also generate/update the bundled .reg file */ + +$dll = addslashes($dll); + +file_put_contents("win32/syslog.reg", <<<REG +REGEDIT4 + +[HKEY_LOCAL_MACHINE\\$PATH] +"TypesSupported"=dword:00000007 +"EventMessageFile"="$dll" + +REG +); + + +?> diff --git a/win32/build/svnclean.js b/win32/build/svnclean.js new file mode 100644 index 0000000..c5f92a3 --- /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.dsp b/win32/build/template.dsp new file mode 100644 index 0000000..ce1b070 --- /dev/null +++ b/win32/build/template.dsp @@ -0,0 +1,81 @@ +# Microsoft Developer Studio Project File - Name="extname" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=extname - Win32 Status_TS
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "extname.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "extname.mak" CFG="extname - Win32 Status_TS"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "extname - Win32 Status_TS" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+RE2C=re2c.exe
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "OUTPUTDIR"
+# PROP BASE Intermediate_Dir "OUTPUTDIR"
+# PROP BASE Ignore_Export_Lib 0
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "OUTPUTDIR"
+# PROP Intermediate_Dir "OUTPUTDIR"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP BASECPP
+# ADD CPP BASECPP LOCALCPP
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 BASELIBS
+# ADD LINK32 BASELIBS LOCALLIBS BASELDFLAGS LOCALLDFLAGS OUTPATH
+
+# Begin Target
+# Name "extname - Win32 Status_TS"
+
+# Begin Group "Source Files"
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+
+CORESOURCES
+SOURCEFILES
+# End Group
+
+# Begin Group "Header Files"
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+
+COREHEADERS
+HEADERFILES
+# End Group
+
+DEFS
+
+TEXTFILES
+
+# Begin Group "Resource Files"
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+
+RESOURCEFILES
+# End Group
+# End Target
+# End Project
diff --git a/win32/build/template.dsw b/win32/build/template.dsw new file mode 100644 index 0000000..ac78166 --- /dev/null +++ b/win32/build/template.dsw @@ -0,0 +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> +{{{ +}}} + +############################################################################### + diff --git a/win32/build/template.rc b/win32/build/template.rc new file mode 100644 index 0000000..13e92e9 --- /dev/null +++ b/win32/build/template.rc @@ -0,0 +1,87 @@ +/* This is a template RC file. + * $Id$ + * Do not edit with MSVC */ +#ifdef APSTUDIO_INVOKED +# error dont edit with MSVC +#endif + +#include "winresrc.h" +#include "main/php_version.h" + +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) + +#ifndef THANKS_GUYS +# define THANKS_GUYS "" +#endif + +#ifdef WANT_LOGO +0 ICON win32\build\php.ico +#endif + +#ifndef INTERNAL_NAME /* e.g. 'PHAR extension', 'CGI SAPI' */ +# ifdef FILE_DESCRIPTION +#define INTERNAL_NAME FILE_DESCRIPTION /* e.g. 'PHP Script Interpreter', 'GD imaging' */ +# else +#define INTERNAL_NAME FILE_NAME /* e.g. 'php5ts.dll', 'php_bz2.dll' */ +# endif +#endif + +#ifndef URL +#define URL "http://www.php.net/" +#endif + +#ifndef EXT_VERSION +#define EXT_VERSION PHP_VERSION +#endif + +#ifndef EXT_FILE_VERSION +#define EXT_FILE_VERSION PHP_MAJOR_VERSION,PHP_MINOR_VERSION,PHP_RELEASE_VERSION +#endif + +VS_VERSION_INFO VERSIONINFO + FILEVERSION EXT_FILE_VERSION + PRODUCTVERSION PHP_MAJOR_VERSION,PHP_MINOR_VERSION,PHP_RELEASE_VERSION + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS (VS_FF_DEBUG|VS_FF_SPECIALBUILD) +#else + FILEFLAGS 0x0L +#endif + FILEOS VOS__WINDOWS32 + FILETYPE VFT_DLL + FILESUBTYPE VFT2_UNKNOWN +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", THANKS_GUYS + VALUE "CompanyName", "The PHP Group" +#ifdef _DEBUG + VALUE "FileDescription", FILE_DESCRIPTION " (DEBUG)" +#else + VALUE "FileDescription", FILE_DESCRIPTION +#endif + VALUE "FileVersion", EXT_VERSION + VALUE "InternalName", INTERNAL_NAME + VALUE "LegalCopyright", "Copyright © 1997-2013 The PHP Group" + VALUE "LegalTrademarks", "PHP" + VALUE "OriginalFilename", FILE_NAME + VALUE "ProductName", "PHP" + VALUE "ProductVersion", PHP_VERSION +#ifdef _DEBUG + VALUE "SpecialBuild", "Debug build" +#endif + VALUE "URL", URL + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#ifdef MC_INCLUDE +#include MC_INCLUDE +#endif diff --git a/win32/build/wsyslog.mc b/win32/build/wsyslog.mc new file mode 100755 index 0000000..01d4d3a --- /dev/null +++ b/win32/build/wsyslog.mc @@ -0,0 +1,28 @@ +MessageId=1 +Severity=Success +SymbolicName=PHP_SYSLOG_SUCCESS_TYPE +Language=English +%1 %2 +. + +MessageId=2 +Severity=Informational +SymbolicName=PHP_SYSLOG_INFO_TYPE +Language=English +%1 %2 +. + +MessageId=3 +Severity=Warning +SymbolicName=PHP_SYSLOG_WARNING_TYPE +Language=English +%1 %2 +. + +MessageId=4 +Severity=Error +SymbolicName=PHP_SYSLOG_ERROR_TYPE +Language=English +%1 %2 +. + |