Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(421)

Unified Diff: pylib/gyp/generator/make.py

Issue 22382003: Fix running actions and rules on make/mac (Closed) Base URL: http://gyp.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/actions-shared-library/gyptest-prog.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pylib/gyp/generator/make.py
===================================================================
--- pylib/gyp/generator/make.py (revision 1690)
+++ pylib/gyp/generator/make.py (working copy)
@@ -867,6 +867,8 @@
# makefile like $(TARGET), so hardcode the target.
command = command.replace('$(TARGET)', self.target)
cd_action = cd_action.replace('$(TARGET)', self.target)
+ target_libraries_path = self._TargetLibrariesPath()
+ ld_library_path = self._LibraryPathVarName()
# Set LD_LIBRARY_PATH in case the action runs an executable from this
# build which links to shared libs from this build.
@@ -874,11 +876,16 @@
# libraries, but until everything is made cross-compile safe, also use
# target libraries.
# TODO(piman): when everything is cross-compile safe, remove lib.target
- self.WriteLn('cmd_%s = LD_LIBRARY_PATH=$(builddir)/lib.host:'
- '$(builddir)/lib.target:$$LD_LIBRARY_PATH; '
- 'export LD_LIBRARY_PATH; '
- '%s%s'
- % (name, cd_action, command))
+ self.WriteLn(
+ 'cmd_%(name)s = %(ld_library_path)s=$(builddir)/lib.host:'
+ '%(target_libraries_path)s:$$%(ld_library_path)s; '
+ 'export %(ld_library_path)s; '
+ '%(cd_action)s%(command)s' % {
+ 'name': name,
+ 'cd_action': cd_action,
+ 'command': command,
+ 'target_libraries_path': target_libraries_path,
+ 'ld_library_path': ld_library_path})
self.WriteLn()
outputs = map(self.Absolutify, outputs)
# The makefile rules are all relative to the top dir, but the gyp actions
@@ -1007,6 +1014,8 @@
action = action.replace('$(TARGET)', self.target)
cd_action = cd_action.replace('$(TARGET)', self.target)
mkdirs = mkdirs.replace('$(TARGET)', self.target)
+ target_libraries_path = self._TargetLibrariesPath()
+ ld_library_path = self._LibraryPathVarName()
# Set LD_LIBRARY_PATH in case the rule runs an executable from this
# build which links to shared libs from this build.
@@ -1015,15 +1024,18 @@
# target libraries.
# TODO(piman): when everything is cross-compile safe, remove lib.target
self.WriteLn(
- "cmd_%(name)s_%(count)d = LD_LIBRARY_PATH="
- "$(builddir)/lib.host:$(builddir)/lib.target:$$LD_LIBRARY_PATH; "
- "export LD_LIBRARY_PATH; "
+ "cmd_%(name)s_%(count)d = %(ld_library_path)s="
+ "$(builddir)/lib.host:%(target_libraries_path)s:"
+ "$$%(ld_library_path)s; "
+ "export %(ld_library_path)s; "
"%(cd_action)s%(mkdirs)s%(action)s" % {
'action': action,
'cd_action': cd_action,
'count': count,
'mkdirs': mkdirs,
'name': name,
+ 'target_libraries_path': target_libraries_path,
+ 'ld_library_path': ld_library_path,
})
self.WriteLn(
'quiet_cmd_%(name)s_%(count)d = RULE %(name)s_%(count)d $@' % {
@@ -1883,6 +1895,21 @@
return '$(builddir)/' + self.alias
+ def _TargetLibrariesPath(self):
+ """Returns the path to shared libraries in the "target" toolset."""
+ if self.flavor == 'mac':
+ return '$(builddir)'
+ else:
+ return '$(builddir)/lib.target'
+
+ def _LibraryPathVarName(self):
+ """Returns the name of the environment variables for shared libraries."""
+ if self.flavor == 'mac':
+ return 'DYLD_LIBRARY_PATH'
+ else:
+ return 'LD_LIBRARY_PATH'
+
+
def WriteAutoRegenerationRule(params, root_makefile, makefile_name,
build_files):
"""Write the target to regenerate the Makefile."""
« no previous file with comments | « no previous file | test/actions-shared-library/gyptest-prog.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698