diff options
Diffstat (limited to 'util/meson_aux/extra-dist-cmd.py')
-rwxr-xr-x | util/meson_aux/extra-dist-cmd.py | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/util/meson_aux/extra-dist-cmd.py b/util/meson_aux/extra-dist-cmd.py new file mode 100755 index 0000000..5b04f06 --- /dev/null +++ b/util/meson_aux/extra-dist-cmd.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python3 + +# External command, intended to be called with meson.add_dist_script() in meson.build + +# argv[1] argv[2] +# extra-dist-cmd.py <root_source_dir> <root_build_dir> + +# Meson does not preserve timestamps on distributed files. +# But this script preserves the timestamps on libstdc++.tag. + +import os +import sys +import subprocess +import shutil + +root_source_dir = sys.argv[1] +root_build_dir = sys.argv[2] + +# Make a ChangeLog file for distribution. +cmd = [ + 'git', + '--git-dir=' + os.path.join(root_source_dir, '.git'), + '--work-tree=' + root_source_dir, + 'log', + '--no-merges', + '--date=short', + '--max-count=200', + '--pretty=tformat:%cd %an <%ae>%n%n %s%n%w(0,0,2)%+b', +] +logfile = open(os.path.join(os.getenv('MESON_DIST_ROOT'), 'ChangeLog'), mode='w') +result = subprocess.run(cmd, stdout=logfile) +logfile.close() + +# Distribute the libstdc++.tag file in addition to the files in the local git clone. +# shutil.copy2() copies timestamps and some other file metadata. +shutil.copy2(os.path.join(root_build_dir, 'libstdc++.tag'), + os.path.join(os.getenv('MESON_DIST_ROOT'), 'doctags')) + +sys.exit(result.returncode) |