~ubuntu-branches/ubuntu/lucid/gyp/lucid-proposed

« back to all changes in this revision

Viewing changes to pylib/gyp/SCons.py

  • Committer: Bazaar Package Importer
  • Author(s): Fabien Tassin
  • Date: 2010-02-17 22:00:38 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20100217220038-hmfvpu3zapmihgeo
Tags: 0.1~svn785-0ubuntu1

New upstream snapshot, needed to support --no-circular-check

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
    """
37
37
    Returns the full name of the product being built:
38
38
 
39
 
      * Uses 'product_name' if it's set, else 'target_name'.
40
 
      * Appends SCons prefix and suffix variables for the target type.
 
39
      * Uses 'product_name' if it's set, else prefix + 'target_name'.
41
40
      * Prepends 'product_dir' if set.
 
41
      * Appends SCons suffix variables for the target type (or
 
42
        product_extension).
42
43
    """
43
 
    name = self.spec.get('product_name') or self.spec['target_name']
44
 
    name = self.target_prefix + name + self.target_suffix
 
44
    suffix = self.target_suffix
 
45
    product_extension = self.spec.get('product_extension')
 
46
    if product_extension:
 
47
      suffix = '.' + product_extension
 
48
    prefix = self.spec.get('product_prefix', self.target_prefix)
 
49
    name = self.spec['target_name']
 
50
    name = prefix + self.spec.get('product_name', name) + suffix
45
51
    product_dir = self.spec.get('product_dir')
46
52
    if product_dir:
47
53
      name = os.path.join(product_dir, name)
 
54
    else:
 
55
      name = os.path.join(self.out_dir, name)
48
56
    return name
49
57
 
50
58
  def write_input_files(self, fp):
64
72
    Returns the actual SCons builder call to build this target.
65
73
    """
66
74
    name = self.full_product_name()
67
 
    return 'env.%s(%r, input_files)' % (self.builder_name, name)
 
75
    return 'env.%s(env.File(%r), input_files)' % (self.builder_name, name)
68
76
  def write_target(self, fp, src_dir='', pre=''):
69
77
    """
70
78
    Writes the lines necessary to build this target.
142
150
  intermediate_builder_name = 'StaticObject'
143
151
  target_prefix = '${PROGPREFIX}'
144
152
  target_suffix = '${PROGSUFFIX}'
145
 
 
146
 
  # TODO:  remove these subclass methods by moving the env.File()
147
 
  # into the base class.
148
 
  def write_target(self, fp, src_dir='', pre=''):
149
 
    fp.write('\n_program = env.File(%r)' % self.full_product_name())
150
 
    super(ProgramTarget, self).write_target(fp, src_dir, pre)
151
 
  def builder_call(self):
152
 
    return 'env.GypProgram(_program, input_files)'
 
153
  out_dir = '${TOP_BUILDDIR}'
153
154
 
154
155
 
155
156
class StaticLibraryTarget(CompilableSourcesTargetBase):
158
159
  """
159
160
  builder_name = 'GypStaticLibrary'
160
161
  intermediate_builder_name = 'StaticObject'
161
 
  # TODO:  enable these
162
 
  #target_prefix = '${LIBPREFIX}'
163
 
  #target_suffix = '${LIBSUFFIX}'
 
162
  target_prefix = '${LIBPREFIX}'
 
163
  target_suffix = '${LIBSUFFIX}'
 
164
  out_dir = '${LIB_DIR}'
164
165
 
165
166
 
166
167
class SharedLibraryTarget(CompilableSourcesTargetBase):
169
170
  """
170
171
  builder_name = 'GypSharedLibrary'
171
172
  intermediate_builder_name = 'SharedObject'
172
 
  # TODO:  enable these
173
 
  #target_prefix = '${SHLIBPREFIX}'
174
 
  #target_suffix = '${SHLIBSUFFIX}'
 
173
  target_prefix = '${SHLIBPREFIX}'
 
174
  target_suffix = '${SHLIBSUFFIX}'
 
175
  out_dir = '${LIB_DIR}'
175
176
 
176
177
 
177
178
class LoadableModuleTarget(CompilableSourcesTargetBase):
180
181
  """
181
182
  builder_name = 'GypLoadableModule'
182
183
  intermediate_builder_name = 'SharedObject'
183
 
  # TODO:  enable these
184
 
  #target_prefix = '${SHLIBPREFIX}'
185
 
  #target_suffix = '${SHLIBSUFFIX}'
 
184
  target_prefix = '${SHLIBPREFIX}'
 
185
  target_suffix = '${SHLIBSUFFIX}'
 
186
  out_dir = '${TOP_BUILDDIR}'
186
187
 
187
188
 
188
189
TargetMap = {