summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authorPierre Joye <pajoye@php.net>2010-12-13 20:55:13 +0000
committerPierre Joye <pajoye@php.net>2010-12-13 20:55:13 +0000
commit4df03c1ded94ff75d74b82c1beb335c9bf3957ed (patch)
tree62a19911dc6230ae61f1a9b3f05978524b3b96fd /win32
parent15ee70e8e0076503f1819f7cdde7138098e9dc9f (diff)
downloadphp-git-4df03c1ded94ff75d74b82c1beb335c9bf3957ed.tar.gz
- phpize support merge from 5.3
Diffstat (limited to 'win32')
-rw-r--r--win32/build/Makefile16
-rw-r--r--win32/build/buildconf.js1
-rw-r--r--win32/build/config.w325
-rw-r--r--win32/build/configure.tail2
-rw-r--r--win32/build/confutils.js165
5 files changed, 146 insertions, 43 deletions
diff --git a/win32/build/Makefile b/win32/build/Makefile
index b5545ad3de..203b03850d 100644
--- a/win32/build/Makefile
+++ b/win32/build/Makefile
@@ -152,12 +152,24 @@ 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-headers install-lib
+install: really-install install-devel install-lib
install-lib:
@if not exist $(PHP_PREFIX)\lib mkdir $(PHP_PREFIX)\lib >nul
@copy $(BUILD_DIR)\$(PHPLIB) $(PHP_PREFIX)\lib /y >nul
+install-devel: install-headers
+ @if not exist $(PHP_PREFIX)\script mkdir $(PHP_PREFIX)\script >nul
+ @if not exist $(PHP_PREFIX)\build mkdir $(PHP_PREFIX)\build >nul
+ @copy win32\build\confutils.js $(PHP_PREFIX)\script\ /y >nul
+ @copy win32\build\configure.tail $(PHP_PREFIX)\script\ /y >nul
+ @copy win32\build\config.w32.phpize.in $(PHP_PREFIX)\script\ /y >nul
+ @copy win32\build\Makefile.phpize $(PHP_PREFIX)\script\ /y >nul
+ @copy win32\build\phpize.bat $(PHP_PREFIX)\ /y >nul
+ @copy win32\build\template.rc $(PHP_PREFIX)\build\ /y >nul
+ @copy $(BUILD_DIR)\devel\config.phpize.js $(PHP_PREFIX)\script\ /y >nul
+ @copy $(BUILD_DIR)\devel\phpize.js $(PHP_PREFIX)\script\ /y >nul
+
really-install:
@if not exist $(PHP_PREFIX) mkdir $(PHP_PREFIX)
@echo Installing files under $(PHP_PREFIX)
@@ -166,5 +178,3 @@ really-install:
@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/buildconf.js b/win32/build/buildconf.js
index d26b4c7403..b4194ad203 100644
--- a/win32/build/buildconf.js
+++ b/win32/build/buildconf.js
@@ -209,6 +209,7 @@ 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
diff --git a/win32/build/config.w32 b/win32/build/config.w32
index 2eaa8b3adb..2525df747a 100644
--- a/win32/build/config.w32
+++ b/win32/build/config.w32
@@ -204,6 +204,9 @@ if (PHP_DEBUG == "yes") {
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");
@@ -356,7 +359,7 @@ ADD_SOURCES("main/streams", "streams.c cast.c memory.c filter.c plain_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/");
+PHP_INSTALL_HEADERS("", "Zend/ TSRM/ main/ main/streams/ win32/");
STDOUT.WriteBlankLines(1);
diff --git a/win32/build/configure.tail b/win32/build/configure.tail
index 1977abb807..70625a43d4 100644
--- a/win32/build/configure.tail
+++ b/win32/build/configure.tail
@@ -2,7 +2,7 @@
// $Id$
// tail end of configure
-if (sapi_enabled.length < 1) {
+if (!MODE_PHPIZE && sapi_enabled.length < 1) {
MESSAGE("");
ERROR("No SAPI selected, please enable at least one SAPI.");
}
diff --git a/win32/build/confutils.js b/win32/build/confutils.js
index fc4b59cb31..75c27b9b77 100644
--- a/win32/build/confutils.js
+++ b/win32/build/confutils.js
@@ -58,11 +58,18 @@ if (PROGRAM_FILES == null) {
PROGRAM_FILES = "C:\\Program Files";
}
-if (!FSO.FileExists("README.SVN-RULES")) {
- STDERR.WriteLine("Must be run from the root of the php source");
- WScript.Quit(10);
+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.SVN-RULES")) {
+ STDERR.WriteLine("Must be run from the root of the php source");
+ WScript.Quit(10);
+ }
}
-
+
var CWD = WshShell.CurrentDirectory;
if (typeof(CWD) == "undefined") {
@@ -109,7 +116,9 @@ build_dirs = new Array();
extension_include_code = "";
extension_module_ptrs = "";
-get_version_numbers();
+if (!MODE_PHPIZE) {
+ get_version_numbers();
+}
/* execute a command and return the output as a string */
function execute(command_line)
@@ -333,7 +342,13 @@ function conf_process_args()
arg.seen = true;
analyzed = analyze_arg(argval);
- shared = analyzed[0];
+
+ /* Force shared when called after phpize */
+ if (MODE_PHPIZE) {
+ shared = "shared";
+ } else {
+ shared = analyzed[0];
+ }
argval = analyzed[1];
if (argname == arg.imparg) {
@@ -975,13 +990,21 @@ function generate_version_info_resource(makefiletarget, basename, creditspath, s
creditspath + '\\template.rc');
return resname;
}
-
- MFO.WriteLine("$(BUILD_DIR)\\" + resname + ": win32\\build\\template.rc");
- MFO.WriteLine("\t$(RC) /n /fo $(BUILD_DIR)\\" + resname + logo + debug +
- ' /d FILE_DESCRIPTION="\\"' + res_desc + '\\"" /d FILE_NAME="\\"'
- + makefiletarget + '\\"" /d URL="\\"' + project_url +
- '\\"" /d INTERNAL_NAME="\\"' + internal_name + versioning +
- '\\"" /d THANKS_GUYS="\\"' + thanks + '\\"" win32\\build\\template.rc');
+ 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;
}
@@ -1020,7 +1043,11 @@ function SAPI(sapiname, file_list, makefiletarget, cflags, obj_dir)
MFO.WriteLine(makefiletarget + ": $(BUILD_DIR)\\" + makefiletarget);
MFO.WriteLine("\t@echo SAPI " + sapiname_for_printing + " build complete");
- MFO.WriteLine("$(BUILD_DIR)\\" + makefiletarget + ": $(DEPS_" + SAPI + ") $(" + SAPI + "_GLOBAL_OBJS) $(BUILD_DIR)\\$(PHPLIB) $(BUILD_DIR)\\" + resname);
+ if (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)";
@@ -1033,11 +1060,20 @@ function SAPI(sapiname, file_list, makefiletarget, cflags, obj_dir)
manifest = "-@$(_VC_MANIFEST_EMBED_EXE)";
}
- if (ld) {
- MFO.WriteLine("\t" + ld + " /nologo /out:$(BUILD_DIR)\\" + makefiletarget + " " + ldflags + " $(" + SAPI + "_GLOBAL_OBJS) $(BUILD_DIR)\\$(PHPLIB) $(LDFLAGS_" + SAPI + ") $(LIBS_" + SAPI + ") $(BUILD_DIR)\\" + resname);
+ 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 {
- 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 (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) {
@@ -1202,8 +1238,13 @@ function EXTENSION(extname, file_list, shared, cflags, dllname, obj_dir)
MFO.WriteLine("$(BUILD_DIR)\\" + libname + ": $(BUILD_DIR)\\" + dllname);
MFO.WriteBlankLines(1);
- MFO.WriteLine("$(BUILD_DIR)\\" + dllname + ": $(DEPS_" + EXT + ") $(" + EXT + "_GLOBAL_OBJS) $(BUILD_DIR)\\$(PHPLIB) $(BUILD_DIR)\\" + resname);
- MFO.WriteLine("\t" + ld + " $(" + EXT + "_GLOBAL_OBJS) $(BUILD_DIR)\\$(PHPLIB) $(LIBS_" + EXT + ") $(LIBS) $(BUILD_DIR)\\" + resname + " /link /out:$(BUILD_DIR)\\" + dllname + " $(DLL_LDFLAGS) $(LDFLAGS) $(LDFLAGS_" + EXT + ")");
+ 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 + " $(DLL_LDFLAGS) $(LDFLAGS) $(LDFLAGS_" + EXT + ")");
+ }
MFO.WriteLine("\t-@$(_VC_MANIFEST_EMBED_DLL)");
MFO.WriteBlankLines(1);
@@ -1317,7 +1358,7 @@ function ADD_SOURCES(dir, file_list, target, obj_dir)
obj = src.replace(re, ".obj");
tv += " " + sub_build + obj;
- if (PHP_ONE_SHOT == "yes") {
+ if (!MODE_PHPIZE && PHP_ONE_SHOT == "yes") {
if (i > 0) {
objs_line += " " + sub_build + obj;
srcs_line += " " + dir + "\\" + src;
@@ -1331,7 +1372,7 @@ function ADD_SOURCES(dir, file_list, target, obj_dir)
}
}
- if (PHP_ONE_SHOT == "yes") {
+ 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);
}
@@ -1483,11 +1524,11 @@ function write_summary()
STDOUT.WriteLine("Enabled extensions:");
output_as_table(["Extension", "Mode"], extensions_enabled.sort());
STDOUT.WriteBlankLines(2);
-
- STDOUT.WriteLine("Enabled SAPI:");
- output_as_table(["Sapi Name"], sapi_enabled);
- STDOUT.WriteBlankLines(2);
-
+ 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]];
@@ -1534,9 +1575,11 @@ function generate_files()
STDOUT.WriteLine("Generating files...");
generate_makefile();
- generate_internal_functions();
- generate_config_h();
-
+ if (!MODE_PHPIZE) {
+ generate_internal_functions();
+ generate_config_h();
+ generate_phpize();
+ }
STDOUT.WriteLine("Done.");
STDOUT.WriteBlankLines(1);
write_summary();
@@ -1610,13 +1653,54 @@ function generate_config_h()
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);
+ 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(2);
+ MF.WriteLine("/* Genereted win32/build/phpize.js.in */");
+ MF.WriteBlankLines(1);
+ MF.Write(file_get_contents("win32/build/phpize.js.in"));
+ MF.Close();
+
+ /* Generate flags file */
+ /* spit out variable definitions */
+ CJ = FSO.CreateTextFile(dest + "/config.phpize.js");
+/*
+ function escape(in) {
+ val = t.replace(new RegExp('("\\\\)', "g"), '\\$1');
+ }
+*/
+ //if (typeof t == "string") {
+
+ CJ.WriteLine("var PHP_ZTS =" + '"' + PHP_ZTS + '"');
+ CJ.WriteLine("var PHP_LIB =" + '"' + get_define('PHPLIB') + '"');
+
+ 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;
@@ -1633,8 +1717,12 @@ function generate_makefile()
}
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);
+ }
- var TF = FSO.OpenTextFile("win32/build/Makefile", 1);
MF.Write(TF.ReadAll());
MF.WriteLine("install-headers:");
@@ -1903,11 +1991,12 @@ function PHP_INSTALL_HEADERS(dir, headers_list)
// and you can then build everything, ignoring fatal errors within a module
// by running "nmake snap"
PHP_SNAPSHOT_BUILD = "no";
-ARG_ENABLE('snapshot-build', 'Build a snapshot; turns on everything it can and ignores build errors', 'no');
-
-// one-shot build optimizes build by asking compiler to build
-// several objects at once, reducing overhead of starting new
-// compiler processes.
-ARG_ENABLE('one-shot', 'Optimize for fast build - best for release and snapshot builders, not so hot for edit-and-rebuild hacking', 'no');
+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');
+}