Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build of HarfBuzz tools and HarfBuzz-GObject on Visual Studio #555

Merged
merged 2 commits into from
Oct 7, 2017

Conversation

fanc999
Copy link
Contributor

@fanc999 fanc999 commented Oct 5, 2017

Hi,

When building the HarfBuzz tools, a recently-added symbol, hb_buffer_diff(), was not marked with HB_EXTERN, so that symbol was not exported from the HarfBuzz DLL when building with Visual Studio, causing tools builds to fail, so I attached a simple patch to fix this.

On the other hand, since GLib 2.53.4 and later had glib-mkenums ported to Python, we have to change how the enum sources for HarfBuzz-GObject is generated. The issue is, since the cmd.exe (which NMake builds run on) do not supported shebang lines, we need to first test-run glib-mkenums with Python, and fall back to PERL if that fails (and bail out if that fails as well), and use a simple Python script or PERL one-liners to do the necessary string replacements in the generated enum sources depending on whether Python or PERL was successfully used for running glib-mkenums.

With blessings, thank you!

This will fix the tools builds on Visual Studio, as the symbol is used
by the tools.
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.
@behdad behdad merged commit 48a9406 into harfbuzz:master Oct 7, 2017
behdad added a commit that referenced this pull request Oct 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants