diff options
author | Patrick Griffis <tingping@tingping.se> | 2016-12-13 16:12:03 -0500 |
---|---|---|
committer | Patrick Griffis <tingping@tingping.se> | 2017-06-13 23:54:51 -0400 |
commit | 628100c19f5d82747170acdf2917cba8c119ccbf (patch) | |
tree | 351a7e9714a1a58390ba349808df5703cef25c3e /plugins/perl/generate_header.py | |
parent | 2edf50d4ddc61ce6f73bf02263c9bdd09632c66b (diff) |
build: Replace Autotools with Meson
Quick rundown of benefits: - Much faster: - Autotools (with autogen): 22 seconds - Meson: 7 seconds - Meson (with ccache): 2 seconds - Simpler: - ~1000 lines smaller - Single simple language - Potentially better Windows (Visual Studio) support What is not done: - Complete Windows support - OSX support (easy) Closes #2013 Closes #1937 Closes #1803
Diffstat (limited to 'plugins/perl/generate_header.py')
-rwxr-xr-x | plugins/perl/generate_header.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/plugins/perl/generate_header.py b/plugins/perl/generate_header.py new file mode 100755 index 00000000..ba7e02a3 --- /dev/null +++ b/plugins/perl/generate_header.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python3 + +import sys +from os.path import basename + +out_file = sys.argv[1] +in_files = sys.argv[2:] + + +def escape_perl(file): + ret = '' + for line in file: + # Escape " and \, strip empty space, shove in C strings. + ret += '"' + line.strip().replace('\\', '\\\\').replace('"', '\\"') + '\\n"\n' + return ret + + +with open(out_file, 'w') as o: + o.write('"BEGIN {\\n"\n') + for in_file in in_files: + o.write("\"$INC{{'{}'}} = 'Compiled into the plugin.';\\n\"\n".format(basename(in_file))) + o.write('"}\\n"\n') + + for in_file in in_files: + o.write('"{\\n"\n') + o.write('"#line 1 \\"{}\\"\\n"\n'.format(basename(in_file))) + with open(in_file) as i: + o.write(escape_perl(i)) + o.write('"}\\n"\n') |