]> granicus.if.org Git - php/commitdiff
moved libs and debug/release mode setup into functions
authorAnatol Belski <ab@php.net>
Mon, 10 Nov 2014 22:28:03 +0000 (23:28 +0100)
committerAnatol Belski <ab@php.net>
Mon, 10 Nov 2014 22:30:16 +0000 (23:30 +0100)
win32/build/config.w32
win32/build/config.w32.phpize.in
win32/build/confutils.js

index e89b805973f8a05d7901ea5cda8a820d3d0d6066..43ff038062edf699bce043238971e13a9ae804f5 100644 (file)
@@ -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");
index da6f6ebae88ee632b1881ae07667f69e1cb8ac4b..e2860e3a963269de4f5b6c89a4efcf5962404f8d 100644 (file)
@@ -83,29 +83,10 @@ ARG_WITH("snapshot-template", "Path to snapshot builder template dir", "no");
 toolset_setup_common_ldlags();\r
 \r
 // General libs\r
-// urlmon.lib ole32.lib oleaut32.lib uuid.lib gdi32.lib winspool.lib comdlg32.lib\r
-DEFINE("LIBS", "kernel32.lib ole32.lib user32.lib advapi32.lib shell32.lib ws2_32.lib Dnsapi.lib");\r
+toolset_setup_common_libs();\r
 \r
 // Set some debug/release specific options\r
-if (PHP_DEBUG == "yes") {\r
-       ADD_FLAG("CFLAGS", "/LDd /MDd /W3 /Gm /Od /D _DEBUG /D ZEND_DEBUG=1 " +\r
-               (X64?"/Zi":"/ZI"));\r
-       ADD_FLAG("LDFLAGS", "/debug");\r
-       // Avoid problems when linking to release libraries that use the release\r
-       // version of the libc\r
-       ADD_FLAG("PHP_LDFLAGS", "/nodefaultlib:msvcrt");\r
-} else {\r
-       // Generate external debug files when --enable-debug-pack is specified\r
-       if (PHP_DEBUG_PACK == "yes") {\r
-               ADD_FLAG("CFLAGS", "/Zi");\r
-               ADD_FLAG("LDFLAGS", "/incremental:no /debug /opt:ref,icf");\r
-       }\r
-       // Equivalent to Release_TSInline build -> best optimization\r
-       ADD_FLAG("CFLAGS", "/LD /MD /W3 /Ox /D NDebug /D NDEBUG /D ZEND_WIN32_FORCE_INLINE /GF /D ZEND_DEBUG=0");\r
-\r
-       // if you have VS.Net /GS hardens the binary against buffer overruns\r
-       // ADD_FLAG("CFLAGS", "/GS");\r
-}\r
+toolset_setup_build_mode();\r
 \r
 if (PHP_ZTS == "yes") {\r
        ADD_FLAG("CFLAGS", "/D ZTS=1");\r
@@ -113,10 +94,6 @@ if (PHP_ZTS == "yes") {
 \r
 DEFINE("PHP_ZTS_ARCHIVE_POSTFIX", PHP_ZTS == "yes" ? '' : "-nts");\r
 \r
-\r
-// we want msvcrt in the PHP DLL\r
-ADD_FLAG("PHP_LDFLAGS", "/nodefaultlib:libcmt");\r
-\r
 // set up the build dir and DLL name\r
 if (PHP_DEBUG == "yes" && PHP_ZTS == "yes") {\r
        DEFINE("BUILD_DIR", PHP_OBJECT_OUT_DIR + "Debug_TS");\r
index 0f07e18120b2644d45bfd01e65994bc80d2c2119..bad5f1322ea75e6b72015d01653ef9ae7f45d532 100644 (file)
@@ -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");
+       }
 }