]> granicus.if.org Git - php/commitdiff
Add --enable-snapshot-build configure option for win32 build.
authorWez Furlong <wez@php.net>
Mon, 22 Dec 2003 13:13:39 +0000 (13:13 +0000)
committerWez Furlong <wez@php.net>
Mon, 22 Dec 2003 13:13:39 +0000 (13:13 +0000)
Using it will attempt to switch on any configure options that
were left to their default value of "no".

Add a "snap" target to the makefile which will run a sub-process
to make each SAPI and EXT independently, so that the whole process
does not bail out if a particular extension is broken.

Add a way to specify dependencies between extensions in the
config.w32 files so that the makefile will include appropriate rules
and linkage.

win32/build/Makefile
win32/build/config.w32
win32/build/confutils.js

index 951e8466ebda8306c190a5a96e8dc7275c9af2b2..5b8a68bd7c1b3fff094e57152f9a3a9c7db3a0f8 100644 (file)
@@ -80,7 +80,12 @@ set TEST_PHP_EXECUTABLE=$(BUILD_DIR)\php.exe
 $(BUILD_DIR)\php.exe -d open_basedir= -d safe_mode=0 -d output_buffering=0 run-tests.php $(TESTS)
 <<NOKEEP
 
-dist: all
+build-snap:
+       @$(MAKE) "$(BUILD_DIR)\$(PHPDLL)"
+       for %T in ($(SAPI_TARGETS)) do $(MAKE) /nologo "%T"
+       for %T in ($(EXT_TARGETS)) do $(MAKE) /nologo "%T"
+
+build-dist:
        -rmdir /s /q $(BUILD_DIR)\php-$(PHP_VERSION_STRING)
        -del /f /q $(BUILD_DIR)\php-$(PHP_VERSION_STRING).zip
        $(BUILD_DIR)\php.exe win32/build/mkdist.php "$(BUILD_DIR)" "$(PHPDLL)" "$(SAPI_TARGETS)" "$(EXT_TARGETS)" "$(SNAPSHOT_TEMPLATE)"
@@ -88,6 +93,9 @@ dist: all
        -$(ZIP) -9 -r ..\php-$(PHP_VERSION_STRING).zip .
        cd ..\..
 
+dist: all build-dist
+snap: build-snap build-dist
+
 msi-installer: dist
        $(BUILD_DIR)\php.exe ..\php-installer\build-installer.php "$(BUILD_DIR)" "$(PHPDLL)" "$(SAPI_TARGETS)" "$(EXT_TARGETS)"
 
index 1c1052839f993666e5636b64e0d5ba1a653ce5d5..b4829d972c7121445de9b8929b2f3757128ceb65 100644 (file)
@@ -17,11 +17,6 @@ PATH_PROG('re2c');
 PATH_PROG('zip');
 PATH_PROG('lemon');
 
-// 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');
-
 ARG_ENABLE('debug', 'Compile with debugging symbols', "no");
 ARG_ENABLE('zts', 'Thread safety', 'yes');
 
index 7cb4f2ec93c92c506ca159d166820157e0ed0d2c..bd9c0ef4589be41ada279ee7957dca90deb3226d 100644 (file)
@@ -17,7 +17,7 @@
   +----------------------------------------------------------------------+
 */
 
-// $Id: confutils.js,v 1.23 2003-12-19 23:19:18 wez Exp $
+// $Id: confutils.js,v 1.24 2003-12-22 13:13:39 wez Exp $
 
 var STDOUT = WScript.StdOut;
 var STDERR = WScript.StdErr;
@@ -318,6 +318,10 @@ can be built that way. \
                WScript.Quit(1);
        }
 
+       var snapshot_build_exclusions = new Array(
+               'debug', 'crt-debug', 'lzf-better-compression', 'php-build', 'snapshot-template'
+               );
+
        // Now set any defaults we might have missed out earlier
        for (i = 0; i < configure_args.length; i++) {
                arg = configure_args[i];
@@ -326,6 +330,22 @@ can be built that way. \
                analyzed = analyze_arg(arg.defval);
                shared = analyzed[0];
                argval = analyzed[1];
+               if (PHP_SNAPSHOT_BUILD != "no" && argval == "no") {
+                       var force;
+
+                       force = true;
+                       for (j = 0; j < snapshot_build_exclusions.length; j++) {
+                               if (snapshot_build_exclusions[j] == arg.optname) {
+                                       force = false;
+                                       break;
+                               }
+                       }
+                       if (force) {
+                               STDOUT.WriteLine("snapshot: forcing " + arg.arg + " on");
+                               argval = "yes";
+                               shared = true;
+                       }
+               }
                eval("PHP_" + arg.symval + " = argval;");
                eval("PHP_" + arg.symval + "_SHARED = shared;");
        }
@@ -611,7 +631,7 @@ function SAPI(sapiname, file_list, makefiletarget, cflags)
        } else {
                ldflags = "$(LDFLAGS)";
        }
-       
+
        MFO.WriteLine("\t" + ld + " /nologo /out:$(BUILD_DIR)\\" + makefiletarget + " " + ldflags + " $(" + SAPI + "_GLOBAL_OBJS) $(BUILD_DIR)\\$(PHPLIB) $(LDFLAGS_" + SAPI + ") $(LIBS_" + SAPI + ") $(BUILD_DIR)\\" + resname);
 
        DEFINE('CFLAGS_' + SAPI + '_OBJ', '$(CFLAGS_' + SAPI + ')');
@@ -628,6 +648,26 @@ function file_get_contents(filename)
        return c;
 }
 
+// Add a dependency on another extension, so that
+// the dependencies are built before extname
+function ADD_EXTENSION_DEP(extname, dependson)
+{
+       var EXT = extname.toUpperCase();
+       var DEP = dependson.toUpperCase();
+
+       var dep_shared = eval("PHP_" + DEP + "_SHARED");
+       var ext_shared = eval("PHP_" + EXT + "_SHARED");
+
+       if (dep_shared) {
+               if (!ext_shared) {
+                       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");
+       }
+}
+
 function EXTENSION(extname, file_list, shared, cflags)
 {
        var objs = null;
@@ -661,9 +701,11 @@ function EXTENSION(extname, file_list, shared, cflags)
        if (shared) {
                dllname = "php_" + extname + ".dll";
                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);
+               var ld = "$(LD)";
+               var libname = "php_" + extname + ".lib";
+
+               MFO.WriteLine("$(BUILD_DIR)\\" + dllname + " $(BUILD_DIR)\\" + libname + ": $(DEPS_" + EXT + ") $(" + 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);
                MFO.WriteBlankLines(1);
 
                ADD_FLAG("EXT_TARGETS", dllname);
@@ -844,7 +886,11 @@ function generate_files()
 
        STDOUT.WriteLine("Done.");
        STDOUT.WriteBlankLines(1);
-       STDOUT.WriteLine("Type 'nmake' to build PHP");
+       if (PHP_SNAPSHOT_BUILD != "no") {
+               STDOUT.WriteLine("Type 'nmake snap' to build a PHP snapshot");
+       } else {
+               STDOUT.WriteLine("Type 'nmake' to build PHP");
+       }
 }
 
 function generate_config_h()
@@ -1008,3 +1054,15 @@ function copy_and_subst(srcname, destname, subst_array)
        f.Close();
 }
 
+// for snapshot builders, this option will attempt to enable everything
+// 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');
+
+