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

Side by Side Diff: pylib/gyp/generator/ninja.py

Issue 17359002: Linux: make ninja respect environment: (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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | test/cflags/gyptest-cflags.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2013 Google Inc. All rights reserved. 1 # Copyright (c) 2013 Google Inc. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import copy 5 import copy
6 import hashlib 6 import hashlib
7 import multiprocessing 7 import multiprocessing
8 import os.path 8 import os.path
9 import re 9 import re
10 import signal 10 import signal
(...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 if not pdbpath: 748 if not pdbpath:
749 obj = 'obj' 749 obj = 'obj'
750 if self.toolset != 'target': 750 if self.toolset != 'target':
751 obj += '.' + self.toolset 751 obj += '.' + self.toolset
752 pdbpath = os.path.normpath(os.path.join(obj, self.base_dir, 752 pdbpath = os.path.normpath(os.path.join(obj, self.base_dir,
753 self.name + '.pdb')) 753 self.name + '.pdb'))
754 self.WriteVariableList(ninja_file, 'pdbname', [pdbpath]) 754 self.WriteVariableList(ninja_file, 'pdbname', [pdbpath])
755 self.WriteVariableList(ninja_file, 'pchprefix', [self.name]) 755 self.WriteVariableList(ninja_file, 'pchprefix', [self.name])
756 else: 756 else:
757 cflags = config.get('cflags', []) 757 cflags = config.get('cflags', [])
758 cflags_c = config.get('cflags_c', []) 758
759 cflags_cc = config.get('cflags_cc', []) 759 # Respect environment variables related to build, but target-specific
760 # flags can still override them.
761 cflags_c = (os.environ.get('CPPFLAGS', '').split() +
762 os.environ.get('CFLAGS', '').split() +
763 config.get('cflags_c', []))
764 cflags_cc = (os.environ.get('CPPFLAGS', '').split() +
765 os.environ.get('CXXFLAGS', '').split() +
766 config.get('cflags_cc', []))
760 767
761 defines = config.get('defines', []) + extra_defines 768 defines = config.get('defines', []) + extra_defines
762 self.WriteVariableList(ninja_file, 'defines', 769 self.WriteVariableList(ninja_file, 'defines',
763 [Define(d, self.flavor) for d in defines]) 770 [Define(d, self.flavor) for d in defines])
764 if self.flavor == 'win': 771 if self.flavor == 'win':
765 self.WriteVariableList(ninja_file, 'rcflags', 772 self.WriteVariableList(ninja_file, 'rcflags',
766 [QuoteShellArgument(self.ExpandSpecial(f), self.flavor) 773 [QuoteShellArgument(self.ExpandSpecial(f), self.flavor)
767 for f in self.msvs_settings.GetRcflags(config_name, 774 for f in self.msvs_settings.GetRcflags(config_name,
768 self.GypPathToNinja)]) 775 self.GypPathToNinja)])
769 776
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
925 ldflags, manifest_files = self.msvs_settings.GetLdflags(config_name, 932 ldflags, manifest_files = self.msvs_settings.GetLdflags(config_name,
926 self.GypPathToNinja, self.ExpandSpecial, manifest_name, is_executable) 933 self.GypPathToNinja, self.ExpandSpecial, manifest_name, is_executable)
927 self.WriteVariableList(ninja_file, 'manifests', manifest_files) 934 self.WriteVariableList(ninja_file, 'manifests', manifest_files)
928 command_suffix = _GetWinLinkRuleNameSuffix( 935 command_suffix = _GetWinLinkRuleNameSuffix(
929 self.msvs_settings.IsEmbedManifest(config_name), 936 self.msvs_settings.IsEmbedManifest(config_name),
930 self.msvs_settings.IsLinkIncremental(config_name)) 937 self.msvs_settings.IsLinkIncremental(config_name))
931 def_file = self.msvs_settings.GetDefFile(self.GypPathToNinja) 938 def_file = self.msvs_settings.GetDefFile(self.GypPathToNinja)
932 if def_file: 939 if def_file:
933 implicit_deps.add(def_file) 940 implicit_deps.add(def_file)
934 else: 941 else:
935 ldflags = config.get('ldflags', []) 942 # Respect environment variables related to build, but target-specific
943 # flags can still override them.
944 ldflags = (os.environ.get('LDFLAGS', '').split() +
945 config.get('ldflags', []))
936 if is_executable and len(solibs): 946 if is_executable and len(solibs):
937 rpath = 'lib/' 947 rpath = 'lib/'
938 if self.toolset != 'target': 948 if self.toolset != 'target':
939 rpath += self.toolset 949 rpath += self.toolset
940 ldflags.append('-Wl,-rpath=\$$ORIGIN/%s' % rpath) 950 ldflags.append('-Wl,-rpath=\$$ORIGIN/%s' % rpath)
941 ldflags.append('-Wl,-rpath-link=%s' % rpath) 951 ldflags.append('-Wl,-rpath-link=%s' % rpath)
942 self.WriteVariableList(ninja_file, 'ldflags', 952 self.WriteVariableList(ninja_file, 'ldflags',
943 gyp.common.uniquer(map(self.ExpandSpecial, ldflags))) 953 gyp.common.uniquer(map(self.ExpandSpecial, ldflags)))
944 954
945 library_dirs = config.get('library_dirs', []) 955 library_dirs = config.get('library_dirs', [])
(...skipping 988 matching lines...) Expand 10 before | Expand all | Expand 10 after
1934 arglists.append( 1944 arglists.append(
1935 (target_list, target_dicts, data, params, config_name)) 1945 (target_list, target_dicts, data, params, config_name))
1936 pool.map(CallGenerateOutputForConfig, arglists) 1946 pool.map(CallGenerateOutputForConfig, arglists)
1937 except KeyboardInterrupt, e: 1947 except KeyboardInterrupt, e:
1938 pool.terminate() 1948 pool.terminate()
1939 raise e 1949 raise e
1940 else: 1950 else:
1941 for config_name in config_names: 1951 for config_name in config_names:
1942 GenerateOutputForConfig(target_list, target_dicts, data, params, 1952 GenerateOutputForConfig(target_list, target_dicts, data, params,
1943 config_name) 1953 config_name)
OLDNEW
« no previous file with comments | « no previous file | test/cflags/gyptest-cflags.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698