From a5cf8362603d1f0a40ce1e0ccbf326a28e741777 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Thu, 4 Dec 2003 13:38:47 +0000 Subject: [PATCH] Fix libxml to use static lib if found. Disable apache and isapi by default. Add some smarts so that we can really build extensions and SAPI found in php-src/pecl and/or php-src/../pecl. Only include a logo in the resources if we are building an .exe. --- ext/libxml/config.w32 | 13 ++++++----- sapi/apache/config.w32 | 2 +- sapi/isapi/config.w32 | 2 +- win32/build/buildconf.js | 30 ++++++++++++++++++++++--- win32/build/confutils.js | 47 ++++++++++++++++++++++++++++++---------- win32/build/template.rc | 2 ++ 6 files changed, 73 insertions(+), 23 deletions(-) diff --git a/ext/libxml/config.w32 b/ext/libxml/config.w32 index cd296dd7a3..c1809a4e88 100644 --- a/ext/libxml/config.w32 +++ b/ext/libxml/config.w32 @@ -4,13 +4,14 @@ ARG_WITH("libxml", "LibXML support", "yes"); if (PHP_LIBXML == "yes") { - EXTENSION("libxml", "libxml.c", false /* never shared */); - AC_DEFINE("HAVE_LIBXML", 1, "LibXML support"); - CHECK_LIB("iconv.lib", "libxml"); - CHECK_LIB("libxml2.lib", "libxml"); - CHECK_HEADER_ADD_INCLUDE("libxml/parser.h", "CFLAGS"); - ADD_FLAG("CFLAGS", "/D LIBXML_THREAD_ENABLED"); + if ((CHECK_LIB("libxml2_a.lib", "libxml") || CHECK_LIB("libxml2.lib", "libxml")) && + CHECK_LIB("iconv.lib", "libxml") && + CHECK_HEADER_ADD_INCLUDE("libxml/parser.h", "CFLAGS")) { + EXTENSION("libxml", "libxml.c", false /* never shared */); + AC_DEFINE("HAVE_LIBXML", 1, "LibXML support"); + ADD_FLAG("CFLAGS", "/D LIBXML_THREAD_ENABLED"); + } } diff --git a/sapi/apache/config.w32 b/sapi/apache/config.w32 index 93b70948db..32ccb92381 100644 --- a/sapi/apache/config.w32 +++ b/sapi/apache/config.w32 @@ -1,7 +1,7 @@ // vim:ft=javascript // $Id$ -ARG_ENABLE('apache', 'Build Apache 1.3.x version of PHP', 'yes'); +ARG_ENABLE('apache', 'Build Apache 1.3.x version of PHP', 'no'); ARG_WITH('apache-includes', 'Where to find Apache 1.3 headers', null); ARG_WITH('apache-libs', 'Where to find Apache 1.3 libraries', null); diff --git a/sapi/isapi/config.w32 b/sapi/isapi/config.w32 index c1a9765641..957fd01635 100644 --- a/sapi/isapi/config.w32 +++ b/sapi/isapi/config.w32 @@ -1,7 +1,7 @@ // vim:ft=javascript // $Id$ -ARG_ENABLE('isapi', 'Build ISAPI version of PHP', 'yes'); +ARG_ENABLE('isapi', 'Build ISAPI version of PHP', 'no'); if (PHP_ISAPI == "yes") { SAPI('isapi', 'php4isapi.c', 'php' + PHP_VERSION + 'isapi.dll', '/D PHP4ISAPI_EXPORTS'); diff --git a/win32/build/buildconf.js b/win32/build/buildconf.js index 33a7bb4adb..0df49c0c56 100644 --- a/win32/build/buildconf.js +++ b/win32/build/buildconf.js @@ -1,4 +1,4 @@ -// $Id: buildconf.js,v 1.4 2003-12-04 01:59:46 wez Exp $ +// $Id: buildconf.js,v 1.5 2003-12-04 13:38:47 wez Exp $ /* +----------------------------------------------------------------------+ | PHP Version 5 | @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: buildconf.js,v 1.4 2003-12-04 01:59:46 wez Exp $ */ +/* $Id: buildconf.js,v 1.5 2003-12-04 13:38:47 wez Exp $ */ // This generates a configure script for win32 build WScript.StdOut.WriteLine("Rebuilding configure.js"); @@ -25,6 +25,7 @@ var FSO = WScript.CreateObject("Scripting.FileSystemObject"); var C = FSO.CreateTextFile("configure.js", true); var modules = ""; +var seen = new Array(); function file_get_contents(filename) { @@ -42,12 +43,34 @@ function find_config_w32(dirname) var f = FSO.GetFolder(dirname); var fc = new Enumerator(f.SubFolders); - var c; + var c, i, ok, n; for (; !fc.atEnd(); fc.moveNext()) { + ok = true; + /* check if we already picked up a module with the same dirname; + * if we have, don't include it here */ + n = FSO.GetFileName(fc.item()); + + if (n == 'CVS' || n == 'tests') + continue; + + // WScript.StdOut.WriteLine("checking " + dirname + "/" + n); + for (i = 0; i < seen.length; i++) { + if (seen[i] == n) { + ok = false; + break; + } + } + if (!ok) { + WScript.StdOut.WriteLine("Skipping " + dirname + "/" + n + " -- already have a module with that name"); + continue; + } + seen[seen.length] = n; + c = FSO.BuildPath(fc.item(), "config.w32"); if (FSO.FileExists(c)) { //WScript.StdOut.WriteLine(c); + modules += "configure_module_dirname = condense_path(FSO.GetParentFolderName('" + c.replace(new RegExp('(["\\\\])', "g"), '\\$1') + "'));\r\n"; modules += file_get_contents(c); } } @@ -69,6 +92,7 @@ modules = file_get_contents("win32/build/config.w32"); find_config_w32("sapi"); find_config_w32("ext"); find_config_w32("pecl"); +find_config_w32("..\\pecl"); // Look for ARG_ENABLE or ARG_WITH calls re = new RegExp("(ARG_(ENABLE|WITH)\([^;]+\);)", "gm"); diff --git a/win32/build/confutils.js b/win32/build/confutils.js index c5278ed307..ad8ee08d72 100644 --- a/win32/build/confutils.js +++ b/win32/build/confutils.js @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -// $Id: confutils.js,v 1.14 2003-12-04 12:34:29 rrichards Exp $ +// $Id: confutils.js,v 1.15 2003-12-04 13:38:47 wez Exp $ var STDOUT = WScript.StdOut; var STDERR = WScript.StdErr; @@ -31,8 +31,12 @@ if (PROGRAM_FILES == null) { PROGRAM_FILES = "C:\\Program Files\\"; } -STDOUT.WriteLine("program files " + PROGRAM_FILES); +if (!FSO.FileExists("README.CVS-RULES")) { + STDERR.WriteLine("Must be run from the root of the php source"); + WScript.Quit(10); +} +// TODO: pick this up from configure.in var PHP_VERSION = 5; configure_args = new Array(); @@ -44,6 +48,20 @@ build_dirs = new Array(); extension_include_code = ""; extension_module_ptrs = ""; +function condense_path(path) +{ + var cd = WshShell.CurrentDirectory; + + path = FSO.GetAbsolutePathName(path); + + if (path.substr(0, cd.length).toLowerCase() + == cd.toLowerCase() && + (path.charCodeAt(cd.length) == 92 || path.charCodeAt(cd.length) == 47)) { + return path.substr(cd.length + 1); + } + return path; +} + function ConfigureArg(type, optname, helptext, defval) { var opptype = type == "enable" ? "disable" : "without"; @@ -425,6 +443,7 @@ function generate_version_info_resource(makefiletarget, creditspath) var res_prod_name = res_desc; var credits; var thanks = ""; + var logo = ""; if (FSO.FileExists(creditspath + '/CREDITS')) { credits = FSO.OpenTextFile(creditspath + '/CREDITS', 1); @@ -437,9 +456,13 @@ function generate_version_info_resource(makefiletarget, creditspath) } credits.Close(); } + + if (makefiletarget.match(new RegExp("\\.exe$"))) { + logo = " /D WANT_LOGO "; + } MFO.WriteLine("$(BUILD_DIR)\\" + resname + ": win32\\build\\template.rc"); - MFO.WriteLine("\t$(RC) /fo $(BUILD_DIR)\\" + resname + + MFO.WriteLine("\t$(RC) /fo $(BUILD_DIR)\\" + resname + logo + ' /d FILE_DESCRIPTION="\\"' + res_desc + '\\"" /d FILE_NAME="\\"' + makefiletarget + '\\"" /d PRODUCT_NAME="\\"' + res_prod_name + '\\"" /d THANKS_GUYS="\\"' + thanks + '\\"" win32\\build\\template.rc'); @@ -454,7 +477,7 @@ function SAPI(sapiname, file_list, makefiletarget, cflags) var ldflags; var resname; - STDOUT.WriteLine("Enabling sapi/" + sapiname); + STDOUT.WriteLine("Enabling SAPI " + configure_module_dirname); MFO.WriteBlankLines(1); MFO.WriteLine("# objects for SAPI " + sapiname); @@ -464,16 +487,16 @@ function SAPI(sapiname, file_list, makefiletarget, cflags) ADD_FLAG('CFLAGS_' + SAPI, cflags); } - ADD_SOURCES("sapi/" + sapiname, file_list, sapiname); + ADD_SOURCES(configure_module_dirname, file_list, sapiname); MFO.WriteBlankLines(1); MFO.WriteLine("# SAPI " + sapiname); MFO.WriteBlankLines(1); /* generate a .res file containing version information */ - resname = generate_version_info_resource(makefiletarget, "sapi/" + sapiname); + resname = generate_version_info_resource(makefiletarget, configure_module_dirname); MFO.WriteLine(makefiletarget + ": $(BUILD_DIR)\\" + makefiletarget); - MFO.WriteLine("\t@echo SAPI " + sapiname + " build complete"); + MFO.WriteLine("\t@echo SAPI " + configure_module_dirname + "/" + sapiname + " build complete"); MFO.WriteLine("$(BUILD_DIR)\\" + makefiletarget + ": $(" + SAPI + "_GLOBAL_OBJS) $(BUILD_DIR)\\$(PHPLIB) $(BUILD_DIR)\\" + resname); if (makefiletarget.match(new RegExp("\\.dll$"))) { @@ -512,11 +535,11 @@ function EXTENSION(extname, file_list, shared, cflags) } if (shared) { - STDOUT.WriteLine("Enabling ext/" + extname + " [shared]"); + STDOUT.WriteLine("Enabling extension " + configure_module_dirname + " [shared]"); cflags = "/D COMPILE_DL_" + EXT + " /D " + EXT + "_EXPORTS=1 " + cflags; ADD_FLAG("CFLAGS_PHP", "/D COMPILE_DL_" + EXT); } else { - STDOUT.WriteLine("Enabling ext/" + extname); + STDOUT.WriteLine("Enabling extension " + configure_module_dirname); } MFO.WriteBlankLines(1); @@ -524,13 +547,13 @@ function EXTENSION(extname, file_list, shared, cflags) MFO.WriteBlankLines(1); - ADD_SOURCES("ext/" + extname, file_list, extname); + ADD_SOURCES(configure_module_dirname, file_list, extname); MFO.WriteBlankLines(1); if (shared) { dllname = "php_" + extname + ".dll"; - var resname = generate_version_info_resource(dllname, "ext/" + extname); + var resname = generate_version_info_resource(dllname, configure_module_dirname); MFO.WriteLine("$(BUILD_DIR)\\" + dllname + ": $(" + EXT + "_GLOBAL_OBJS) $(BUILD_DIR)\\$(PHPLIB) $(BUILD_DIR)\\" + resname); MFO.WriteLine("\t$(LD) /out:$(BUILD_DIR)\\" + dllname + " $(DLL_LDFLAGS) $(LDFLAGS) $(LDFLAGS_" + EXT + ") $(" + EXT + "_GLOBAL_OBJS) $(BUILD_DIR)\\$(PHPLIB) $(LIBS_" + EXT + ") $(LIBS) $(BUILD_DIR)\\" + resname); @@ -559,7 +582,7 @@ function EXTENSION(extname, file_list, shared, cflags) if (s.match(re)) { c = file_get_contents(s); if (c.match("phpext_")) { - extension_include_code += '#include "ext/' + extname + '/' + FSO.GetFileName(s) + '"\r\n'; + extension_include_code += '#include "' + configure_module_dirname + '/' + FSO.GetFileName(s) + '"\r\n'; } } } diff --git a/win32/build/template.rc b/win32/build/template.rc index 61bff04a37..3160c58a6b 100644 --- a/win32/build/template.rc +++ b/win32/build/template.rc @@ -15,7 +15,9 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US # define THANKS_GUYS "" #endif +#ifdef WANT_LOGO 0 ICON win32\build\php.ico +#endif #define XSTRVER4(maj, min, rel, build) #maj "." #min "." #rel "." #build #define XSTRVER3(maj, min, rel) #maj "." #min "." #rel -- 2.40.0