Strip on install and generate pch properly.

pull/15/head
Jussi Pakkanen 12 years ago
parent 75dbc2abdb
commit 26ff3fa23e
  1. 10
      builder_install.py
  2. 8
      generators.py

@ -74,10 +74,20 @@ def install_targets(d):
fname = os.path.split(fullfilename)[1]
aliases = t[2]
outname = os.path.join(outdir, fname)
should_strip = t[3]
print('Installing %s to %s' % (fname, outdir))
os.makedirs(outdir, exist_ok=True)
shutil.copyfile(fullfilename, outname)
shutil.copystat(fullfilename, outname)
if should_strip:
print('Stripping target')
ps = subprocess.Popen(['strip', outname], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(stdo, stde) = ps.communicate()
if ps.returncode != 0:
print('Could not strip file.\n')
print('Stdout:\n%s\n' % stdo.decode())
print('Stderr:\n%s\n' % stde.decode())
sys.exit(1)
for alias in aliases:
os.symlink(fname, os.path.join(outdir, alias))
p = subprocess.Popen([d.depfixer, outname, d.dep_prefix], stdout=subprocess.PIPE,

@ -198,13 +198,14 @@ class NinjaGenerator(Generator):
libdir = os.path.join(prefix, self.environment.get_libdir())
bindir = os.path.join(prefix, self.environment.get_bindir())
should_strip = self.environment.options.strip
for t in self.build.get_targets().values():
if t.should_install():
if isinstance(t, interpreter.Executable):
outdir = bindir
else:
outdir = libdir
i = [os.path.join(self.environment.get_build_dir(), self.get_target_filename(t)), outdir, t.get_aliaslist()]
i = [os.path.join(self.environment.get_build_dir(), self.get_target_filename(t)), outdir, t.get_aliaslist(), should_strip]
d.targets.append(i)
def generate_header_install(self, d):
@ -360,12 +361,15 @@ class NinjaGenerator(Generator):
src = os.path.join(self.build_to_src, target.get_source_subdir(), pch)
dst = os.path.join(self.get_target_private_dir(target),
os.path.split(pch)[-1] + '.' + compiler.get_pch_suffix())
dep = dst + '.' + compiler.get_depfile_suffix()
build = 'build %s: %s %s\n' % (ninja_quote(dst),
ninja_quote(compiler.get_language() + '_COMPILER'),
ninja_quote(src))
flags = ' FLAGS = %s\n\n' % ' '.join([ninja_quote(t) for t in commands])
flags = ' FLAGS = %s\n' % ' '.join([ninja_quote(t) for t in commands])
depfile = ' DEPFILE = %s\n\n' % ninja_quote(dep)
outfile.write(build)
outfile.write(flags)
outfile.write(depfile)
def generate_link(self, target, outfile, outname, obj_list):
if isinstance(target, interpreter.StaticLibrary):

Loading…
Cancel
Save