diff options
author | Steph Fox <sfox@php.net> | 2008-07-21 09:56:37 +0000 |
---|---|---|
committer | Steph Fox <sfox@php.net> | 2008-07-21 09:56:37 +0000 |
commit | 9a7b2f0b9fd69b3c9a0255004241c1bb85be9e10 (patch) | |
tree | 5452bfd5377d334e7d3f5229b99fb330db79f178 /win32/build | |
parent | a1420c3e90ff76a9237d41440712fce95d340b90 (diff) | |
download | php-git-9a7b2f0b9fd69b3c9a0255004241c1bb85be9e10.tar.gz |
MFH project file generation + a few small fixes made along the way
Diffstat (limited to 'win32/build')
-rw-r--r-- | win32/build/DSP.README | 37 | ||||
-rw-r--r-- | win32/build/Makefile | 23 | ||||
-rw-r--r-- | win32/build/block.template.dsw | 15 | ||||
-rw-r--r-- | win32/build/buildconf.js | 20 | ||||
-rw-r--r-- | win32/build/config.w32 | 34 | ||||
-rw-r--r-- | win32/build/confutils.js | 113 | ||||
-rw-r--r-- | win32/build/cvsclean.js | 4 | ||||
-rw-r--r-- | win32/build/projectgen.js | 625 | ||||
-rw-r--r-- | win32/build/template.dsp | 81 | ||||
-rw-r--r-- | win32/build/template.dsw | 63 |
10 files changed, 969 insertions, 46 deletions
diff --git a/win32/build/DSP.README b/win32/build/DSP.README new file mode 100644 index 0000000000..c6736578cf --- /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 index 3f946c9dd1..2b677fa3b3 100644 --- a/win32/build/Makefile +++ b/win32/build/Makefile @@ -1,7 +1,7 @@ # +----------------------------------------------------------------------+ # | PHP Version 5 | # +----------------------------------------------------------------------+ -# | Copyright (c) 1997-2007 The PHP Group | +# | 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 | @@ -76,14 +76,14 @@ $(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 + 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) $(PHP_LDFLAGS) $(LDFLAGS) $(STATIC_EXT_LDFLAGS) -@$(_VC_MANIFEST_EMBED_DLL) - + $(BUILD_DIR)\$(PHPLIB): $(BUILD_DIR)\$(PHPDLL) - + $(BUILD_DIR) $(BUILD_DIRS_SUB): @echo Recreating build dirs @if not exist $(BUILD_DIR) mkdir $(BUILD_DIR) @@ -97,14 +97,19 @@ clean-sapi: -@del /F /Q $(BUILD_DIR)\$(PHPDLL) clean: clean-sapi - @echo Cleaning build dirs + @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 - -rmdir /s /q $(BUILD_DIR)\php-$(PHP_VERSION_STRING) + -rd /s /q $(BUILD_DIR)\php-$(PHP_VERSION_STRING) clean-pecl: @echo Cleaning PECL targets only - -rmdir /s /q $(BUILD_DIR)\pecl + -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)\*.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 test: <<test_suite_uses_lame_env_vars.bat @@ -119,8 +124,8 @@ build-snap: generated_files -for %T in ($(PECL_TARGETS)) do $(MAKE) /I /nologo "%T" build-dist: $(BUILD_DIR)\deplister.exe - -rmdir /s /q $(BUILD_DIR)\php-$(PHP_VERSION_STRING) - -rmdir /s /q $(BUILD_DIR)\pecl-$(PHP_VERSION_STRING) + -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)-Win32.zip -del /f /q $(BUILD_DIR)\php-debug-pack-$(PHP_VERSION_STRING)-Win32.zip -del /f /q $(BUILD_DIR)\pecl-$(PHP_VERSION_STRING)-Win32.zip diff --git a/win32/build/block.template.dsw b/win32/build/block.template.dsw new file mode 100644 index 0000000000..2f2682dc71 --- /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 index 051bcc6b9b..f7601785cb 100644 --- a/win32/build/buildconf.js +++ b/win32/build/buildconf.js @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2007 The PHP Group | + | 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 | @@ -16,13 +16,14 @@ +----------------------------------------------------------------------+ */ -/* $Id: buildconf.js,v 1.18 2008-07-02 20:53:36 pajoye Exp $ */ +/* $Id: buildconf.js,v 1.19 2008-07-21 09:56:37 sfox 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"); @@ -203,6 +204,11 @@ function buildconf_process_args() 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; + } } } @@ -212,6 +218,16 @@ buildconf_process_args(); C.WriteLine("/* This file automatically generated from win32/build/confutils.js */"); C.Write(file_get_contents("win32/build/confutils.js")); +// If project files were requested, pull in the code to generate them +if (DSP == true) { + C.WriteLine('PHP_DSP="yes"'); + C.WriteBlankLines(1); + C.Write(file_get_contents("win32/build/projectgen.js")); +} else { + C.WriteLine('PHP_DSP="no"'); + C.WriteBlankLines(1); +} + // Pull in code from sapi and extensions modules = file_get_contents("win32/build/config.w32"); diff --git a/win32/build/config.w32 b/win32/build/config.w32 index af47cdcb2e..2e90bd5717 100644 --- a/win32/build/config.w32 +++ b/win32/build/config.w32 @@ -9,6 +9,7 @@ if (!CL) { ERROR("MS C++ compiler is required"); } +/* For the record here: */ // 1200 is VC6 // 1300 is vs.net 2002 // 1310 is vs.net 2003 @@ -22,10 +23,11 @@ AC_DEFINE('COMPILER', VC_VERSIONS[VCVERS], "Detected compiler version"); // do we use x64 or 80x86 version of compiler? X64 = probe_binary(CL, 64); if (X64) { - STDOUT.WriteLine("Detected 64-bit compiler"); + STDOUT.WriteLine(" Detected 64-bit compiler"); } else { - STDOUT.WriteLine("Detected 32-bit compiler"); + STDOUT.WriteLine(" Detected 32-bit compiler"); } +AC_DEFINE('ARCHITECTURE', X64 ? 'x64' : 'x86', "Detected compiler architecture"); // cygwin now ships with link.exe. Avoid searching the cygwin path // for this, as we want the MS linker, not the fileutil @@ -42,28 +44,19 @@ if (!PATH_PROG('bison')) { // There's a minimum requirement for re2c.. MINRE2C = "0.13.4"; -function probe_re2c_version(RE2C) -{ - var command = "cmd /c " + RE2C + " -v"; - var version = execute(command + '" 2>&1"'); - - if (version.match(/((\d+)\.(\d+)\.(\d+))/)) { - return RegExp.$1; - } - return 0; -} - RE2C = PATH_PROG('re2c'); if (RE2C) { var intvers, intmin; var pattern = /\./g; - RE2CVERS = probe_re2c_version(RE2C); + 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 + ', ' + RE2CVERS + ' detected'); + 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 { @@ -79,7 +72,9 @@ PATH_PROG('lemon'); PATH_PROG('mc', WshShell.Environment("Process").Item("PATH")); // Try locating manifest tool -PATH_PROG('mt', WshShell.Environment("Process").Item("PATH")); +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', ''); @@ -384,3 +379,10 @@ if (PHP_SNAPSHOT_TEMPLATE == "no") { DEFINE('SNAPSHOT_TEMPLATE', PHP_SNAPSHOT_TEMPLATE); ARG_ENABLE('summary', 'Enable configuration summary', 'yes'); + +if (PHP_DSP != "no") { + if (FSO.FolderExists("tmp")) { + FSO.DeleteFolder("tmp"); + } + FSO.CreateFolder("tmp"); +} diff --git a/win32/build/confutils.js b/win32/build/confutils.js index fedf046465..7bc9b144bf 100644 --- a/win32/build/confutils.js +++ b/win32/build/confutils.js @@ -3,7 +3,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2007 The PHP Group | + | 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 | @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -// $Id: confutils.js,v 1.76 2008-07-07 13:48:23 pajoye Exp $ +// $Id: confutils.js,v 1.77 2008-07-21 09:56:37 sfox Exp $ var STDOUT = WScript.StdOut; var STDERR = WScript.StdErr; @@ -26,10 +26,15 @@ var FSO = WScript.CreateObject("Scripting.FileSystemObject"); var MFO = null; var SYSTEM_DRIVE = WshShell.Environment("Process").Item("SystemDrive"); var PROGRAM_FILES = WshShell.Environment("Process").Item("ProgramFiles"); +var DSP_FLAGS = new Array(); +/* Store the enabled extensions (summary + QA check) */ var extensions_enabled = new Array(); + +/* Store the SAPI enabled (summary + QA check) */ var sapi_enabled = new Array(); +/* Mapping CL version > human readable name */ var VC_VERSIONS = new Array(); VC_VERSIONS[1200] = 'MSVC6 (Visual C++ 6.0)'; VC_VERSIONS[1300] = 'MSVC7 (Visual C++ 2002)'; @@ -378,7 +383,7 @@ can be built that way. \ var snapshot_build_exclusions = new Array( 'debug', 'crt-debug', 'lzf-better-compression', - 'php-build', 'snapshot-template', + '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' @@ -467,7 +472,7 @@ can be built that way. \ nicefile.WriteLine(nice + " %*"); nicefile.Close(); - AC_DEFINE('CONFIGURE_COMMAND', nice); + AC_DEFINE('CONFIGURE_COMMAND', nice, "Configure line"); } function DEFINE(name, value) @@ -1035,6 +1040,10 @@ function SAPI(sapiname, file_list, makefiletarget, cflags, obj_dir) 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]; } @@ -1073,15 +1082,24 @@ function ADD_EXTENSION_DEP(extname, dependson, optional) try { dep_present = eval("PHP_" + DEP); - dep_shared = eval("PHP_" + DEP + "_SHARED"); + + if (dep_present != "no") { + try { + dep_shared = eval("PHP_" + DEP + "_SHARED"); + } catch (e) { + dep_shared = false; + } + } + } catch (e) { dep_present = "no"; - dep_shared = false; } - + if (optional) { - if (dep_present == "no") + if (dep_present == "no") { + MESSAGE("\t" + dependson + " not found: " + dependson + " support in " + extname + " disabled"); return false; + } } var ext_shared = eval("PHP_" + EXT + "_SHARED"); @@ -1089,22 +1107,33 @@ function ADD_EXTENSION_DEP(extname, dependson, optional) 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 + " has a missing dependency: " + dependson); - return false; - } else { - ERROR("Cannot build " + extname + "; " + dependson + " not enabled"); + 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; @@ -1199,6 +1228,11 @@ function EXTENSION(extname, file_list, shared, cflags, dllname, obj_dir) 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']; } @@ -1289,6 +1323,30 @@ function ADD_SOURCES(dir, file_list, target, obj_dir) 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; @@ -1332,6 +1390,7 @@ function output_as_table(header, ar_out) 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; @@ -1404,7 +1463,7 @@ function write_summary() STDOUT.WriteBlankLines(2); STDOUT.WriteLine("Enabled extensions:"); - output_as_table(["Extension", "Mode"], extensions_enabled); + output_as_table(["Extension", "Mode"], extensions_enabled.sort()); STDOUT.WriteBlankLines(2); STDOUT.WriteLine("Enabled SAPI:"); @@ -1431,7 +1490,7 @@ function generate_files() 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) { @@ -1443,11 +1502,21 @@ function generate_files() FSO.CreateFolder(bd); } } - + + if (PHP_DSP != "no") { + generate_dsp_file("TSRM", "TSRM", null, false); + generate_dsp_file("Zend", "Zend", null, false); + generate_dsp_file("win32", "win32", null, false); + generate_dsp_file("main", "main", null, false); + generate_dsp_file("streams", "main\\streams", null, false); + copy_dsp_files(); + } + STDOUT.WriteLine("Generating files..."); generate_makefile(); generate_internal_functions(); generate_config_h(); + STDOUT.WriteLine("Done."); STDOUT.WriteBlankLines(1); write_summary(); @@ -1572,11 +1641,20 @@ function ADD_FLAG(name, flags, target) 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) { - return configure_subst.Item(name); + if (configure_subst.Exists(name)) { + return configure_subst.Item(name); + } + return ""; } // Add a .def to the core to export symbols @@ -1602,7 +1680,7 @@ function AC_DEFINE(name, value, comment, quote) 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 " + item[0]); + STDOUT.WriteLine("AC_DEFINE[" + name + "]=" + value + ": is already defined to " + orig_item[0]); } else { configure_hdr.Add(name, item); } @@ -1765,3 +1843,4 @@ ARG_ENABLE('snapshot-build', 'Build a snapshot; turns on everything it can and i // several objects at once, reducing overhead of starting new // compiler processes. ARG_ENABLE('one-shot', 'Optimize for fast build - best for release and snapshot builders, not so hot for edit-and-rebuild hacking', 'no'); + diff --git a/win32/build/cvsclean.js b/win32/build/cvsclean.js index 5dce0fecb3..87eedd1ac5 100644 --- a/win32/build/cvsclean.js +++ b/win32/build/cvsclean.js @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2007 The PHP Group | + | 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 | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: cvsclean.js,v 1.7 2007-01-29 04:40:46 iliaa Exp $ */ +/* $Id: cvsclean.js,v 1.8 2008-07-21 09:56:37 sfox Exp $ */ // Cleans up files that do not belong in CVS var FSO = WScript.CreateObject("Scripting.FileSystemObject"); diff --git a/win32/build/projectgen.js b/win32/build/projectgen.js new file mode 100644 index 0000000000..390a303fb4 --- /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/template.dsp b/win32/build/template.dsp new file mode 100644 index 0000000000..ce1b070d5a --- /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 0000000000..ac781664ff --- /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> +{{{ +}}} + +############################################################################### + |