Remove nmake port of harfbuzz (#562)

This commit is contained in:
ebraminio 2017-10-12 12:11:47 +03:30 committed by Behdad Esfahbod
parent 4e4781319b
commit dfeccd073a
22 changed files with 9 additions and 1750 deletions

View File

@ -5,7 +5,13 @@ Cairo, and GLib. For example, on Ubuntu / Debian, you would do:
whereas on Fedora, RHEL, CentOS, and other Red Hat based systems you would do: whereas on Fedora, RHEL, CentOS, and other Red Hat based systems you would do:
* sudo yum install gcc gcc-c++ freetype-devel glib2-devel cairo-devel * sudo yum install gcc gcc-c++ freetype-devel glib2-devel cairo-devel
on the Mac, using MacPorts: on Windows, consider using [vcpkg](https://github.com/Microsoft/vcpkg),
provided by Microsoft, for building HarfBuzz and other open-source libraries
but if you need to build harfbuzz from source, put ragel binary on your
PATH and follow appveyor CI's cmake
[https://github.com/behdad/harfbuzz/blob/master/appveyor.yml](build steps).
on macOS, using MacPorts:
* sudo port install freetype glib2 cairo * sudo port install freetype glib2 cairo
or using Homebrew: or using Homebrew:
@ -14,9 +20,7 @@ or using Homebrew:
If you are using a tarball, you can now proceed to running configure and make 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 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 library in src/, and a few utility programs including hb-view and hb-shape
under util/. From the tarball, NMake Makefiles are also provided in win32/, under util/.
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 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, run autogen.sh for the first time. Namely, pkg-config and ragel. Again,
on Ubuntu / Debian: on Ubuntu / Debian:

View File

@ -4,7 +4,7 @@ NULL =
ACLOCAL_AMFLAGS = -I m4 ACLOCAL_AMFLAGS = -I m4
SUBDIRS = src util test docs win32 SUBDIRS = src util test docs
EXTRA_DIST = \ EXTRA_DIST = \
autogen.sh \ autogen.sh \

View File

@ -15,23 +15,6 @@ environment:
platform: ARM platform: ARM
configuration: Debug configuration: Debug
- compiler: nmake
ARCH: amd64
VCPKG_ARCH: x64-windows
CFG: debug
- compiler: nmake
ARCH: x86
VCPKG_ARCH: x86-windows
CFG: debug
# - compiler: nmake
# ARCH: amd64
# VCPKG_ARCH: x64-windows
# CFG: release
# - compiler: nmake
# ARCH: x86
# VCPKG_ARCH: x86-windows
# CFG: release
- compiler: msys2 - compiler: msys2
MINGW_PREFIX: /c/msys2/mingw64/ MINGW_PREFIX: /c/msys2/mingw64/
MINGW_CHOST: x86_64-w64-mingw32 MINGW_CHOST: x86_64-w64-mingw32
@ -44,14 +27,6 @@ environment:
install: install:
- C:\msys64\usr\bin\bash -lc "pacman --noconfirm -S mingw-w64-x86_64-ragel" - C:\msys64\usr\bin\bash -lc "pacman --noconfirm -S mingw-w64-x86_64-ragel"
- 'if "%compiler%"=="nmake" call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" %ARCH%'
# - 'if "%compiler%"=="nmake" git clone https://github.com/Microsoft/vcpkg'
# - 'if "%compiler%"=="nmake" cd vcpkg'
# - 'if "%compiler%"=="nmake" powershell -exec bypass scripts\bootstrap.ps1'
# - 'if "%compiler%"=="nmake" vcpkg install freetype:%VCPKG_ARCH%'
# - 'if "%compiler%"=="nmake" copy installed\%VCPKG_ARCH%\debug\lib\freetyped.lib installed\%VCPKG_ARCH%\lib'
# - 'if "%compiler%"=="nmake" cd ..'
build_script: build_script:
- 'if "%compiler%"=="cmake" md build' - 'if "%compiler%"=="cmake" md build'
- 'if "%compiler%"=="cmake" cd build' - 'if "%compiler%"=="cmake" cd build'
@ -59,11 +34,6 @@ build_script:
- 'if "%compiler%"=="cmake" cmake -DHB_HAVE_UNISCRIBE=ON -DHB_HAVE_DIRECTWRITE=ON -G "%generator%" ../' - 'if "%compiler%"=="cmake" cmake -DHB_HAVE_UNISCRIBE=ON -DHB_HAVE_DIRECTWRITE=ON -G "%generator%" ../'
- 'if "%compiler%"=="cmake" msbuild harfbuzz.sln /p:Configuration=%configuration% /p:Platform=%platform%' - 'if "%compiler%"=="cmake" msbuild harfbuzz.sln /p:Configuration=%configuration% /p:Platform=%platform%'
- 'if "%compiler%"=="nmake" C:\msys64\usr\bin\bash -lc "cd $APPVEYOR_BUILD_FOLDER; PATH=$PATH:/mingw64/bin:/mingw32/bin; ./autogen.sh; make distdir"'
- 'if "%compiler%"=="nmake" cd harfbuzz-*\win32'
- 'if "%compiler%"=="nmake" nmake /f Makefile.vc CFG=%CFG% UNISCRIBE=1 DIRECTWRITE=1' # FREETYPE=1 FREETYPE_DIR=..\..\vcpkg\installed\%VCPKG_ARCH%\include ADDITIONAL_LIB_DIR=..\..\vcpkg\installed\%VCPKG_ARCH%\lib'
- 'if "%compiler%"=="nmake" nmake /f Makefile.vc CFG=%CFG% UNISCRIBE=1 DIRECTWRITE=1 install' # FREETYPE=1 install'
- 'if "%compiler%"=="msys2" C:\msys64\usr\bin\bash -lc "pacman --noconfirm -S mingw-w64-$MSYS2_ARCH-{freetype,cairo,icu,gettext,gobject-introspection,gcc,gcc-libs,glib2,graphite2,pkg-config}"' - 'if "%compiler%"=="msys2" C:\msys64\usr\bin\bash -lc "pacman --noconfirm -S mingw-w64-$MSYS2_ARCH-{freetype,cairo,icu,gettext,gobject-introspection,gcc,gcc-libs,glib2,graphite2,pkg-config}"'
- 'if "%compiler%"=="msys2" C:\msys64\usr\bin\bash -lc "cd $APPVEYOR_BUILD_FOLDER; PATH=$PATH:/mingw64/bin:/mingw32/bin; ./autogen.sh --with-uniscribe --with-freetype --with-glib --with-gobject --with-cairo --with-icu --with-graphite2 --build=%MINGW_CHOST% --host=%MINGW_CHOST% --prefix=%MINGW_PREFIX%; make; make check || (cat */test-suite.log test/*/test-suite.log && false)"' - 'if "%compiler%"=="msys2" C:\msys64\usr\bin\bash -lc "cd $APPVEYOR_BUILD_FOLDER; PATH=$PATH:/mingw64/bin:/mingw32/bin; ./autogen.sh --with-uniscribe --with-freetype --with-glib --with-gobject --with-cairo --with-icu --with-graphite2 --build=%MINGW_CHOST% --host=%MINGW_CHOST% --prefix=%MINGW_PREFIX%; make; make check || (cat */test-suite.log test/*/test-suite.log && false)"'

View File

@ -494,8 +494,6 @@ test/fuzzing/Makefile
test/shaping/Makefile test/shaping/Makefile
docs/Makefile docs/Makefile
docs/version.xml docs/version.xml
win32/Makefile
win32/config.h.win32
]) ])
AC_OUTPUT AC_OUTPUT

View File

@ -1,18 +0,0 @@
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 \
replace.py \
sed-enums-srcs.py
-include $(top_srcdir)/git.mk

View File

@ -1,67 +0,0 @@
# 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
# We need to include the sources in ..\src\hb-ucdn indirectly
!if [call create-lists.bat header hb_ucdn_srcs.mak hb_ucdn_SRCS]
!endif
!if [for %c in ($(LIBHB_UCDN_sources)) do @call create-lists.bat file hb_ucdn_srcs.mak hb-ucdn\%c]
!endif
!if [call create-lists.bat footer hb_ucdn_srcs.mak]
!endif
!include hb_ucdn_srcs.mak
!if [del /f /q hb_ucdn_srcs.mak]
!endif
# 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

View File

@ -1,97 +0,0 @@
Instructions for building HarfBuzz on Visual Studio
===================================================
Building the HarfBuzz DLL on Windows is now also supported using Visual Studio
versions 2008 through 2015, in both 32-bit and 64-bit (x64) flavors, via NMake
Makefiles.
The following are instructions for performing such a build, as there is a
number of build configurations supported for the build. Note that for all
build configurations, the OpenType and Simple TrueType layout (fallback)
backends are enabled, and this is the base configuration that is built if no
options (see below) are specified. A 'clean' target is provided-it is recommended
that one cleans the build and redo the build if any configuration option changed.
An 'install' target is also provided to copy the built items in their appropriate
locations under $(PREFIX), which is described below. A 'reallyclean' target is
provided that not only does what is done for the 'clean' target, but also removes
the sources/headers that are generated from the Ragel sources. Therefore, if one
is not building from a release tarball, or is rebuilding after using the 'reallyclean'
target or when the Ragel (*.rl) sources are updated, the Ragel state machine
compiler (ragel.exe) is needed, and needs to be passed in via RAGEL=<path_to_ragel_exe>
if ragel.exe is not already in the PATH.
We now support building from a GIT checkout via NMake for convenience. In addition to
the requirements as outlined in the later part of this file, you will need to run the
setup.py (Python 2.7.x or later) script to generate the headers (src\hb-version.h and
win32\config.h.win32) that are normally shipped in a release tarball before running
NMake, and you will need to pass RAGEL=<path_to_ragel_exe> if the Ragel state machine
compiler (ragel.exe) is not in your PATH when invoking NMake. Note that the
'reallyclean' target does not remove these 2 generated headers, so re-run the setup.py
script if necessary.
Invoke the build by issuing the command:
nmake /f Makefile.vc CFG=[release|debug] [PREFIX=...] <option1=1 option2=1 ...>
where:
CFG: Required. Choose from a release or debug build. Note that
all builds generate a .pdb file for each .dll and .exe built--this refers
to the C/C++ runtime that the build uses.
PREFIX: Optional. Base directory of where the third-party headers, libraries
and needed tools can be found, i.e. headers in $(PREFIX)\include,
libraries in $(PREFIX)\lib and tools in $(PREFIX)\bin. If not
specified, $(PREFIX) is set as $(srcroot)\..\vs$(X)\$(platform), where
$(platform) is win32 for 32-bit builds or x64 for 64-bit builds, and
$(X) is the short version of the Visual Studio used, as follows:
2008: 9
2010: 10
2012: 11
2013: 12
2015: 14
2017: 15
Explanation of options, set by <option>=1:
------------------------------------------
GLIB: Enable GLib support in HarfBuzz, which also uses the GLib unicode
callback if the bundled UCDN unicode callback is disabled. This requires the
GLib libraries, and is required for building all tool and test programs.
GOBJECT: Enable building the HarfBuzz-GObject DLL, and thus implies GLib
support. This requires the GObject libraries and glib-mkenums script,
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
Python, available. This requires the GObject-Introspection
libraries and tools, along with the Python interpretor that was
used during the build of GObject-Introspection. Please see
$(srcroot)\README.python for more related details. This implies
the build of the HarfBuzz-GObject DLL, along with GLib support.
FREETYPE: Enable the FreeType font callbacks. Requires the FreeType2 library.
CAIRO: Enable Cairo support. Requires the Cairo library.
CAIRO_FT: Enable the build of the hb-view tool, which makes use of Cairo, and
thus implies FreeType font callback support and Cairo support.
Requires Cairo libraries built with FreeType support. Note that the
hb-view tool requires GLib support as well.
GRAPHITE2: Enable the Graphite2 shaper, requires the SIL Graphite2 library.
ICU: Enables the build of ICU Unicode functions. Requires the ICU libraries.
UNISCRIBE: Enable Uniscribe platform shaper support.
DIRECTWRITE: Enable DirectWrite platform shaper support,
requires a rather recent Windows SDK, and at least Windows Vista/
Server 2008 with SP2 and platform update.
PYTHON: Full path to the Python interpretor to be used, if it is not in %PATH%.
PERL: Full path to the PERL interpretor to be used, if it is not in %PATH%.
RAGEL: Full path to the Ragel state machine compiler executable, if not in %PATH%
LIBTOOL_DLL_NAME: Enable libtool-style DLL names.

View File

@ -1,130 +0,0 @@
# 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 @<<
$<
<<
{..\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-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 $(HB_RAGEL_GENERATED_ACTUAL_SOURCES) $(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_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
@-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
reallyclean: clean
@-del /f /q $(HB_RAGEL_GENERATED_ACTUAL_SOURCES)

View File

@ -1,230 +0,0 @@
# 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
!if "$(CFG)" == "debug"
FREETYPE_LIB = freetyped.lib
!else
FREETYPE_LIB = freetype.lib
!endif
# Cairo is needed for building hb-view
CAIRO_LIB = cairo.lib
# Graphite2 is needed for building SIL Graphite2 support
GRAPHITE2_LIB = graphite2.lib
# Uniscribe is needed for Uniscribe shaping support
UNISCRIBE_LIB = usp10.lib gdi32.lib rpcrt4.lib user32.lib
# Directwrite is needed for DirectWrite shaping support
DIRECTWRITE_LIB = dwrite.lib
# Full path to Ragel state machine compiler if not already in PATH
!if "$(RAGEL)" == ""
RAGEL = ragel
!endif
# 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_BASE_RAGEL_GENERATED_sources) \
$(HB_FALLBACK_sources) \
$(HB_OT_sources) \
$(HB_OT_RAGEL_GENERATED_sources)
HB_HEADERS = \
$(HB_BASE_headers) \
$(HB_NODIST_headers) \
$(HB_OT_headers)
RAGEL_RAW_GEN_SRCS = $(HB_OT_RAGEL_GENERATED_sources) $(HB_BASE_RAGEL_GENERATED_sources)
# Minimal set of (system) libraries needed for the HarfBuzz DLL
HB_DEP_LIBS =
# 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_GOBJECT_DLL_FILENAME = $(CFG)\$(PLAT)\libharfbuzz-gobject-0
!else
HARFBUZZ_DLL_FILENAME = $(CFG)\$(PLAT)\harfbuzz-vs$(VSVER)
HARFBUZZ_GOBJECT_DLL_FILENAME = $(CFG)\$(PLAT)\harfbuzz-gobject-vs$(VSVER)
!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"
!if "$(FREETYPE_DIR)" != ""
HB_CFLAGS = $(HB_CFLAGS) /I$(FREETYPE_DIR)
!endif
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
# Always enable UCDN unless explicitly disabled
!if "$(NO_UCDN)" != "1"
HB_DEFINES = $(HB_DEFINES) /DHAVE_UCDN=1
HB_CFLAGS = \
$(HB_CFLAGS) \
$(HB_UCDN_CFLAGS)
HB_SOURCES = $(HB_SOURCES) $(hb_ucdn_SRCS) $(HB_UCDN_sources)
!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
# Define some of the macros in GLib's msvc_recommended_pragmas.h
# to reduce some unneeded build-time warnings
HB_CFLAGS = \
$(HB_CFLAGS) \
/wd4244 \
/D_CRT_SECURE_NO_WARNINGS \
/D_CRT_NONSTDC_NO_WARNINGS
!endif
!if "$(ICU)" == "1"
# use ICU for Unicode functions
# 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_ICU=1 /DHAVE_ICU_BUILTIN=1
# We don't want ICU to re-define int8_t in VS 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_CFLAGS = $(HB_CFLAGS) /DU_HAVE_INT8_T
!endif
HB_SOURCES = $(HB_SOURCES) $(HB_ICU_sources)
HB_HEADERS = $(HB_HEADERS) $(HB_ICU_headers)
HB_DEP_LIBS = $(HB_DEP_LIBS) $(HB_ICU_DEP_LIBS)
!endif
!if "$(UNISCRIBE)" == "1"
HB_CFLAGS = $(HB_CFLAGS) /DHAVE_UNISCRIBE
HB_SOURCES = $(HB_SOURCES) $(HB_UNISCRIBE_sources)
HB_HEADERS = $(HB_HEADERS) $(HB_UNISCRIBE_headers)
HB_DEP_LIBS = $(HB_DEP_LIBS) $(UNISCRIBE_LIB)
!endif
!if "$(DIRECTWRITE)" == "1"
HB_CFLAGS = $(HB_CFLAGS) /DHAVE_DIRECTWRITE
HB_SOURCES = $(HB_SOURCES) $(HB_DIRECTWRITE_sources)
HB_HEADERS = $(HB_HEADERS) $(HB_DIRECTWRITE_headers)
HB_DEP_LIBS = $(HB_DEP_LIBS) $(DIRECTWRITE_LIB)
!endif
HB_LIB_CFLAGS = $(HB_CFLAGS) /DHB_EXTERN="__declspec (dllexport) extern"

View File

@ -1,158 +0,0 @@
/* config.h.in. Generated from configure.ac by autoheader. */
/* The normal alignment of `struct{char;}', in bytes. */
#define ALIGNOF_STRUCT_CHAR__ 1
/* Define to 1 if you have the `atexit' function. */
#define HAVE_ATEXIT 1
/* Have cairo graphics library */
/* #undef HAVE_CAIRO */
/* Have cairo-ft support in cairo graphics library */
/* #undef HAVE_CAIRO_FT */
/* Have Core Text backend */
/* #undef HAVE_CORETEXT */
/* Define to 1 if you have the <dlfcn.h> header file. */
/* #undef HAVE_DLFCN_H */
/* Have DirectWrite Library */
/* #undef HAVE_DIRECTWRITE */
/* Have simple TrueType Layout backend */
#define HAVE_FALLBACK 1
/* Have fontconfig library */
/* #undef HAVE_FONTCONFIG */
/* Have FreeType 2 library */
/* #undef HAVE_FREETYPE */
/* Define to 1 if you have the `getpagesize' function. */
/* #undef HAVE_GETPAGESIZE */
/* Have glib2 library */
/* #undef HAVE_GLIB */
/* Have gobject2 library */
/* #undef HAVE_GOBJECT */
/* Have Graphite2 library */
/* #undef HAVE_GRAPHITE2 */
/* Have ICU library */
/* #undef HAVE_ICU */
/* Have Intel __sync_* atomic primitives */
/* #undef HAVE_INTEL_ATOMIC_PRIMITIVES */
/* Define to 1 if you have the <inttypes.h> header file. */
#if !defined (_MSC_VER) || (_MSC_VER >= 1800)
#define HAVE_INTTYPES_H 1
#endif
/* Define to 1 if you have the `isatty' function. */
#define HAVE_ISATTY 1
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the `mmap' function. */
/* #undef HAVE_MMAP */
/* Define to 1 if you have the `mprotect' function. */
/* #undef HAVE_MPROTECT */
/* Have native OpenType Layout backend */
#define HAVE_OT 1
/* Have POSIX threads */
/* #undef HAVE_PTHREAD */
/* Have PTHREAD_PRIO_INHERIT. */
/* #undef HAVE_PTHREAD_PRIO_INHERIT */
/* Define to 1 if you have the <sched.h> header file. */
/* #undef HAVE_SCHED_H */
/* Have sched_yield */
/* #undef HAVE_SCHED_YIELD */
/* Have Solaris __machine_*_barrier and atomic_* operations */
/* #undef HAVE_SOLARIS_ATOMIC_OPS */
/* Define to 1 if you have the <stdint.h> header file. */
#if !defined (_MSC_VER) || (_MSC_VER >= 1600)
#define HAVE_STDINT_H 1
#endif
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the <strings.h> header file. */
#ifndef _MSC_VER
#define HAVE_STRINGS_H 1
#endif
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the `sysconf' function. */
/* #undef HAVE_SYSCONF */
/* Define to 1 if you have the <sys/mman.h> header file. */
/* #undef HAVE_SYS_MMAN_H */
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Have UCDN Unicode functions */
/* #undef HAVE_UCDN */
/* Have Uniscribe library */
/* #undef HAVE_UNISCRIBE */
/* Define to 1 if you have the <unistd.h> header file. */
#ifndef _MSC_VER
#define HAVE_UNISTD_H 1
#endif
/* Define to 1 if you have the <usp10.h> header file. */
#define HAVE_USP10_H 1
/* Define to 1 if you have the <windows.h> header file. */
#define HAVE_WINDOWS_H 1
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#define LT_OBJDIR ".libs/"
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "@PACKAGE_BUGREPORT@"
/* Define to the full name of this package. */
#define PACKAGE_NAME "@PACKAGE_NAME@"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "@PACKAGE_NAME@ @PACKAGE_VERSION@"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "@PACKAGE_TARNAME@"
/* Define to the home page for this package. */
#define PACKAGE_URL "@PACKAGE_URL@"
/* Define to the version of this package. */
#define PACKAGE_VERSION "@PACKAGE_VERSION@"
/* Define to necessary symbol if this constant uses a non-standard name on
your system. */
/* #undef PTHREAD_CREATE_JOINABLE */
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1

View File

@ -1,147 +0,0 @@
# 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 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
!if [call create-lists.bat header hb_srcs.mak HB_RAGEL_GENERATED_ACTUAL_SOURCES]
!endif
!if [for %s in ($(RAGEL_RAW_GEN_SRCS)) 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

View File

@ -1,42 +0,0 @@
@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

View File

@ -1,146 +0,0 @@
# 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) < 1910
VSVER = 14
!elseif $(VCVERSION) > 1909 && $(VCVERSION) < 2000
VSVER = 15
!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 && $(VSVER) < 14
# Undocumented "enhance optimized debugging" switch. Became documented
# as "/Zo" in VS 2013 Update 3, and is turned on by default in VS 2015.
CFLAGS_ADD = $(CFLAGS_ADD) /d2Zi+
!endif
!else
CFLAGS_ADD = /MDd /Od
!endif
!if "$(PLAT)" == "x64"
LDFLAGS_ARCH = /machine:x64
!elseif "$(PLAT)" == "arm"
LDFLAGS_ARCH = /machine:arm
CFLAGS_ADD = $(CFLAGS_ADD) /DWINAPI_FAMILY=3
!else
LDFLAGS_ARCH = /machine:x86
!endif
!if "$(VALID_CFGSET)" == "TRUE"
CFLAGS = $(CFLAGS_ADD) /W3 /Zi /I.. /I..\src /I. /I$(PREFIX)\include
!if "$(ADDITIONAL_LIB_DIR)" != ""
ADDITIONAL_LIB_ARG = /libpath:$(ADDITIONAL_LIB_DIR)
!endif
LDFLAGS_BASE = $(LDFLAGS_ARCH) /libpath:$(PREFIX)\lib $(ADDITIONAL_LIB_ARG) /DEBUG
!if "$(CFG)" == "debug"
LDFLAGS = $(LDFLAGS_BASE)
!else
LDFLAGS = $(LDFLAGS_BASE) /opt:ref /LTCG
!endif
!endif

View File

@ -1,39 +0,0 @@
# 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)
-$(PYTHON) $(PREFIX)\bin\glib-mkenums \
--identifier-prefix hb_ --symbol-prefix hb_gobject \
--template ..\src\$(@F).tmpl $(HB_ACTUAL_HEADERS) > $@.tmp
for %%f in ($@.tmp) do if %%~zf gtr 0 $(PYTHON) sed-enums-srcs.py --input=$@.tmp --output=$@
@-del $@.tmp
if not exist $@ \
$(PERL) $(PREFIX)\bin\glib-mkenums \
--identifier-prefix hb_ --symbol-prefix hb_gobject \
--template ..\src\$(@F).tmpl $(HB_ACTUAL_HEADERS) > $@.tmp
if exist $@.tmp $(PERL) -p -i.tmp1 -e "s/_t_get_type/_get_type/g" $@.tmp
if exist $@.tmp $(PERL) -p -i.tmp2 -e "s/_T \(/ (/g" $@.tmp
@if exist $@.tmp.tmp1 del $@.tmp.tmp1
@if exist $@.tmp.tmp2 del $@.tmp.tmp2
@if exist $@.tmp move $@.tmp $@
!endif
# Create the build directories
$(CFG)\$(PLAT)\harfbuzz $(CFG)\$(PLAT)\harfbuzz-gobject $(CFG)\$(PLAT)\util:
@-md $@
.SUFFIXES: .c .cc .hh .rl
# Generate headers from Ragel sources
{..\src\}.rl{..\src\}.hh:
$(RAGEL) -e -F1 -o $@ $<

View File

@ -1,42 +0,0 @@
!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

View File

@ -1,162 +0,0 @@
# NMake Makefile portion for displaying config info
INC_FEATURES = Fallback OT
BUILT_TOOLS =
BUILT_LIBRARIES = HarfBuzz
!if "$(NO_UCDN)" != "1"
UNICODE_IMPL = ucdn
!elseif "$(GLIB)" == "1"
UNICODE_IMPL = GLib
!elseif "$(ICU)" == "1"
UNICODE_IMPL = ICU
!endif
!if "$(GLIB)" == "1"
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
!endif
!if "$(ICU)" == "1"
INC_FEATURES = $(INC_FEATURES) ICU
!endif
!if "$(FREETYPE)" == "1"
INC_FEATURES = $(INC_FEATURES) FreeType
!endif
!if "$(GRAPHITE2)" == "1"
INC_FEATURES = $(INC_FEATURES) Graphite2
!endif
!if "$(UNISCRIBE)" == "1"
INC_FEATURES = $(INC_FEATURES) Uniscribe
!endif
!if "$(DIRECTWRITE)" == "1"
INC_FEATURES = $(INC_FEATURES) DirectWrite
!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 and support with a bundled
@echo Unicode implementation (UCDN).
@echo ======
@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 DIRECTWRITE:
@echo Enable DirectWrite support, requires a recent enough Windows SDK.
@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 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 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:
@echo Enable graphite2 support, requires the SIL Graphite2 library
@echo.
@echo ICU:
@echo Enable build with ICU Unicode functions, requires the International
@echo Components for Unicode (ICU) libraries.
@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 interpreter (that was used to build the gobject-introspection 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 LIBTOOL_DLL_NAME:
@echo Use a libtool-style DLL name to mimic the DLL file naming generated by
@echo MinGW builds.
@echo.
@echo NO_UCDN:
@echo Do not use the bundled Unicode callback, which is the default. GLib or
@echo ICU-based unicode callback is therefore required.
@echo.
@echo UNISCRIBE:
@echo Enable Uniscribe support.
@echo.
@echo RAGEL:
@echo Set the full path to the Ragel state machine compiler, if not already in
@echo PATH. The Ragel state machine compiler is required if not building from
@echo a release tarball, or a rebuild is to be carried out after using the
@echo 'reallyclean' target.
@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.

View File

@ -1,25 +0,0 @@
# 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_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_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

View File

@ -1,73 +0,0 @@
# 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

View File

@ -1,124 +0,0 @@
#!/usr/bin/python
#
# Simple utility script to generate the basic info
# needed in a .pc (pkg-config) file, used especially
# for introspection purposes
# This can be used in various projects where
# there is the need to generate .pc files,
# and is copied from GLib's $(srcroot)/win32
# Author: Fan, Chun-wei
# Date: March 10, 2016
import os
import sys
import argparse
class BasePCItems:
def __init__(self):
self.base_replace_items = {}
self.exec_prefix = ''
self.includedir = ''
self.libdir = ''
self.prefix = ''
self.srcdir = os.path.dirname(__file__)
self.top_srcdir = self.srcdir + '\\..'
self.version = ''
def setup(self, argv, parser=None):
if parser is None:
parser = argparse.ArgumentParser(description='Setup basic .pc file info')
parser.add_argument('--prefix', help='prefix of the installed library',
required=True)
parser.add_argument('--exec-prefix',
help='prefix of the installed programs, \
if different from the prefix')
parser.add_argument('--includedir',
help='includedir of the installed library, \
if different from ${prefix}/include')
parser.add_argument('--libdir',
help='libdir of the installed library, \
if different from ${prefix}/lib')
parser.add_argument('--version', help='Version of the package',
required=True)
args = parser.parse_args()
self.version = args.version
# check whether the prefix and exec_prefix are valid
if not os.path.exists(args.prefix):
raise SystemExit('Specified prefix \'%s\' is invalid' % args.prefix)
# use absolute paths for prefix
self.prefix = os.path.abspath(args.prefix).replace('\\','/')
# check and setup the exec_prefix
if getattr(args, 'exec_prefix', None) is None:
exec_prefix_use_shorthand = True
self.exec_prefix = '${prefix}'
else:
if args.exec_prefix.startswith('${prefix}'):
exec_prefix_use_shorthand = True
input_exec_prefix = args.prefix + args.exec_prefix[len('${prefix}'):]
else:
exec_prefix_use_shorthand = False
input_exec_prefix = args.exec_prefix
if not os.path.exists(input_exec_prefix):
raise SystemExit('Specified exec_prefix \'%s\' is invalid' %
args.exec_prefix)
if exec_prefix_use_shorthand is True:
self.exec_prefix = args.exec_prefix.replace('\\','/')
else:
self.exec_prefix = os.path.abspath(input_exec_prefix).replace('\\','/')
# check and setup the includedir
if getattr(args, 'includedir', None) is None:
self.includedir = '${prefix}/include'
else:
if args.includedir.startswith('${prefix}'):
includedir_use_shorthand = True
input_includedir = args.prefix + args.includedir[len('${prefix}'):]
else:
if args.includedir.startswith('${exec_prefix}'):
includedir_use_shorthand = True
input_includedir = input_exec_prefix + args.includedir[len('${exec_prefix}'):]
else:
includedir_use_shorthand = False
input_includedir = args.includedir
if not os.path.exists(input_includedir):
raise SystemExit('Specified includedir \'%s\' is invalid' %
args.includedir)
if includedir_use_shorthand is True:
self.includedir = args.includedir.replace('\\','/')
else:
self.includedir = os.path.abspath(input_includedir).replace('\\','/')
# check and setup the libdir
if getattr(args, 'libdir', None) is None:
self.libdir = '${prefix}/lib'
else:
if args.libdir.startswith('${prefix}'):
libdir_use_shorthand = True
input_libdir = args.prefix + args.libdir[len('${prefix}'):]
else:
if args.libdir.startswith('${exec_prefix}'):
libdir_use_shorthand = True
input_libdir = input_exec_prefix + args.libdir[len('${exec_prefix}'):]
else:
libdir_use_shorthand = False
input_libdir = args.libdir
if not os.path.exists(input_libdir):
raise SystemExit('Specified libdir \'%s\' is invalid' %
args.libdir)
if libdir_use_shorthand is True:
self.libdir = args.libdir.replace('\\','/')
else:
self.libdir = os.path.abspath(input_libdir).replace('\\','/')
# setup dictionary for replacing items in *.pc.in
self.base_replace_items.update({'@VERSION@': self.version})
self.base_replace_items.update({'@prefix@': self.prefix})
self.base_replace_items.update({'@exec_prefix@': self.exec_prefix})
self.base_replace_items.update({'@libdir@': self.libdir})
self.base_replace_items.update({'@includedir@': self.includedir})

View File

@ -1,115 +0,0 @@
#!/usr/bin/python
#
# Simple utility script to manipulate
# certain types of strings in a file
# This can be used in various projects where
# there is the need to replace strings in files,
# and is copied from GLib's $(srcroot)/win32
# Author: Fan, Chun-wei
# Date: September 03, 2014
import os
import sys
import re
import string
import argparse
valid_actions = ['remove-prefix',
'replace-var',
'replace-str',
'remove-str']
def open_file(filename, mode):
if sys.version_info[0] < 3:
return open(filename, mode=mode)
else:
return open(filename, mode=mode, encoding='latin-1')
def replace_multi(src, dest, replace_items):
with open_file(src, 'r') as s:
with open_file(dest, 'w') as d:
for line in s:
replace_dict = dict((re.escape(key), value) \
for key, value in replace_items.items())
replace_pattern = re.compile("|".join(replace_dict.keys()))
d.write(replace_pattern.sub(lambda m: \
replace_dict[re.escape(m.group(0))], line))
def replace(src, dest, instring, outstring):
replace_item = {instring: outstring}
replace_multi(src, dest, replace_item)
def check_required_args(args, params):
for param in params:
if getattr(args, param, None) is None:
raise SystemExit('%s: error: --%s argument is required' % (__file__, param))
def warn_ignored_args(args, params):
for param in params:
if getattr(args, param, None) is not None:
print('%s: warning: --%s argument is ignored' % (__file__, param))
def main(argv):
parser = argparse.ArgumentParser(description='Process strings in a file.')
parser.add_argument('-a',
'--action',
help='Action to carry out. Can be one of:\n'
'remove-prefix\n'
'replace-var\n'
'replace-str\n'
'remove-str',
choices=valid_actions)
parser.add_argument('-i', '--input', help='Input file')
parser.add_argument('-o', '--output', help='Output file')
parser.add_argument('--instring', help='String to replace or remove')
parser.add_argument('--var', help='Autotools variable name to replace')
parser.add_argument('--outstring',
help='New String to replace specified string or variable')
parser.add_argument('--removeprefix', help='Prefix of string to remove')
args = parser.parse_args()
input_string = ''
output_string = ''
# We must have action, input, output for all operations
check_required_args(args, ['action','input','output'])
# Build the arguments by the operation that is to be done,
# to be fed into replace()
# Get rid of prefixes from a string
if args.action == 'remove-prefix':
check_required_args(args, ['instring','removeprefix'])
warn_ignored_args(args, ['outstring','var'])
input_string = args.removeprefix + args.instring
output_string = args.instring
# Replace an m4-style variable (those surrounded by @...@)
if args.action == 'replace-var':
check_required_args(args, ['var','outstring'])
warn_ignored_args(args, ['instring','removeprefix'])
input_string = '@' + args.var + '@'
output_string = args.outstring
# Replace a string
if args.action == 'replace-str':
check_required_args(args, ['instring','outstring'])
warn_ignored_args(args, ['var','removeprefix'])
input_string = args.instring
output_string = args.outstring
# Remove a string
if args.action == 'remove-str':
check_required_args(args, ['instring'])
warn_ignored_args(args, ['var','outstring','removeprefix'])
input_string = args.instring
output_string = ''
replace(args.input, args.output, input_string, output_string)
if __name__ == '__main__':
sys.exit(main(sys.argv))

View File

@ -1,36 +0,0 @@
#!/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))

View File

@ -1,62 +0,0 @@
#!/usr/bin/python
# vim: encoding=utf-8
#expand *.in files
#this script is only intended for building from git, not for building from the released tarball, which already includes all necessary files
import os
import sys
import re
import string
import subprocess
import optparse
from pc_base import BasePCItems
from replace import replace_multi
def get_version_items(srcroot):
ver = {}
RE_VERSION_LINE_START = re.compile(r'^AC_INIT\(\[(.+)\], *\n')
RE_VERSION_LINE_BODY = re.compile(r'^ \[(.+)\], *\n')
RE_VERSION_LINE_END = re.compile(r'^ \[(.+)\]\) *\n')
# Read from the AC_INIT lines to get the version/name/URLs info
with open(os.path.join(srcroot, 'configure.ac'), 'r') as ac:
for i in ac:
mo_init = RE_VERSION_LINE_START.search(i)
mo_pkg_info = RE_VERSION_LINE_BODY.search(i)
mo_pkg_url = RE_VERSION_LINE_END.search(i)
if mo_init:
ver['@PACKAGE_NAME@'] = mo_init.group(1)
if mo_pkg_info:
if mo_pkg_info.group(1).startswith('http'):
ver['@PACKAGE_BUGREPORT@'] = mo_pkg_info.group(1)
elif mo_pkg_info.group(1)[0].isdigit():
ver['@PACKAGE_VERSION@'] = mo_pkg_info.group(1)
else:
ver['@PACKAGE_TARNAME@'] = mo_pkg_info.group(1)
if mo_pkg_url:
ver['@PACKAGE_URL@'] = mo_pkg_url.group(1)
ver['@HB_VERSION@'] = ver['@PACKAGE_VERSION@']
pkg_ver_parts = ver['@PACKAGE_VERSION@'].split('.')
ver['@HB_VERSION_MAJOR@'] = pkg_ver_parts[0]
ver['@HB_VERSION_MINOR@'] = pkg_ver_parts[1]
ver['@HB_VERSION_MICRO@'] = pkg_ver_parts[2]
return ver
def main(argv):
pc = BasePCItems()
srcroot = pc.top_srcdir
srcdir = pc.srcdir
ver = get_version_items(srcroot)
replace_multi(os.path.join(srcdir, 'config.h.win32.in'),
os.path.join(srcdir, 'config.h.win32'),
ver)
replace_multi(os.path.join(srcroot, 'src', 'hb-version.h.in'),
os.path.join(srcroot, 'src', 'hb-version.h'),
ver)
return 0
if __name__ == '__main__':
sys.exit(main(sys.argv))