pajoye                                   Wed, 11 Jan 2012 15:46:45 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=322074

Log:
- add new build type, optional. has been used for the last 2 RCs

Changed paths:
    U   php/php-src/branches/PHP_5_4/win32/build/config.w32
    U   php/php-src/branches/PHP_5_4/win32/build/confutils.js
    U   php/php-src/trunk/win32/build/Makefile
    U   php/php-src/trunk/win32/build/config.w32
    U   php/php-src/trunk/win32/build/confutils.js

Modified: php/php-src/branches/PHP_5_4/win32/build/config.w32
===================================================================
--- php/php-src/branches/PHP_5_4/win32/build/config.w32	2012-01-11 15:24:32 UTC (rev 322073)
+++ php/php-src/branches/PHP_5_4/win32/build/config.w32	2012-01-11 15:46:45 UTC (rev 322074)
@@ -105,6 +105,19 @@
 if (PHP_DEBUG == "yes" && PHP_DEBUG_PACK == "yes") {
 	ERROR("Use of both --enable-debug and --enable-debug-pack not allowed.");
 }
+
+ARG_ENABLE('pgi', 'Generate PGO instrumented binaries', 'no');
+ARG_WITH('pgo', 'Compile optimized binaries using training data from folder', 'no');
+if (PHP_PGI == "yes" || PHP_PGO != "no") {
+	PGOMGR = PATH_PROG('pgomgr', WshShell.Environment("Process").Item("PATH"));
+	if (!PGOMGR) {
+		ERROR("--enable-pgi and --with-pgo options can only be used if PGO capable compiler is present.");
+	}
+	if (PHP_PGI == "yes" && PHP_PGO != "no") {
+		ERROR("Use of both --enable-pgi and --with-pgo not allowed.");
+	}
+}
+
 ARG_ENABLE('zts', 'Thread safety', 'yes');
 // Configures the hard-coded installation dir
 ARG_WITH('prefix', 'where PHP will be installed', '');
@@ -234,6 +247,19 @@
 	DEFINE("PHPLIB", "php" + PHP_VERSION + ".lib");
 }

+// CFLAGS, LDFLAGS and BUILD_DIR are defined
+// Add compiler and link flags if PGO options are selected
+if (PHP_DEBUG != "yes" && PHP_PGI == "yes") {
+	ADD_FLAG('CFLAGS', "/GL /O2");
+	ADD_FLAG('LDFLAGS', "/LTCG:PGINSTRUMENT");
+	DEFINE("PGOPGD_DIR", "$(BUILD_DIR)");
+}
+else if (PHP_DEBUG != "yes" && PHP_PGO != "no") {
+	ADD_FLAG('CFLAGS', "/GL /O2");
+	ADD_FLAG('LDFLAGS', "/LTCG:PGUPDATE");
+	DEFINE("PGOPGD_DIR", ((PHP_PGO.length == 0 || PHP_PGO == "yes") ? "$(BUILD_DIR)" : PHP_PGO));
+}
+
 // Find the php_build dir - it contains headers and libraries
 // that we need
 ARG_WITH('php-build', 'Path to where you extracted the development libraries (http://wiki.php.net/internals/windows/libs). Assumes that it is a sibling of this source dir (..\\deps) if not specified', 'no');

Modified: php/php-src/branches/PHP_5_4/win32/build/confutils.js
===================================================================
--- php/php-src/branches/PHP_5_4/win32/build/confutils.js	2012-01-11 15:24:32 UTC (rev 322073)
+++ php/php-src/branches/PHP_5_4/win32/build/confutils.js	2012-01-11 15:46:45 UTC (rev 322074)
@@ -414,7 +414,8 @@
 		 'php-build', 'snapshot-template', 'ereg',
 		 'pcre-regex', 'fastcgi', 'force-cgi-redirect',
 		 'path-info-check', 'zts', 'ipv6', 'memory-limit',
-		 'zend-multibyte', 'fd-setsize', 'memory-manager', 't1lib'
+		 'zend-multibyte', 'fd-setsize', 'memory-manager',
+		 't1lib', 'pgi', 'pgo'
 		);
 	var force;

@@ -1060,6 +1061,10 @@
 		ldflags = "$(LDFLAGS)";
 		manifest = "-@$(_VC_MANIFEST_EMBED_EXE)";
 	}
+
+	if(PHP_PGI == "yes" || PHP_PGO != "no") {
+		ldflags += " /PGD:$(PGOPGD_DIR)\\" + makefiletarget.substring(0, makefiletarget.indexOf(".")) + ".pgd";
+	}

 	if (MODE_PHPIZE) {
 		if (ld) {
@@ -1199,6 +1204,7 @@
 	var objs = null;
 	var EXT = extname.toUpperCase();
 	var extname_for_printing;
+	var ldflags;

 	if (shared == null) {
 		eval("shared = PHP_" + EXT + "_SHARED;");
@@ -1228,7 +1234,6 @@
 	MFO.WriteLine("# objects for EXT " + extname);
 	MFO.WriteBlankLines(1);

-
 	ADD_SOURCES(configure_module_dirname, file_list, extname, obj_dir);

 	MFO.WriteBlankLines(1);
@@ -1242,6 +1247,11 @@
 		var resname = generate_version_info_resource(dllname, extname, configure_module_dirname, false);
 		var ld = "@$(CC)";

+		ldflags = "";
+		if (PHP_PGI == "yes" || PHP_PGO != "no") {
+			ldflags = " /PGD:$(PGOPGD_DIR)\\" + dllname.substring(0, dllname.indexOf(".")) + ".pgd";
+		}
+
 		MFO.WriteLine("$(BUILD_DIR)\\" + libname + ": $(BUILD_DIR)\\" + dllname);
 		MFO.WriteBlankLines(1);
 		if (MODE_PHPIZE) {
@@ -1249,7 +1259,7 @@
 			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" + ld + " $(" + EXT + "_GLOBAL_OBJS) $(BUILD_DIR)\\$(PHPLIB) $(LIBS_" + EXT + ") $(LIBS) $(BUILD_DIR)\\" + resname + " /link /out:$(BUILD_DIR)\\" + dllname + ldflags + " $(DLL_LDFLAGS) $(LDFLAGS) $(LDFLAGS_" + EXT + ")");
 		}
 		MFO.WriteLine("\t-@$(_VC_MANIFEST_EMBED_DLL)");
 		MFO.WriteBlankLines(1);

Modified: php/php-src/trunk/win32/build/Makefile
===================================================================
--- php/php-src/trunk/win32/build/Makefile	2012-01-11 15:24:32 UTC (rev 322073)
+++ php/php-src/trunk/win32/build/Makefile	2012-01-11 15:46:45 UTC (rev 322074)
@@ -22,6 +22,7 @@
 MC="$(MC)"
 MT="$(MT)"
 RE2C="$(RE2C)"
+PGOMGR="$(PGOMGR)"
 PHP_BUILD=$(PHP_BUILD)

 MCFILE=$(BUILD_DIR)\wsyslog.rc
@@ -60,6 +61,12 @@
 	$(RE2C) $(RE2C_FLAGS) --case-inverted -cbdFt Zend/zend_language_scanner_defs.h -oZend/zend_language_scanner.c Zend/zend_language_scanner.l
 !endif

+!if $(PGOMGR) != ""
+PHP5_PGD_OPTION=/PGD:$(PGOPGD_DIR)\php5.pgd
+!else
+PHP5_PGD_OPTION=
+!endif
+
 PHPDLL_RES=$(BUILD_DIR)\$(PHPDLL).res

 $(MCFILE): win32\build\wsyslog.mc
@@ -82,7 +89,7 @@
 		win32\build\template.rc

 $(BUILD_DIR)\$(PHPDLL): generated_files $(PHPDEF) $(PHP_GLOBAL_OBJS) $(STATIC_EXT_OBJS) $(PHPDLL_RES) $(MCFILE)
-	@$(CC) $(PHP_GLOBAL_OBJS) $(STATIC_EXT_OBJS) $(STATIC_EXT_LIBS) $(LIBS) $(PHPDLL_RES) /link /out:$(BUILD_DIR)\$(PHPDLL) $(PHP_LDFLAGS) $(LDFLAGS) $(STATIC_EXT_LDFLAGS)
+	@$(CC) $(PHP_GLOBAL_OBJS) $(STATIC_EXT_OBJS) $(STATIC_EXT_LIBS) $(LIBS) $(PHPDLL_RES) /link /out:$(BUILD_DIR)\$(PHPDLL) $(PHP5_PGD_OPTION) $(PHP_LDFLAGS) $(LDFLAGS) $(STATIC_EXT_LDFLAGS)
 	-@$(_VC_MANIFEST_EMBED_DLL)

 $(BUILD_DIR)\$(PHPLIB): $(BUILD_DIR)\$(PHPDLL)
@@ -120,8 +127,17 @@
 	@cd $(BUILD_DIR)
 	@for %D in (_x $(BUILD_DIRS_SUB)) do @if exist %D @rd /s /q %D
 	@cd "$(PHP_SRC_DIR)"
-	-@del /f /q $(BUILD_DIR)\*.res $(BUILD_DIR)\*.lib $(BUILD_DIR)\*.ilk $(BUILD_DIR)\*.pdb $(BUILD_DIR)\*.exp $(PHPDEF) $(BUILD_DIR)\*.rc $(BUILD_DIR)\*.dbg $(BUILD_DIR)\*.bin $(BUILD_DIR)\php*.dll $(BUILD_DIR)\php*.exe > NUL
+	-@del /f /q $(BUILD_DIR)\*.res $(BUILD_DIR)\*.lib $(BUILD_DIR)\*.ilk $(BUILD_DIR)\*.pdb $(BUILD_DIR)\*.exp $(PHPDEF) $(BUILD_DIR)\*.rc $(BUILD_DIR)\*.manifest $(BUILD_DIR)\*.dbg $(BUILD_DIR)\*.bin $(BUILD_DIR)\php*.dll $(BUILD_DIR)\php*.exe > NUL

+clean-pgo: clean-all
+	-rd /s /q $(BUILD_DIR)\php-$(PHP_VERSION_STRING)
+	-rd /s /q $(BUILD_DIR)\pecl-$(PHP_VERSION_STRING)
+	-rd /s /q $(BUILD_DIR)\php-test-pack-$(PHP_VERSION_STRING)
+	-del /f /q $(BUILD_DIR)\php-$(PHP_VERSION_STRING)$(PHP_ZTS_ARCHIVE_POSTFIX)-Win32-$(PHP_COMPILER_SHORT)-$(PHP_ARCHITECTURE).zip
+	-del /f /q $(BUILD_DIR)\php-debug-pack-$(PHP_VERSION_STRING)$(PHP_ZTS_ARCHIVE_POSTFIX)-Win32-$(PHP_COMPILER_SHORT)-$(PHP_ARCHITECTURE).zip
+	-del /f /q $(BUILD_DIR)\pecl-$(PHP_VERSION_STRING)$(PHP_ZTS_ARCHIVE_POSTFIX)-Win32-$(PHP_COMPILER_SHORT)-$(PHP_ARCHITECTURE).zip
+	-del /f /q $(BUILD_DIR)\php-test-pack-$(PHP_VERSION_STRING).zip
+
 test:
 	"$(BUILD_DIR)\php.exe" -d open_basedir= -d output_buffering=0 run-tests.php $(TESTS) -p "$(BUILD_DIR)\php.exe"


Modified: php/php-src/trunk/win32/build/config.w32
===================================================================
--- php/php-src/trunk/win32/build/config.w32	2012-01-11 15:24:32 UTC (rev 322073)
+++ php/php-src/trunk/win32/build/config.w32	2012-01-11 15:46:45 UTC (rev 322074)
@@ -105,6 +105,19 @@
 if (PHP_DEBUG == "yes" && PHP_DEBUG_PACK == "yes") {
 	ERROR("Use of both --enable-debug and --enable-debug-pack not allowed.");
 }
+
+ARG_ENABLE('pgi', 'Generate PGO instrumented binaries', 'no');
+ARG_WITH('pgo', 'Compile optimized binaries using training data from folder', 'no');
+if (PHP_PGI == "yes" || PHP_PGO != "no") {
+	PGOMGR = PATH_PROG('pgomgr', WshShell.Environment("Process").Item("PATH"));
+	if (!PGOMGR) {
+		ERROR("--enable-pgi and --with-pgo options can only be used if PGO capable compiler is present.");
+	}
+	if (PHP_PGI == "yes" && PHP_PGO != "no") {
+		ERROR("Use of both --enable-pgi and --with-pgo not allowed.");
+	}
+}
+
 ARG_ENABLE('zts', 'Thread safety', 'yes');
 // Configures the hard-coded installation dir
 ARG_WITH('prefix', 'where PHP will be installed', '');
@@ -234,6 +247,19 @@
 	DEFINE("PHPLIB", "php" + PHP_VERSION + ".lib");
 }

+// CFLAGS, LDFLAGS and BUILD_DIR are defined
+// Add compiler and link flags if PGO options are selected
+if (PHP_DEBUG != "yes" && PHP_PGI == "yes") {
+	ADD_FLAG('CFLAGS', "/GL /O2");
+	ADD_FLAG('LDFLAGS', "/LTCG:PGINSTRUMENT");
+	DEFINE("PGOPGD_DIR", "$(BUILD_DIR)");
+}
+else if (PHP_DEBUG != "yes" && PHP_PGO != "no") {
+	ADD_FLAG('CFLAGS', "/GL /O2");
+	ADD_FLAG('LDFLAGS', "/LTCG:PGUPDATE");
+	DEFINE("PGOPGD_DIR", ((PHP_PGO.length == 0 || PHP_PGO == "yes") ? "$(BUILD_DIR)" : PHP_PGO));
+}
+
 // Find the php_build dir - it contains headers and libraries
 // that we need
 ARG_WITH('php-build', 'Path to where you extracted the development libraries (http://wiki.php.net/internals/windows/libs). Assumes that it is a sibling of this source dir (..\\deps) if not specified', 'no');

Modified: php/php-src/trunk/win32/build/confutils.js
===================================================================
--- php/php-src/trunk/win32/build/confutils.js	2012-01-11 15:24:32 UTC (rev 322073)
+++ php/php-src/trunk/win32/build/confutils.js	2012-01-11 15:46:45 UTC (rev 322074)
@@ -414,7 +414,8 @@
 		 'php-build', 'snapshot-template', 'ereg',
 		 'pcre-regex', 'fastcgi', 'force-cgi-redirect',
 		 'path-info-check', 'zts', 'ipv6', 'memory-limit',
-		 'zend-multibyte', 'fd-setsize', 'memory-manager', 't1lib'
+		 'zend-multibyte', 'fd-setsize', 'memory-manager',
+		 't1lib', 'pgi', 'pgo'
 		);
 	var force;

@@ -1060,6 +1061,10 @@
 		ldflags = "$(LDFLAGS)";
 		manifest = "-@$(_VC_MANIFEST_EMBED_EXE)";
 	}
+
+	if(PHP_PGI == "yes" || PHP_PGO != "no") {
+		ldflags += " /PGD:$(PGOPGD_DIR)\\" + makefiletarget.substring(0, makefiletarget.indexOf(".")) + ".pgd";
+	}

 	if (MODE_PHPIZE) {
 		if (ld) {
@@ -1199,6 +1204,7 @@
 	var objs = null;
 	var EXT = extname.toUpperCase();
 	var extname_for_printing;
+	var ldflags;

 	if (shared == null) {
 		eval("shared = PHP_" + EXT + "_SHARED;");
@@ -1228,7 +1234,6 @@
 	MFO.WriteLine("# objects for EXT " + extname);
 	MFO.WriteBlankLines(1);

-
 	ADD_SOURCES(configure_module_dirname, file_list, extname, obj_dir);

 	MFO.WriteBlankLines(1);
@@ -1242,6 +1247,11 @@
 		var resname = generate_version_info_resource(dllname, extname, configure_module_dirname, false);
 		var ld = "@$(CC)";

+		ldflags = "";
+		if (PHP_PGI == "yes" || PHP_PGO != "no") {
+			ldflags = " /PGD:$(PGOPGD_DIR)\\" + dllname.substring(0, dllname.indexOf(".")) + ".pgd";
+		}
+
 		MFO.WriteLine("$(BUILD_DIR)\\" + libname + ": $(BUILD_DIR)\\" + dllname);
 		MFO.WriteBlankLines(1);
 		if (MODE_PHPIZE) {
@@ -1249,7 +1259,7 @@
 			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" + ld + " $(" + EXT + "_GLOBAL_OBJS) $(BUILD_DIR)\\$(PHPLIB) $(LIBS_" + EXT + ") $(LIBS) $(BUILD_DIR)\\" + resname + " /link /out:$(BUILD_DIR)\\" + dllname + ldflags + " $(DLL_LDFLAGS) $(LDFLAGS) $(LDFLAGS_" + EXT + ")");
 		}
 		MFO.WriteLine("\t-@$(_VC_MANIFEST_EMBED_DLL)");
 		MFO.WriteBlankLines(1);
-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to