|
|
|
@ -141,6 +141,17 @@ class Generator(): |
|
|
|
|
args.append(fname) |
|
|
|
|
return args |
|
|
|
|
|
|
|
|
|
def generate_configure_files(self): |
|
|
|
|
for cf in self.build.get_configure_files(): |
|
|
|
|
infile = os.path.join(self.environment.get_source_dir(), |
|
|
|
|
cf.get_subdir(), |
|
|
|
|
cf.get_source_name()) |
|
|
|
|
outdir = os.path.join(self.environment.get_build_dir(), |
|
|
|
|
cf.get_subdir()) |
|
|
|
|
os.makedirs(outdir, exist_ok=True) |
|
|
|
|
outfile = os.path.join(outdir, cf.get_target_name()) |
|
|
|
|
do_conf_file(infile, outfile, self.interpreter.get_variables()) |
|
|
|
|
|
|
|
|
|
class NinjaGenerator(Generator): |
|
|
|
|
|
|
|
|
|
def __init__(self, build, interp): |
|
|
|
@ -150,6 +161,7 @@ class NinjaGenerator(Generator): |
|
|
|
|
def generate(self): |
|
|
|
|
outfilename = os.path.join(self.environment.get_build_dir(), self.ninja_filename) |
|
|
|
|
outfile = open(outfilename, 'w') |
|
|
|
|
self.generate_configure_files() |
|
|
|
|
outfile.write('# This is the build file for project "%s"\n' % self.build.get_project()) |
|
|
|
|
outfile.write('# It is autogenerated. Do not edit by hand.\n\n') |
|
|
|
|
self.generate_rules(outfile) |
|
|
|
@ -324,7 +336,7 @@ class NinjaGenerator(Generator): |
|
|
|
|
build = 'build %s: %s %s %s\n' % \ |
|
|
|
|
(ninja_quote(abs_obj), compiler_name, ninja_quote(abs_src), |
|
|
|
|
pch_dep) |
|
|
|
|
flags = ' FLAGS = %s\n\n' % ' '.join([ninja_quote(t) for t in commands]) |
|
|
|
|
flags = ' FLAGS = %s\n\n' % ' '.join(["'" + ninja_quote(t) + "'" for t in commands]) |
|
|
|
|
outfile.write(build) |
|
|
|
|
outfile.write(flags) |
|
|
|
|
return abs_obj |
|
|
|
@ -460,17 +472,6 @@ echo Run compile.sh before this or bad things will happen. |
|
|
|
|
cpcommand = ' '.join(shell_quote(cpcommand)) + ' || exit\n' |
|
|
|
|
outfile.write(cpcommand) |
|
|
|
|
|
|
|
|
|
def generate_configure_files(self): |
|
|
|
|
for cf in self.build.get_configure_files(): |
|
|
|
|
infile = os.path.join(self.environment.get_source_dir(), |
|
|
|
|
cf.get_subdir(), |
|
|
|
|
cf.get_source_name()) |
|
|
|
|
outdir = os.path.join(self.environment.get_build_dir(), |
|
|
|
|
cf.get_subdir()) |
|
|
|
|
os.makedirs(outdir, exist_ok=True) |
|
|
|
|
outfile = os.path.join(outdir, cf.get_target_name()) |
|
|
|
|
do_conf_file(infile, outfile, self.interpreter.get_variables()) |
|
|
|
|
|
|
|
|
|
def generate_data_install(self, outfile): |
|
|
|
|
prefix = self.environment.get_prefix() |
|
|
|
|
dataroot = os.path.join(prefix, self.environment.get_datadir()) |
|
|
|
|