You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

236 lines
9.0 KiB

  1. --- a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py
  2. +++ b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py
  3. @@ -154,6 +154,32 @@ cmd_alink_thin = rm -f $@ && $(AR.$(TOOL
  4. quiet_cmd_link = LINK($(TOOLSET)) $@
  5. cmd_link = $(LINK.$(TOOLSET)) -o $@ $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,--start-group $(LD_INPUTS) $(LIBS) -Wl,--end-group
  6. +define xargs
  7. + $(1) $(wordlist 1,100,$(2))
  8. + $(if $(word 101,$(2)),$(call xargs,$(1),$(wordlist 101,$(words $(2)),$(2))))
  9. +endef
  10. +
  11. +define write-to-file
  12. + @echo >$(1)
  13. + $(call xargs,printf "%s\\n" >>$(1),$(2))
  14. +endef
  15. +
  16. +OBJ_FILE_LIST_SFX := ar-file-list
  17. +
  18. +define create_archive
  19. + $(eval OBJ_FILE_LIST := $(basename $(notdir $(1))).$(OBJ_FILE_LIST_SFX))
  20. + rm -f $(1) $(1).$(OBJ_FILE_LIST); mkdir -p `dirname $(1)`
  21. + $(call write-to-file,$(1).$(OBJ_FILE_LIST),$(filter %.o,$(2)))
  22. + $(AR.$(TOOLSET)) crs $(1) @$(1).$(OBJ_FILE_LIST)
  23. +endef
  24. +
  25. +define create_thin_archive
  26. + $(eval OBJ_FILE_LIST := $(basename $(notdir $(1))).$(OBJ_FILE_LIST_SFX))
  27. + rm -f $(1) $(OBJ_FILE_LIST); mkdir -p `dirname $(1)`
  28. + $(call write-to-file,$(1).$(OBJ_FILE_LIST),$(filter %.o,$(2)))
  29. + $(AR.$(TOOLSET)) crsT $(1) @$(1).$(OBJ_FILE_LIST)
  30. +endef
  31. +
  32. # We support two kinds of shared objects (.so):
  33. # 1) shared_library, which is just bundling together many dependent libraries
  34. # into a link line.
  35. @@ -198,6 +224,32 @@ cmd_alink = rm -f $@ && $(AR.$(TOOLSET))
  36. quiet_cmd_alink_thin = AR($(TOOLSET)) $@
  37. cmd_alink_thin = rm -f $@ && $(AR.$(TOOLSET)) crsT $@ $(filter %.o,$^)
  38. +define xargs
  39. + $(1) $(wordlist 1,100,$(2))
  40. + $(if $(word 101,$(2)),$(call xargs,$(1),$(wordlist 101,$(words $(2)),$(2))))
  41. +endef
  42. +
  43. +define write-to-file
  44. + @echo >$(1)
  45. + $(call xargs,printf "%s\\n" >>$(1),$(2))
  46. +endef
  47. +
  48. +OBJ_FILE_LIST_SFX := ar-file-list
  49. +
  50. +define create_archive
  51. + $(eval OBJ_FILE_LIST := $(basename $(notdir $(1))).$(OBJ_FILE_LIST_SFX))
  52. + rm -f $(1) $(1).$(OBJ_FILE_LIST); mkdir -p `dirname $(1)`
  53. + $(call write-to-file,$(1).$(OBJ_FILE_LIST),$(filter %.o,$(2)))
  54. + $(AR.$(TOOLSET)) crs $(1) @$(1).$(OBJ_FILE_LIST)
  55. +endef
  56. +
  57. +define create_thin_archive
  58. + $(eval OBJ_FILE_LIST := $(basename $(notdir $(1))).$(OBJ_FILE_LIST_SFX))
  59. + rm -f $(1) $(OBJ_FILE_LIST); mkdir -p `dirname $(1)`
  60. + $(call write-to-file,$(1).$(OBJ_FILE_LIST),$(filter %.o,$(2)))
  61. + $(AR.$(TOOLSET)) crsT $(1) @$(1).$(OBJ_FILE_LIST)
  62. +endef
  63. +
  64. # Due to circular dependencies between libraries :(, we wrap the
  65. # special "figure out circular dependencies" flags around the entire
  66. # input list during linking.
  67. @@ -1768,21 +1820,35 @@ $(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj)
  68. self.flavor not in ("mac", "openbsd", "netbsd", "win")
  69. and not self.is_standalone_static_library
  70. ):
  71. - self.WriteDoCmd(
  72. - [self.output_binary],
  73. - link_deps,
  74. - "alink_thin",
  75. - part_of_all,
  76. - postbuilds=postbuilds,
  77. - )
  78. + if self.flavor in ('linux', 'android'):
  79. + self.WriteMakeRule(
  80. + [self.output_binary],
  81. + link_deps,
  82. + actions = ['$(call create_thin_archive,$@,$^)']
  83. + )
  84. + else:
  85. + self.WriteDoCmd(
  86. + [self.output_binary],
  87. + link_deps,
  88. + "alink_thin",
  89. + part_of_all,
  90. + postbuilds=postbuilds,
  91. + )
  92. else:
  93. - self.WriteDoCmd(
  94. - [self.output_binary],
  95. - link_deps,
  96. - "alink",
  97. - part_of_all,
  98. - postbuilds=postbuilds,
  99. - )
  100. + if self.flavor in ('linux', 'android'):
  101. + self.WriteMakeRule(
  102. + [self.output_binary],
  103. + link_deps,
  104. + actions = ['$(call create_archive,$@,$^)']
  105. + )
  106. + else:
  107. + self.WriteDoCmd(
  108. + [self.output_binary],
  109. + link_deps,
  110. + "alink",
  111. + part_of_all,
  112. + postbuilds=postbuilds,
  113. + )
  114. elif self.type == "shared_library":
  115. self.WriteLn(
  116. "%s: LD_INPUTS := %s"
  117. --- a/tools/gyp/pylib/gyp/generator/make.py
  118. +++ b/tools/gyp/pylib/gyp/generator/make.py
  119. @@ -156,6 +156,32 @@ cmd_alink_thin = rm -f $@ && $(AR.$(TOOL
  120. quiet_cmd_link = LINK($(TOOLSET)) $@
  121. cmd_link = $(LINK.$(TOOLSET)) -o $@ $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,--start-group $(LD_INPUTS) $(LIBS) -Wl,--end-group
  122. +define xargs
  123. + $(1) $(wordlist 1,100,$(2))
  124. + $(if $(word 101,$(2)),$(call xargs,$(1),$(wordlist 101,$(words $(2)),$(2))))
  125. +endef
  126. +
  127. +define write-to-file
  128. + @echo >$(1)
  129. + $(call xargs,printf "%s\\n" >>$(1),$(2))
  130. +endef
  131. +
  132. +OBJ_FILE_LIST_SFX := ar-file-list
  133. +
  134. +define create_archive
  135. + $(eval OBJ_FILE_LIST := $(basename $(notdir $(1))).$(OBJ_FILE_LIST_SFX))
  136. + rm -f $(1) $(1).$(OBJ_FILE_LIST); mkdir -p `dirname $(1)`
  137. + $(call write-to-file,$(1).$(OBJ_FILE_LIST),$(filter %.o,$(2)))
  138. + $(AR.$(TOOLSET)) crs $(1) @$(1).$(OBJ_FILE_LIST)
  139. +endef
  140. +
  141. +define create_thin_archive
  142. + $(eval OBJ_FILE_LIST := $(basename $(notdir $(1))).$(OBJ_FILE_LIST_SFX))
  143. + rm -f $(1) $(OBJ_FILE_LIST); mkdir -p `dirname $(1)`
  144. + $(call write-to-file,$(1).$(OBJ_FILE_LIST),$(filter %.o,$(2)))
  145. + $(AR.$(TOOLSET)) crsT $(1) @$(1).$(OBJ_FILE_LIST)
  146. +endef
  147. +
  148. # We support two kinds of shared objects (.so):
  149. # 1) shared_library, which is just bundling together many dependent libraries
  150. # into a link line.
  151. @@ -200,6 +226,32 @@ cmd_alink = rm -f $@ && $(AR.$(TOOLSET))
  152. quiet_cmd_alink_thin = AR($(TOOLSET)) $@
  153. cmd_alink_thin = rm -f $@ && $(AR.$(TOOLSET)) crsT $@ $(filter %.o,$^)
  154. +define xargs
  155. + $(1) $(wordlist 1,100,$(2))
  156. + $(if $(word 101,$(2)),$(call xargs,$(1),$(wordlist 101,$(words $(2)),$(2))))
  157. +endef
  158. +
  159. +define write-to-file
  160. + @echo >$(1)
  161. + $(call xargs,printf "%s\\n" >>$(1),$(2))
  162. +endef
  163. +
  164. +OBJ_FILE_LIST_SFX := ar-file-list
  165. +
  166. +define create_archive
  167. + $(eval OBJ_FILE_LIST := $(basename $(notdir $(1))).$(OBJ_FILE_LIST_SFX))
  168. + rm -f $(1) $(1).$(OBJ_FILE_LIST); mkdir -p `dirname $(1)`
  169. + $(call write-to-file,$(1).$(OBJ_FILE_LIST),$(filter %.o,$(2)))
  170. + $(AR.$(TOOLSET)) crs $(1) @$(1).$(OBJ_FILE_LIST)
  171. +endef
  172. +
  173. +define create_thin_archive
  174. + $(eval OBJ_FILE_LIST := $(basename $(notdir $(1))).$(OBJ_FILE_LIST_SFX))
  175. + rm -f $(1) $(OBJ_FILE_LIST); mkdir -p `dirname $(1)`
  176. + $(call write-to-file,$(1).$(OBJ_FILE_LIST),$(filter %.o,$(2)))
  177. + $(AR.$(TOOLSET)) crsT $(1) @$(1).$(OBJ_FILE_LIST)
  178. +endef
  179. +
  180. # Due to circular dependencies between libraries :(, we wrap the
  181. # special "figure out circular dependencies" flags around the entire
  182. # input list during linking.
  183. @@ -1809,21 +1861,35 @@ $(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj)
  184. self.flavor not in ("mac", "openbsd", "netbsd", "win")
  185. and not self.is_standalone_static_library
  186. ):
  187. - self.WriteDoCmd(
  188. - [self.output_binary],
  189. - link_deps,
  190. - "alink_thin",
  191. - part_of_all,
  192. - postbuilds=postbuilds,
  193. - )
  194. + if self.flavor in ('linux', 'android'):
  195. + self.WriteMakeRule(
  196. + [self.output_binary],
  197. + link_deps,
  198. + actions = ['$(call create_thin_archive,$@,$^)']
  199. + )
  200. + else:
  201. + self.WriteDoCmd(
  202. + [self.output_binary],
  203. + link_deps,
  204. + 'alink_thin',
  205. + part_of_all,
  206. + postbuilds=postbuilds
  207. + )
  208. else:
  209. - self.WriteDoCmd(
  210. - [self.output_binary],
  211. - link_deps,
  212. - "alink",
  213. - part_of_all,
  214. - postbuilds=postbuilds,
  215. - )
  216. + if self.flavor in ('linux', 'android'):
  217. + self.WriteMakeRule(
  218. + [self.output_binary],
  219. + link_deps,
  220. + actions = ['$(call create_archive,$@,$^)']
  221. + )
  222. + else:
  223. + self.WriteDoCmd(
  224. + [self.output_binary],
  225. + link_deps,
  226. + 'alink',
  227. + part_of_all,
  228. + postbuilds=postbuilds
  229. + )
  230. elif self.type == "shared_library":
  231. self.WriteLn(
  232. "%s: LD_INPUTS := %s"