summaryrefslogtreecommitdiff
path: root/win32/build
diff options
context:
space:
mode:
Diffstat (limited to 'win32/build')
-rw-r--r--win32/build/Makefile9
-rw-r--r--win32/build/config.w32158
-rw-r--r--win32/build/config.w32.phpize.in156
-rw-r--r--win32/build/confutils.js243
-rw-r--r--win32/build/libs_version.txt6
5 files changed, 266 insertions, 306 deletions
diff --git a/win32/build/Makefile b/win32/build/Makefile
index 90f02d2494..c24bd70ba6 100644
--- a/win32/build/Makefile
+++ b/win32/build/Makefile
@@ -90,7 +90,7 @@ $(PHPDLL_RES): 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) $(PHP7_PGD_OPTION) $(PHP_LDFLAGS) $(LDFLAGS) $(STATIC_EXT_LDFLAGS)
- @"$(LINK)" $(PHP_GLOBAL_OBJS) $(STATIC_EXT_OBJS) $(STATIC_EXT_LIBS) $(LIBS) $(PHPDLL_RES) /out:$(BUILD_DIR)\$(PHPDLL) $(PHP7_PGD_OPTION) $(PHP_LDFLAGS) $(LDFLAGS) $(STATIC_EXT_LDFLAGS)
+ @"$(LINK)" $(PHP_GLOBAL_OBJS_RESP) $(STATIC_EXT_OBJS_RESP) $(STATIC_EXT_LIBS) $(LIBS) $(PHPDLL_RES) /out:$(BUILD_DIR)\$(PHPDLL) $(PHP7_PGD_OPTION) $(PHP_LDFLAGS) $(LDFLAGS) $(STATIC_EXT_LDFLAGS)
-@$(_VC_MANIFEST_EMBED_DLL)
$(BUILD_DIR)\$(PHPLIB): $(BUILD_DIR)\$(PHPDLL)
@@ -158,19 +158,14 @@ build-dist: $(BUILD_DIR)\deplister.exe
$(BUILD_DIR)\php.exe -d date.timezone=UTC -n -dphar.readonly=0 win32/build/mkdist.php "$(BUILD_DIR)" "$(PHP_BUILD)" "$(PHPDLL)" "$(SAPI_TARGETS)" "$(EXT_TARGETS) $(PHP_EXTRA_DIST_FILES)" "$(PECL_TARGETS) $(PECL_EXTRA_DIST_FILES)" "$(SNAPSHOT_TEMPLATE)"
cd $(BUILD_DIR)\php-$(PHP_VERSION_STRING)
-$(ZIP) -9 -q -r ..\php-$(PHP_VERSION_STRING)$(PHP_ZTS_ARCHIVE_POSTFIX)-Win32-$(PHP_COMPILER_SHORT)-$(PHP_ARCHITECTURE).zip .
- cd ..\..
cd $(BUILD_DIR)\pecl-$(PHP_VERSION_STRING)
-$(ZIP) -9 -q -r ..\pecl-$(PHP_VERSION_STRING)$(PHP_ZTS_ARCHIVE_POSTFIX)-Win32-$(PHP_COMPILER_SHORT)-$(PHP_ARCHITECTURE).zip .
- cd ..\..
cd $(BUILD_DIR)\php-test-pack-$(PHP_VERSION_STRING)
-$(ZIP) -9 -q -r ..\php-test-pack-$(PHP_VERSION_STRING).zip .
- cd ..\..
cd $(BUILD_DIR)
-$(ZIP) -9 -q php-debug-pack-$(PHP_VERSION_STRING)$(PHP_ZTS_ARCHIVE_POSTFIX)-Win32-$(PHP_COMPILER_SHORT)-$(PHP_ARCHITECTURE).zip *.pdb
- cd
- cd
-$(ZIP) -9 -q -r php-devel-pack-$(PHP_VERSION_STRING)$(PHP_ZTS_ARCHIVE_POSTFIX)-Win32-$(PHP_COMPILER_SHORT)-$(PHP_ARCHITECTURE).zip $(BUILD_DIR_DEV_NAME)
- cd ..\..
+ cd $(BUILD_DIR)
dist: all build-dist
snap: build-snap build-devel build-dist
diff --git a/win32/build/config.w32 b/win32/build/config.w32
index 7187eacca1..7ca0293f3f 100644
--- a/win32/build/config.w32
+++ b/win32/build/config.w32
@@ -3,7 +3,9 @@
// "Master" config file; think of it as a configure.in
// equivalent.
-ARG_WITH("toolset", "Toolset to use for the compilation, supported: vs, clang, icc", "vs");
+ARG_WITH("toolset", "Toolset to use for the compilation, give: vs, clang, icc. " +
+ "The only recommended and supported toolset for production use " +
+ "is Visual Studio. Use others at your own risk.", "vs");
toolset_option_handle();
ARG_WITH('cygwin', 'Path to cygwin utilities on your system', '\\cygwin');
@@ -12,31 +14,14 @@ toolset_setup_compiler();
// do we use x64 or 80x86 version of compiler?
X64 = toolset_is_64();
-if (X64) {
- STDOUT.WriteLine(" Detected 64-bit compiler");
-} else {
- STDOUT.WriteLine(" Detected 32-bit compiler");
-}
-AC_DEFINE('ARCHITECTURE', X64 ? 'x64' : 'x86', "Detected compiler architecture");
-DEFINE("PHP_ARCHITECTURE", X64 ? 'x64' : 'x86');
+toolset_setup_arch();
toolset_setup_linker();
toolset_setup_project_tools();
// stick objects somewhere outside of the source tree
ARG_ENABLE('object-out-dir', 'Alternate location for binary objects during build', '');
-if (PHP_OBJECT_OUT_DIR.length) {
- PHP_OBJECT_OUT_DIR = FSO.GetAbsolutePathName(PHP_OBJECT_OUT_DIR);
- if (!FSO.FolderExists(PHP_OBJECT_OUT_DIR)) {
- ERROR('you chosen output directory ' + PHP_OBJECT_OUT_DIR + ' does not exist');
- }
- PHP_OBJECT_OUT_DIR += '\\';
-} else if (X64) {
- if (!FSO.FolderExists("x64")) {
- FSO.CreateFolder("x64");
- }
- PHP_OBJECT_OUT_DIR = 'x64\\';
-}
+object_out_dir_option_handle();
ARG_ENABLE('debug', 'Compile with debugging symbols', "no");
ARG_ENABLE('debug-pack', 'Release binaries with external debug symbols (--enable-debug must not be specified)', 'no');
@@ -91,61 +76,12 @@ if (VS_TOOLSET && VCVERS >= 1500 && PHP_MP != 'disable') {
toolset_setup_common_ldlags();
// General libs
-// urlmon.lib ole32.lib oleaut32.lib uuid.lib gdi32.lib winspool.lib comdlg32.lib
-DEFINE("LIBS", "kernel32.lib ole32.lib user32.lib advapi32.lib shell32.lib ws2_32.lib Dnsapi.lib");
+toolset_setup_common_libs();
// Set some debug/release specific options
-if (PHP_DEBUG == "yes") {
- ADD_FLAG("CFLAGS", "/LDd /MDd /W3 /Gm /Od /D _DEBUG /D ZEND_DEBUG=1 " +
- (X64?"/Zi":"/ZI"));
- ADD_FLAG("LDFLAGS", "/debug");
- // Avoid problems when linking to release libraries that use the release
- // version of the libc
- ADD_FLAG("PHP_LDFLAGS", "/nodefaultlib:msvcrt");
-} else {
- // Generate external debug files when --enable-debug-pack is specified
- if (PHP_DEBUG_PACK == "yes") {
- ADD_FLAG("CFLAGS", "/Zi");
- ADD_FLAG("LDFLAGS", "/incremental:no /debug /opt:ref,icf");
- }
- // Equivalent to Release_TSInline build -> best optimization
- ADD_FLAG("CFLAGS", "/LD /MD /W3 /Ox /D NDebug /D NDEBUG /D ZEND_WIN32_FORCE_INLINE /GF /D ZEND_DEBUG=0");
+toolset_setup_build_mode();
- // if you have VS.Net /GS hardens the binary against buffer overruns
- // ADD_FLAG("CFLAGS", "/GS");
-}
-
-if (PHP_ZTS == "yes") {
- ADD_FLAG("CFLAGS", "/D ZTS=1");
- ADD_FLAG("ZTS", "1");
-} else {
- ADD_FLAG("ZTS", "0");
-}
-
-DEFINE("PHP_ZTS_ARCHIVE_POSTFIX", PHP_ZTS == "yes" ? '' : "-nts");
-
-
-// we want msvcrt in the PHP DLL
-ADD_FLAG("PHP_LDFLAGS", "/nodefaultlib:libcmt");
-
-// set up the build dir and DLL name
-if (PHP_DEBUG == "yes" && PHP_ZTS == "yes") {
- DEFINE("BUILD_DIR", PHP_OBJECT_OUT_DIR + "Debug_TS");
- DEFINE("PHPDLL", "php" + PHP_VERSION + "ts_debug.dll");
- DEFINE("PHPLIB", "php" + PHP_VERSION + "ts_debug.lib");
-} else if (PHP_DEBUG == "yes" && PHP_ZTS == "no") {
- DEFINE("BUILD_DIR", PHP_OBJECT_OUT_DIR + "Debug");
- DEFINE("PHPDLL", "php" + PHP_VERSION + "_debug.dll");
- DEFINE("PHPLIB", "php" + PHP_VERSION + "_debug.lib");
-} else if (PHP_DEBUG == "no" && PHP_ZTS == "yes") {
- DEFINE("BUILD_DIR", PHP_OBJECT_OUT_DIR + "Release_TS");
- DEFINE("PHPDLL", "php" + PHP_VERSION + "ts.dll");
- DEFINE("PHPLIB", "php" + PHP_VERSION + "ts.lib");
-} else if (PHP_DEBUG == "no" && PHP_ZTS == "no") {
- DEFINE("BUILD_DIR", PHP_OBJECT_OUT_DIR + "Release");
- DEFINE("PHPDLL", "php" + PHP_VERSION + ".dll");
- DEFINE("PHPLIB", "php" + PHP_VERSION + ".lib");
-}
+setup_zts_stuff();
// CFLAGS, LDFLAGS and BUILD_DIR are defined
// Add compiler and link flags if PGO options are selected
@@ -161,32 +97,7 @@ else if (PHP_DEBUG != "yes" && PHP_PGO != "no") {
// 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');
-
-if (PHP_PHP_BUILD == 'no') {
- if (FSO.FolderExists("..\\deps")) {
- PHP_PHP_BUILD = "..\\deps";
- } else {
- if (FSO.FolderExists("..\\php_build")) {
- PHP_PHP_BUILD = "..\\php_build";
- } else {
- if (X64) {
- if (FSO.FolderExists("..\\win64build")) {
- PHP_PHP_BUILD = "..\\win64build";
- } else if (FSO.FolderExists("..\\php-win64-dev\\php_build")) {
- PHP_PHP_BUILD = "..\\php-win64-dev\\php_build";
- }
- } else {
- if (FSO.FolderExists("..\\win32build")) {
- PHP_PHP_BUILD = "..\\win32build";
- } else if (FSO.FolderExists("..\\php-win32-dev\\php_build")) {
- PHP_PHP_BUILD = "..\\php-win32-dev\\php_build";
- }
- }
- }
- }
- PHP_PHP_BUILD = FSO.GetAbsolutePathName(PHP_PHP_BUILD);
-}
-DEFINE("PHP_BUILD", PHP_PHP_BUILD);
+php_build_option_handle();
ARG_WITH('extra-includes', 'Extra include path to use when building everything', '');
ARG_WITH('extra-libs', 'Extra library path to use when linking everything', '');
@@ -196,46 +107,7 @@ var php_usual_lib_suspects = PHP_PHP_BUILD+"\\lib";
ADD_FLAG("CFLAGS", '/I "' + php_usual_include_suspects + '" ');
ADD_FLAG("LDFLAGS", '/libpath:"' + php_usual_lib_suspects + '" ');
-
-// Poke around for some headers
-function probe_basic_headers()
-{
- var p;
-
- if (PHP_PHP_BUILD != "no") {
- php_usual_include_suspects += ";" + PHP_PHP_BUILD + "\\include";
- php_usual_lib_suspects += ";" + PHP_PHP_BUILD + "\\lib";
- }
-}
-
-function add_extra_dirs()
-{
- var path, i, f;
-
- if (PHP_EXTRA_INCLUDES.length) {
- path = PHP_EXTRA_INCLUDES.split(';');
- for (i = 0; i < path.length; i++) {
- f = FSO.GetAbsolutePathName(path[i]);
- if (FSO.FolderExists(f)) {
- ADD_FLAG("CFLAGS", '/I "' + f + '" ');
- }
- }
- }
- if (PHP_EXTRA_LIBS.length) {
- path = PHP_EXTRA_LIBS.split(';');
- for (i = 0; i < path.length; i++) {
- f = FSO.GetAbsolutePathName(path[i]);
- if (FSO.FolderExists(f)) {
- if (VS_TOOLSET && VCVERS <= 1200 && f.indexOf(" ") >= 0) {
- ADD_FLAG("LDFLAGS", '/libpath:"\\"' + f + '\\"" ');
- } else {
- ADD_FLAG("LDFLAGS", '/libpath:"' + f + '" ');
- }
- }
- }
- }
-
-}
+ADD_FLAG("ARFLAGS", '/libpath:"' + php_usual_lib_suspects + '" ');
probe_basic_headers();
add_extra_dirs();
@@ -275,7 +147,7 @@ ADD_SOURCES("win32", "inet.c fnmatch.c sockets.c");
if (VS_TOOLSET && VCVERS <= 1300) {
ADD_SOURCES("win32", "strtoi64.c");
}
-if (VS_TOOLSET && VCVERS >= 1400 || ICC_TOOLSET) {
+if (VS_TOOLSET && VCVERS >= 1400 || !VS_TOOLSET) {
AC_DEFINE('HAVE_STRNLEN', 1);
}
@@ -368,3 +240,11 @@ if (PHP_ANALYZER == "vs") {
PHP_ANALYZER = "no"
}
+if (CLANG_TOOLSET) {
+ ARG_WITH("uncritical-warn-choke", "Disable some uncritical warnings", "yes");
+ if (PHP_UNCRITICAL_WARN_CHOKE != "no") {
+ ADD_FLAG("CFLAGS", "-Wno-ignored-attributes -Wno-deprecated-declarations -Wno-missing-braces \
+ -Wno-logical-op-parentheses -Wno-msvc-include -Wno-invalid-source-encoding -Wno-unknown-pragmas");
+ }
+}
+
diff --git a/win32/build/config.w32.phpize.in b/win32/build/config.w32.phpize.in
index 5a7f31d5d4..a340af0e60 100644
--- a/win32/build/config.w32.phpize.in
+++ b/win32/build/config.w32.phpize.in
@@ -3,7 +3,9 @@
// "Master" config file; think of it as a configure.in
// equivalent.
-ARG_WITH("toolset", "Toolset to use for the compilation, supported: vs, clang, icc", "vs");
+ARG_WITH("toolset", "Toolset to use for the compilation, give: vs, clang, icc. " +
+ "The only recommended and supported toolset for production use " +
+ "is Visual Studio. Use others at your own risk.", "vs");
toolset_option_handle()
var PHP_CYGWIN="notset";
@@ -12,31 +14,14 @@ toolset_setup_compiler();
// do we use x64 or 80x86 version of compiler?
X64 = toolset_is_64();
-if (X64) {
- STDOUT.WriteLine(" Detected 64-bit compiler");
-} else {
- STDOUT.WriteLine(" Detected 32-bit compiler");
-}
-AC_DEFINE('ARCHITECTURE', X64 ? 'x64' : 'x86', "Detected compiler architecture");
-DEFINE("PHP_ARCHITECTURE", X64 ? 'x64' : 'x86');
+toolset_setup_arch();
toolset_setup_linker();
toolset_setup_project_tools();
// stick objects somewhere outside of the source tree
ARG_ENABLE('object-out-dir', 'Alternate location for binary objects during build', '');
-if (PHP_OBJECT_OUT_DIR.length) {
- PHP_OBJECT_OUT_DIR = FSO.GetAbsolutePathName(PHP_OBJECT_OUT_DIR);
- if (!FSO.FolderExists(PHP_OBJECT_OUT_DIR)) {
- ERROR('you chosen output directory ' + PHP_OBJECT_OUT_DIR + ' does not exist');
- }
- PHP_OBJECT_OUT_DIR += '\\';
-} else if (X64) {
- if (!FSO.FolderExists("x64")) {
- FSO.CreateFolder("x64");
- }
- PHP_OBJECT_OUT_DIR = 'x64\\';
-}
+object_out_dir_option_handle();
ARG_ENABLE('debug', 'Compile with debugging symbols', "no");
ARG_ENABLE('debug-pack', 'Release binaries with external debug symbols (--enable-debug must not be specified)', 'no');
@@ -81,66 +66,12 @@ ARG_WITH("snapshot-template", "Path to snapshot builder template dir", "no");
toolset_setup_common_ldlags();
// General libs
-// urlmon.lib ole32.lib oleaut32.lib uuid.lib gdi32.lib winspool.lib comdlg32.lib
-DEFINE("LIBS", "kernel32.lib ole32.lib user32.lib advapi32.lib shell32.lib ws2_32.lib Dnsapi.lib");
+toolset_setup_common_libs();
// Set some debug/release specific options
-if (PHP_DEBUG == "yes") {
- ADD_FLAG("CFLAGS", "/LDd /MDd /W3 /Gm /Od /D _DEBUG /D ZEND_DEBUG=1 " +
- (X64?"/Zi":"/ZI"));
- ADD_FLAG("LDFLAGS", "/debug");
- // Avoid problems when linking to release libraries that use the release
- // version of the libc
- ADD_FLAG("PHP_LDFLAGS", "/nodefaultlib:msvcrt");
-} else {
- // Generate external debug files when --enable-debug-pack is specified
- if (PHP_DEBUG_PACK == "yes") {
- ADD_FLAG("CFLAGS", "/Zi");
- ADD_FLAG("LDFLAGS", "/incremental:no /debug /opt:ref,icf");
- }
- // Equivalent to Release_TSInline build -> best optimization
- ADD_FLAG("CFLAGS", "/LD /MD /W3 /Ox /D NDebug /D NDEBUG /D ZEND_WIN32_FORCE_INLINE /GF /D ZEND_DEBUG=0");
-
- // if you have VS.Net /GS hardens the binary against buffer overruns
- // ADD_FLAG("CFLAGS", "/GS");
-}
-
-if (PHP_ZTS == "yes") {
- ADD_FLAG("CFLAGS", "/D ZTS=1");
-}
-
-DEFINE("PHP_ZTS_ARCHIVE_POSTFIX", PHP_ZTS == "yes" ? '' : "-nts");
+toolset_setup_build_mode();
-
-// we want msvcrt in the PHP DLL
-ADD_FLAG("PHP_LDFLAGS", "/nodefaultlib:libcmt");
-
-// set up the build dir and DLL name
-if (PHP_DEBUG == "yes" && PHP_ZTS == "yes") {
- DEFINE("BUILD_DIR", PHP_OBJECT_OUT_DIR + "Debug_TS");
- if (!MODE_PHPIZE) {
- DEFINE("PHPDLL", "php" + PHP_VERSION + "ts_debug.dll");
- DEFINE("PHPLIB", "php" + PHP_VERSION + "ts_debug.lib");
- }
-} else if (PHP_DEBUG == "yes" && PHP_ZTS == "no") {
- DEFINE("BUILD_DIR", PHP_OBJECT_OUT_DIR + "Debug");
- if (!MODE_PHPIZE) {
- DEFINE("PHPDLL", "php" + PHP_VERSION + "_debug.dll");
- DEFINE("PHPLIB", "php" + PHP_VERSION + "_debug.lib");
- }
-} else if (PHP_DEBUG == "no" && PHP_ZTS == "yes") {
- DEFINE("BUILD_DIR", PHP_OBJECT_OUT_DIR + "Release_TS");
- if (!MODE_PHPIZE) {
- DEFINE("PHPDLL", "php" + PHP_VERSION + "ts.dll");
- DEFINE("PHPLIB", "php" + PHP_VERSION + "ts.lib");
- }
-} else if (PHP_DEBUG == "no" && PHP_ZTS == "no") {
- DEFINE("BUILD_DIR", PHP_OBJECT_OUT_DIR + "Release");
- if (!MODE_PHPIZE) {
- DEFINE("PHPDLL", "php" + PHP_VERSION + ".dll");
- DEFINE("PHPLIB", "php" + PHP_VERSION + ".lib");
- }
-}
+setup_zts_stuff();
if (MODE_PHPIZE) {
DEFINE("PHPDLL", PHP_DLL);
@@ -150,32 +81,7 @@ if (MODE_PHPIZE) {
// 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');
-
-if (PHP_PHP_BUILD == 'no') {
- if (FSO.FolderExists("..\\deps")) {
- PHP_PHP_BUILD = "..\\deps";
- } else {
- if (FSO.FolderExists("..\\php_build")) {
- PHP_PHP_BUILD = "..\\php_build";
- } else {
- if (X64) {
- if (FSO.FolderExists("..\\win64build")) {
- PHP_PHP_BUILD = "..\\win64build";
- } else if (FSO.FolderExists("..\\php-win64-dev\\php_build")) {
- PHP_PHP_BUILD = "..\\php-win64-dev\\php_build";
- }
- } else {
- if (FSO.FolderExists("..\\win32build")) {
- PHP_PHP_BUILD = "..\\win32build";
- } else if (FSO.FolderExists("..\\php-win32-dev\\php_build")) {
- PHP_PHP_BUILD = "..\\php-win32-dev\\php_build";
- }
- }
- }
- }
- PHP_PHP_BUILD = FSO.GetAbsolutePathName(PHP_PHP_BUILD);
-}
-DEFINE("PHP_BUILD", PHP_PHP_BUILD);
+php_build_option_handle();
ARG_WITH('extra-includes', 'Extra include path to use when building everything', '');
ARG_WITH('extra-libs', 'Extra library path to use when linking everything', '');
@@ -185,46 +91,7 @@ var php_usual_lib_suspects = PHP_PHP_BUILD+"\\lib";
ADD_FLAG("CFLAGS", '/I "' + php_usual_include_suspects + '" ');
ADD_FLAG("LDFLAGS", '/libpath:"\\"' + php_usual_lib_suspects + '\\"" ');
-
-// Poke around for some headers
-function probe_basic_headers()
-{
- var p;
-
- if (PHP_PHP_BUILD != "no") {
- php_usual_include_suspects += ";" + PHP_PHP_BUILD + "\\include";
- php_usual_lib_suspects += ";" + PHP_PHP_BUILD + "\\lib";
- }
-}
-
-function add_extra_dirs()
-{
- var path, i, f;
-
- if (PHP_EXTRA_INCLUDES.length) {
- path = PHP_EXTRA_INCLUDES.split(';');
- for (i = 0; i < path.length; i++) {
- f = FSO.GetAbsolutePathName(path[i]);
- if (FSO.FolderExists(f)) {
- ADD_FLAG("CFLAGS", '/I "' + f + '" ');
- }
- }
- }
- if (PHP_EXTRA_LIBS.length) {
- path = PHP_EXTRA_LIBS.split(';');
- for (i = 0; i < path.length; i++) {
- f = FSO.GetAbsolutePathName(path[i]);
- if (FSO.FolderExists(f)) {
- if (VCVERS <= 1200 && f.indexOf(" ") >= 0) {
- ADD_FLAG("LDFLAGS", '/libpath:"\\"' + f + '\\"" ');
- } else {
- ADD_FLAG("LDFLAGS", '/libpath:"' + f + '" ');
- }
- }
- }
- }
-
-}
+ADD_FLAG("ARFLAGS", '/libpath:"\\"' + php_usual_lib_suspects + '\\"" ');
probe_basic_headers();
add_extra_dirs();
@@ -235,13 +102,12 @@ STDOUT.WriteBlankLines(1);
STDOUT.WriteLine("Build dir: " + get_define('BUILD_DIR'));
STDOUT.WriteLine("PHP Core: " + get_define('PHPDLL') + " and " + get_define('PHPLIB'));
-
/* XXX inspect this for other toolsets */
if (VS_TOOLSET && VCVERS == 1200) {
AC_DEFINE('ZEND_DVAL_TO_LVAL_CAST_OK', 1);
}
-if (ICC_TOOLSET || VS_TOOLSET && VCVERS >= 1400) {
+if (!VS_TOOLSET || VS_TOOLSET && VCVERS >= 1400) {
AC_DEFINE('HAVE_STRNLEN', 1);
}
diff --git a/win32/build/confutils.js b/win32/build/confutils.js
index 0f07e18120..7d02f99ad6 100644
--- a/win32/build/confutils.js
+++ b/win32/build/confutils.js
@@ -63,8 +63,7 @@ VC_VERSIONS[1500] = 'MSVC9 (Visual C++ 2008)';
VC_VERSIONS[1600] = 'MSVC10 (Visual C++ 2010)';
VC_VERSIONS[1700] = 'MSVC11 (Visual C++ 2012)';
VC_VERSIONS[1800] = 'MSVC12 (Visual C++ 2013)';
-/* XXX update after the final rename */
-VC_VERSIONS[1900] = 'MSVC14 (Visual C++ CTP14)';
+VC_VERSIONS[1900] = 'MSVC14 (Visual C++ 2015)';
var VC_VERSIONS_SHORT = new Array();
VC_VERSIONS_SHORT[1200] = 'VC6';
@@ -717,6 +716,7 @@ function CHECK_LIB(libnames, target, path_to_check, common_name)
var libdir = FSO.GetParentFolderName(location);
libname = FSO.GetFileName(location);
ADD_FLAG("LDFLAGS" + target, '/libpath:"' + libdir + '" ');
+ ADD_FLAG("ARFLAGS" + target, '/libpath:"' + libdir + '" ');
ADD_FLAG("LIBS" + target, libname);
STDOUT.WriteLine(location);
@@ -786,6 +786,7 @@ function OLD_CHECK_LIB(libnames, target, path_to_check)
if (typeof(p) == "string") {
ADD_FLAG("LDFLAGS" + target, '/libpath:"' + p + '" ');
+ ADD_FLAG("ARFLAGS" + target, '/libpath:"' + p + '" ');
ADD_FLAG("LIBS" + target, libname);
have = 1;
} else if (p == true) {
@@ -1097,7 +1098,7 @@ function SAPI(sapiname, file_list, makefiletarget, cflags, obj_dir)
ldflags = "/dll $(LDFLAGS)";
manifest = "-@$(_VC_MANIFEST_EMBED_DLL)";
} else if (makefiletarget.match(new RegExp("\\.lib$"))) {
- ldflags = "$(LDFLAGS)";
+ ldflags = "$(ARFLAGS)";
ld = "$(MAKE_LIB)";
} else {
ldflags = "$(LDFLAGS)";
@@ -1120,17 +1121,17 @@ function SAPI(sapiname, file_list, makefiletarget, cflags, obj_dir)
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);
+ MFO.WriteLine("\t" + ld + " /nologo /out:$(BUILD_DIR)\\" + makefiletarget + " " + ldflags + " $(" + SAPI + "_GLOBAL_OBJS_RESP) $(PHPLIB) $(ARFLAGS_" + SAPI + ") $(LIBS_" + SAPI + ") $(BUILD_DIR)\\" + resname);
} else {
ld = '@"$(LINK)"';
- MFO.WriteLine("\t" + ld + " /nologo " + " $(" + SAPI + "_GLOBAL_OBJS) $(PHPLIB) $(LIBS_" + SAPI + ") $(BUILD_DIR)\\" + resname + " /out:$(BUILD_DIR)\\" + makefiletarget + " " + ldflags + " $(LDFLAGS_" + SAPI + ")");
+ MFO.WriteLine("\t" + ld + " /nologo " + " $(" + SAPI + "_GLOBAL_OBJS_RESP) $(PHPLIB) $(LIBS_" + SAPI + ") $(BUILD_DIR)\\" + resname + " /out:$(BUILD_DIR)\\" + makefiletarget + " " + ldflags + " $(LDFLAGS_" + SAPI + ")");
}
} else {
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_RESP) $(BUILD_DIR)\\$(PHPLIB) $(ARFLAGS_" + SAPI + ") $(LIBS_" + SAPI + ") $(BUILD_DIR)\\" + resname);
} else {
ld = '@"$(LINK)"';
- MFO.WriteLine("\t" + ld + " /nologo " + " $(" + SAPI + "_GLOBAL_OBJS) $(BUILD_DIR)\\$(PHPLIB) $(LIBS_" + SAPI + ") $(BUILD_DIR)\\" + resname + " /out:$(BUILD_DIR)\\" + makefiletarget + " " + ldflags + " $(LDFLAGS_" + SAPI + ")");
+ MFO.WriteLine("\t" + ld + " /nologo " + " $(" + SAPI + "_GLOBAL_OBJS_RESP) $(BUILD_DIR)\\$(PHPLIB) $(LIBS_" + SAPI + ") $(BUILD_DIR)\\" + resname + " /out:$(BUILD_DIR)\\" + makefiletarget + " " + ldflags + " $(LDFLAGS_" + SAPI + ")");
}
}
@@ -1316,10 +1317,10 @@ function EXTENSION(extname, file_list, shared, cflags, dllname, obj_dir)
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 + " /out:$(BUILD_DIR)\\" + dllname + " $(DLL_LDFLAGS) $(LDFLAGS) $(LDFLAGS_" + EXT + ")");
+ MFO.WriteLine("\t" + ld + " $(" + EXT + "_GLOBAL_OBJS_RESP) $(PHPLIB) $(LIBS_" + EXT + ") $(LIBS) $(BUILD_DIR)\\" + resname + " /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 + " /out:$(BUILD_DIR)\\" + dllname + ldflags + " $(DLL_LDFLAGS) $(LDFLAGS) $(LDFLAGS_" + EXT + ")");
+ MFO.WriteLine("\t" + ld + " $(" + EXT + "_GLOBAL_OBJS_RESP) $(BUILD_DIR)\\$(PHPLIB) $(LIBS_" + EXT + ") $(LIBS) $(BUILD_DIR)\\" + resname + " /out:$(BUILD_DIR)\\" + dllname + ldflags + " $(DLL_LDFLAGS) $(LDFLAGS) $(LDFLAGS_" + EXT + ")");
}
MFO.WriteLine("\t-@$(_VC_MANIFEST_EMBED_DLL)");
MFO.WriteBlankLines(1);
@@ -1336,6 +1337,7 @@ function EXTENSION(extname, file_list, shared, cflags, dllname, obj_dir)
DEFINE('CFLAGS_' + EXT + '_OBJ', '$(CFLAGS_' + EXT + ')');
} else {
ADD_FLAG("STATIC_EXT_OBJS", "$(" + EXT + "_GLOBAL_OBJS)");
+ ADD_FLAG("STATIC_EXT_OBJS_RESP", "$(" + EXT + "_GLOBAL_OBJS_RESP)");
ADD_FLAG("STATIC_EXT_LIBS", "$(LIBS_" + EXT + ")");
ADD_FLAG("STATIC_EXT_LDFLAGS", "$(LDFLAGS_" + EXT + ")");
ADD_FLAG("STATIC_EXT_CFLAGS", "$(CFLAGS_" + EXT + ")");
@@ -1394,9 +1396,20 @@ function ADD_SOURCES(dir, file_list, target, obj_dir)
sym = target.toUpperCase() + "_GLOBAL_OBJS";
flags = "CFLAGS_" + target.toUpperCase() + '_OBJ';
+ var bd = get_define('BUILD_DIR');
+ var respd = bd + '\\resp';
+ if (!FSO.FolderExists(respd)) {
+ FSO.CreateFolder(respd);
+ }
+ var obj_lst_fn = respd + '\\' + sym + '.txt';
+ var resp = "";
+
if (configure_subst.Exists(sym)) {
tv = configure_subst.Item(sym);
} else {
+ if (FSO.FileExists(obj_lst_fn)) {
+ FSO.DeleteFile(obj_lst_fn, true);
+ }
tv = "";
}
@@ -1439,12 +1452,16 @@ function ADD_SOURCES(dir, file_list, target, obj_dir)
sub_build += d;
- DEFINE(bd_flags_name, " /Fp" + sub_build + " /FR" + sub_build + " ");
+ DEFINE(bd_flags_name, "/Fp" + sub_build + " /FR" + sub_build + " ");
+ if (VS_TOOLSET) {
+ ADD_FLAG(bd_flags_name, "/Fd" + sub_build);
+ }
for (i in file_list) {
src = file_list[i];
obj = src.replace(re, ".obj");
tv += " " + sub_build + obj;
+ resp += " " + sub_build.replace('$(BUILD_DIR)', bd) + obj;
if (!PHP_MP_DISABLED) {
if (i > 0) {
@@ -1471,6 +1488,21 @@ function ADD_SOURCES(dir, file_list, target, obj_dir)
}
DEFINE(sym, tv);
+
+ /* Generate the response file and define it to the Makefile. This can be
+ useful when getting the "command line too long" linker errors. */
+ var obj_lst_fh = null;
+ if (!FSO.FileExists(obj_lst_fn)) {
+ obj_lst_fh = FSO.CreateTextFile(obj_lst_fn);
+ //STDOUT.WriteLine("Creating " + obj_lst_fn);
+ } else {
+ //STDOUT.WriteLine("Appending to " + obj_lst_fn);
+ obj_lst_fh = FSO.OpenTextFile(obj_lst_fn, 8);
+ }
+
+ obj_lst_fh.Write(" " + resp);
+ obj_lst_fh.Close();
+ DEFINE(sym + "_RESP", '@"' + obj_lst_fn + '"');
}
function REMOVE_TARGET(dllname, flag)
@@ -1967,8 +1999,9 @@ function generate_makefile()
// that is part of the build dir flags (CFLAGS_BD_XXX) from being
// seen as a line continuation character
MF.WriteLine(keys[i] + "=" +
- //word_wrap_and_indent(1, configure_subst.Item(keys[i]), ' \\', '\t') + " "
- configure_subst.Item(keys[i]) + " "
+ /* \s+\/ eliminates extra whitespace caused when using \ for string continuation,
+ whereby \/ is the start of the next compiler switch */
+ trim(configure_subst.Item(keys[i])).replace(/\s+\//gm, " /") + " "
);
MF.WriteBlankLines(1);
}
@@ -2035,6 +2068,7 @@ function ADD_FLAG(name, flags, target)
if (target != null) {
name = target.toUpperCase() + "_" + name;
}
+ flags = trim(flags);
if (configure_subst.Exists(name)) {
var curr_flags = configure_subst.Item(name);
@@ -2499,6 +2533,17 @@ function toolset_is_64()
ERROR("Unsupported toolset");
}
+function toolset_setup_arch()
+{
+ if (X64) {
+ STDOUT.WriteLine(" Detected 64-bit compiler");
+ } else {
+ STDOUT.WriteLine(" Detected 32-bit compiler");
+ }
+ AC_DEFINE('ARCHITECTURE', X64 ? 'x64' : 'x86', "Detected compiler architecture");
+ DEFINE("PHP_ARCHITECTURE", X64 ? 'x64' : 'x86');
+}
+
function toolset_setup_linker()
{
@@ -2562,6 +2607,9 @@ function toolset_setup_common_cflags()
ADD_FLAG('CFLAGS', '-m32');
}
ADD_FLAG("CFLAGS", " /fallback ");
+
+ var vc_ver = probe_binary(PATH_PROG('cl', null));
+ ADD_FLAG("CFLAGS", "-fms-compatibility-version=" + vc_ver);
}
}
@@ -2583,5 +2631,176 @@ function toolset_setup_common_ldlags()
} else {
DEFINE("LDFLAGS", "/nologo ");
}
+
+ // we want msvcrt in the PHP DLL
+ ADD_FLAG("PHP_LDFLAGS", "/nodefaultlib:libcmt");
+}
+
+function toolset_setup_common_libs()
+{
+ // urlmon.lib ole32.lib oleaut32.lib uuid.lib gdi32.lib winspool.lib comdlg32.lib
+ DEFINE("LIBS", "kernel32.lib ole32.lib user32.lib advapi32.lib shell32.lib ws2_32.lib Dnsapi.lib");
+}
+
+function toolset_setup_build_mode()
+{
+ if (PHP_DEBUG == "yes") {
+ ADD_FLAG("CFLAGS", "/LDd /MDd /W3 /Gm /Od /D _DEBUG /D ZEND_DEBUG=1 " +
+ (X64?"/Zi":"/ZI"));
+ ADD_FLAG("LDFLAGS", "/debug");
+ // Avoid problems when linking to release libraries that use the release
+ // version of the libc
+ ADD_FLAG("PHP_LDFLAGS", "/nodefaultlib:msvcrt");
+ } else {
+ // Generate external debug files when --enable-debug-pack is specified
+ if (PHP_DEBUG_PACK == "yes") {
+ ADD_FLAG("CFLAGS", "/Zi");
+ ADD_FLAG("LDFLAGS", "/incremental:no /debug /opt:ref,icf");
+ }
+ // Equivalent to Release_TSInline build -> best optimization
+ ADD_FLAG("CFLAGS", "/LD /MD /W3 /Ox /D NDebug /D NDEBUG /D ZEND_WIN32_FORCE_INLINE /GF /D ZEND_DEBUG=0");
+
+ // if you have VS.Net /GS hardens the binary against buffer overruns
+ // ADD_FLAG("CFLAGS", "/GS");
+ }
+}
+
+function object_out_dir_option_handle()
+{
+ if (PHP_OBJECT_OUT_DIR.length) {
+ PHP_OBJECT_OUT_DIR = FSO.GetAbsolutePathName(PHP_OBJECT_OUT_DIR);
+ if (!FSO.FolderExists(PHP_OBJECT_OUT_DIR)) {
+ ERROR('you chosen output directory ' + PHP_OBJECT_OUT_DIR + ' does not exist');
+ }
+ PHP_OBJECT_OUT_DIR += '\\';
+ } else {
+ PHP_OBJECT_OUT_DIR = FSO.GetAbsolutePathName(".") + '\\';
+
+ if (X64) {
+ PHP_OBJECT_OUT_DIR += 'x64\\';
+ if (!FSO.FolderExists(PHP_OBJECT_OUT_DIR)) {
+ FSO.CreateFolder(PHP_OBJECT_OUT_DIR);
+ }
+ }
+ }
+}
+
+function setup_zts_stuff()
+{
+ if (PHP_ZTS == "yes") {
+ ADD_FLAG("CFLAGS", "/D ZTS=1");
+ ADD_FLAG("ZTS", "1");
+ } else {
+ ADD_FLAG("ZTS", "0");
+ }
+
+ DEFINE("PHP_ZTS_ARCHIVE_POSTFIX", PHP_ZTS == "yes" ? '' : "-nts");
+
+ // set up the build dir and DLL name
+ if (PHP_DEBUG == "yes" && PHP_ZTS == "yes") {
+ DEFINE("BUILD_DIR", PHP_OBJECT_OUT_DIR + "Debug_TS");
+ if (!MODE_PHPIZE) {
+ DEFINE("PHPDLL", "php" + PHP_VERSION + "ts_debug.dll");
+ DEFINE("PHPLIB", "php" + PHP_VERSION + "ts_debug.lib");
+ }
+ } else if (PHP_DEBUG == "yes" && PHP_ZTS == "no") {
+ DEFINE("BUILD_DIR", PHP_OBJECT_OUT_DIR + "Debug");
+ if (!MODE_PHPIZE) {
+ DEFINE("PHPDLL", "php" + PHP_VERSION + "_debug.dll");
+ DEFINE("PHPLIB", "php" + PHP_VERSION + "_debug.lib");
+ }
+ } else if (PHP_DEBUG == "no" && PHP_ZTS == "yes") {
+ DEFINE("BUILD_DIR", PHP_OBJECT_OUT_DIR + "Release_TS");
+ if (!MODE_PHPIZE) {
+ DEFINE("PHPDLL", "php" + PHP_VERSION + "ts.dll");
+ DEFINE("PHPLIB", "php" + PHP_VERSION + "ts.lib");
+ }
+ } else if (PHP_DEBUG == "no" && PHP_ZTS == "no") {
+ DEFINE("BUILD_DIR", PHP_OBJECT_OUT_DIR + "Release");
+ if (!MODE_PHPIZE) {
+ DEFINE("PHPDLL", "php" + PHP_VERSION + ".dll");
+ DEFINE("PHPLIB", "php" + PHP_VERSION + ".lib");
+ }
+ }
+
+ if (!FSO.FolderExists(get_define('BUILD_DIR'))) {
+ FSO.CreateFolder(get_define('BUILD_DIR'));
+ }
+}
+
+function php_build_option_handle()
+{
+ if (PHP_PHP_BUILD == 'no') {
+ if (FSO.FolderExists("..\\deps")) {
+ PHP_PHP_BUILD = "..\\deps";
+ } else {
+ if (FSO.FolderExists("..\\php_build")) {
+ PHP_PHP_BUILD = "..\\php_build";
+ } else {
+ if (X64) {
+ if (FSO.FolderExists("..\\win64build")) {
+ PHP_PHP_BUILD = "..\\win64build";
+ } else if (FSO.FolderExists("..\\php-win64-dev\\php_build")) {
+ PHP_PHP_BUILD = "..\\php-win64-dev\\php_build";
+ }
+ } else {
+ if (FSO.FolderExists("..\\win32build")) {
+ PHP_PHP_BUILD = "..\\win32build";
+ } else if (FSO.FolderExists("..\\php-win32-dev\\php_build")) {
+ PHP_PHP_BUILD = "..\\php-win32-dev\\php_build";
+ }
+ }
+ }
+ }
+ PHP_PHP_BUILD = FSO.GetAbsolutePathName(PHP_PHP_BUILD);
+ }
+ DEFINE("PHP_BUILD", PHP_PHP_BUILD);
+}
+
+// Poke around for some headers
+function probe_basic_headers()
+{
+ var p;
+
+ if (PHP_PHP_BUILD != "no") {
+ php_usual_include_suspects += ";" + PHP_PHP_BUILD + "\\include";
+ php_usual_lib_suspects += ";" + PHP_PHP_BUILD + "\\lib";
+ }
+}
+
+function add_extra_dirs()
+{
+ var path, i, f;
+
+ if (PHP_EXTRA_INCLUDES.length) {
+ path = PHP_EXTRA_INCLUDES.split(';');
+ for (i = 0; i < path.length; i++) {
+ f = FSO.GetAbsolutePathName(path[i]);
+ if (FSO.FolderExists(f)) {
+ ADD_FLAG("CFLAGS", '/I "' + f + '" ');
+ }
+ }
+ }
+ if (PHP_EXTRA_LIBS.length) {
+ path = PHP_EXTRA_LIBS.split(';');
+ for (i = 0; i < path.length; i++) {
+ f = FSO.GetAbsolutePathName(path[i]);
+ if (FSO.FolderExists(f)) {
+ if (VS_TOOLSET && VCVERS <= 1200 && f.indexOf(" ") >= 0) {
+ ADD_FLAG("LDFLAGS", '/libpath:"\\"' + f + '\\"" ');
+ ADD_FLAG("ARFLAGS", '/libpath:"\\"' + f + '\\"" ');
+ } else {
+ ADD_FLAG("LDFLAGS", '/libpath:"' + f + '" ');
+ ADD_FLAG("ARFLAGS", '/libpath:"' + f + '" ');
+ }
+ }
+ }
+ }
+
+}
+
+function trim(s)
+{
+ return s.replace(/^\s+/, "").replace(/\s+$/, "");
}
diff --git a/win32/build/libs_version.txt b/win32/build/libs_version.txt
index 0ea0067a62..091c3f3282 100644
--- a/win32/build/libs_version.txt
+++ b/win32/build/libs_version.txt
@@ -1,9 +1,9 @@
bz2-1.0.6
cclient-2007f
freetype-2.5.3
-icu-53.1
+icu-54.1
jpeglib-9a
-libcurl-7.36.0
+libcurl-7.39.0
libiconv-1.14
libmcrypt-2.5.8
libmpir-2.6.0
@@ -13,4 +13,4 @@ libssh2-1.4.3
libtidy-20090406
libxslt-1.1.27
libxml-2.9.1
-openssl-1.0.1h
+openssl-1.0.1i