CMakeLists.txt | 3 +-- src/Makefile.am | 8 ++++---- src/gen-def.py | 12 +++++++++--- src/hb-private.hh | 18 ++++++++++++++++++ src/hb-set-private.hh | 1 + 5 files changed, 33 insertions(+), 9 deletions(-)
New commits: commit bca83618cda7ee4f683b4685d10db9e1bef4983c Author: Behdad Esfahbod <[email protected]> Date: Tue Jul 10 12:58:13 2018 +0200 Add fallback implementation for constexpr and alignof diff --git a/src/hb-private.hh b/src/hb-private.hh index 5cec8e0b..6893bfd3 100644 --- a/src/hb-private.hh +++ b/src/hb-private.hh @@ -84,6 +84,10 @@ extern "C" void hb_free_impl(void *ptr); #define nullptr NULL #endif +#ifndef constexpr +#define constexpr const +#endif + // Static assertions #ifndef static_assert #define static_assert(e, msg) \ @@ -98,6 +102,20 @@ extern "C" void hb_free_impl(void *ptr); #define thread_local #endif +#ifndef alignof +#define alignof(x) _hb_alignof<x>::value; +template <typename T> +struct _hb_alignof +{ + struct s + { + char c; + T t; + }; + static constexpr unsigned int value = offsetof (s, t); +}; +#endif // alignof + #endif // __cplusplus < 201103L #if (defined(__GNUC__) || defined(__clang__)) && defined(__OPTIMIZE__) commit 7cb47d0f3f202843ebc7fb8801bf388bb90ba3aa Author: Behdad Esfahbod <[email protected]> Date: Tue Jul 10 12:51:29 2018 +0200 Minor diff --git a/src/hb-set-private.hh b/src/hb-set-private.hh index ccd4d8df..6841189e 100644 --- a/src/hb-set-private.hh +++ b/src/hb-set-private.hh @@ -405,6 +405,7 @@ struct hb_set_t if (get_population () > larger_set->get_population ()) return false; + /* TODO Optimize to use pages. */ hb_codepoint_t c = INVALID; while (next (&c)) if (!larger_set->has (c)) commit bf9e9676dda686f5b76826b4e3148f4a0b512e3c Merge: 46d8f0d5 53f73409 Author: Cosimo Lupo <[email protected]> Date: Mon Jul 9 20:24:22 2018 +0200 Merge pull request #1091 from anthrotype/fix-gen-def-py gen-def.py: pass headers as arguments so that msys2 can convert posix paths commit 53f73409a91241765ae6a0cadf7600676988b6af Author: Cosimo Lupo <[email protected]> Date: Mon Jul 9 18:54:23 2018 +0100 CMakeLists.txt: don't pass header args as single space-separated string let python's parse command-line args as usual diff --git a/CMakeLists.txt b/CMakeLists.txt index e0a4b881..e881dbd1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -834,9 +834,8 @@ set_target_properties(hb-ot-tag PROPERTIES COMPILE_FLAGS "-DMAIN") if (UNIX OR MINGW) if (BUILD_SHARED_LIBS) # generate harfbuzz.def after build completion - string(REPLACE ";" " " space_separated_headers "${project_headers}") add_custom_command(TARGET harfbuzz POST_BUILD - COMMAND "${PYTHON_EXECUTABLE}" ${PROJECT_SOURCE_DIR}/src/gen-def.py ${PROJECT_BINARY_DIR}/harfbuzz.def ${space_separated_headers} + COMMAND "${PYTHON_EXECUTABLE}" ${PROJECT_SOURCE_DIR}/src/gen-def.py ${PROJECT_BINARY_DIR}/harfbuzz.def ${project_headers} WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/src) add_test(NAME check-static-inits.sh commit 83d2233a5c47cf1feadcdece5bd4a6b498c6ee7a Author: Cosimo Lupo <[email protected]> Date: Mon Jul 9 18:48:20 2018 +0100 CMakeLists.txt: pass headers as arguments to gen-def.py; call using PYTHON_EXECUTABLE diff --git a/CMakeLists.txt b/CMakeLists.txt index 9ed7e56e..e0a4b881 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -836,7 +836,7 @@ if (UNIX OR MINGW) # generate harfbuzz.def after build completion string(REPLACE ";" " " space_separated_headers "${project_headers}") add_custom_command(TARGET harfbuzz POST_BUILD - COMMAND ${CMAKE_COMMAND} -E env "headers=${space_separated_headers}" python ${PROJECT_SOURCE_DIR}/src/gen-def.py ${PROJECT_BINARY_DIR}/harfbuzz.def + COMMAND "${PYTHON_EXECUTABLE}" ${PROJECT_SOURCE_DIR}/src/gen-def.py ${PROJECT_BINARY_DIR}/harfbuzz.def ${space_separated_headers} WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/src) add_test(NAME check-static-inits.sh commit ccdd15655480fe35226c0b757e28d3527fe2e6af Author: Cosimo Lupo <[email protected]> Date: Mon Jul 9 18:26:44 2018 +0100 src/Makefile.am: pass headers to gen-def.py as arguments, not env vars diff --git a/src/Makefile.am b/src/Makefile.am index 9d5662e4..6dfec3bf 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -277,13 +277,13 @@ endif check: $(DEF_FILES) # For check-symbols.sh CLEANFILES += $(DEF_FILES) harfbuzz.def: $(HBHEADERS) $(HBNODISTHEADERS) - $(AM_V_GEN) headers="$^" $(srcdir)/gen-def.py "$@" + $(AM_V_GEN) $(srcdir)/gen-def.py "$@" $^ harfbuzz-subset.def: $(HB_SUBSET_headers) - $(AM_V_GEN) headers="$^" $(srcdir)/gen-def.py "$@" + $(AM_V_GEN) $(srcdir)/gen-def.py "$@" $^ harfbuzz-icu.def: $(HB_ICU_headers) - $(AM_V_GEN) headers="$^" $(srcdir)/gen-def.py "$@" + $(AM_V_GEN) $(srcdir)/gen-def.py "$@" $^ harfbuzz-gobject.def: $(HB_GOBJECT_headers) - $(AM_V_GEN) headers="$^" $(srcdir)/gen-def.py "$@" + $(AM_V_GEN) $(srcdir)/gen-def.py "$@" $^ GENERATORS = \ commit e3a931ef0b86419b5e4ba17de51535393471ed9d Author: Cosimo Lupo <[email protected]> Date: Mon Jul 9 18:11:29 2018 +0100 gen-def.py: pass headers as arguments so that msys2 can convert posix paths When one is not using the msys2 python, the header files that are passed in as environment variable cannot be found. https://ci.appveyor.com/project/fonttools/ttfautohint-py/build/1.0.65/job/rkremny4jjid9nl2#L803 This is because msys2 shell and make use POSIX paths (e.g. /c/Users/clupo/...) whereas non-msys2 python.exe uses native Windows paths (e.g. C:\Users\clupo\...). Msys2 will automatically convert command line arguments (but not environment variables) from POSIX to Windows paths when calling a native win32 executable, so we pass the header paths as arguments instead of environment variables. This way the gen-def.py script can support both mingw python running in an MSYS2 shell, and native win32 python. diff --git a/src/gen-def.py b/src/gen-def.py index 9a997d65..ba39eaae 100755 --- a/src/gen-def.py +++ b/src/gen-def.py @@ -4,8 +4,14 @@ from __future__ import print_function, division, absolute_import import io, os, re, sys +if len (sys.argv) < 3: + sys.exit("usage: gen-def.py harfbuzz.def hb.h [hb-blob.h hb-buffer.h ...]") + +output_file = sys.argv[1] +header_paths = sys.argv[2:] + headers_content = [] -for h in os.environ["headers"].split (' '): +for h in header_paths: if h.endswith (".h"): with io.open (h, encoding='utf-8') as f: headers_content.append (f.read ()) @@ -13,7 +19,7 @@ result = """EXPORTS %s LIBRARY lib%s-0.dll""" % ( "\n".join (sorted (re.findall (r"^hb_\w+(?= \()", "\n".join (headers_content), re.M))), - sys.argv[1].replace ('.def', '') + output_file.replace ('.def', '') ) -with open (sys.argv[1], "w") as f: f.write (result) +with open (output_file, "w") as f: f.write (result) _______________________________________________ HarfBuzz mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/harfbuzz
