build: Support Visual Studio builds using NMake
authorChun-wei Fan <fanchunwei@src.gnome.org>
Tue, 3 Nov 2015 11:00:42 +0000 (19:00 +0800)
committerChun-wei Fan <fanchunwei@src.gnome.org>
Wed, 3 Feb 2016 10:14:30 +0000 (18:14 +0800)
This adds a set of NMake Makefiles that can be used to build HarfBuzz, from
the standard basic build building the minimal HarfBuzz DLL (consisting
of OpenType, fallback and Uniscribe support only), to a full fledged build
consisting of GLib and FreeType support, as well as building the utilities,
the test programs in src/ and test/api, and HarfBuzz-ICU and
HarfBuzz-GObject, and up to building the introspection files.  This means a
flexible build mechanism is supported here, so anything that is supported
for a Windows build (code-wise), should all be supported by this build
system.

As in an earlier commit, the source listings are shared with the autotools
builds with the various Makefile.sources in src/, src/hb-ucdn and util/, and
this set of NMake Makefiles will transform these lists into the form they
want.

In the current form, all the test programs in test/api pass, and this has
been checked successfully with 'make -j8 distcheck'.

16 files changed:
BUILD.md
Makefile.am
configure.ac
win32/Makefile.am [new file with mode: 0644]
win32/Makefile.vc [new file with mode: 0644]
win32/README.txt [new file with mode: 0644]
win32/build-rules-msvc.mak [new file with mode: 0644]
win32/config-msvc.mak [new file with mode: 0644]
win32/create-lists-msvc.mak [new file with mode: 0644]
win32/create-lists.bat [new file with mode: 0644]
win32/detectenv-msvc.mak [new file with mode: 0644]
win32/generate-msvc.mak [new file with mode: 0644]
win32/hb-introspection-msvc.mak [new file with mode: 0644]
win32/info-msvc.mak [new file with mode: 0644]
win32/install.mak [new file with mode: 0644]
win32/introspection-msvc.mak [new file with mode: 0644]

index e9d7d4d..86285c6 100644 (file)
--- a/BUILD.md
+++ b/BUILD.md
@@ -15,7 +15,9 @@ or using Homebrew:
 If you are using a tarball, you can now proceed to running configure and make
 as with any other standard package. That should leave you with a shared
 library in src/, and a few utility programs including hb-view and hb-shape
-under util/.
+under util/.  From the tarball, NMake Makefiles are also provided in win32/,
+which supports building HarfBuzz using Visual Studio, with a README.txt that
+gives instructions on building using NMake.
 If you are bootstraping from git, you need a few more tools before you can
 run autogen.sh for the first time. Namely, pkg-config and ragel. Again,
 on Ubuntu / Debian:
index 3c1e7a2..8987d57 100644 (file)
@@ -4,7 +4,7 @@ NULL =
 
 ACLOCAL_AMFLAGS = -I m4
 
-SUBDIRS = src util test docs
+SUBDIRS = src util test docs win32
 
 EXTRA_DIST = \
        autogen.sh \
index 7642115..d14e0fc 100644 (file)
@@ -444,6 +444,8 @@ test/fuzzing/Makefile
 test/shaping/Makefile
 docs/Makefile
 docs/version.xml
+win32/Makefile
+win32/config.h.win32
 ])
 
 AC_OUTPUT
diff --git a/win32/Makefile.am b/win32/Makefile.am
new file mode 100644 (file)
index 0000000..be7a477
--- /dev/null
@@ -0,0 +1,14 @@
+EXTRA_DIST = \
+       build-rules-msvc.mak \
+       config-msvc.mak \
+       config.h.win32 \
+       create-lists.bat \
+       create-lists-msvc.mak \
+       detectenv-msvc.mak \
+       generate-msvc.mak \
+       hb-introspection-msvc.mak \
+       info-msvc.mak \
+       install.mak \
+       introspection-msvc.mak \
+       Makefile.vc \
+       README.txt
diff --git a/win32/Makefile.vc b/win32/Makefile.vc
new file mode 100644 (file)
index 0000000..fdde7a7
--- /dev/null
@@ -0,0 +1,52 @@
+# NMake Makefile for building HarfBuzz as a DLL on Windows
+
+# The items below this line should not be changed, unless one is maintaining
+# the NMake Makefiles.  Customizations can be done in the following NMake Makefile
+# portions (please see comments in the these files to see what can be customized):
+#
+# detectenv-msvc.mak
+# config-msvc.mak
+
+!include detectenv-msvc.mak
+
+# Include the Makefile portions with the source listings
+!include ..\src\Makefile.sources
+!include ..\src\hb-ucdn\Makefile.sources
+!include ..\util\Makefile.sources
+
+# Include the Makefile portion that enables features based on user input
+!include config-msvc.mak
+
+!if "$(VALID_CFGSET)" == "TRUE"
+
+# Include the Makefile portion to convert the source and header lists
+# into the lists we need for compilation and introspection
+!include create-lists-msvc.mak
+
+all: $(HB_LIBS) $(HB_UTILS) $(EXTRA_TARGETS) all-build-info
+
+tests: all $(HB_TESTS)
+
+# Include the build rules for sources, DLLs and executables
+!include build-rules-msvc.mak
+
+# Include the rules for build directory creation and code generation
+!include generate-msvc.mak
+
+# Generate the introspection files
+
+!if "$(INTROSPECTION)" == "1"
+# Include the rules for building the introspection files
+!include introspection-msvc.mak
+!include hb-introspection-msvc.mak
+!endif
+
+!include install.mak
+
+!else
+all: help
+       @echo You need to specify a valid configuration, via
+       @echo CFG=release or CFG=debug
+!endif
+
+!include info-msvc.mak
diff --git a/win32/README.txt b/win32/README.txt
new file mode 100644 (file)
index 0000000..1cb965c
--- /dev/null
@@ -0,0 +1,75 @@
+Instructions for building HarfBuzz on Visual Studio\r
+===================================================\r
+Building the HarfBuzz DLL on Windows is now also supported using Visual Studio\r
+versions 2008 through 2015, in both 32-bit and 64-bit (x64) flavors, via NMake\r
+Makefiles.\r
+\r
+The following are instructions for performing such a build, as there is a\r
+number of build configurations supported for the build.  Note that for all\r
+build configurations, the OpenType and Simple TrueType layout (fallback)\r
+backends are enabled, as well as the Uniscribe platform shaper, and this\r
+is the base configuration that is built if no options (see below) are\r
+specified.  A 'clean' target is provided-it is recommended that one cleans\r
+the build and redo the build if any configuration option changed.  An\r
+'install' target is also provided to copy the built items in their appropriate\r
+locations under $(PREFIX), which is described below.\r
+\r
+Invoke the build by issuing the command:\r
+nmake /f Makefile.vc CFG=[release|debug] [PREFIX=...] <option1=1 option2=1 ...>\r
+where:\r
+\r
+CFG: Required.  Choose from a release or debug build.  Note that \r
+     all builds generate a .pdb file for each .dll and .exe built--this refers\r
+     to the C/C++ runtime that the build uses.\r
+\r
+PREFIX: Optional.  Base directory of where the third-party headers, libraries\r
+        and needed tools can be found, i.e. headers in $(PREFIX)\include,\r
+        libraries in $(PREFIX)\lib and tools in $(PREFIX)\bin.  If not\r
+        specified, $(PREFIX) is set as $(srcroot)\..\vs$(X)\$(platform), where\r
+        $(platform) is win32 for 32-bit builds or x64 for 64-bit builds, and\r
+        $(X) is the short version of the Visual Studio used, as follows:\r
+        2008: 9\r
+        2010: 10\r
+        2012: 11\r
+        2013: 12\r
+        2015: 14\r
+\r
+Explanation of options, set by <option>=1:\r
+------------------------------------------\r
+GLIB: Enable GLib support in HarfBuzz, which also uses the GLib unicode\r
+      callback instead of the bundled UCDN unicode callback.  This requires the\r
+      GLib libraries, and is required for building all tool and test programs.\r
+\r
+GOBJECT: Enable building the HarfBuzz-GObject DLL, and thus implies GLib\r
+         support.  This requires the GObject libraries and glib-mkenums script,\r
+         along with PERL to generate the enum sources and headers, which is\r
+         required for the build.\r
+\r
+INTROSPECTION: Enable build of introspection files, for making HarfBuzz\r
+               bindings for other programming languages available, such as\r
+               Python, available.  This requires the GObject-Introspection\r
+               libraries and tools, along with the Python interpretor that was\r
+               used during the build of GObject-Introspection.  Please see\r
+               $(srcroot)\README.python for more related details.  This implies\r
+               the build of the HarfBuzz-GObject DLL, along with GLib support.\r
+\r
+FREETYPE: Enable the FreeType font callbacks.  Requires the FreeType2 library.\r
+\r
+CAIRO: Enable Cairo support.  Requires the Cairo library.\r
+\r
+CAIRO_FT: Enable the build of the hb-view tool, which makes use of Cairo, and\r
+          thus implies FreeType font callback support and Cairo support.\r
+          Requires Cairo libraries built with FreeType support.  Note that the\r
+          hb-view tool requires GLib support as well.\r
+\r
+GRAPHITE2: Enable the Graphite2 shaper, requires the SIL Graphite2 library.\r
+\r
+ICU: Enables the build HarfBuzz-ICU, which is now the recommended layout engine\r
+     for ICU (International Components for Unicode), which deprecated ICU LE.\r
+     Requires the ICU libraries.\r
+\r
+PYTHON: Full path to the Python interpretor to be used, if it is not in %PATH%.\r
+\r
+PERL: Full path to the PERL interpretor to be used, if it is not in %PATH%.\r
+\r
+LIBTOOL_DLL_NAME: Enable libtool-style DLL names.
\ No newline at end of file
diff --git a/win32/build-rules-msvc.mak b/win32/build-rules-msvc.mak
new file mode 100644 (file)
index 0000000..03b3833
--- /dev/null
@@ -0,0 +1,140 @@
+# NMake Makefile portion for compilation rules
+# Items in here should not need to be edited unless
+# one is maintaining the NMake build files.  The format
+# of NMake Makefiles here are different from the GNU
+# Makefiles.  Please see the comments about these formats.
+
+# Inference rules for compiling the .obj files.
+# Used for libs and programs with more than a single source file.
+# Format is as follows
+# (all dirs must have a trailing '\'):
+#
+# {$(srcdir)}.$(srcext){$(destdir)}.obj::
+#      $(CC)|$(CXX) $(cflags) /Fo$(destdir) /c @<<
+# $<
+# <<
+{..\src\}.cc{$(CFG)\$(PLAT)\harfbuzz\}.obj::
+       $(CXX) $(CFLAGS) $(HB_DEFINES) $(HB_LIB_CFLAGS) /Fo$(CFG)\$(PLAT)\harfbuzz\ /c @<<
+$<
+<<
+
+{..\src\hb-ucdn\}.c{$(CFG)\$(PLAT)\harfbuzz\}.obj::
+       $(CC) $(CFLAGS) /Fo$(CFG)\$(PLAT)\harfbuzz\ /c @<<
+$<
+<<
+
+{..\src\}.cc{$(CFG)\$(PLAT)\harfbuzz-icu\}.obj::
+       $(CXX) $(CFLAGS) $(HB_LIB_CFLAGS) $(HB_ICU_CFLAGS) /Fo$(CFG)\$(PLAT)\harfbuzz-icu\ /c @<<
+$<
+<<
+
+{..\util\}.cc{$(CFG)\$(PLAT)\util\}.obj::
+       $(CXX) $(CFLAGS) $(HB_DEFINES) $(HB_CFLAGS) /Fo$(CFG)\$(PLAT)\util\ /c @<<
+$<
+<<
+
+# Inference rules for building the test programs
+# Used for programs with a single source file.
+# Format is as follows
+# (all dirs must have a trailing '\'):
+#
+# {$(srcdir)}.$(srcext){$(destdir)}.exe::
+#      $(CC)|$(CXX) $(cflags) $< /Fo$*.obj  /Fe$@ [/link $(linker_flags) $(dep_libs)]
+{..\src\}.cc{$(CFG)\$(PLAT)\}.exe:
+       $(CXX) $(CFLAGS) $(HB_DEFINES) $(HB_CFLAGS) $< /Fo$*.obj  /Fe$@ /link $(LDFLAGS) $(CFG)\$(PLAT)\harfbuzz.lib $(HB_TESTS_DEP_LIBS)
+
+{..\test\api\}.c{$(CFG)\$(PLAT)\}.exe:
+       $(CXX) $(CFLAGS) $(HB_DEFINES) $(HB_CFLAGS) /DSRCDIR="\"../../../test/api\"" $< /Fo$*.obj /Fe$@ /link $(LDFLAGS) $(CFG)\$(PLAT)\harfbuzz.lib $(HB_TESTS_DEP_LIBS)
+
+# Rules for building .lib files
+$(CFG)\$(PLAT)\harfbuzz.lib: $(HARFBUZZ_DLL_FILENAME).dll
+$(CFG)\$(PLAT)\harfbuzz-icu.lib: $(HARFBUZZ_ICU_DLL_FILENAME).dll
+$(CFG)\$(PLAT)\harfbuzz-gobject.lib: $(HARFBUZZ_GOBJECT_DLL_FILENAME).dll
+
+# Rules for linking DLLs
+# Format is as follows (the mt command is needed for MSVC 2005/2008 builds):
+# $(dll_name_with_path): $(dependent_libs_files_objects_and_items)
+#      link /DLL [$(linker_flags)] [$(dependent_libs)] [/def:$(def_file_if_used)] [/implib:$(lib_name_if_needed)] -out:$@ @<<
+# $(dependent_objects)
+# <<
+#      @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;2
+$(HARFBUZZ_DLL_FILENAME).dll: config.h $(harfbuzz_dll_OBJS) $(CFG)\$(PLAT)\harfbuzz
+       link /DLL $(LDFLAGS) $(HB_DEP_LIBS) /implib:$(CFG)\$(PLAT)\harfbuzz.lib -out:$@ @<<
+$(harfbuzz_dll_OBJS)
+<<
+       @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;2
+
+$(HARFBUZZ_ICU_DLL_FILENAME).dll: $(CFG)\$(PLAT)\harfbuzz.lib $(harfbuzz_icu_OBJS) $(CFG)\$(PLAT)\harfbuzz-icu
+       link /DLL $(LDFLAGS) $(CFG)\$(PLAT)\harfbuzz.lib $(HB_ICU_DEP_LIBS) /implib:$(CFG)\$(PLAT)\harfbuzz-icu.lib -out:$@ @<<
+$(harfbuzz_icu_OBJS)
+<<
+       @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;2
+
+$(HARFBUZZ_GOBJECT_DLL_FILENAME).dll: $(CFG)\$(PLAT)\harfbuzz.lib $(harfbuzz_gobject_OBJS) $(CFG)\$(PLAT)\harfbuzz-gobject
+       link /DLL $(LDFLAGS) $(CFG)\$(PLAT)\harfbuzz.lib $(HB_GOBJECT_DEP_LIBS) /implib:$(CFG)\$(PLAT)\harfbuzz-gobject.lib -out:$@ @<<
+$(harfbuzz_gobject_OBJS)
+<<
+       @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;2
+
+# Rules for linking Executables
+# Format is as follows (the mt command is needed for MSVC 2005/2008 builds):
+# $(dll_name_with_path): $(dependent_libs_files_objects_and_items)
+#      link [$(linker_flags)] [$(dependent_libs)] -out:$@ @<<
+# $(dependent_objects)
+# <<
+#      @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;1
+$(CFG)\$(PLAT)\hb-view.exe: $(CFG)\$(PLAT)\harfbuzz.lib $(CFG)\$(PLAT)\util $(hb_view_OBJS)
+       link $(LDFLAGS) $(CFG)\$(PLAT)\harfbuzz.lib $(HB_UTILS_DEP_LIBS) -out:$@ @<<
+$(hb_view_OBJS)
+<<
+       @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;1
+
+$(CFG)\$(PLAT)\hb-shape.exe: $(CFG)\$(PLAT)\harfbuzz.lib $(CFG)\$(PLAT)\util $(hb_shape_OBJS)
+       link $(LDFLAGS) $(CFG)\$(PLAT)\harfbuzz.lib $(HB_UTILS_DEP_LIBS) -out:$@ @<<
+$(hb_shape_OBJS)
+<<
+       @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;1
+
+$(CFG)\$(PLAT)\hb-ot-shape-closure.exe: $(CFG)\$(PLAT)\harfbuzz.lib $(CFG)\$(PLAT)\util $(hb_ot_shape_closure_OBJS)
+       link $(LDFLAGS) $(CFG)\$(PLAT)\harfbuzz.lib $(HB_UTILS_DEP_LIBS) -out:$@ @<<
+$(hb_ot_shape_closure_OBJS)
+<<
+       @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;1
+
+# Other .obj files requiring individual attention, that could not be covered by the inference rules.
+# Format is as follows (all dirs must have a trailing '\'):
+#
+# $(obj_file):
+#      $(CC)|$(CXX) $(cflags) /Fo$(obj_destdir) /c @<<
+# $(srcfile)
+# <<
+$(CFG)\$(PLAT)\harfbuzz-gobject\hb-gobject-structs.obj:        $(CFG)\$(PLAT)\harfbuzz-gobject $(HB_GOBJECT_ENUM_GENERATED_SOURCES)
+       $(CXX) $(CFLAGS) $(HB_DEFINES) $(HB_LIB_CFLAGS) /I$(CFG)\$(PLAT)\harfbuzz-gobject /Fo$(CFG)\$(PLAT)\harfbuzz-gobject\ /c @<<
+..\src\hb-gobject-structs.cc
+<<
+
+$(CFG)\$(PLAT)\harfbuzz-gobject\hb-gobject-enums.obj: $(CFG)\$(PLAT)\harfbuzz-gobject $(HB_GOBJECT_ENUM_GENERATED_SOURCES)
+       $(CXX) $(CFLAGS) $(HB_DEFINES) $(HB_LIB_CFLAGS) /I$(CFG)\$(PLAT)\harfbuzz-gobject /Fo$(CFG)\$(PLAT)\harfbuzz-gobject\ /c @<<
+$(CFG)\$(PLAT)\harfbuzz-gobject\hb-gobject-enums.cc
+<<
+
+clean:
+       @-if exist $(CFG)\$(PLAT)\HarfBuzz-0.0.typelib del /f /q $(CFG)\$(PLAT)\HarfBuzz-0.0.typelib
+       @-if exist $(CFG)\$(PLAT)\HarfBuzz-0.0.gir del /f /q $(CFG)\$(PLAT)\HarfBuzz-0.0.gir
+       @-if exist $(CFG)\$(PLAT)\hb_list del /f /q $(CFG)\$(PLAT)\hb_list
+       @-del /f /q $(CFG)\$(PLAT)\*.pdb
+       @-if exist $(CFG)\$(PLAT)\.exe.manifest del /f /q $(CFG)\$(PLAT)\*.exe.manifest
+       @-if exist $(CFG)\$(PLAT)\.exe del /f /q $(CFG)\$(PLAT)\*.exe
+       @-del /f /q $(CFG)\$(PLAT)\*.dll.manifest
+       @-del /f /q $(CFG)\$(PLAT)\*.dll
+       @-del /f /q $(CFG)\$(PLAT)\*.ilk
+       @-del /f /q $(CFG)\$(PLAT)\*.obj
+       @-if exist $(CFG)\$(PLAT)\util del /f /q $(CFG)\$(PLAT)\util\*.obj
+       @-if exist $(CFG)\$(PLAT)\harfbuzz-gobject del /f /q $(CFG)\$(PLAT)\harfbuzz-gobject\*.obj
+       @-if exist $(CFG)\$(PLAT)\harfbuzz-icu del /f /q $(CFG)\$(PLAT)\harfbuzz-icu\*.obj
+       @-del /f /q $(CFG)\$(PLAT)\harfbuzz\*.obj
+       @-rmdir /s /q $(CFG)\$(PLAT)
+       @-if exist $(CFG)\$(PLAT)\harfbuzz-gobject\hb-gobject-enums.h del $(CFG)\$(PLAT)\harfbuzz-gobject\hb-gobject-enums.h
+       @-if exist $(CFG)\$(PLAT)\harfbuzz-gobject\hb-gobject-enums.cc del $(CFG)\$(PLAT)\harfbuzz-gobject\hb-gobject-enums.cc
+       @-del vc$(VSVER)0.pdb
+       @-del config.h
diff --git a/win32/config-msvc.mak b/win32/config-msvc.mak
new file mode 100644 (file)
index 0000000..70f4c1b
--- /dev/null
@@ -0,0 +1,188 @@
+# NMake Makefile portion for enabling features for Windows builds
+
+# You may change these lines to customize the .lib files that will be linked to
+# Additional Libraries for building HarfBuzz-ICU
+# icudt.lib may be required for static ICU builds
+HB_ICU_DEP_LIBS = icuuc.lib
+
+# GLib is required for all utility programs and tests
+HB_GLIB_LIBS = glib-2.0.lib
+
+# Needed for building HarfBuzz-GObject
+HB_GOBJECT_DEP_LIBS = gobject-2.0.lib $(HB_GLIB_LIBS)
+
+# Freetype is needed for building FreeType support and hb-view
+FREETYPE_LIB = freetype.lib
+
+# Cairo is needed for building hb-view
+CAIRO_LIB = cairo.lib
+
+# Graphite2 is needed for building SIL Graphite2 support
+GRAPHITE2_LIB = graphite2.lib
+
+# Please do not change anything beneath this line unless maintaining the NMake Makefiles
+# Bare minimum features and sources built into HarfBuzz on Windows
+HB_DEFINES =
+HB_CFLAGS = /DHAVE_CONFIG_H
+HB_UCDN_CFLAGS = /I..\src\hb-ucdn
+HB_SOURCES =   \
+       $(HB_BASE_sources)              \
+       $(HB_FALLBACK_sources)  \
+       $(HB_OT_sources)                \
+       $(HB_UNISCRIBE_sources) \
+
+HB_HEADERS =   \
+       $(HB_BASE_headers)              \
+       $(HB_NODIST_headers)    \
+       $(HB_OT_headers)                \
+       $(HB_UNISCRIBE_headers)
+
+# Minimal set of (system) libraries needed for the HarfBuzz DLL
+HB_DEP_LIBS = usp10.lib gdi32.lib rpcrt4.lib user32.lib
+
+# We build the HarfBuzz DLL/LIB at least
+HB_LIBS = $(CFG)\$(PLAT)\harfbuzz.lib
+
+# Note: All the utility and test programs require GLib support to be present!
+HB_UTILS =
+HB_UTILS_DEP_LIBS = $(HB_GLIB_LIBS)
+HB_TESTS =
+HB_TESTS_DEP_LIBS = $(HB_GLIB_LIBS)
+
+# Use libtool-style DLL names, if desired
+!if "$(LIBTOOL_DLL_NAME)" == "1"
+HARFBUZZ_DLL_FILENAME = $(CFG)\$(PLAT)\libharfbuzz-0
+HARFBUZZ_ICU_DLL_FILENAME = $(CFG)\$(PLAT)\libharfbuzz-icu-0
+HARFBUZZ_GOBJECT_DLL_FILENAME = $(CFG)\$(PLAT)\libharfbuzz-gobject-0
+!else
+HARFBUZZ_DLL_FILENAME = $(CFG)\$(PLAT)\harfbuzz-vs$(VSVER)
+HARFBUZZ_ICU_DLL_FILENAME = $(CFG)\$(PLAT)\harfbuzz-icu-vs$(VSVER)
+HARFBUZZ_GOBJECT_DLL_FILENAME = $(CFG)\$(PLAT)\harfbuzz-gobject-vs$(VSVER)
+!endif
+
+# Enable HarfBuzz-ICU, if desired
+!if "$(ICU)" == "1"
+HB_ICU_CFLAGS =
+HB_LIBS =      \
+       $(HB_LIBS)      \
+       $(CFG)\$(PLAT)\harfbuzz-icu.lib
+
+# We don't want to re-define int8_t Visual Studio 2008, will cause build breakage
+# as we define it in hb-common.h, and we ought to use the definitions there.
+!if "$(VSVER)" == "9"
+HB_ICU_CFLAGS = /DU_HAVE_INT8_T
+!endif
+
+!endif
+
+# Enable Introspection (enables HarfBuzz-Gobject as well)
+!if "$(INTROSPECTION)" == "1"
+GOBJECT = 1
+CHECK_PACKAGE = gobject-2.0
+EXTRA_TARGETS = $(CFG)\$(PLAT)\HarfBuzz-0.0.gir $(CFG)\$(PLAT)\HarfBuzz-0.0.typelib
+!else
+EXTRA_TARGETS =
+!endif
+
+# Enable HarfBuzz-GObject (enables GLib support as well)
+!if "$(GOBJECT)" == "1"
+GLIB = 1
+HB_LIBS =      \
+       $(HB_LIBS)      \
+       $(CFG)\$(PLAT)\harfbuzz-gobject.lib
+
+HB_GOBJECT_ENUM_GENERATED_SOURCES = \
+       $(CFG)\$(PLAT)\harfbuzz-gobject\hb-gobject-enums.cc     \
+       $(CFG)\$(PLAT)\harfbuzz-gobject\hb-gobject-enums.h
+
+!endif
+
+# Enable cairo-ft (enables cairo and freetype as well)
+!if "$(CAIRO_FT)" == "1"
+HB_DEFINES = $(HB_DEFINES) /DHAVE_CAIRO_FT=1
+CAIRO = 1
+FREETYPE = 1
+!if "$(GLIB)" == "1"
+HB_UTILS = \
+       $(HB_UTILS)     \
+       $(CFG)\$(PLAT)\hb-view.exe
+
+HB_UTILS_DEP_LIBS = $(HB_UTILS_DEP_LIBS) $(CAIRO_LIB) $(FREETYPE_LIB)
+!else
+!if [echo Warning: GLib support not enabled, hb-view not built]
+!endif
+!endif
+!endif
+
+# Enable cairo
+!if "$(CAIRO)" == "1"
+HB_DEFINES = $(HB_DEFINES) /DHAVE_CAIRO=1
+!endif
+
+# Enable freetype if desired
+!if "$(FREETYPE)" == "1"
+HB_DEFINES = $(HB_DEFINES) /DHAVE_FREETYPE=1
+HB_SOURCES = $(HB_SOURCES) $(HB_FT_sources)
+HB_HEADERS = $(HB_HEADERS) $(HB_FT_headers)
+HB_DEP_LIBS = $(HB_DEP_LIBS) $(FREETYPE_LIB)
+!endif
+
+# Enable graphite2 if desired
+!if "$(GRAPHITE2)" == "1"
+HB_DEFINES = $(HB_DEFINES) /DHAVE_GRAPHITE2=1
+HB_SOURCES = $(HB_SOURCES) $(HB_GRAPHITE2_sources)
+HB_HEADERS = $(HB_HEADERS) $(HB_GRAPHITE2_headers)
+HB_DEP_LIBS = $(HB_DEP_LIBS) $(GRAPHITE2_LIB)
+!endif
+
+# Enable GLib if desired
+!if "$(GLIB)" == "1"
+HB_DEFINES = $(HB_DEFINES) /DHAVE_GLIB=1
+HB_CFLAGS =    \
+       $(HB_CFLAGS)                                    \
+       /FImsvc_recommended_pragmas.h   \
+       /I$(PREFIX)\include\glib-2.0    \
+       /I$(PREFIX)\lib\glib-2.0\include
+
+HB_SOURCES = $(HB_SOURCES) $(HB_GLIB_sources)
+HB_HEADERS = $(HB_HEADERS) $(HB_GLIB_headers)
+HB_DEP_LIBS = $(HB_DEP_LIBS) $(HB_GLIB_LIBS)
+
+HB_UTILS = \
+       $(HB_UTILS)                                     \
+       $(CFG)\$(PLAT)\hb-shape.exe     \
+       $(CFG)\$(PLAT)\hb-ot-shape-closure.exe
+
+HB_TESTS = \
+       $(HB_TESTS)     \
+       $(CFG)\$(PLAT)\main.exe                                         \
+       $(CFG)\$(PLAT)\test.exe                                         \
+       $(CFG)\$(PLAT)\test-buffer-serialize.exe        \
+       $(CFG)\$(PLAT)\test-size-params.exe                     \
+       $(CFG)\$(PLAT)\test-would-substitute.exe        \
+       $(CFG)\$(PLAT)\test-blob.exe                            \
+       $(CFG)\$(PLAT)\test-buffer.exe                          \
+       $(CFG)\$(PLAT)\test-common.exe                          \
+       $(CFG)\$(PLAT)\test-font.exe                            \
+       $(CFG)\$(PLAT)\test-object.exe                          \
+       $(CFG)\$(PLAT)\test-set.exe                                     \
+       $(CFG)\$(PLAT)\test-shape.exe                           \
+       $(CFG)\$(PLAT)\test-unicode.exe                         \
+       $(CFG)\$(PLAT)\test-version.exe
+
+!else
+# If there is no GLib support, use the built-in UCDN
+# and define some of the macros in GLib's msvc_recommended_pragmas.h
+# to reduce some unneeded build-time warnings
+HB_DEFINES = $(HB_DEFINES) /DHAVE_UCDN=1
+HB_CFLAGS =    \
+       $(HB_CFLAGS)                                    \
+       $(HB_UCDN_CFLAGS)                               \
+       /wd4244                                                 \
+       /D_CRT_SECURE_NO_WARNINGS               \
+       /D_CRT_NONSTDC_NO_WARNINGS
+
+HB_SOURCES = $(HB_SOURCES) $(LIBHB_UCDN_sources) $(HB_UCDN_sources)
+!endif
+
+HB_LIB_CFLAGS = $(HB_CFLAGS) /DHB_EXTERN="__declspec (dllexport) extern"
diff --git a/win32/create-lists-msvc.mak b/win32/create-lists-msvc.mak
new file mode 100644 (file)
index 0000000..9b5574b
--- /dev/null
@@ -0,0 +1,151 @@
+# Convert the source listing to object (.obj) listing in
+# another NMake Makefile module, include it, and clean it up.
+# This is a "fact-of-life" regarding NMake Makefiles...
+# This file does not need to be changed unless one is maintaining the NMake Makefiles
+
+# For those wanting to add things here:
+# To add a list, do the following:
+# # $(description_of_list)
+# if [call create-lists.bat header $(makefile_snippet_file) $(variable_name)]
+# endif
+#
+# if [call create-lists.bat file $(makefile_snippet_file) $(file_name)]
+# endif
+#
+# if [call create-lists.bat footer $(makefile_snippet_file)]
+# endif
+# ... (repeat the if [call ...] lines in the above order if needed)
+# !include $(makefile_snippet_file)
+#
+# (add the following after checking the entries in $(makefile_snippet_file) is correct)
+# (the batch script appends to $(makefile_snippet_file), you will need to clear the file unless the following line is added)
+#!if [del /f /q $(makefile_snippet_file)]
+#!endif
+
+# In order to obtain the .obj filename that is needed for NMake Makefiles to build DLLs/static LIBs or EXEs, do the following
+# instead when doing 'if [call create-lists.bat file $(makefile_snippet_file) $(file_name)]'
+# (repeat if there are multiple $(srcext)'s in $(source_list), ignore any headers):
+# !if [for %c in ($(source_list)) do @if "%~xc" == ".$(srcext)" @call create-lists.bat file $(makefile_snippet_file) $(intdir)\%~nc.obj]
+#
+# $(intdir)\%~nc.obj needs to correspond to the rules added in build-rules-msvc.mak
+# %~xc gives the file extension of a given file, %c in this case, so if %c is a.cc, %~xc means .cc
+# %~nc gives the file name of a given file without extension, %c in this case, so if %c is a.cc, %~nc means a
+
+NULL=
+
+# For HarfBuzz
+!if [call create-lists.bat header hb_objs.mak harfbuzz_dll_OBJS]
+!endif
+
+!if [for %c in ($(HB_SOURCES)) do @if "%~xc" == ".cc" @call create-lists.bat file hb_objs.mak ^$(CFG)\^$(PLAT)\harfbuzz\%~nc.obj]
+!endif
+
+!if [for %c in ($(HB_SOURCES)) do @if "%~xc" == ".c" @call create-lists.bat file hb_objs.mak ^$(CFG)\^$(PLAT)\harfbuzz\%~nc.obj]
+!endif
+
+!if [call create-lists.bat footer hb_objs.mak]
+!endif
+
+# For HarfBuzz-GObject
+!if "$(GOBJECT)" == "1"
+
+!if [call create-lists.bat header hb_objs.mak harfbuzz_gobject_OBJS]
+!endif
+
+!if [for %c in ($(HB_GOBJECT_sources) $(HB_GOBJECT_ENUM_sources)) do @if "%~xc" == ".cc" @call create-lists.bat file hb_objs.mak ^$(CFG)\^$(PLAT)\harfbuzz-gobject\%~nc.obj]
+!endif
+
+!if [call create-lists.bat footer hb_objs.mak]
+!endif
+!endif
+
+# For HarfBuzz-ICU
+!if "$(ICU)" == "1"
+
+!if [call create-lists.bat header hb_objs.mak harfbuzz_icu_OBJS]
+!endif
+
+!if [for %c in ($(HB_ICU_sources)) do @if "%~xc" == ".cc" @call create-lists.bat file hb_objs.mak ^$(CFG)\^$(PLAT)\harfbuzz-icu\%~nc.obj]
+!endif
+
+!if [call create-lists.bat footer hb_objs.mak]
+!endif
+!endif
+
+# For the utility programs (GLib support is required)
+!if "$(GLIB)" == "1"
+
+# For hb-view, Cairo-FT support is required
+!if "$(CAIRO_FT)" == "1"
+
+!if [call create-lists.bat header hb_objs.mak hb_view_OBJS]
+!endif
+
+!if [for %c in ($(HB_VIEW_sources)) do @if "%~xc" == ".cc" @call create-lists.bat file hb_objs.mak ^$(CFG)\^$(PLAT)\util\%~nc.obj]
+!endif
+
+!if [call create-lists.bat footer hb_objs.mak]
+!endif
+!endif
+
+# For hb-shape
+!if [call create-lists.bat header hb_objs.mak hb_shape_OBJS]
+!endif
+
+!if [for %c in ($(HB_SHAPE_sources)) do @if "%~xc" == ".cc" @call create-lists.bat file hb_objs.mak ^$(CFG)\^$(PLAT)\util\%~nc.obj]
+!endif
+
+!if [call create-lists.bat footer hb_objs.mak]
+!endif
+
+# For hb-ot-shape-closure
+
+!if [call create-lists.bat header hb_objs.mak hb_ot_shape_closure_OBJS]
+!endif
+
+!if [for %c in ($(HB_OT_SHAPE_CLOSURE_sources)) do @if "%~xc" == ".cc" @call create-lists.bat file hb_objs.mak ^$(CFG)\^$(PLAT)\util\%~nc.obj]
+!endif
+
+!if [call create-lists.bat footer hb_objs.mak]
+!endif
+
+!endif
+
+!include hb_objs.mak
+
+!if [del /f /q hb_objs.mak]
+!endif
+
+# Gather the list of headers and sources for introspection and glib-mkenums
+!if [call create-lists.bat header hb_srcs.mak HB_ACTUAL_HEADERS]
+!endif
+
+!if [for %h in ($(HB_HEADERS)) do @call create-lists.bat file hb_srcs.mak ..\src\%h]
+!endif
+
+!if [call create-lists.bat footer hb_srcs.mak]
+!endif
+
+# Gather the lists of sources for introspection
+!if [call create-lists.bat header hb_srcs.mak HB_ACTUAL_SOURCES]
+!endif
+
+!if [for %s in ($(HB_SOURCES)) do @call create-lists.bat file hb_srcs.mak ..\src\%s]
+!endif
+
+!if [call create-lists.bat footer hb_srcs.mak]
+!endif
+
+!if [call create-lists.bat header hb_srcs.mak HB_GOBJECT_ACTUAL_SOURCES]
+!endif
+
+!if [for %s in ($(HB_GOBJECT_sources) $(HB_GOBJECT_STRUCTS_headers)) do @call create-lists.bat file hb_srcs.mak ..\src\%s]
+!endif
+
+!if [call create-lists.bat footer hb_srcs.mak]
+!endif
+
+!include hb_srcs.mak
+
+!if [del /f /q hb_srcs.mak]
+!endif
diff --git a/win32/create-lists.bat b/win32/create-lists.bat
new file mode 100644 (file)
index 0000000..ef60d5c
--- /dev/null
@@ -0,0 +1,42 @@
+@echo off
+rem Simple .bat script for creating the NMake Makefile snippets.
+
+if not "%1" == "header" if not "%1" == "file" if not "%1" == "footer" goto :error_cmd
+if "%2" == "" goto error_no_destfile
+
+if "%1" == "header" goto :header
+if "%1" == "file" goto :addfile
+if "%1" == "footer" goto :footer
+
+:header
+if "%3" == "" goto error_var
+echo %3 =      \>>%2
+goto done
+
+:addfile
+if "%3" == "" goto error_file
+echo.  %3      \>>%2
+goto done
+
+:footer
+echo.  $(NULL)>>%2
+echo.>>%2
+goto done
+
+:error_cmd
+echo Specified command '%1' was invalid.  Valid commands are: header file footer.
+goto done
+
+:error_no_destfile
+echo Destination NMake snippet file must be specified
+goto done
+
+:error_var
+echo A name must be specified for using '%1'.
+goto done
+
+:error_file
+echo A file must be specified for using '%1'.
+goto done
+
+:done
\ No newline at end of file
diff --git a/win32/detectenv-msvc.mak b/win32/detectenv-msvc.mak
new file mode 100644 (file)
index 0000000..a94ab84
--- /dev/null
@@ -0,0 +1,136 @@
+# Change this (or specify PREFIX= when invoking this NMake Makefile) if
+# necessary, so that the libs and headers of the dependent third-party
+# libraries can be located.  For instance, if building from GLib's
+# included Visual Studio projects, this should be able to locate the GLib
+# build out-of-the-box if they were not moved.  GLib's headers will be
+# found in $(GLIB_PREFIX)\include\glib-2.0 and
+# $(GLIB_PREFIX)\lib\glib-2.0\include and its import library will be found
+# in $(GLIB_PREFIX)\lib.
+
+!if "$(PREFIX)" == ""
+PREFIX = ..\..\vs$(VSVER)\$(PLAT)
+!endif
+
+# Location of the PERL interpretor, for running glib-mkenums.  glib-mkenums
+# needs to be found in $(PREFIX)\bin.  Using either a 32-bit or x64 PERL
+# interpretor are supported for either a 32-bit or x64 build.
+
+!if "$(PERL)" == ""
+PERL = perl
+!endif
+
+# Location of the Python interpretor, for building introspection.  The complete set
+# of Python Modules for introspection (the giscanner Python scripts and the _giscanner.pyd
+# compiled module) needs to be found in $(PREFIX)\lib\gobject-introspection\giscanner, and
+# the g-ir-scanner Python script and g-ir-compiler utility program needs to be found
+# in $(PREFIX)\bin, together with any DLLs they will depend on, if those DLLs are not already
+# in your PATH.
+# Note that the Python interpretor and the introspection modules and utility progam must
+# correspond to the build type (i.e. 32-bit Release for 32-bit Release builds, and so on).
+#
+# For introspection, currently only Python 2.7.x is supported.  This may change when Python 3.x
+# support is added upstream in gobject-introspection--when this happens, the _giscanner.pyd must
+# be the one that is built against the release series of Python that is used here.
+
+!if "$(PYTHON)" == ""
+PYTHON = python
+!endif
+
+# Location of the pkg-config utility program, for building introspection.  It needs to be able
+# to find the pkg-config (.pc) files so that the correct libraries and headers for the needed libraries
+# can be located, using PKG_CONFIG_PATH.  Using either a 32-bit or x64 pkg-config are supported for
+# either a 32-bit or x64 build.
+
+!if "$(PKG_CONFIG)" == ""
+PKG_CONFIG = pkg-config
+!endif
+
+# The items below this line should not be changed, unless one is maintaining
+# the NMake Makefiles.  The exception is for the CFLAGS_ADD line(s) where one
+# could use his/her desired compiler optimization flags, if he/she knows what is
+# being done.
+
+# Check to see we are configured to build with MSVC (MSDEVDIR, MSVCDIR or
+# VCINSTALLDIR) or with the MS Platform SDK (MSSDK or WindowsSDKDir)
+!if !defined(VCINSTALLDIR) && !defined(WINDOWSSDKDIR)
+MSG = ^
+This Makefile is only for Visual Studio 2008 and later.^
+You need to ensure that the Visual Studio Environment is properly set up^
+before running this Makefile.
+!error $(MSG)
+!endif
+
+ERRNUL  = 2>NUL
+_HASH=^#
+
+!if ![echo VCVERSION=_MSC_VER > vercl.x] \
+    && ![echo $(_HASH)if defined(_M_IX86) >> vercl.x] \
+    && ![echo PLAT=Win32 >> vercl.x] \
+    && ![echo $(_HASH)elif defined(_M_AMD64) >> vercl.x] \
+    && ![echo PLAT=x64 >> vercl.x] \
+    && ![echo $(_HASH)endif >> vercl.x] \
+    && ![cl -nologo -TC -P vercl.x $(ERRNUL)]
+!include vercl.i
+!if ![echo VCVER= ^\> vercl.vc] \
+    && ![set /a $(VCVERSION) / 100 - 6 >> vercl.vc]
+!include vercl.vc
+!endif
+!endif
+!if ![del $(ERRNUL) /q/f vercl.x vercl.i vercl.vc]
+!endif
+
+!if $(VCVERSION) > 1499 && $(VCVERSION) < 1600
+VSVER = 9
+!elseif $(VCVERSION) > 1599 && $(VCVERSION) < 1700
+VSVER = 10
+!elseif $(VCVERSION) > 1699 && $(VCVERSION) < 1800
+VSVER = 11
+!elseif $(VCVERSION) > 1799 && $(VCVERSION) < 1900
+VSVER = 12
+!elseif $(VCVERSION) > 1899 && $(VCVERSION) < 2000
+VSVER = 14
+!else
+VSVER = 0
+!endif
+
+!if "$(VSVER)" == "0"
+MSG = ^
+This NMake Makefile set supports Visual Studio^
+9 (2008) through 14 (2015).  Your Visual Studio^
+version is not supported.
+!error $(MSG)
+!endif
+
+VALID_CFGSET = FALSE
+!if "$(CFG)" == "release" || "$(CFG)" == "debug"
+VALID_CFGSET = TRUE
+!endif
+
+# One may change these items, but be sure to test
+# the resulting binaries
+!if "$(CFG)" == "release"
+CFLAGS_ADD = /MD /O2 /GL /MP
+!if "$(VSVER)" != "9"
+CFLAGS_ADD = $(CFLAGS_ADD) /d2Zi+
+!endif
+!else
+CFLAGS_ADD = /MDd /Od
+!endif
+
+!if "$(PLAT)" == "x64"
+LDFLAGS_ARCH = /machine:x64
+!else
+LDFLAGS_ARCH = /machine:x86
+!endif
+
+!if "$(VALID_CFGSET)" == "TRUE"
+CFLAGS = $(CFLAGS_ADD) /W3 /Zi /I.. /I..\src /I. /I$(PREFIX)\include
+
+LDFLAGS_BASE = $(LDFLAGS_ARCH) /libpath:$(PREFIX)\lib /DEBUG
+
+!if "$(CFG)" == "debug"
+LDFLAGS = $(LDFLAGS_BASE)
+!else
+LDFLAGS = $(LDFLAGS_BASE) /opt:ref /LTCG
+!endif
+!endif
diff --git a/win32/generate-msvc.mak b/win32/generate-msvc.mak
new file mode 100644 (file)
index 0000000..48bd9f0
--- /dev/null
@@ -0,0 +1,26 @@
+# NMake Makefile portion for code generation and
+# intermediate build directory creation
+# Items in here should not need to be edited unless
+# one is maintaining the NMake build files.
+
+# Copy the pre-defined config.h.win32
+config.h: config.h.win32
+       @-copy $@.win32 $@
+
+# Generate the enumeration sources and headers
+# sed is not normally available on Windows, but since
+# 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)
+       $(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 $@.tmp1
+       @-del $@.tmp2
+!endif
+
+# Create the build directories
+$(CFG)\$(PLAT)\harfbuzz $(CFG)\$(PLAT)\harfbuzz-icu $(CFG)\$(PLAT)\harfbuzz-gobject $(CFG)\$(PLAT)\util:
+       @-mkdir $@
diff --git a/win32/hb-introspection-msvc.mak b/win32/hb-introspection-msvc.mak
new file mode 100644 (file)
index 0000000..67a0c5e
--- /dev/null
@@ -0,0 +1,42 @@
+
+!if "$(BUILD_INTROSPECTION)" == "TRUE"
+# Create the file list for introspection (to avoid the dreaded command-line-too-long problem on Windows)
+$(CFG)\$(PLAT)\hb_list: $(HB_ACTUAL_HEADERS) $(HB_ACTUAL_SOURCES) $(HB_GOBJECT_ENUM_GENERATED_SOURCES) $(HB_GOBJECT_ACTUAL_SOURCES)
+       @for %f in ($(HB_ACTUAL_HEADERS) $(HB_ACTUAL_SOURCES) $(HB_GOBJECT_ENUM_GENERATED_SOURCES) $(HB_GOBJECT_ACTUAL_SOURCES)) do @echo %f >> $@
+
+$(CFG)\$(PLAT)\HarfBuzz-0.0.gir: $(CFG)\$(PLAT)\harfbuzz-gobject.lib $(CFG)\$(PLAT)\hb_list
+       @set LIB=$(CFG)\$(PLAT);$(PREFIX)\lib;$(LIB)
+       @set PATH=$(CFG)\$(PLAT);$(PREFIX)\bin;$(PATH)
+       @-echo Generating $@...
+       $(PYTHON) $(G_IR_SCANNER)       \
+       --verbose -no-libtool   \
+       -I..\src -n hb --identifier-prefix=hb_ --warn-all       \
+       --namespace=HarfBuzz    \
+       --nsversion=0.0 \
+       --include=GObject-2.0   \
+       --library=harfbuzz-gobject      \
+       --library=harfbuzz      \
+       --add-include-path=$(G_IR_INCLUDEDIR)   \
+       --pkg-export=harfbuzz   \
+       --cflags-begin  \
+       $(CFLAGS) $(HB_DEFINES) $(HB_CFLAGS)    \
+       -DHB_H \
+       -DHB_H_IN \
+       -DHB_OT_H \
+       -DHB_OT_H_IN \
+       -DHB_GOBJECT_H \
+       -DHB_GOBJECT_H_IN \
+       --cflags-end    \
+       --filelist=$(CFG)\$(PLAT)\hb_list       \
+       -o $@
+
+$(CFG)\$(PLAT)\HarfBuzz-0.0.typelib: $(CFG)\$(PLAT)\HarfBuzz-0.0.gir
+       @copy $*.gir $(@B).gir
+       $(PREFIX)\bin\g-ir-compiler     \
+       --includedir=$(CFG)\$(PLAT) --debug --verbose   \
+       $(@B).gir       \
+       -o $@
+       @del $(@B).gir
+!else
+!error $(ERROR_MSG)
+!endif
diff --git a/win32/info-msvc.mak b/win32/info-msvc.mak
new file mode 100644 (file)
index 0000000..c009639
--- /dev/null
@@ -0,0 +1,130 @@
+# NMake Makefile portion for displaying config info
+
+INC_FEATURES = Uniscribe Fallback OT
+BUILT_TOOLS =
+BUILT_LIBRARIES = HarfBuzz
+
+!if "$(GLIB)" == "1"
+UNICODE_IMPL = GLib
+INC_FEATURES = $(INC_FEATURES) GLib
+BUILT_TOOLS = hb-shape.exe hb-ot-shape-closure.exe
+!if "$(CAIRO_FT)" == "1"
+BUILT_TOOLS = hb-view.exe $(BUILT_TOOLS)
+!endif
+!else
+UNICODE_IMPL = ucdn
+!endif
+
+!if "$(FREETYPE)" == "1"
+INC_FEATURES = $(INC_FEATURES) FreeType
+!endif
+
+!if "$(GRAPHITE2)" == "1"
+INC_FEATURES = $(INC_FEATURES) Graphite2
+!endif
+
+!if "$(ICU)" == "1"
+BUILT_LIBRARIES = $(BUILT_LIBRARIES) HarfBuzz-ICU
+!endif
+
+!if "$(GOBJECT)" == "1"
+BUILT_LIBRARIES = $(BUILT_LIBRARIES) HarfBuzz-GObject
+!endif
+
+!if "$(INTROSPECTION)" == "1"
+BUILD_INTROSPECTION = yes
+!else
+BUILD_INTROSPECTION = no
+!endif
+
+build-info-hb:
+       @echo.
+       @echo ==================================
+       @echo Configuration for HarfBuzz Library
+       @echo ==================================
+       @echo Unicode Implementation: $(UNICODE_IMPL)
+       @echo Enabled Features: $(INC_FEATURES)
+
+all-build-info: build-info-hb
+       @echo.
+       @echo ----------------
+       @echo Other build info
+       @echo ----------------
+       @echo Built Libraries: $(BUILT_LIBRARIES)
+       @echo Built Tools: $(BUILT_TOOLS)
+       @echo Introspection: $(BUILD_INTROSPECTION)
+
+help:
+       @echo.
+       @echo =============================
+       @echo Building HarfBuzz Using NMake
+       @echo =============================
+       @echo nmake /f Makefile.vc CFG=[release^|debug] ^<PREFIX=PATH^> OPTION=1 ...
+       @echo.
+       @echo Where:
+       @echo ------
+       @echo CFG: Required, use CFG=release for an optimized build and CFG=debug
+       @echo for a debug build.  PDB files are generated for all builds.
+       @echo.
+       @echo PREFIX: Optional, the path where dependent libraries and tools may be
+       @echo found, default is ^$(srcrootdir)\..\vs^$(short_vs_ver)\^$(platform),
+       @echo where ^$(short_vs_ver) is 9 for VS 2008, 10 for VS 2010 and so on; and
+       @echo ^$(platform) is Win32 for 32-bit builds and x64 for x64 builds.
+       @echo.
+       @echo OPTION: Optional, may be any of the following, use OPTION=1 to enable;
+       @echo multiple OPTION's may be used.  If no OPTION is specified, a default
+       @echo HarfBuzz DLL is built with OpenType, fallback and Uniscribe support
+       @echo with a bundled Unicode implementation (UCDN).
+       @echo ======
+       @echo GRAPHITE2:
+       @echo Enable graphite2 support, requires the SIL Graphite2 library
+       @echo.
+       @echo FREETYPE:
+       @echo Enable FreeType2 support, requires the FreeType2 library
+       @echo.
+       @echo GLIB:
+       @echo Enable GLib2 support, with GLib Unicode support, requires the GNOME GLib2
+       @echo library.  Enables the build of utility programs.
+       @echo.
+       @echo ICU:
+       @echo Enable the HarfBuzz-ICU layout library, requires the International
+       @echo Components for Unicode (ICU) libraries.
+       @echo.
+       @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 interpretor (use
+       @echo PERL=^$(PATH_TO_PERL_INTERPRETOR)) if it is not already in your PATH).
+       @echo.
+       @echo INTROSPECTION:
+       @echo Enable the build of introspection files, also implies GObject/GLib2 support,
+       @echo requires the GNOME gobject-introspection libraries and tools.  You will need
+       @echo to ensure the pkg-config (.pc) files can be found for GObject-2.0 and the
+       @echo Python interpretor (that was used to build the gobject-introsoection tools)
+       @echo can be found by setting PKG_CONFIG_PATH beforehand, and passing in PYTHON=
+       @echo ^$(PATH_TO_PYTHON_INTERPRETOR) respectively, if python.exe is not already
+       @echo in your PATH.
+       @echo.
+       @echo CAIRO_FT:
+       @echo Enables Cairo-Freetype support, needed for the build of the hb-view utility.
+       @echo Implies FreeType2 support and also requires Cairo built with FreeType2
+       @echo support; GLib2 support must also be enabled.
+       @echo.
+       @echo LIBTOOL_DLL_NAME:
+       @echo Use a libtool-style DLL name to mimic the DLL file naming generated by
+       @echo MinGW builds.
+       @echo.
+       @echo Note that GLib2 support is required for all utility and test programs.
+       @echo ======
+       @echo A 'clean' target is supported to remove all generated files, intermediate
+       @echo object files and binaries for the specified configuration.
+       @echo.
+       @echo A 'tests' target is supported to build the test programs, if GLib2 support
+       @echo is enabled.  Use after building the libraries and utilities.
+       @echo.
+       @echo An 'install' target is supported to copy the build (DLLs, utility programs,
+       @echo LIBs, along with the introspection files if applicable) to appropriate
+       @echo locations under ^$(PREFIX).
+       @echo ======
+       @echo.
+       
diff --git a/win32/install.mak b/win32/install.mak
new file mode 100644 (file)
index 0000000..fa239ea
--- /dev/null
@@ -0,0 +1,29 @@
+# NMake Makefile snippet for copying the built libraries, utilities and headers to
+# a path under $(PREFIX).
+
+install: all
+       @if not exist $(PREFIX)\bin\ mkdir $(PREFIX)\bin
+       @if not exist $(PREFIX)\lib\ mkdir $(PREFIX)\lib
+       @if not exist $(PREFIX)\include\harfbuzz\ mkdir $(PREFIX)\include\harfbuzz
+       @copy /b $(HARFBUZZ_DLL_FILENAME).dll $(PREFIX)\bin
+       @copy /b $(HARFBUZZ_DLL_FILENAME).pdb $(PREFIX)\bin
+       @copy /b $(CFG)\$(PLAT)\harfbuzz.lib $(PREFIX)\lib
+       @if exist $(HARFBUZZ_ICU_DLL_FILENAME).dll copy /b $(HARFBUZZ_ICU_DLL_FILENAME).dll $(PREFIX)\bin
+       @if exist $(HARFBUZZ_ICU_DLL_FILENAME).dll copy /b $(HARFBUZZ_ICU_DLL_FILENAME).pdb $(PREFIX)\bin
+       @if exist $(HARFBUZZ_ICU_DLL_FILENAME).dll copy /b $(CFG)\$(PLAT)\harfbuzz-icu.lib $(PREFIX)\lib
+       @if exist $(HARFBUZZ_GOBJECT_DLL_FILENAME).dll copy /b $(HARFBUZZ_GOBJECT_DLL_FILENAME).dll $(PREFIX)\bin
+       @if exist $(HARFBUZZ_GOBJECT_DLL_FILENAME).dll copy /b $(HARFBUZZ_GOBJECT_DLL_FILENAME).pdb $(PREFIX)\bin
+       @if exist $(HARFBUZZ_GOBJECT_DLL_FILENAME).dll copy /b $(CFG)\$(PLAT)\harfbuzz-gobject.lib $(PREFIX)\lib
+       @if exist $(CFG)\$(PLAT)\hb-view.exe copy /b $(CFG)\$(PLAT)\hb-view.exe $(PREFIX)\bin
+       @if exist $(CFG)\$(PLAT)\hb-view.exe copy /b $(CFG)\$(PLAT)\hb-view.pdb $(PREFIX)\bin
+       @if exist $(CFG)\$(PLAT)\hb-ot-shape-closure.exe copy /b $(CFG)\$(PLAT)\hb-ot-shape-closure.exe $(PREFIX)\bin
+       @if exist $(CFG)\$(PLAT)\hb-ot-shape-closure.exe copy /b $(CFG)\$(PLAT)\hb-ot-shape-closure.pdb $(PREFIX)\bin
+       @if exist $(CFG)\$(PLAT)\hb-shape.exe copy /b $(CFG)\$(PLAT)\hb-shape.exe $(PREFIX)\bin
+       @if exist $(CFG)\$(PLAT)\hb-shape.exe copy /b $(CFG)\$(PLAT)\hb-shape.pdb $(PREFIX)\bin
+       @for %h in ($(HB_ACTUAL_HEADERS)) do @copy %h $(PREFIX)\include\harfbuzz
+       @if exist $(HARFBUZZ_ICU_DLL_FILENAME).dll for %h in ($(HB_ICU_headers)) do @copy ..\src\%h $(PREFIX)\include\harfbuzz
+       @if exist $(HARFBUZZ_GOBJECT_DLL_FILENAME).dll for %h in ($(HB_GOBJECT_headers)) do @copy ..\src\%h $(PREFIX)\include\harfbuzz
+       @if exist $(HARFBUZZ_GOBJECT_DLL_FILENAME).dll copy $(CFG)\$(PLAT)\harfbuzz-gobject\hb-gobject-enums.h $(PREFIX)\include\harfbuzz
+       @rem Copy the generated introspection files
+       @if exist $(CFG)\$(PLAT)\HarfBuzz-0.0.gir copy $(CFG)\$(PLAT)\HarfBuzz-0.0.gir $(PREFIX)\share\gir-1.0
+       @if exist $(CFG)\$(PLAT)\HarfBuzz-0.0.typelib copy /b $(CFG)\$(PLAT)\HarfBuzz-0.0.typelib $(PREFIX)\lib\girepository-1.0
diff --git a/win32/introspection-msvc.mak b/win32/introspection-msvc.mak
new file mode 100644 (file)
index 0000000..d32f7cf
--- /dev/null
@@ -0,0 +1,73 @@
+# Common NMake Makefile module for checking the build environment is sane
+# for building introspection files under MSVC/NMake.
+# This can be copied from $(gi_srcroot)\build\win32 for GNOME items
+# that support MSVC builds and introspection under MSVC.
+
+# Can override with env vars as needed
+# You will need to have built gobject-introspection for this to work.
+# Change or pass in or set the following to suit your environment
+
+!if "$(PREFIX)" == ""
+PREFIX = ..\..\..\vs$(VSVER)\$(PLAT)
+!endif
+
+# Note: The PYTHON must be the Python release series that was used to build
+# the GObject-introspection scanner Python module!
+# Either having python.exe your PATH will work or passing in
+# PYTHON=<full path to your Python interpretor> will do
+
+# This is required, and gobject-introspection needs to be built
+# before this can be successfully run.
+!if "$(PYTHON)" == ""
+PYTHON=python
+!endif
+
+# Don't change anything following this line!
+
+GIR_SUBDIR = share\gir-1.0
+GIR_TYPELIBDIR = lib\girepository-1.0
+G_IR_SCANNER = $(PREFIX)\bin\g-ir-scanner
+G_IR_COMPILER = $(PREFIX)\bin\g-ir-compiler.exe
+G_IR_INCLUDEDIR = $(PREFIX)\$(GIR_SUBDIR)
+G_IR_TYPELIBDIR = $(PREFIX)\$(GIR_TYPELIBDIR)
+
+VALID_PKG_CONFIG_PATH = FALSE
+
+MSG_INVALID_PKGCONFIG = You must set or specifiy a valid PKG_CONFIG_PATH
+MSG_INVALID_CFG = You need to specify or set CFG to be release or debug to use this Makefile to build the Introspection Files
+
+ERROR_MSG =
+
+BUILD_INTROSPECTION = TRUE
+
+!if ![pkg-config --print-errors --errors-to-stdout $(CHECK_PACKAGE) > pkgconfig.x]     \
+       && ![setlocal]  \
+       && ![set file="pkgconfig.x"]    \
+       && ![FOR %A IN (%file%) DO @echo PKG_CHECK_SIZE=%~zA > pkgconfig.chksize]       \
+       && ![del $(ERRNUL) /q/f pkgconfig.x]
+!endif
+
+!include pkgconfig.chksize
+!if "$(PKG_CHECK_SIZE)" == "0"
+VALID_PKG_CONFIG_PATH = TRUE
+!else
+VALID_PKG_CONFIG_PATH = FALSE
+!endif
+
+!if ![del $(ERRNUL) /q/f pkgconfig.chksize]
+!endif
+
+VALID_CFGSET = FALSE
+!if "$(CFG)" == "release" || "$(CFG)" == "debug"
+VALID_CFGSET = TRUE
+!endif
+
+!if "$(VALID_PKG_CONFIG_PATH)" != "TRUE"
+BUILD_INTROSPECTION = FALSE
+ERROR_MSG = $(MSG_INVALID_PKGCONFIG)
+!endif
+
+!if "$(VALID_CFGSET)" != "TRUE"
+BUILD_INTROSPECTION = FALSE
+ERROR_MSG = $(MSG_INVALID_CFG)
+!endif