[meson] Use the recommended way to generate harfbuzz.cc

As https://github.com/harfbuzz/harfbuzz/pull/2532
This commit is contained in:
Ebrahim Byagowi 2020-07-04 12:28:06 +04:30
parent a7e82e4ffd
commit 359dbc97ae
2 changed files with 17 additions and 21 deletions

View File

@ -1,22 +1,18 @@
#!/usr/bin/env python3
"usage: gen-harfbuzzcc.py harfbuzz.cc hb-blob.cc hb-buffer.cc ..."
"This tool is intended to be used from meson"
import os, sys
os.chdir (os.path.dirname (__file__))
import os, sys, shutil
if len (sys.argv) < 3:
sys.exit (__doc__)
exit (__doc__)
output_file = sys.argv[1]
source_paths = sys.argv[2:]
OUTPUT = sys.argv[1]
CURRENT_SOURCE_DIR = sys.argv[2]
sources = sys.argv[3:]
result = "".join ('#include "{}"\n'.format (os.path.basename (x)) for x in source_paths if x.endswith (".cc")).encode ()
with open (OUTPUT, "wb") as f:
f.write ("".join ('#include "{}"\n'.format (os.path.basename (x)) for x in sources if x.endswith (".cc")).encode ())
with open (output_file, "rb") as f:
current = f.read()
if result != current:
with open (output_file, "wb") as f:
f.write (result)
# copy it also to src/
shutil.copyfile (OUTPUT, os.path.join (CURRENT_SOURCE_DIR, os.path.basename (OUTPUT)))

View File

@ -301,9 +301,7 @@ else
input: rl,
output: hh,
command: [find_program('gen-ragel-artifacts.py'),
'@OUTPUT@',
'@CURRENT_SOURCE_DIR@',
'@INPUT@'],
'@OUTPUT@', '@CURRENT_SOURCE_DIR@', '@INPUT@'],
)
endforeach
endif
@ -311,10 +309,12 @@ endif
custom_target('harfbuzz.cc',
build_by_default: true,
output: 'harfbuzz.cc',
command: [find_program('gen-harfbuzzcc.py'), 'harfbuzz.cc'] +
hb_base_sources + hb_glib_sources + hb_ft_sources +
hb_graphite2_sources + hb_uniscribe_sources + hb_gdi_sources +
hb_directwrite_sources + hb_coretext_sources)
input: hb_base_sources + hb_glib_sources + hb_ft_sources +
hb_graphite2_sources + hb_uniscribe_sources + hb_gdi_sources +
hb_directwrite_sources + hb_coretext_sources,
command: [find_program('gen-harfbuzzcc.py'),
'@OUTPUT@', '@CURRENT_SOURCE_DIR@', '@INPUT@'],
)
incsrc = include_directories('.')