From: Anatol Belski Date: Wed, 12 Nov 2014 16:05:01 +0000 (+0100) Subject: generate response files for use by linker X-Git-Tag: PRE_NATIVE_TLS_MERGE~130^2~20^2~6 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1acbcdeb27abefa1a6966a8d791fa2707931b79f;p=php generate response files for use by linker Object dir path can under circumstances cause that the expanded command line exceeds the length allowed by the OS. Linker can read the object lists from a file which eliminates this issue. --- diff --git a/win32/build/Makefile b/win32/build/Makefile index d6a22c162c..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) diff --git a/win32/build/confutils.js b/win32/build/confutils.js index 94068bfa9d..201c368a3a 100644 --- a/win32/build/confutils.js +++ b/win32/build/confutils.js @@ -1336,6 +1336,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 +1395,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 = ""; } @@ -1448,6 +1460,7 @@ function ADD_SOURCES(dir, file_list, target, obj_dir) 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) { @@ -1474,6 +1487,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)