Skip to content

Commit

Permalink
- add new build type, optional. has been used for the last 2 RCs
Browse files Browse the repository at this point in the history
  • Loading branch information
pierrejoye committed Jan 11, 2012
1 parent ca77173 commit 9212099
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 3 deletions.
26 changes: 26 additions & 0 deletions win32/build/config.w32
Expand Up @@ -105,6 +105,19 @@ ARG_ENABLE('debug-pack', 'Release binaries with external debug symbols (--enable
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', '');
Expand Down Expand Up @@ -234,6 +247,19 @@ if (PHP_DEBUG == "yes" && PHP_ZTS == "yes") {
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');
Expand Down
16 changes: 13 additions & 3 deletions win32/build/confutils.js
Expand Up @@ -414,7 +414,8 @@ can be built that way. \
'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;

Expand Down Expand Up @@ -1060,6 +1061,10 @@ function SAPI(sapiname, file_list, makefiletarget, cflags, obj_dir)
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) {
Expand Down Expand Up @@ -1199,6 +1204,7 @@ function EXTENSION(extname, file_list, shared, cflags, dllname, obj_dir)
var objs = null;
var EXT = extname.toUpperCase();
var extname_for_printing;
var ldflags;

if (shared == null) {
eval("shared = PHP_" + EXT + "_SHARED;");
Expand Down Expand Up @@ -1228,7 +1234,6 @@ function EXTENSION(extname, file_list, shared, cflags, dllname, obj_dir)
MFO.WriteLine("# objects for EXT " + extname);
MFO.WriteBlankLines(1);


ADD_SOURCES(configure_module_dirname, file_list, extname, obj_dir);

MFO.WriteBlankLines(1);
Expand All @@ -1242,14 +1247,19 @@ function EXTENSION(extname, file_list, shared, cflags, dllname, obj_dir)
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) {
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" + 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);
Expand Down

0 comments on commit 9212099

Please sign in to comment.