aboutsummaryrefslogtreecommitdiff
path: root/shellgenerator.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2013-01-12 13:53:19 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2013-01-12 13:53:19 +0200
commit8d038ef09ed709f7db95504f04b13678ecf79816 (patch)
tree1d37bc3bfb91ae56d78b85950683b860e9f8aec9 /shellgenerator.py
parentb6886b2c27f6b9b18acc1c6ac57d6d64039aa815 (diff)
downloadmeson-8d038ef09ed709f7db95504f04b13678ecf79816.zip
meson-8d038ef09ed709f7db95504f04b13678ecf79816.tar.gz
meson-8d038ef09ed709f7db95504f04b13678ecf79816.tar.bz2
Can install header files.
Diffstat (limited to 'shellgenerator.py')
-rwxr-xr-xshellgenerator.py39
1 files changed, 31 insertions, 8 deletions
diff --git a/shellgenerator.py b/shellgenerator.py
index ee2eabd..79dab1a 100755
--- a/shellgenerator.py
+++ b/shellgenerator.py
@@ -71,15 +71,40 @@ echo This is experimental and most likely will not work!
echo Run compile.sh before this or bad things will happen.
""" % self.build.get_project()
outfile = self.create_shfile(outfilename, message)
- self.generate_install(outfile)
+ self.generate_target_install(outfile)
+ self.generate_header_install(outfile)
outfile.close()
-
- def generate_install(self, outfile):
+
+ def make_subdir(self, outfile, dir):
+ cmdlist = ['mkdir', '-p', dir]
+ outfile.write(' '.join(shell_quote(cmdlist)) + '\n')
+
+ def copy_file(self, outfile, filename, outdir):
+ cpcommand = ['cp', filename, outdir]
+ cpcommand = ' '.join(shell_quote(cpcommand)) + '\n'
+ outfile.write(cpcommand)
+
+ def generate_header_install(self, outfile):
+ prefix = self.environment.get_prefix()
+ incroot = os.path.join(prefix, self.environment.get_includedir())
+ headers = self.build.get_headers()
+ if len(headers) != 0:
+ outfile.write('\necho Installing headers.\n')
+ else:
+ outfile.write('\necho This project has no headers to install.')
+ for h in headers:
+ outdir = os.path.join(incroot, h.get_subdir())
+ self.make_subdir(outfile, outdir)
+ for f in h.get_sources():
+ abspath = os.path.join(self.environment.get_source_dir(), f)
+ self.copy_file(outfile, abspath, outdir)
+
+ def generate_target_install(self, outfile):
prefix = self.environment.get_prefix()
libdir = os.path.join(prefix, self.environment.get_libdir())
bindir = os.path.join(prefix, self.environment.get_bindir())
- outfile.write("mkdir -p '%s'\n" % libdir)
- outfile.write("mkdir -p '%s'\n" % bindir)
+ self.make_subdir(outfile, libdir)
+ self.make_subdir(outfile, bindir)
for tmp in self.build.get_targets().items():
(name, t) = tmp
if t.should_install():
@@ -88,9 +113,7 @@ echo Run compile.sh before this or bad things will happen.
else:
outdir = libdir
outfile.write('echo Installing "%s".\n' % name)
- cpcommand = ['cp', self.get_target_filename(t), outdir]
- cpcommand = ' '.join(shell_quote(cpcommand)) + '\n'
- outfile.write(cpcommand)
+ self.copy_file(outfile, self.get_target_filename(t), outdir)
def generate_tests(self, outfile):
for t in self.build.get_tests():