Thursday, July 30, 2009

MinGW: To Compile Fribidi for Windows

The Fribidi library facilitates rendering of right-to-left scripts, such as Arabic and Hebrew. Though I'm not a native speaker of these languages, I am interested in various languages of the world. Thus I compiled fribidi 0.19.2 with MinGW, as shown below.


Download the Fribidi source from fribidi.org. Launch MSYS and unpack the source.


tar xzvf fribidi-0.19.2.tar.gz

cd fribidi-0.19.2

I configured fribidi by simply typing:


./configure --prefix=/mingw --disable-glib --disable-debug

If you only want to create a static library, append --disable-shared to the configure line. Then, I began compilation:


make -C charset
make -C lib
make -C lib install

I got an error that said “libtool: link: more than one -exported-symbols argument is not allowed.” To fix it, I edited lib/Makefile as follows:


libfribidi_la_LDFLAGS = -no-undefined -version-info $(LT_VERSION_INFO) \
-export-symbols-regex "^fribidi_.*" # $(am__append_1)

Fribidi2 doesn't install fribidi-config. Some programs like mplayer look for fribidi-config to use fribidi. To enable fribidi support for such programs, create a new sh script /mingw/bin/fribidi-config with the following contents:


#!/bin/sh
case $1 in
--version)
pkg-config --modversion fribidi
;;
--cflags)
pkg-config --cflags fribidi
;;
--libs)
pkg-config --libs fribidi
;;
*)
false
;;
esac

If you want to link your program with the static Fribidi library (libfribidi.a), you should define FRIBIDI_ENTRY with an empty string. In other words, you should type something like this when you configure:


CPPFLAGS=' -DFRIBIDI_ENTRY="" ' ./configure --prefix=/mingw

If you want to link your program with the shared Fribidi library (libfribidi-0.dll), you should define WIN32 as follows:


CPPFLAGS='-DWIN32' ./configure --prefix=/mingw

1 comment:

  1. Hi, Thanks for your detailed solution to installing fribidi2 on MinGW. However, I'm wondering is there a full solution without modifying "lib/Makefile" or "bin/fribidi-benchmark.c" ?

    ReplyDelete

About This Blog

KBlog logo This blog seeks to provide a collection of interesting pictures found on the Web. Thanks for visiting the blog and posting your comments.

© Contents by KBlog

© Blogger template by Emporium Digital 2008

Followers

Total Pageviews

Powered By Blogger