diff options
-rwxr-xr-x | builder_install.py | 23 | ||||
-rwxr-xr-x | builder_test.py | 2 | ||||
-rwxr-xr-x | generators.py | 24 |
3 files changed, 44 insertions, 5 deletions
diff --git a/builder_install.py b/builder_install.py new file mode 100755 index 0000000..79e046d --- /dev/null +++ b/builder_install.py @@ -0,0 +1,23 @@ +#!/usr/bin/python3 -tt + +# Copyright 2013 Jussi Pakkanen + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at + +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import sys + +if __name__ == '__main__': + if len(sys.argv) != 2: + print('Installer script for Builder. Do not run on your own, mmm\'kay?') + print('%s [install info file]' % sys.argv[0]) + datafile = sys.argv[1] diff --git a/builder_test.py b/builder_test.py index df8781c..2cea912 100755 --- a/builder_test.py +++ b/builder_test.py @@ -32,7 +32,7 @@ def run_tests(datafilename): if __name__ == '__main__': if len(sys.argv) != 2: - print('Test runner for builder. Do not run on your own, mmm\'kay?') + print('Test runner for Builder. Do not run on your own, mmm\'kay?') print('%s [data file]' % sys.argv[0]) datafile = sys.argv[1] run_tests(datafile) diff --git a/generators.py b/generators.py index af28eb7..173fa7c 100755 --- a/generators.py +++ b/generators.py @@ -56,6 +56,12 @@ class Generator(): self.build_to_src = os.path.relpath(self.environment.get_source_dir(), self.environment.get_build_dir()) + def get_script_root(self): + # The path to wherever our internal scripts are. + # /usr/share/../ when installed, local path + # when running from source directory. + return '..' # FIXME + def get_compiler_for_source(self, src): for i in self.build.compilers: if i.can_compile(src): @@ -150,11 +156,21 @@ class NinjaGenerator(Generator): [self.generate_target(t, outfile) for t in self.build.get_targets().values()] outfile.write('# Test rules\n\n') self.generate_tests(outfile) + outfile.write('# Install rules\n\n') + self.generate_install(outfile) outfile.write('# Suffix\n\n') self.generate_ending(outfile) + + def generate_install(self, outfile): + script_root = self.get_script_root() + install_script = os.path.join(script_root, 'builder_install.py') + install_data = os.path.join(self.environment.get_scratch_dir(), 'install.dat') + outfile.write('build install: CUSTOM_COMMAND | all\n') + outfile.write(" COMMAND = '%s' '%s'\n\n" % (ninja_quote(install_script), ninja_quote(install_data))) + def generate_tests(self, outfile): - script_root = '..' # FIXME + script_root = self.get_script_root() test_script = os.path.join(script_root, 'builder_test.py') test_data = os.path.join(self.environment.get_scratch_dir(), 'builder_test_setup.dat') outfile.write('build test: CUSTOM_COMMAND\n') @@ -179,9 +195,9 @@ class NinjaGenerator(Generator): def generate_static_link_rules(self, outfile): static_linker = self.build.static_linker rule = 'rule STATIC_LINKER\n' - command = ' command = %s %s $out $LINK_FLAGS $in\n' % \ - (' '.join(static_linker.get_exelist()),\ - ' '.join(static_linker.get_std_link_flags())) + command = ' command = %s $LINK_FLAGS $out $in\n' % \ + ' '.join(static_linker.get_exelist()) + description = ' description = Static linking library $out\n\n' outfile.write(rule) outfile.write(command) |