2016-08-15 08:03:57 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
|
|
|
# This is in its own file rather than inside meson.build
|
|
|
|
# because a) mixing the two is ugly and b) trying to
|
|
|
|
# make special characters such as \n go through all
|
|
|
|
# backends is a fool's errand.
|
|
|
|
|
|
|
|
import sys, os, shutil, subprocess
|
|
|
|
|
2016-08-22 19:26:38 +00:00
|
|
|
# [genmarshal, prefix, infile, outfile]
|
|
|
|
cmd = [sys.argv[1]]
|
|
|
|
prefix = sys.argv[2]
|
|
|
|
ifilename = sys.argv[3]
|
|
|
|
ofilename = sys.argv[4]
|
|
|
|
|
|
|
|
h_array = ['--prefix=' + prefix, '--header', '--valist-marshallers']
|
|
|
|
|
|
|
|
c_array = ['--prefix=' + prefix, '--body', '--valist-marshallers']
|
|
|
|
|
2016-08-15 08:03:57 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ofilename.endswith('.h'):
|
|
|
|
arg_array = h_array
|
|
|
|
else:
|
|
|
|
arg_array = c_array
|
|
|
|
|
|
|
|
pc = subprocess.Popen(cmd + [ifilename] + arg_array, stdout=subprocess.PIPE)
|
|
|
|
(stdo, _) = pc.communicate()
|
|
|
|
if pc.returncode != 0:
|
|
|
|
sys.exit(pc.returncode)
|
|
|
|
open(ofilename, 'wb').write(stdo)
|