- phpize support merge from 5.3

This commit is contained in:
Pierre Joye 2010-12-13 20:55:13 +00:00
parent 15ee70e8e0
commit 4df03c1ded
5 changed files with 146 additions and 43 deletions

View file

@ -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)" $(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... # 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: install-lib:
@if not exist $(PHP_PREFIX)\lib mkdir $(PHP_PREFIX)\lib >nul @if not exist $(PHP_PREFIX)\lib mkdir $(PHP_PREFIX)\lib >nul
@copy $(BUILD_DIR)\$(PHPLIB) $(PHP_PREFIX)\lib /y >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: really-install:
@if not exist $(PHP_PREFIX) mkdir $(PHP_PREFIX) @if not exist $(PHP_PREFIX) mkdir $(PHP_PREFIX)
@echo Installing files under $(PHP_PREFIX) @echo Installing files under $(PHP_PREFIX)
@ -166,5 +178,3 @@ really-install:
@echo Registering event source with syslog (requires admin rights) @echo Registering event source with syslog (requires admin rights)
@echo It's okay for this step to fail: @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) -$(PHP_PREFIX)\php.exe -n -dextension_dir=$(PHP_PREFIX) win32/build/registersyslog.php $(PHP_PREFIX)\$(PHPDLL)

View file

@ -209,6 +209,7 @@ buildconf_process_args();
// Write the head of the configure script // Write the head of the configure script
C.WriteLine("/* This file automatically generated from win32/build/confutils.js */"); 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")); C.Write(file_get_contents("win32/build/confutils.js"));
// If project files were requested, pull in the code to generate them // If project files were requested, pull in the code to generate them

View file

@ -204,6 +204,9 @@ if (PHP_DEBUG == "yes") {
if (PHP_ZTS == "yes") { if (PHP_ZTS == "yes") {
ADD_FLAG("CFLAGS", "/D ZTS=1"); ADD_FLAG("CFLAGS", "/D ZTS=1");
ADD_FLAG("ZTS", "1");
} else {
ADD_FLAG("ZTS", "0");
} }
DEFINE("PHP_ZTS_ARCHIVE_POSTFIX", PHP_ZTS == "yes" ? '' : "-nts"); 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 \ ADD_SOURCES("win32", "glob.c readdir.c \
registry.c select.c sendmail.c time.c winutil.c wsyslog.c globals.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); STDOUT.WriteBlankLines(1);

View file

@ -2,7 +2,7 @@
// $Id$ // $Id$
// tail end of configure // tail end of configure
if (sapi_enabled.length < 1) { if (!MODE_PHPIZE && sapi_enabled.length < 1) {
MESSAGE(""); MESSAGE("");
ERROR("No SAPI selected, please enable at least one SAPI."); ERROR("No SAPI selected, please enable at least one SAPI.");
} }

View file

@ -58,9 +58,16 @@ if (PROGRAM_FILES == null) {
PROGRAM_FILES = "C:\\Program Files"; PROGRAM_FILES = "C:\\Program Files";
} }
if (!FSO.FileExists("README.SVN-RULES")) { 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"); STDERR.WriteLine("Must be run from the root of the php source");
WScript.Quit(10); WScript.Quit(10);
}
} }
var CWD = WshShell.CurrentDirectory; var CWD = WshShell.CurrentDirectory;
@ -109,7 +116,9 @@ build_dirs = new Array();
extension_include_code = ""; extension_include_code = "";
extension_module_ptrs = ""; extension_module_ptrs = "";
get_version_numbers(); if (!MODE_PHPIZE) {
get_version_numbers();
}
/* execute a command and return the output as a string */ /* execute a command and return the output as a string */
function execute(command_line) function execute(command_line)
@ -333,7 +342,13 @@ function conf_process_args()
arg.seen = true; arg.seen = true;
analyzed = analyze_arg(argval); analyzed = analyze_arg(argval);
/* Force shared when called after phpize */
if (MODE_PHPIZE) {
shared = "shared";
} else {
shared = analyzed[0]; shared = analyzed[0];
}
argval = analyzed[1]; argval = analyzed[1];
if (argname == arg.imparg) { if (argname == arg.imparg) {
@ -975,13 +990,21 @@ function generate_version_info_resource(makefiletarget, basename, creditspath, s
creditspath + '\\template.rc'); creditspath + '\\template.rc');
return resname; 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("$(BUILD_DIR)\\" + resname + ": win32\\build\\template.rc");
MFO.WriteLine("\t$(RC) /n /fo $(BUILD_DIR)\\" + resname + logo + debug + MFO.WriteLine("\t$(RC) /n /fo $(BUILD_DIR)\\" + resname + logo + debug +
' /d FILE_DESCRIPTION="\\"' + res_desc + '\\"" /d FILE_NAME="\\"' ' /d FILE_DESCRIPTION="\\"' + res_desc + '\\"" /d FILE_NAME="\\"'
+ makefiletarget + '\\"" /d URL="\\"' + project_url + + makefiletarget + '\\"" /d URL="\\"' + project_url +
'\\"" /d INTERNAL_NAME="\\"' + internal_name + versioning + '\\"" /d INTERNAL_NAME="\\"' + internal_name + versioning +
'\\"" /d THANKS_GUYS="\\"' + thanks + '\\"" win32\\build\\template.rc'); '\\"" /d THANKS_GUYS="\\"' + thanks + '\\"" win32\\build\\template.rc');
}
MFO.WriteBlankLines(1); MFO.WriteBlankLines(1);
return resname; return resname;
} }
@ -1020,7 +1043,11 @@ function SAPI(sapiname, file_list, makefiletarget, cflags, obj_dir)
MFO.WriteLine(makefiletarget + ": $(BUILD_DIR)\\" + makefiletarget); MFO.WriteLine(makefiletarget + ": $(BUILD_DIR)\\" + makefiletarget);
MFO.WriteLine("\t@echo SAPI " + sapiname_for_printing + " build complete"); 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); MFO.WriteLine("$(BUILD_DIR)\\" + makefiletarget + ": $(DEPS_" + SAPI + ") $(" + SAPI + "_GLOBAL_OBJS) $(BUILD_DIR)\\$(PHPLIB) $(BUILD_DIR)\\" + resname);
}
if (makefiletarget.match(new RegExp("\\.dll$"))) { if (makefiletarget.match(new RegExp("\\.dll$"))) {
ldflags = "/dll $(LDFLAGS)"; ldflags = "/dll $(LDFLAGS)";
@ -1033,12 +1060,21 @@ function SAPI(sapiname, file_list, makefiletarget, cflags, obj_dir)
manifest = "-@$(_VC_MANIFEST_EMBED_EXE)"; manifest = "-@$(_VC_MANIFEST_EMBED_EXE)";
} }
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) { 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); MFO.WriteLine("\t" + ld + " /nologo /out:$(BUILD_DIR)\\" + makefiletarget + " " + ldflags + " $(" + SAPI + "_GLOBAL_OBJS) $(BUILD_DIR)\\$(PHPLIB) $(LDFLAGS_" + SAPI + ") $(LIBS_" + SAPI + ") $(BUILD_DIR)\\" + resname);
} else { } else {
ld = "@$(CC)"; 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 + ")"); 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) { if (manifest) {
MFO.WriteLine("\t" + manifest); MFO.WriteLine("\t" + manifest);
@ -1202,8 +1238,13 @@ function EXTENSION(extname, file_list, shared, cflags, dllname, obj_dir)
MFO.WriteLine("$(BUILD_DIR)\\" + libname + ": $(BUILD_DIR)\\" + dllname); MFO.WriteLine("$(BUILD_DIR)\\" + libname + ": $(BUILD_DIR)\\" + dllname);
MFO.WriteBlankLines(1); 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("$(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" + 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.WriteLine("\t-@$(_VC_MANIFEST_EMBED_DLL)");
MFO.WriteBlankLines(1); MFO.WriteBlankLines(1);
@ -1317,7 +1358,7 @@ function ADD_SOURCES(dir, file_list, target, obj_dir)
obj = src.replace(re, ".obj"); obj = src.replace(re, ".obj");
tv += " " + sub_build + obj; tv += " " + sub_build + obj;
if (PHP_ONE_SHOT == "yes") { if (!MODE_PHPIZE && PHP_ONE_SHOT == "yes") {
if (i > 0) { if (i > 0) {
objs_line += " " + sub_build + obj; objs_line += " " + sub_build + obj;
srcs_line += " " + dir + "\\" + src; 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(objs_line + ": " + srcs_line);
MFO.WriteLine("\t$(CC) $(" + flags + ") $(CFLAGS) /Fo" + sub_build + " $(" + bd_flags_name + ") /c " + 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:"); STDOUT.WriteLine("Enabled extensions:");
output_as_table(["Extension", "Mode"], extensions_enabled.sort()); output_as_table(["Extension", "Mode"], extensions_enabled.sort());
STDOUT.WriteBlankLines(2); STDOUT.WriteBlankLines(2);
if (!MODE_PHPIZE) {
STDOUT.WriteLine("Enabled SAPI:"); STDOUT.WriteLine("Enabled SAPI:");
output_as_table(["Sapi Name"], sapi_enabled); output_as_table(["Sapi Name"], sapi_enabled);
STDOUT.WriteBlankLines(2); STDOUT.WriteBlankLines(2);
}
ar[0] = ['Build type', PHP_DEBUG == "yes" ? "Debug" : "Release"]; ar[0] = ['Build type', PHP_DEBUG == "yes" ? "Debug" : "Release"];
ar[1] = ['Thread Safety', PHP_ZTS == "yes" ? "Yes" : "No"]; ar[1] = ['Thread Safety', PHP_ZTS == "yes" ? "Yes" : "No"];
ar[2] = ['Compiler', VC_VERSIONS[VCVERS]]; ar[2] = ['Compiler', VC_VERSIONS[VCVERS]];
@ -1534,9 +1575,11 @@ function generate_files()
STDOUT.WriteLine("Generating files..."); STDOUT.WriteLine("Generating files...");
generate_makefile(); generate_makefile();
if (!MODE_PHPIZE) {
generate_internal_functions(); generate_internal_functions();
generate_config_h(); generate_config_h();
generate_phpize();
}
STDOUT.WriteLine("Done."); STDOUT.WriteLine("Done.");
STDOUT.WriteBlankLines(1); STDOUT.WriteBlankLines(1);
write_summary(); write_summary();
@ -1610,13 +1653,54 @@ function generate_config_h()
outfile.Close(); 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() function generate_makefile()
{ {
STDOUT.WriteLine("Generating Makefile"); STDOUT.WriteLine("Generating Makefile");
var MF = FSO.CreateTextFile("Makefile", true); var MF = FSO.CreateTextFile("Makefile", true);
MF.WriteLine("# Generated by configure.js"); MF.WriteLine("# Generated by configure.js");
/* spit out variable definitions */ /* spit out variable definitions */
var keys = (new VBArray(configure_subst.Keys())).toArray(); var keys = (new VBArray(configure_subst.Keys())).toArray();
var i; var i;
@ -1633,8 +1717,12 @@ function generate_makefile()
} }
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); var TF = FSO.OpenTextFile("win32/build/Makefile", 1);
}
MF.Write(TF.ReadAll()); MF.Write(TF.ReadAll());
MF.WriteLine("install-headers:"); 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 // and you can then build everything, ignoring fatal errors within a module
// by running "nmake snap" // by running "nmake snap"
PHP_SNAPSHOT_BUILD = "no"; PHP_SNAPSHOT_BUILD = "no";
ARG_ENABLE('snapshot-build', 'Build a snapshot; turns on everything it can and ignores build errors', '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');
// 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');
}