From f60271c0c2b0101e7b2725f9a9ad950c277a616c Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 2 Aug 2011 09:56:30 -0400 Subject: [PATCH] Add mingw32 support With these changes, on Ubuntu I can do: ./configure --host=i586-mingw32msvc && make --- configure.ac | 1 + src/hb-mutex-private.hh | 4 ++-- src/hb-open-type-private.hh | 5 +++++ src/hb-private.hh | 6 +++++- src/main.cc | 1 + 5 files changed, 14 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index d2a23310..882d218e 100644 --- a/configure.ac +++ b/configure.ac @@ -104,6 +104,7 @@ dnl ========================================================================== PKG_CHECK_MODULES(ICU, icu, have_icu=true, [ AC_CHECK_PROG([have_icu], [icu-config], [true], [false]) + have_icu=false if $have_icu; then icu_cflags=`icu-config --cppflags` icu_libs=`icu-config --ldflags-libsonly` diff --git a/src/hb-mutex-private.hh b/src/hb-mutex-private.hh index 91c94388..0907e869 100644 --- a/src/hb-mutex-private.hh +++ b/src/hb-mutex-private.hh @@ -53,9 +53,9 @@ typedef GStaticMutex hb_mutex_impl_t; #define hb_mutex_impl_free(M) g_static_mutex_free (M) -#elif defined(_MSC_VER) +#elif defined(_MSC_VER) || defined(__MINGW32__) -#include +#include typedef CRITICAL_SECTION hb_mutex_impl_t; #define HB_MUTEX_IMPL_INIT { NULL, 0, 0, NULL, NULL, 0 } diff --git a/src/hb-open-type-private.hh b/src/hb-open-type-private.hh index ab2a3462..0c2ccd84 100644 --- a/src/hb-open-type-private.hh +++ b/src/hb-open-type-private.hh @@ -384,6 +384,11 @@ struct IntType DEFINE_SIZE_STATIC (sizeof (Type)); }; +/* Typedef these to avoid clash with windows.h */ +#define USHORT HB_USHORT +#define SHORT HB_SHORT +#define ULONG HB_ULONG +#define LONG HB_LONG typedef IntType USHORT; /* 16-bit unsigned integer. */ typedef IntType SHORT; /* 16-bit signed integer. */ typedef IntType ULONG; /* 32-bit unsigned integer. */ diff --git a/src/hb-private.hh b/src/hb-private.hh index 23fc0af7..8612789d 100644 --- a/src/hb-private.hh +++ b/src/hb-private.hh @@ -139,7 +139,11 @@ ASSERT_STATIC (sizeof (hb_var_int_t) == 4); #endif #ifndef HB_INTERNAL -# define HB_INTERNAL __attribute__((__visibility__("hidden"))) +# ifndef __MINGW32__ +# define HB_INTERNAL __attribute__((__visibility__("hidden"))) +# else +# define HB_INTERNAL +# endif #endif diff --git a/src/main.cc b/src/main.cc index 4bf809e6..31efa965 100644 --- a/src/main.cc +++ b/src/main.cc @@ -25,6 +25,7 @@ */ #define HB_OT_LAYOUT_CC +#include "hb-mutex-private.hh" #include "hb-open-file-private.hh" #include "hb-ot-layout-gdef-private.hh" #include "hb-ot-layout-gsubgpos-private.hh" -- GitLab