[Libreoffice-commits] .: liblangtag/liblangtag-0.4.0-windows.patch liblangtag/makefile.mk

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Nov 6 10:26:27 PST 2012


 liblangtag/liblangtag-0.4.0-windows.patch |  291 ++++++++++++++++++++++++++++++
 liblangtag/makefile.mk                    |    1 
 2 files changed, 292 insertions(+)

New commits:
commit 93e83584c491cb53aec34dab2375bfc07337075c
Author: Tor Lillqvist <tlillqvist at suse.com>
Date:   Tue Nov 6 20:21:37 2012 +0200

    Start making liblangtag 0.4.0 build for Windows
    
    Harder than I expected. Still incomplete. Thanks to Fridrich for the
    atomic stuff.
    
    Change-Id: Iacf6d3708ee04c75b98da4ffe250194657fda7c8

diff --git a/liblangtag/liblangtag-0.4.0-windows.patch b/liblangtag/liblangtag-0.4.0-windows.patch
new file mode 100644
index 0000000..7e8ec41
--- /dev/null
+++ b/liblangtag/liblangtag-0.4.0-windows.patch
@@ -0,0 +1,291 @@
+--- misc/liblangtag-0.4.0/configure.ac
++++ misc/build/liblangtag-0.4.0/configure.ac
+@@ -291,8 +291,14 @@
+ dnl ======================================================================
+ dnl check another libraries
+ dnl ======================================================================
++case $host_os in
++  cygwin* | mingw*)
++    ;;
+-AX_PTHREAD([],
++  *)
++    AX_PTHREAD([],
+ 	[AC_MSG_ERROR([*** pthread library are required])])
++    ;;
++esac
+ 
+ GOBJECT_INTROSPECTION_CHECK([1.30.0])
+ if test "x$enable_introspection" != "xyes"; then
+--- misc/liblangtag-0.4.0/configure
++++ misc/build/liblangtag-0.4.0/configure
+@@ -13203,6 +13203,10 @@
+ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ ac_compiler_gnu=$ac_cv_c_compiler_gnu
+ 
++case $host_os in
++  cygwin* | mingw*)
++    ;;
++  *)
+ ax_pthread_ok=no
+ 
+ # We used to check for pthread.h first, but this fails if pthread.h
+@@ -13584,6 +13584,8 @@
+         ax_pthread_ok=no
+         as_fn_error $? "*** pthread library are required" "$LINENO" 5
+ fi
++;;
++esac
+ ac_ext=c
+ ac_cpp='$CPP $CPPFLAGS'
+ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+--- misc/liblangtag-0.4.0/liblangtag/lt-macros.h
++++ misc/build/liblangtag-0.4.0/liblangtag/lt-macros.h
+@@ -14,7 +14,9 @@
+ #error "Only <liblangtag/langtag.h> can be included directly."
+ #endif
+ 
++#ifndef _WIN32
+ #include <sys/param.h>
++#endif
+ 
+ #ifndef __LT_MACROS_H__
+ #define __LT_MACROS_H__
+@@ -206,6 +206,14 @@
+ 
+ LT_BEGIN_DECLS
+ 
++#ifdef _MSC_VER
++#ifdef _M_AMD64
++typedef signed long long ssize_t;
++#else
++typedef signed int ssize_t;
++#endif
++#endif
++
+ typedef void *		lt_pointer_t;
+ typedef int		lt_bool_t;
+ typedef lt_pointer_t (* lt_copy_func_t)	(lt_pointer_t data);
+--- misc/liblangtag-0.4.0/liblangtag/lt-atomic.h
++++ misc/build/liblangtag-0.4.0/liblangtag/lt-atomic.h
+@@ -17,7 +17,11 @@
+ #include "config.h"
+ #endif
+ 
++#if !defined(LT_HAVE_ATOMIC_BUILTINS) && !defined(_WIN32)
+ #include <pthread.h>
++#elif defined(_WIN32)
++#include <windows.h>
++#endif
+ #include "lt-messages.h"
+ 
+ LT_BEGIN_DECLS
+@@ -26,14 +30,40 @@
+ LT_INLINE_FUNC int       lt_atomic_int_inc         (volatile int *v);
+ LT_INLINE_FUNC lt_bool_t lt_atomic_int_dec_and_test(volatile int *v);
+ 
+-#ifndef LT_HAVE_ATOMIC_BUILTINS
++#if !defined(LT_HAVE_ATOMIC_BUILTINS) && !defined(_WIN32)
+ static pthread_mutex_t __lt_atomic_lock = PTHREAD_MUTEX_INITIALIZER;
+ #endif
+ 
+ /*< private >*/
+ 
+ /*< public >*/
+-#ifdef LT_HAVE_ATOMIC_BUILTINS
++#ifdef _WIN32
++LT_INLINE_FUNC int
++lt_atomic_int_get(volatile int *v)
++{
++       lt_return_val_if_fail (v != NULL, 0);
++
++       return (int)InterlockedAdd((LONG*)v, 0);
++}
++
++LT_INLINE_FUNC int
++lt_atomic_int_inc(volatile int *v)
++{
++       lt_return_val_if_fail (v != NULL, 0);
++
++       return (int)InterlockedAdd((LONG*)v, 1);
++}
++
++lt_bool_t
++lt_atomic_int_dec_and_test(volatile int *v)
++{
++       lt_return_val_if_fail (v != NULL, FALSE);
++
++       return 1 == InterlockedAdd((LONG*)v, -1);
++}
++
++
++#elif defined(LT_HAVE_ATOMIC_BUILTINS)
+ LT_INLINE_FUNC int
+ lt_atomic_int_get(volatile int *v)
+ {
+--- misc/liblangtag-0.4.0/liblangtag/lt-messages.h
++++ misc/build/liblangtag-0.4.0/liblangtag/lt-messages.h
+@@ -298,10 +298,17 @@
+ 	_lt_return_after_eval_if_fail(__expr__,__eval__)
+ #define lt_return_val_after_eval_if_fail(__expr__,__val__,__eval__)	\
+ 	_lt_return_val_after_eval_if_fail(__expr__,__val__,__eval__)
++#ifdef __GNUC__
+ #define lt_warn_if_reached()						\
+ 	lt_message_printf(LT_MSG_WARNING, LT_MSG_FLAG_NONE, 0,		\
+ 			  "(%s:%d): %s: code should not be reached",	\
+ 			  __FILE__, __LINE__, __PRETTY_FUNCTION__)
++#else
++#define lt_warn_if_reached()						\
++	lt_message_printf(LT_MSG_WARNING, LT_MSG_FLAG_NONE, 0,		\
++			  "(%s:%d): code should not be reached",	\
++			  __FILE__, __LINE__)
++#endif
+ 
+ LT_END_DECLS
+ 
+--- misc/liblangtag-0.4.0/liblangtag/lt-error.c
++++ misc/build/liblangtag-0.4.0/liblangtag/lt-error.c
+@@ -14,7 +14,9 @@
+ #include "config.h"
+ #endif
+ 
++#ifndef _WIN32
+ #include <execinfo.h>
++#endif
+ #include <stdlib.h>
+ #include "lt-list.h"
+ #include "lt-mem.h"
+@@ -120,9 +120,13 @@
+ 	d->message = lt_strdup_vprintf(message, ap);
+ 	va_end(ap);
+ 
++#ifdef _WIN32
++	size = 0;
++#else
+ 	size = backtrace(traces, 1024);
+ 	if (size > 0)
+ 		d->traces = backtrace_symbols(traces, size);
++#endif
+ 	d->stack_size = size;
+ 
+ 	lt_mem_add_ref(&d->parent, d->message, free);
+--- misc/liblangtag-0.4.0/liblangtag/lt-ext-module.c
++++ misc/build/liblangtag-0.4.0/liblangtag/lt-ext-module.c
+@@ -15,11 +15,15 @@
+ #endif
+ 
+ #include <ctype.h>
++#ifdef ENABLE_MODULE
+ #include <dirent.h>
++#endif
+ #ifdef HAVE_DLFCN_H
+ #include <dlfcn.h>
+ #endif
++#ifndef _WIN32
+ #include <libgen.h>
++#endif
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+--- misc/liblangtag-0.4.0/liblangtag/lt-xml.c
++++ misc/build/liblangtag-0.4.0/liblangtag/lt-xml.c
+@@ -14,7 +14,11 @@
+ #include "config.h"
+ #endif
+ 
++#ifndef _WIN32
+ #include <pthread.h>
++#else
++#include <windows.h>
++#endif
+ #include <sys/stat.h>
+ #include <libxml/parser.h>
+ #include <libxml/xpath.h>
+@@ -40,7 +44,9 @@
+ };
+ 
+ static lt_xml_t *__xml = NULL;
++#ifndef _WIN32
+ static pthread_mutex_t __lt_xml_lock = PTHREAD_MUTEX_INITIALIZER;
++#endif
+ 
+ /*< private >*/
+ static lt_bool_t
+@@ -309,11 +315,18 @@
+ {
+ 	lt_error_t *err = NULL;
+ 
++#ifdef _WIN32
++       HANDLE __lt_xml_lock = CreateMutex(NULL, FALSE, NULL);
++#else
+ 	pthread_mutex_lock(&__lt_xml_lock);
++#endif
+ 
+ 	if (__xml) {
++#ifdef _WIN32
++		ReleaseMutex(__lt_xml_lock);
++#else
+ 		pthread_mutex_unlock(&__lt_xml_lock);
+-
++#endif
+ 		return lt_xml_ref(__xml);
+ 	}
+ 
+@@ -389,8 +402,11 @@
+ 		lt_xml_unref(__xml);
+ 	}
+ 
++#ifdef _WIN32
++	ReleaseMutex(__lt_xml_lock);
++#else
+ 	pthread_mutex_unlock(&__lt_xml_lock);
+-
++#endif
+ 	return __xml;
+ }
+ 
+--- misc/liblangtag-0.4.0/liblangtag/lt-messages.c
++++ misc/build/liblangtag-0.4.0/liblangtag/lt-messages.c
+@@ -17,7 +17,9 @@
+ #include "config.h"
+ #endif
+ 
++#ifndef _WIN32
+ #include <execinfo.h>
++#endif
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+@@ -98,6 +98,7 @@
+ static void
+ _lt_message_stacktrace(void)
+ {
++#ifndef _WIN32
+ 	void *traces[1024];
+ 	char **strings;
+ 	int size, i;
+@@ -119,6 +119,7 @@
+ 		}
+ 		free(strings);
+ 	}
++#endif
+ }
+ 
+ static void
+--- misc/liblangtag-0.4.0/liblangtag/lt-tag.c
++++ misc/build/liblangtag-0.4.0/liblangtag/lt-tag.c
+@@ -15,9 +15,15 @@
+ #endif
+ 
+ #include <ctype.h>
++#ifndef _WIN32
+ #include <langinfo.h>
++#endif
+ #include <locale.h>
++#ifdef _MSC_VER
++typedef int int32_t;
++#else
+ #include <stdint.h>
++#endif
+ #include <string.h>
+ #include <libxml/xpath.h>
+ #include "lt-database.h"
diff --git a/liblangtag/makefile.mk b/liblangtag/makefile.mk
index 5ecce8c..f4cfc51 100644
--- a/liblangtag/makefile.mk
+++ b/liblangtag/makefile.mk
@@ -35,6 +35,7 @@ TARFILE_NAME=liblangtag-$(LIBLANGTAG_MAJOR).$(LIBLANGTAG_MINOR).$(LIBLANGTAG_MIC
 TARFILE_MD5=54e578c91b1b68e69c72be22adcb2195
 
 PATCH_FILES=liblangtag-0.4.0-msvc-warning.patch
+PATCH_FILES+=liblangtag-0.4.0-windows.patch
 PATCH_FILES+=liblangtag-0.4.0-reg2xml-encoding-problem.patch
 .IF "$(OS)" == "MACOSX"
 PATCH_FILES=liblangtag-0.4.0-mac.patch


More information about the Libreoffice-commits mailing list