From: Anatol Belski Date: Mon, 10 Nov 2014 22:28:03 +0000 (+0100) Subject: moved libs and debug/release mode setup into functions X-Git-Tag: PRE_NATIVE_TLS_MERGE~130^2~26 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=64c081f347b177d11b1083a6f13efa744884ff98;p=php moved libs and debug/release mode setup into functions --- diff --git a/win32/build/config.w32 b/win32/build/config.w32 index e89b805973..43ff038062 100644 --- a/win32/build/config.w32 +++ b/win32/build/config.w32 @@ -93,29 +93,10 @@ 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"); - - // if you have VS.Net /GS hardens the binary against buffer overruns - // ADD_FLAG("CFLAGS", "/GS"); -} +toolset_setup_build_mode(); if (PHP_ZTS == "yes") { ADD_FLAG("CFLAGS", "/D ZTS=1"); @@ -126,10 +107,6 @@ if (PHP_ZTS == "yes") { 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"); diff --git a/win32/build/config.w32.phpize.in b/win32/build/config.w32.phpize.in index da6f6ebae8..e2860e3a96 100644 --- a/win32/build/config.w32.phpize.in +++ b/win32/build/config.w32.phpize.in @@ -83,29 +83,10 @@ 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"); -} +toolset_setup_build_mode(); if (PHP_ZTS == "yes") { ADD_FLAG("CFLAGS", "/D ZTS=1"); @@ -113,10 +94,6 @@ if (PHP_ZTS == "yes") { 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"); diff --git a/win32/build/confutils.js b/win32/build/confutils.js index 0f07e18120..bad5f1322e 100644 --- a/win32/build/confutils.js +++ b/win32/build/confutils.js @@ -2583,5 +2583,37 @@ 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"); + } }