src/Makefile.am | 1 + src/check-externs.sh | 21 +++++++++++++++++++++ src/hb-buffer.h | 2 +- win32/Makefile.am | 4 +++- win32/README.txt | 5 +++-- win32/generate-msvc.mak | 17 ++++++++++++----- win32/info-msvc.mak | 5 ++++- win32/replace.py | 2 +- win32/sed-enums-srcs.py | 36 ++++++++++++++++++++++++++++++++++++ 9 files changed, 82 insertions(+), 11 deletions(-)
New commits: commit c2545b921523538e8237ff6a2591f6cb75ee79f1 Author: Behdad Esfahbod <[email protected]> Date: Sat Oct 7 12:56:53 2017 +0200 Add check for HB_EXTERNs https://github.com/behdad/harfbuzz/pull/555 diff --git a/src/Makefile.am b/src/Makefile.am index 0c077d99..ea550d26 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -300,6 +300,7 @@ check: harfbuzz.def # For check-defs.sh dist_check_SCRIPTS = \ check-c-linkage-decls.sh \ check-defs.sh \ + check-externs.sh \ check-header-guards.sh \ check-includes.sh \ check-libstdc++.sh \ diff --git a/src/check-externs.sh b/src/check-externs.sh new file mode 100755 index 00000000..63cc7d5b --- /dev/null +++ b/src/check-externs.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +LC_ALL=C +export LC_ALL + +test -z "$srcdir" && srcdir=. +stat=0 + +test "x$HBHEADERS" = x && HBHEADERS=`cd "$srcdir"; find . -maxdepth 1 -name 'hb*.h'` +test "x$EGREP" = x && EGREP='grep -E' + + +echo 'Checking that all public symbols are exported with HB_EXTERN' + +for x in $HBHEADERS; do + test -f "$srcdir/$x" && x="$srcdir/$x" + $EGREP -B1 '^hb_' "$x" | $EGREP -E -v '^(--|hb_|HB_EXTERN )' -A1 +done | +grep . >&2 && stat=1 + +exit $stat commit 48a9406839f086735a05a2f1a07987b8a6bd6d33 Author: fanc999 <[email protected]> Date: Sat Oct 7 18:57:14 2017 +0800 Fix build of HarfBuzz tools and HarfBuzz-GObject on Visual Studio (#555) * hb-buffer.h: Mark hb_buffer_diff() for export This will fix the tools builds on Visual Studio, as the symbol is used by the tools. * build: Adapt NMake Makefiles for GLib 2.53.4 or later glib-mkenums was ported from a PERL script to a Python script, so we need to update how we generate the enum sources for HarfBuzz-GObject in the NMake builds. Let this be known in the build documentation for MSVC builds. One of the problems with the underlying cmd.exe that the NMake Makefiles run on is that shebang lines are not recognized, so we need to to test run the script with Python and see whether it succeeded by outputing a source file that is larger than 0 in file size (since running the PERL version of the script will clearly fail and cause an empty file to be created). If it succeeds, we then run a small Python utility script that makes the necessary string replacements, and we are done. If that fails, then we run the glib-mkenums script with PERL, and do the replacements with the PERL one-liners as we did before. We need to make replace.py use latin-1 encoding when using Python 3.x to cope with the copyright sign that is in the generated enum sources. diff --git a/src/hb-buffer.h b/src/hb-buffer.h index 1d633f7d..42564bb1 100644 --- a/src/hb-buffer.h +++ b/src/hb-buffer.h @@ -504,7 +504,7 @@ typedef enum { /*< flags >*/ } hb_buffer_diff_flags_t; /* Compare the contents of two buffers, report types of differences. */ -hb_buffer_diff_flags_t +HB_EXTERN hb_buffer_diff_flags_t hb_buffer_diff (hb_buffer_t *buffer, hb_buffer_t *reference, hb_codepoint_t dottedcircle_glyph, diff --git a/win32/Makefile.am b/win32/Makefile.am index 63ba4680..79ce999d 100644 --- a/win32/Makefile.am +++ b/win32/Makefile.am @@ -11,6 +11,8 @@ EXTRA_DIST = \ install.mak \ introspection-msvc.mak \ Makefile.vc \ - README.txt + README.txt \ + replace.py \ + sed-enums-srcs.py -include $(top_srcdir)/git.mk diff --git a/win32/README.txt b/win32/README.txt index 90554c01..185a44c3 100644 --- a/win32/README.txt +++ b/win32/README.txt @@ -57,8 +57,9 @@ GLIB: Enable GLib support in HarfBuzz, which also uses the GLib unicode GOBJECT: Enable building the HarfBuzz-GObject DLL, and thus implies GLib support. This requires the GObject libraries and glib-mkenums script, - along with PERL to generate the enum sources and headers, which is - required for the build. + along with Python (when using GObject/GLib 2.53.4 or later) or PERL + (when using GObject/GLib 2.53.3 or earlier) to generate the enum + sources and headers, which is required for the build. INTROSPECTION: Enable build of introspection files, for making HarfBuzz bindings for other programming languages available, such as diff --git a/win32/generate-msvc.mak b/win32/generate-msvc.mak index b0727d50..0d5c4b06 100644 --- a/win32/generate-msvc.mak +++ b/win32/generate-msvc.mak @@ -12,13 +12,20 @@ config.h: config.h.win32 # we are already using PERL, use PERL one-liners. !if "$(GOBJECT)" == "1" $(HB_GOBJECT_ENUM_GENERATED_SOURCES): ..\src\hb-gobject-enums.h.tmpl ..\src\hb-gobject-enums.cc.tmpl $(HB_ACTUAL_HEADERS) + -$(PYTHON) $(PREFIX)\bin\glib-mkenums \ + --identifier-prefix hb_ --symbol-prefix hb_gobject \ + --template ..\src\$(@F).tmpl $(HB_ACTUAL_HEADERS) > [email protected] + for %%f in ([email protected]) do if %%~zf gtr 0 $(PYTHON) sed-enums-srcs.py [email protected] --output=$@ + @-del [email protected] + if not exist $@ \ $(PERL) $(PREFIX)\bin\glib-mkenums \ --identifier-prefix hb_ --symbol-prefix hb_gobject \ - --template ..\src\$(@F).tmpl $(HB_ACTUAL_HEADERS) > $@ - $(PERL) -p -i.tmp1 -e "s/_t_get_type/_get_type/g" $@ - $(PERL) -p -i.tmp2 -e "s/_T \(/ (/g" $@ - @-del [email protected] - @-del [email protected] + --template ..\src\$(@F).tmpl $(HB_ACTUAL_HEADERS) > [email protected] + if exist [email protected] $(PERL) -p -i.tmp1 -e "s/_t_get_type/_get_type/g" [email protected] + if exist [email protected] $(PERL) -p -i.tmp2 -e "s/_T \(/ (/g" [email protected] + @if exist [email protected] del [email protected] + @if exist [email protected] del [email protected] + @if exist [email protected] move [email protected] $@ !endif # Create the build directories diff --git a/win32/info-msvc.mak b/win32/info-msvc.mak index 4586548c..2a61b180 100644 --- a/win32/info-msvc.mak +++ b/win32/info-msvc.mak @@ -107,7 +107,10 @@ help: @echo GOBJECT: @echo Enable the HarfBuzz-GObject library, also implies GLib2 support, @echo requires the GNOME GLib2 libraries and tools, notably the glib-mkenums - @echo tool script, which will require a PERL interpreter (use + @echo tool script, which will require a Python interpretor (when using + @echo GObject/GLib 2.53.4 or later; use PYTHON=^$(PATH_TO_PYTHON_INTERPRETOR) + @echo if the Python interpretor is not already in your PATH) or PERL + @echo interpreter (when using GObject/GLib 2.53.3 or earlier; use @echo PERL=^$(PATH_TO_PERL_INTERPRETOR)) if it is not already in your PATH). @echo. @echo GRAPHITE2: diff --git a/win32/replace.py b/win32/replace.py index 3aeceb1f..e3ef1635 100644 --- a/win32/replace.py +++ b/win32/replace.py @@ -25,7 +25,7 @@ def open_file(filename, mode): if sys.version_info[0] < 3: return open(filename, mode=mode) else: - return open(filename, mode=mode, encoding='utf-8') + return open(filename, mode=mode, encoding='latin-1') def replace_multi(src, dest, replace_items): with open_file(src, 'r') as s: diff --git a/win32/sed-enums-srcs.py b/win32/sed-enums-srcs.py new file mode 100644 index 00000000..ee761489 --- /dev/null +++ b/win32/sed-enums-srcs.py @@ -0,0 +1,36 @@ +#!/usr/bin/python +# +# Utility script to replace strings in the +# generated enum sources, as needed by the build + +# Author: Fan, Chun-wei +# Date: Oct. 5, 2017 + +import os +import sys +import argparse + +from replace import replace_multi + +def main(argv): + parser = argparse.ArgumentParser(description='Replace strings in generated enum sources') + parser.add_argument('--input', help='input generated temporary enum source', + required=True) + parser.add_argument('--output', + help='output generated final enum source', required=True) + args = parser.parse_args() + + # check whether the generated temporary enum source exists + if not os.path.exists(args.input): + raise SystemExit('Specified generated temporary enum source \'%s\' is invalid' % args.input) + + replace_items = {'_t_get_type': '_get_type', + '_T (': ' ('} + + # Generate the final enum source + replace_multi(args.input, + args.output, + replace_items) + +if __name__ == '__main__': + sys.exit(main(sys.argv)) \ No newline at end of file _______________________________________________ HarfBuzz mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/harfbuzz
