Win32 (MinGW) work

Fridrich Strba <[email protected]>
Newsgroups gmane.comp.internationalization.fribidi
Message-ID <[email protected]>
Hello, I just wanted to say following:

1) It is very likely that libwpd, http://libwpd.sf.net, a project that I 
code for, will have to use fribidi(for AbiWord) and/or icu (for OOo) in 
order to reorder the WordPerfect text before giving it to an unicode 
enabled application. WordPerfect stores all characters in visual order 
(the Arabic and Hebrew glyphs are handled as mere pictures).

2) Since we are shipping also a Windows version of libwpd, I tried to 
build the CVS module fribidi2 with MinGW and I managed after a small 
patching of the build system:
(a) if the libfribibi-char-sets.a remains built as it is now, in "bin" 
directory, in LDFLAGS, charset/libfribidi-char-sets.la must be before 
lib/libfribidi.la. In the oposite case, the linker will fail with 
unresolved symbols
(b) the fribidi_version_info symbol has to be in the fribidi.def file. 
If it is not, the linking in "bin" directory fails with undefined 
symbol. I will still try whether one cannot just simply ommit the 
fribidi.def file, since MinGW gcc is having an auto import/export 
capacity. But, I have to investigate more, since if I am not mistaken, 
_const_ char * is not correctly exported, but it remains to be confirmed.
(c) if the configure process does not find the sys/times.h header, the 
function utime(void) in fribidi-benchmark.c will fail, with tb and times 
"used prior to declaration". This patch makes the file build with a hack 
making (in this case) the utime return "0" always.

3) When I was reading the code, I realized that it is very well possible 
to separate the libfribidi.so and an eventual libfribidi-char-sets.so. 
The only link between the two is the "#include <fribidi-char-sets.h> in 
fribidi.h header. I tried in this patch something: to create two 
libraries that do not depend on each other. This would allow the 
configure of an application to know whether the system has both 
libfribidi.so and libfribidi-char-sets.so and act accordingly. Without 
the need to check whether libfribidi.so contains 
fribidi_charset_to_unicode, etc. It would also mean that the result 
would be two separate DLLs for Windows and an application should just 
ship with one if they do not use the conversion routines.

I am attaching the patch. You are free to use it or to discard it.

Concerning the Win32 "porting" work, if you are interested, I can do 
something with it. BTW: I tried to build the DLLs of 0.10.5 using the 
include MSVC project files and it is possible with some small patching 
and leaving out wcwidth.c that has all problems getting compiled.

Cheers

Fridrich Strba

_______________________________________________
fribidi mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/fribidi
fribidi2.diff (text/x-patch, 7.1 KB)
Index: Makefile.am
===================================================================
RCS file: /cvs/fribidi/fribidi2/Makefile.am,v
retrieving revision 1.8
diff -u -r1.8 Makefile.am
--- Makefile.am	27 Aug 2004 21:55:59 -0000	1.8
+++ Makefile.am	7 Jul 2005 11:38:52 -0000
@@ -9,12 +9,24 @@
 ##############################################################################
 
 ## The order of subdirs is important, don't change without a reason.
-SUBDIRS = gen.tab charset lib bin doc test
+if FRIBIDI_CHARSETS
+charset_dir = charset
+bin_dir = bin
+else #!FRIBIDI_CHARSETS
+charset_dir =
+bin_dir =
+endif #FRIBIDI_CHARSETS
+
+SUBDIRS = gen.tab $(charset_dir) lib $(bin_dir) doc test
 
 EXTRA_DIST = bootstrap ChangeLog.old
 
 pkgconfigdir = $(libdir)/pkgconfig
+if FRIBIDI_CHARSETS
+pkgconfig_DATA = @[email protected] @[email protected]
+else #!FRIBIDI_CHARSETS
 pkgconfig_DATA = @[email protected]
+endif #FRIBIDI_CHARSETS
 
 BUILT_SOURCES = lib/fribidi-unicode-version.h
 lib/fribidi-unicode-version.h:
Index: configure.ac
===================================================================
RCS file: /cvs/fribidi/fribidi2/configure.ac,v
retrieving revision 1.19
diff -u -r1.19 configure.ac
--- configure.ac	7 Jun 2005 08:44:23 -0000	1.19
+++ configure.ac	7 Jul 2005 11:38:52 -0000
@@ -209,6 +209,7 @@
 
 # Generate output
 AC_CONFIG_FILES([fribidi.pc
+                 fribidi-char-sets.pc
                  fribidi.spec
                  lib/fribidi-config.h
                  Makefile
Index: bin/Makefile.am
===================================================================
RCS file: /cvs/fribidi/fribidi2/bin/Makefile.am,v
retrieving revision 1.6
diff -u -r1.6 Makefile.am
--- bin/Makefile.am	7 Jun 2005 08:39:14 -0000	1.6
+++ bin/Makefile.am	7 Jul 2005 11:38:52 -0000
@@ -14,12 +14,23 @@
 		-I$(top_srcdir)/charset \
 		$(MISC_CFLAGS)
 
-LDADD = $(top_builddir)/lib/libfribidi.la $(MISC_LIBS)
-
 if FRIBIDI_CHARSETS
-else # !FRIBIDI_CHARSETS
-LDADD += $(top_builddir)/charset/libfribidi-char-sets.la
-endif # !FRIBIDI_CHARSETS
+
+LDADD = $(top_builddir)/charset/libfribidi-char-sets.la
+
+$(top_builddir)/charset/libfribidi-char-sets.la:
+	cd $(top_builddir)/charset && $(MAKE) $(AM_MAKEFLAGS) libfribidi-char-sets.la
+
+else #!FRIBIDI_CHARSETS
+
+LDADD = 
+
+endif #FRIBIDI_CHARSETS
+
+
+
+LDADD += $(top_builddir)/lib/libfribidi.la $(MISC_LIBS)
 
 $(top_builddir)/lib/libfribidi.la:
 	cd $(top_builddir)/lib && $(MAKE) $(AM_MAKEFLAGS) libfribidi.la
+
Index: bin/fribidi-benchmark.c
===================================================================
RCS file: /cvs/fribidi/fribidi2/bin/fribidi-benchmark.c,v
retrieving revision 1.4
diff -u -r1.4 fribidi-benchmark.c
--- bin/fribidi-benchmark.c	9 Jun 2004 08:56:53 -0000	1.4
+++ bin/fribidi-benchmark.c	7 Jul 2005 11:38:52 -0000
@@ -124,9 +124,13 @@
   void
 )
 {
+#if HAVE_SYS_TIMES_H 
   struct tms tb;
   times (&tb);
   return 0.01 * tb.tms_utime;
+#else
+  return 0.00;
+#endif
 }
 
 static void
Index: bin/fribidi-caprtl2utf8.c
===================================================================
RCS file: /cvs/fribidi/fribidi2/bin/fribidi-caprtl2utf8.c,v
retrieving revision 1.1
diff -u -r1.1 fribidi-caprtl2utf8.c
--- bin/fribidi-caprtl2utf8.c	7 Jun 2005 08:39:14 -0000	1.1
+++ bin/fribidi-caprtl2utf8.c	7 Jul 2005 11:38:52 -0000
@@ -1,6 +1,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <fribidi.h>
+#include <fribidi-char-sets.h>
 
 char buf[BUFSIZ];
 FriBidiChar ubuf[BUFSIZ];
Index: bin/fribidi-main.c
===================================================================
RCS file: /cvs/fribidi/fribidi2/bin/fribidi-main.c,v
retrieving revision 1.11
diff -u -r1.11 fribidi-main.c
--- bin/fribidi-main.c	23 Jun 2004 22:26:06 -0000	1.11
+++ bin/fribidi-main.c	7 Jul 2005 11:38:52 -0000
@@ -36,6 +36,7 @@
 #include <common.h>
 
 #include <fribidi.h>
+#include <fribidi-char-sets.h>
 #if !FRIBIDI_CHARSETS
 # if FRIBIDI_MAIN_USE_ICONV_H
 #  include <iconv.h>
Index: charset/Makefile.am
===================================================================
RCS file: /cvs/fribidi/fribidi2/charset/Makefile.am,v
retrieving revision 1.4
diff -u -r1.4 Makefile.am
--- charset/Makefile.am	13 Jun 2004 20:11:41 -0000	1.4
+++ charset/Makefile.am	7 Jul 2005 11:38:52 -0000
@@ -1,4 +1,4 @@
-noinst_LTLIBRARIES = libfribidi-char-sets.la
+lib_LTLIBRARIES = libfribidi-char-sets.la
 
 AM_CPPFLAGS = \
 		-I$(top_builddir)/lib \
@@ -10,6 +10,15 @@
 libfribidi_char_sets_la_LDFLAGS = 
 libfribidi_char_sets_la_LIBADD = $(GLIB_LIBS)
 
+if OS_WIN32
+#libfribidi_char_sets_la_LDFLAGS += -export-symbols $(srcdir)/fribidi-char-sets.def
+libfribidi_char_sets_la_LDFLAGS += -export-dynamic
+endif # OS_WIN32
+
+if PLATFORM_WIN32
+libfribidi_char_sets_la_LDFLAGS += -no-undefined
+endif # PLATFORM_WIN32
+
 if FRIBIDI_CHARSETS
 
 include Headers.mk
Index: doc/Makefile.am
===================================================================
RCS file: /cvs/fribidi/fribidi2/doc/Makefile.am,v
retrieving revision 1.14
diff -u -r1.14 Makefile.am
--- doc/Makefile.am	14 Jun 2004 18:43:53 -0000	1.14
+++ doc/Makefile.am	7 Jul 2005 11:38:52 -0000
@@ -40,9 +40,8 @@
 C2MANFLAGS = $(includepath) \
 		-D__FRIBIDI_DOC \
 		-DDONT_HAVE_FRIBIDI_CONFIG_H \
-		-M "Programmer's Manual" \
-		-m "$(PACKAGE_NAME) $(PACKAGE_VERSION)"
-
+		-M "Programmer's Manual"
+		
 VPATH += $(includevpath)
 
 c2man.stamp: $(headers)
Index: lib/Makefile.am
===================================================================
RCS file: /cvs/fribidi/fribidi2/lib/Makefile.am,v
retrieving revision 1.14
diff -u -r1.14 Makefile.am
--- lib/Makefile.am	3 Jul 2004 11:36:15 -0000	1.14
+++ lib/Makefile.am	7 Jul 2005 11:38:52 -0000
@@ -16,17 +16,6 @@
 libfribidi_la_LDFLAGS += -no-undefined
 endif # PLATFORM_WIN32
 
-if FRIBIDI_CHARSETS
-
-AM_CPPFLAGS += -I$(top_srcdir)/charset
-libfribidi_la_LIBADD += $(top_builddir)/charset/libfribidi-char-sets.la
-libfribidi_la_DEPENDENCIES += $(top_builddir)/charset/libfribidi-char-sets.la
-
-$(top_builddir)/charset/libfribidi-char-sets.la:
-	cd $(top_builddir)/lib && $(MAKE) $(AM_MAKEFLAGS) libfribidi-char-sets.la
-
-endif # FRIBIDI_CHARSETS
-
 include Headers.mk
 pkginclude_HEADERS = $(libfribidi_la_headers)
 nodist_pkginclude_HEADERS = fribidi-config.h
Index: lib/fribidi.def
===================================================================
RCS file: /cvs/fribidi/fribidi2/lib/fribidi.def,v
retrieving revision 1.7
diff -u -r1.7 fribidi.def
--- lib/fribidi.def	15 Jun 2004 11:52:02 -0000	1.7
+++ lib/fribidi.def	7 Jul 2005 11:38:52 -0000
@@ -19,3 +19,4 @@
 fribidi_shape
 fribidi_remove_bidi_marks
 fribidi_log2vis
+fribidi_version_info
Index: lib/fribidi.h
===================================================================
RCS file: /cvs/fribidi/fribidi2/lib/fribidi.h,v
retrieving revision 1.8
diff -u -r1.8 fribidi.h
--- lib/fribidi.h	21 Jun 2004 21:15:31 -0000	1.8
+++ lib/fribidi.h	7 Jul 2005 11:38:52 -0000
@@ -44,9 +44,6 @@
 #else
 typedef void FriBidiJoiningType typedef void FriBidiArabicProp
 #endif				/* !FRIBIDI_NO_ARABIC */
-#if FRIBIDI_CHARSETS
-# include "fribidi-char-sets.h"
-#endif				/* FRIBIDI_CHARSETS */
 #include "fribidi-begindecls.h"
 /* See fribidi-bidi.h for the core functions
  * fribidi_get_par_embedding_levels() and fribidi_reorder_line() which are
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.