summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteph Fox <sfox@php.net>2008-07-09 08:15:46 +0000
committerSteph Fox <sfox@php.net>2008-07-09 08:15:46 +0000
commit208d8514441b07ddfb7b81dfb9e4abd177d72664 (patch)
treee8d40bbbd788d70ddac2e9fdd3a51512d687f02a
parent767eaa7a4ec2d264386c8154463f49f49961f10c (diff)
downloadphp-git-208d8514441b07ddfb7b81dfb9e4abd177d72664.tar.gz
- Embryonic project file generation. Use buildconf --add-project-files and hopefully it'll work.
- Please read the README before complaining. @Stas, Rob - please test.
-rw-r--r--win32/build/DSP.README38
-rw-r--r--win32/build/block.template.dsw14
-rw-r--r--win32/build/buildconf.js18
-rw-r--r--win32/build/config.w327
-rw-r--r--win32/build/confutils.js28
-rw-r--r--win32/build/projectgen.js185
-rw-r--r--win32/build/template.dsp75
-rw-r--r--win32/build/template.dsw116
8 files changed, 479 insertions, 2 deletions
diff --git a/win32/build/DSP.README b/win32/build/DSP.README
new file mode 100644
index 0000000000..9a67d514ee
--- /dev/null
+++ b/win32/build/DSP.README
@@ -0,0 +1,38 @@
+MSVC++ project file generation
+==============================
+
+The project files generated by projectgen.js are in no way intended
+for building with. There is already a perfectly good Windows build
+system in place. These files are only intended for use in debugging
+and profiling, and are very unlikely to create working binaries.
+
+With this in mind, the script will only generate basic .dsp files
+for the modules that are currently configured, and a single project
+workspace file to rule them all.
+
+The switch for project file generation is a buildconf switch and
+not a configure switch:
+
+> buildconf --add-project-files
+> configure ...
+
+The resulting workspace file should appear at /win32/php.dsw after
+configure is run.
+
+If the .dsw hasn'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 doesn't give you anything).
+
+- Steph
+sfox@php.net
+
+July 2008
diff --git a/win32/build/block.template.dsw b/win32/build/block.template.dsw
new file mode 100644
index 0000000000..9f78f6e1a1
--- /dev/null
+++ b/win32/build/block.template.dsw
@@ -0,0 +1,14 @@
+Project: "EXTNAME"=..\ADDRESS - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name main
+ End Project Dependency
+}}}
+
+###############################################################################
diff --git a/win32/build/buildconf.js b/win32/build/buildconf.js
index 641758bb94..0aa0a51ba1 100644
--- a/win32/build/buildconf.js
+++ b/win32/build/buildconf.js
@@ -16,13 +16,14 @@
+----------------------------------------------------------------------+
*/
-/* $Id: buildconf.js,v 1.13.2.2.2.1.2.2 2008-06-23 07:55:03 pajoye Exp $ */
+/* $Id: buildconf.js,v 1.13.2.2.2.1.2.3 2008-07-09 08:15:46 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 d57ef2d522..3d744284e5 100644
--- a/win32/build/config.w32
+++ b/win32/build/config.w32
@@ -364,3 +364,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 0b515ddaa9..bd7e70f2e6 100644
--- a/win32/build/confutils.js
+++ b/win32/build/confutils.js
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-// $Id: confutils.js,v 1.60.2.1.2.8.2.22 2008-07-07 13:51:35 pajoye Exp $
+// $Id: confutils.js,v 1.60.2.1.2.8.2.23 2008-07-09 08:15:46 sfox Exp $
var STDOUT = WScript.StdOut;
var STDERR = WScript.StdErr;
@@ -26,6 +26,7 @@ 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();
@@ -1039,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];
}
@@ -1203,6 +1208,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'];
}
@@ -1449,10 +1459,20 @@ function generate_files()
}
}
+ 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);
+ generate_dsp_flags();
+ }
+
STDOUT.WriteLine("Generating files...");
generate_makefile();
generate_internal_functions();
generate_config_h();
+
STDOUT.WriteLine("Done.");
STDOUT.WriteBlankLines(1);
write_summary();
@@ -1577,6 +1597,12 @@ 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)
diff --git a/win32/build/projectgen.js b/win32/build/projectgen.js
new file mode 100644
index 0000000000..4dcb082d48
--- /dev/null
+++ b/win32/build/projectgen.js
@@ -0,0 +1,185 @@
+function write_src_file(fname, arr)
+{
+ var src = FSO.CreateTextFile(fname, true);
+
+ for (i = 0; i < arr.length; i++) {
+ if (arr[i].length > 1) {
+ src.WriteLine("# Begin Source File");
+ src.WriteLine("SOURCE=" + arr[i]);
+ src.WriteLine("# End Source File");
+ src.WriteBlankLines(1);
+ }
+ }
+ src.Close();
+ return;
+}
+
+function copy_dsp_files() {
+ var tmp = FSO.GetFolder("tmp");
+ var core = "TSRM Zend main streams win32 standard";
+ var tmpl = file_get_contents("win32\\build\\template.dsw");
+
+ f = new Enumerator(tmp.Files);
+ blocks = "";
+ for (; !f.atEnd(); f.moveNext()) {
+ contents = file_get_contents(f.item());
+ address = contents.slice(0, contents.indexOf("#"));
+ contents = contents.slice(contents.indexOf("#"));
+ dsp = FSO.CreateTextFile(address, true);
+ dsp.Write(contents);
+ dsp.Close();
+ ext = address.slice(address.lastIndexOf("\\")+1, address.length-4);
+ if (!core.match(ext)) {
+ blocks += file_get_contents("win32\\build\\block.template.dsw");
+ blocks = blocks.replace("ADDRESS", address);
+ blocks = blocks.replace("EXTNAME", ext);
+ }
+ FSO.DeleteFile(f.item());
+ }
+ tmpl = tmpl.replace("INSERT", blocks);
+ dsw = FSO.CreateTextFile("win32\\php.dsw", true);
+ dsw.Write(tmpl);
+ dsw.Close();
+ FSO.DeleteFolder("tmp");
+}
+
+function generate_dsp_flags()
+{
+ for (i = 0; i < DSP_FLAGS.length; i++) {
+ name = DSP_FLAGS[i][0];
+ if (DSP_FLAGS.length == i+1 || name != DSP_FLAGS[i+1][0]) {
+ ext = name.substr(7).toLowerCase();
+ src = file_get_contents("tmp\\" + ext + ".dsp");
+ have = "/D HAVE_" + ext.toUpperCase() + "=1";
+ src = src.replace(have, have + " " + DSP_FLAGS[i][1]);
+ dsp = FSO.CreateTextFile("tmp\\" + ext + ".dsp", true);
+ dsp.Write(src);
+ dsp.Close();
+ }
+ }
+ copy_dsp_files();
+ return;
+}
+
+function generate_dsp_filelist(ext, ext_dir, files)
+{
+ 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 headers = "";
+
+ if (!files) {
+ 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(" ");
+
+ 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(" ");
+
+ configfile = FSO.BuildPath(ext_dir, "config.w32");
+ 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, "");
+ newarr = line.split(',');
+ orig_path = newarr[0].replace("ADD_SOURCES(", "");
+ munged_dir = ext_dir.replace(/\\/g, '/');
+ orig_path = orig_path.replace("configure_module_dirname", munged_dir);
+ orig_path = orig_path.replace(" + ", "");
+ path = orig_path.replace(munged_dir + '/', "");
+
+ if (path.length > 0) {
+ 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(" "));
+ }
+
+ sources = newarr[1].replace(/\\/g, "");
+ sources = sources.replace(ws, " ");
+ path = path ? " ./" + path + "/" : " ./";
+ sources = sources.replace(/ /g, path);
+ DSP_SOURCES = DSP_SOURCES.concat(sources.split(" "));
+ }
+ }
+ write_src_file("tmp\\" + ext + ".headers.tmp", DSP_HEADERS);
+ write_src_file("tmp\\" + ext + ".sources.tmp", DSP_SOURCES);
+ return;
+}
+
+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 EXT = ext.toUpperCase();
+
+ tmpl = ext_dir + "\\" + ext + ".dsp" + tmpl;
+
+ extname = new RegExp("extname", "gm");
+ EXTNAME = new RegExp("EXTNAME", "gm");
+ tmpl = tmpl.replace(extname, ext);
+ tmpl = tmpl.replace(EXTNAME, EXT);
+
+ status = PHP_DEBUG == "no" ? 'Release' : 'Debug';
+ STATUS = new RegExp("Status", "gm");
+ tmpl = tmpl.replace(STATUS, status);
+
+ if (PHP_ZTS == "no") {
+ zts = new RegExp("_TS", "gmi");
+ tmpl = tmpl.replace(zts, '');
+ }
+
+ if (PHP_DEBUG != "no") {
+ tmpl = tmpl.replace(/Use_Debug_Libraries 0/g, "Use_Debug_Libraries 1");
+ tmpl = tmpl.replace(/NDEBUG/g, "_DEBUG");
+ }
+
+ cflags = get_define("CFLAGS").replace("$(BASE_INCLUDES)", '/I "..\\.." /I "..\\..\\..\\Zend" /I "..\\..\\TSRM" /I "..\\..\\main" ');
+ basecpp = cflags = cflags.replace('/I "..\\bindlib_w32"', '/I "..\\..\\..\\bindlib_w32"');
+ if (shared) {
+ basecpp += " /D COMPILE_DL_" + EXT;
+ }
+ tmpl = tmpl.replace("BASECPP", basecpp);
+ tmpl = tmpl.replace("BASECPP", cflags + " /D HAVE_" + EXT + "=1");
+ tmpl = tmpl.replace(/BASELIBS/g, get_define("LIBS"));
+ tmpl = tmpl.replace("LOCALLIBS", get_define("PHPLIB"));
+ debug = PHP_DEBUG != "no" ? " /debug" : "";
+ dll = shared ? ' /dll /out:"..\\..\\Debug_TS\\php_' + ext + '.dll"' : "";
+ tmpl = tmpl.replace(/BASELDFLAGS/g, "/nologo" + debug + dll);
+
+ generate_dsp_filelist(ext, ext_dir, files);
+ sources = file_get_contents("tmp\\" + ext + ".sources.tmp");
+ tmpl = tmpl.replace("SOURCEFILES", sources);
+ FSO.DeleteFile("tmp\\" + ext + ".sources.tmp");
+ headers = file_get_contents("tmp\\" + ext + ".headers.tmp");
+ tmpl = tmpl.replace("HEADERFILES", headers);
+ FSO.DeleteFile("tmp\\" + ext + ".headers.tmp");
+ dsp.Write(tmpl);
+ dsp.Close();
+ return;
+}
diff --git a/win32/build/template.dsp b/win32/build/template.dsp
new file mode 100644
index 0000000000..3cebb39de7
--- /dev/null
+++ b/win32/build/template.dsp
@@ -0,0 +1,75 @@
+# 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
+MTL=midl.exe
+RSC=rc.exe
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Status_TS"
+# PROP BASE Intermediate_Dir "Status_TS"
+# PROP BASE Ignore_Export_Lib 0
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Status_TS"
+# PROP Intermediate_Dir "Status_TS"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP BASECPP
+# ADD CPP BASECPP
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# 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 BASELDFLAGS /libpath:"..\..\Status_TS" /libpath:"..\..\..\bindlib_w32\Status"
+# ADD LINK32 LOCALLIBS BASELIBS BASELDFLAGS /libpath:"..\..\Status_TS" /libpath:"..\..\..\bindlib_w32\Status"
+
+# Begin Target
+# Name "extname - Win32 Status_TS"
+
+# Begin Group "Source Files"
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+
+SOURCEFILES
+# End Group
+
+# Begin Group "Header Files"
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+
+HEADERFILES
+# End Group
+
+# Begin Group "Resource Files"
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/win32/build/template.dsw b/win32/build/template.dsw
new file mode 100644
index 0000000000..0e95baaa86
--- /dev/null
+++ b/win32/build/template.dsw
@@ -0,0 +1,116 @@
+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: "win32"=.\win32.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "main"=..\main\main.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name Zend
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name TSRM
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name win32
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "streams"=..\main\streams\streams.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name Zend
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name TSRM
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name win32
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "standard"=..\ext\standard\standard.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name main
+ End Project Dependency
+}}}
+
+###############################################################################
+
+INSERT
+
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+