FriBidi on 64 bit machines
Baruch Even <[email protected]>
| Newsgroups | gmane.comp.internationalization.fribidi |
|---|---|
| Message-ID | <[email protected]> |
Hi, Geresh was uploaded recently to the Debian archive and failed to compile since it checks that the UCS-4 codes of FriBidi are indeed 32 bit sized. This appears to have been wrong since FriBidi never checked on what architecture it runs and always uses long for 32 bit sized ints. This is wrong since long is 64 bits on 64 bit machines. Attached is a patch I used to fix this (hopefully). Baruch _______________________________________________ fribidi mailing list [email protected] http://freedesktop.org/mailman/listinfo/fribidi
fribidi_0.10.4-5.diff
(text/x-patch, 29.2 KB)
--- fribidi-0.10.4.orig/Makefile
+++ fribidi-0.10.4/Makefile
@@ -0,0 +1,48 @@
+TARFILE=fribidi-0.10.4.tar.gz
+TARDIR=fribidi-0.10.4
+
+CONFIGURE_FLAG= --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info
+
+all: build
+
+unpack: unpack-stamp
+unpack-stamp: $(TARFILE)
+ -rm -rf $(TARDIR)
+ tar zxf $(TARFILE)
+ for P in `ls patches/*.diff 2>/dev/null`; do \
+ (cd $(TARDIR) && patch -p1) < $$P; \
+ done
+ touch $@
+
+build: build-stamp
+build-stamp: unpack-stamp
+ install -d build/fribidi
+# cd $(TARDIR) && aclocal
+# cd $(TARDIR) && autoheader
+# cd $(TARDIR) && libtoolize -c --force
+# cd $(TARDIR) && automake -i --foreign
+# cd $(TARDIR) && autoconf
+
+ cd build/fribidi && ../../$(TARDIR)/configure --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info
+ cd build/fribidi && make $(MAKE_DEFINES)
+
+ touch $@
+
+install: install-stamp
+install-stamp: build-stamp
+ P=`pwd`/$(INSTALL_PREFIX) && cd build/fribidi && make install prefix=$$P/debian/tmp/usr
+
+ touch $@
+
+clean:
+ rm -rf build
+ rm -rf $(TARDIR)
+ rm -f build*-stamp install*-stamp unpack-stamp
+ rm -f *~ patches/*~
+ rm -f fribidi_test
+
+test: build
+ cd build/fribidi && make test check
+ gcc -static -o fribidi_test fribidi_test.c -Lbuild/fribidi/.libs -lfribidi -I$(TARDIR)
+ ./fribidi_test
+ @echo "All Debian Package tests passed succesfully."
--- fribidi-0.10.4.orig/debian/libfribidi0.files
+++ fribidi-0.10.4/debian/libfribidi0.files
@@ -0,0 +1,4 @@
+usr/bin/fribidi
+usr/lib/libfribidi.so.0
+usr/lib/libfribidi.so.0.0.0
+
--- fribidi-0.10.4.orig/debian/fribidi.1
+++ fribidi-0.10.4/debian/fribidi.1
@@ -0,0 +1,132 @@
+.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.29.
+.TH FRIBIDI "1" "April 2003" "fribidi 0.10.4" "User Commands"
+.SH NAME
+fribidi \- manual page for fribidi 0.10.4
+.SH SYNOPSIS
+.B fribidi
+[\fIOPTION\fR]... [\fIFILE\fR]...
+.SH DESCRIPTION
+A command line interface for the fribidi library,
+Converts a logical string to visual.
+.TP
+\fB\-h\fR, \fB\-\-help\fR
+Display this information and exit
+.TP
+\fB\-V\fR, \fB\-\-version\fR
+Display version information and exit
+.TP
+\fB\-v\fR, \fB\-\-verbose\fR
+Verbose mode, same as \fB\-\-basedir\fR \fB\-\-ltov\fR \fB\-\-vtol\fR \e
+\fB\-\-levels\fR \fB\-\-changes\fR
+.TP
+\fB\-d\fR, \fB\-\-debug\fR
+Output debug information
+.TP
+\fB\-t\fR, \fB\-\-test\fR
+Test fribidi, same as \fB\-\-clean\fR \fB\-\-nobreak\fR \fB\-\-showinput\fR \e
+\fB\-\-reordernsm\fR
+.TP
+\fB\-c\fR, \fB\-\-charset\fR CS
+Specify character set, default is UTF-8
+.TP
+\fB\-C\fR, \fB\-\-charsetdesc\fR CS
+Show descriptions for character set CS and exit
+.TP
+\fB\-\-caprtl\fR
+Old style: set character set to CapRTL
+.TP
+\fB\-\-showinput\fR
+Output the input string too
+.TP
+\fB\-\-nopad\fR
+Do not right justify RTL lines
+.TP
+\fB\-\-nobreak\fR
+Do not break long lines
+.TP
+\fB\-w\fR, \fB\-\-width\fR W
+Screen width for padding, default is 80, but if \e
+enviroment variable COLUMNS is defined, its value \e
+will be used, \fB\-\-width\fR overrides both of them.\e
+.TP
+\fB\-B\fR, \fB\-\-bol\fR BOL
+Output string BOL before the visual string
+.TP
+\fB\-E\fR, \fB\-\-eol\fR EOL
+Output string EOL after the visual string
+.TP
+\fB\-\-rtl\fR
+Force base direction to RTL
+.TP
+\fB\-\-ltr\fR
+Force base direction to LTR
+.TP
+\fB\-\-wrtl\fR
+Set base direction to RTL if no strong character found
+.TP
+\fB\-\-wltr\fR
+Set base direction to LTR if no strong character found \e
+(default)
+.TP
+\fB\-\-nomirror\fR
+Turn mirroring off, to do it later
+.TP
+\fB\-\-reordernsm\fR
+Reorder NSM sequences to follow their base character
+.TP
+\fB\-\-clean\fR
+Remove explicit format codes in visual string \e
+output, currently does not affect other outputs
+.TP
+\fB\-\-basedir\fR
+Output Base Direction
+.TP
+\fB\-\-ltov\fR
+Output Logical to Visual position map
+.TP
+\fB\-\-vtol\fR
+Output Visual to Logical position map
+.TP
+\fB\-\-levels\fR
+Output Embedding Levels
+.TP
+\fB\-\-changes\fR
+Output information about changes between \e
+logical and visual string (start, length)
+.TP
+\fB\-\-novisual\fR
+Do not output the visual string, to be used with \e
+\fB\-\-basedir\fR, \fB\-\-ltov\fR, \fB\-\-vtol\fR, \fB\-\-levels\fR, \fB\-\-changes\fR
+.IP
+All string indexes are zero based
+.SS "Output:"
+.IP
+For each line of input, output something like this:
+.IP
+[input-str` => '][BOL][[padding space]visual-str][EOL]
+[\en base-dir][\en ltov-map][\en vtol-map][\en levels][\en changes]
+.SS "Available character sets:"
+.TP
+* UTF-8
+: UTF-8 (Unicode)
+.TP
+* CapRTL
+: CapRTL (Test) X
+.IP
+* ISO8859-6 : ISO 8859-6 (Arabic)
+* ISO8859-8 : ISO 8859-8 (Hebrew)
+* CP1255 : CP1255 (Hebrew/Yiddish)
+* CP1256 : CP1256 (MS-Arabic)
+* ISIRI-3342: ISIRI 3342 (Persian)
+X: Character set has descriptions, use \fB\-\-charsetdesc\fR to see
+.SH "REPORTING BUGS"
+Report bugs online at <http://fribidi.sourceforge.net/bugs.php>.
+.PP
+interface version 2
+Unicode version 3.2.0
+.SH COPYRIGHT
+Copyright \(co 2002 FriBidi Project (http://fribidi.sf.net/).
+fribidi comes with NO WARRANTY, to the extent permitted by law.
+You may redistribute copies of fribidi under the terms of
+the GNU Lesser General Public License.
+For more information about these matters, see the files named COPYING.
--- fribidi-0.10.4.orig/debian/control
+++ fribidi-0.10.4/debian/control
@@ -0,0 +1,35 @@
+Source: fribidi
+Section: libs
+Priority: optional
+Maintainer: Baruch Even <[email protected]>
+Standards-Version: 3.6.1
+Build-Depends: debhelper (>> 3.0.0), pkg-config
+
+Package: libfribidi0
+Architecture: any
+Depends: ${shlibs:Depends}
+Description: Free Implementation of the Unicode BiDi algorithm
+ FriBiDi is a BiDi algorithm implementation for Hebrew and/or Arabic
+ languages.
+ .
+ Upstream: http://freedesktop.org/Software/FriBidi
+
+Package: libfribidi-dev
+Architecture: any
+Section: libdevel
+Depends: libfribidi0 (= ${Source-Version})
+Description: Development files for FreeBidi library
+ This package contains the header files and static libraries for the
+ FriBidi C library.
+ .
+ Upstream: http://freedesktop.org/Software/FriBidi
+
+Package: libfribidi0-udeb
+Architecture: any
+Section: debian-installer
+Priority: extra
+Depends: libc-udeb
+Description: Free Implementation of the Unicode BiDi algorithm
+ This Debian Installer component provided Bidirectional support
+ for Arabic and/or Hebrew languages.
+
--- fribidi-0.10.4.orig/debian/rules
+++ fribidi-0.10.4/debian/rules
@@ -0,0 +1,92 @@
+#!/usr/bin/make -f
+# Sample debian/rules that uses debhelper.
+# GNU copyright 1997 by Joey Hess.
+#
+# This version is for a hypothetical package that builds an
+# architecture-dependant package, as well as an architecture-independent
+# package.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+# This is the debhelper compatability version to use.
+export DH_COMPAT=3
+
+# This has to be exported to make some magic below work.
+export DH_OPTIONS
+
+FRIBIDI_UDEB=libfribidi0-udeb
+DEBVERSION=$(shell dpkg-parsechangelog | grep '^Version: ' | sed -e 's/^Version: //')
+UDEBNAME=$(FRIBIDI_UDEB)_$(DEBVERSION)_$(shell dpkg --print-architecture).udeb
+
+ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
+OBJS += xmalloc.o
+STRIP= /bin/true
+else
+STRIPTOOL=strip
+STRIP= $(STRIPTOOL) --remove-section=.note --remove-section=.comment
+endif
+
+build: build-stamp
+build-stamp:
+ dh_testdir
+
+ $(MAKE)
+ $(MAKE) test
+
+ touch build-stamp
+
+clean:
+ dh_testdir
+ dh_testroot
+ rm -f build-stamp configure-stamp
+
+ -$(MAKE) clean
+
+ dh_clean
+
+install: DH_OPTIONS=
+install: build
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+ dh_installdirs
+
+ $(MAKE) install
+
+# Build architecture-independent files here.
+# Pass -i to all debhelper commands in this target to reduce clutter.
+binary-indep:
+
+# Build architecture-dependent files here.
+# Pass -a to all debhelper commands in this target to reduce clutter.
+binary-arch: DH_OPTIONS=-a
+binary-arch: build install
+ # Need this version of debhelper for DH_OPTIONS to work.
+ dh_testdir
+ dh_testroot
+
+ dh_movefiles
+
+ dh_installdocs -a -N$(FRIBIDI_UDEB)
+ dh_installman -a -N$(FRIBIDI_UDEB)
+ dh_installchangelogs fribidi-0.10.4/ChangeLog -a -N$(FRIBIDI_UDEB)
+ mkdir -p debian/$(FRIBIDI_UDEB)/lib
+ cp -a debian/libfribidi0/usr/lib/* debian/$(FRIBIDI_UDEB)/lib
+ $(STRIP) debian/$(FRIBIDI_UDEB)/lib/libfribidi.so.0.0.0
+ dh_strip
+ dh_link
+ dh_compress
+ dh_fixperms
+ dh_makeshlibs -N$(FRIBIDI_UDEB)
+ dh_shlibdeps -Xusr/bin/fribidi -N$(FRIBIDI_UDEB)
+ dh_installdeb -N$(FRIBIDI_UDEB)
+ dh_gencontrol -a -N$(FRIBIDI_UDEB)
+ dh_md5sums -a -N$(FRIBIDI_UDEB)
+ dh_builddeb -a -N$(FRIBIDI_UDEB)
+ dh_gencontrol -p$(FRIBIDI_UDEB) -- -fdebian/files~
+ dpkg-distaddfile $(UDEBNAME) debian-installer extra
+ dh_builddeb $(FRIBIDI_UDEB) --filename=$(UDEBNAME)
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install
--- fribidi-0.10.4.orig/debian/watch
+++ fribidi-0.10.4/debian/watch
@@ -0,0 +1,2 @@
+version=2
+http://freedesktop.org/~fribidi/download/fribidi-([\d\.]+)\.tar\.gz
--- fribidi-0.10.4.orig/debian/libfribidi-dev.files
+++ fribidi-0.10.4/debian/libfribidi-dev.files
@@ -0,0 +1,6 @@
+usr/bin/fribidi-config
+usr/include/fribidi/
+usr/lib/libfribidi.a
+usr/lib/libfribidi.la
+usr/lib/libfribidi.so
+usr/lib/pkgconfig/fribidi.pc
--- fribidi-0.10.4.orig/debian/libfribidi0.shlibs
+++ fribidi-0.10.4/debian/libfribidi0.shlibs
@@ -0,0 +1 @@
+libfribidi 0 libfribidi0 (>= 0.10.5)
--- fribidi-0.10.4.orig/debian/changelog
+++ fribidi-0.10.4/debian/changelog
@@ -0,0 +1,109 @@
+fribidi (0.10.4-5) unstable; urgency=low
+
+ * Fixed a portability issue in fribidi where the uint32 type it used was
+ really just unsigned long and this fails miserably on 64 bit machines.
+ This bug was exposed by geresh test program for fribidi on ia64 and alpha
+ machines.
+ - Now using standard glibc headers to provide uint32 type and similar size
+ mandataed types.
+ - Added a test program in build stage to make sure we don't have this
+ problem again.
+ * Upped the version required in the Build-Dep so that others will use the
+ fixed version (the above changed ABI on 64 bit machines).
+
+ -- Baruch Even <[email protected]> Mon, 25 Oct 2004 07:42:00 +0100
+
+fribidi (0.10.4-4) unstable; urgency=low
+
+ * Change the FriBidi homepage in the description. Closes: #275900, #275902
+ * Change the FriBidi homepage in the copyright file.
+ * Remove dependency on automake and libtool, it's unneeded.
+ * Updated watch file.
+ * Added fribidi-config manpage. Closes: #190549
+ * Add shlibs file so other packages will have the correct dependency.
+ Closes: #158886, #183540, #228776
+
+ -- Baruch Even <[email protected]> Mon, 11 Oct 2004 05:15:23 +0100
+
+fribidi (0.10.4-3) unstable; urgency=low
+
+ * Change -dev package to section libdevel, the override said so.
+
+ -- Baruch Even <[email protected]> Mon, 7 Jun 2004 08:38:59 +0300
+
+fribidi (0.10.4-2) unstable; urgency=low
+
+ * Move the files in the udeb from /usr/lib to /lib, needed for library
+ reduction to work properly (God knows why). Thanks to Steve Langasek.
+ Closes: #252958
+
+ -- Baruch Even <[email protected]> Sun, 6 Jun 2004 21:00:04 +0300
+
+fribidi (0.10.4-1.1) unstable; urgency=low
+
+ * NMU.
+ * Produce libfribidi-udeb for debian Installer.
+
+ -- Alastair McKinstry <[email protected]> Sat, 27 Mar 2004 21:17:09 +0000
+
+fribidi (0.10.4-1) unstable; urgency=low
+
+ * New maintainer (Closes: bug#188662)
+ * Moved dh_installdeb near the end so that postrm/postinst will be installed
+ correctly.
+ * Add manpage for fribidi (Closes: bug#174817)
+ * Move pkgconfig files to -dev package (Closes: bug#186158)
+
+ -- Baruch Even <[email protected]> Sat, 19 Apr 2003 17:32:26 +0300
+
+fribidi (0.10.4-0.1) unstable; urgency=low
+
+ * NMU.
+ * New upstream release - closes: #156879, #157807
+
+ -- Masayuki Hatta <[email protected]> Thu, 29 Aug 2002 09:56:48 +0900
+
+fribidi (0.10.1-2) unstable; urgency=low
+
+ * Removed Depends, Build-Depends which don't be needed anymore.
+ (Closes: #136889)
+
+ -- Changwoo Ryu <[email protected]> Thu, 7 Mar 2002 12:10:23 +0900
+
+fribidi (0.10.1-1) unstable; urgency=low
+
+ * New upstream release
+
+ -- Changwoo Ryu <[email protected]> Fri, 8 Feb 2002 22:30:34 +0900
+
+fribidi (0.9.0-4) unstable; urgency=high
+
+ * Rebuild with glib 1.3.12. (Closes: #128539)
+
+ -- Changwoo Ryu <[email protected]> Thu, 10 Jan 2002 16:54:19 +0900
+
+fribidi (0.9.0-3) unstable; urgency=low
+
+ * Rebuilt with glib 1.3.11.
+
+ -- Changwoo Ryu <[email protected]> Sun, 2 Dec 2001 00:55:38 +0900
+
+fribidi (0.9.0-2) unstable; urgency=high
+
+ * Added libglib1.2-dev to the Build-Depends (Closes: #117224).
+
+ -- Changwoo Ryu <[email protected]> Mon, 26 Nov 2001 03:57:04 +0900
+
+fribidi (0.9.0-1) unstable; urgency=low
+
+ * New upstream release. (Closes: #113299)
+
+ -- Changwoo Ryu <[email protected]> Mon, 24 Sep 2001 10:51:47 +0900
+
+fribidi (0.1.12-1) unstable; urgency=low
+
+ * Initial Release.
+
+ -- Changwoo Ryu <[email protected]> Tue, 22 Aug 2000 02:13:16 +0900
+
+
--- fribidi-0.10.4.orig/debian/libfribidi0.docs
+++ fribidi-0.10.4/debian/libfribidi0.docs
@@ -0,0 +1,4 @@
+fribidi-0.10.4/ANNOUNCE
+fribidi-0.10.4/NEWS
+fribidi-0.10.4/README
+fribidi-0.10.4/TODO
--- fribidi-0.10.4.orig/debian/fribidi-config.1
+++ fribidi-0.10.4/debian/fribidi-config.1
@@ -0,0 +1,30 @@
+.\" Process this file with
+.\" groff -man -Tascii fribidi-config.1
+.\"
+.TH fribidi-config 1 "OCTOBER 2004" "Library Configuration" "User Manuals"
+.SH NAME
+fribidi-config \- Display FriBidi Library Configuration
+.SH SYNOPSIS
+.B fribidi-config
+.I OPTION
+.B [
+.I OPTION
+.B ... ]
+.SH DESCRIPTION
+.B fribidi-config
+is a script that is used to display what compiler flags and libraries were
+used when FriBidi were built.
+
+.SH OPTIONS
+.IP --version
+FriBidi version information
+.IP --prefix
+displays prefix of directory where FriBidi were installed.
+.IP --exec-prefix
+displays exec-prefix of directory where FriBidi were installed.
+.IP --cflags
+C pre-processor and compiler flags for use with FriBidi.
+.IP --libs
+FriBidi library linking information
+.SH AUTHOR
+Baruch Even <[email protected]>
--- fribidi-0.10.4.orig/debian/libfribidi0.manpages
+++ fribidi-0.10.4/debian/libfribidi0.manpages
@@ -0,0 +1 @@
+debian/fribidi.1
--- fribidi-0.10.4.orig/debian/libfribidi-dev.manpages
+++ fribidi-0.10.4/debian/libfribidi-dev.manpages
@@ -0,0 +1 @@
+debian/fribidi-config.1
--- fribidi-0.10.4.orig/debian/copyright
+++ fribidi-0.10.4/debian/copyright
@@ -0,0 +1,15 @@
+This package was debianized by Changwoo Ryu <[email protected]> on
+Tue, 22 Aug 2000 02:13:16 +0900.
+
+It was downloaded from: http://freedesktop.org/Software/FriBidi
+
+Upstream Authors:
+ Dov Grobgeld <[email protected]>
+ Behdad Esfahbod <[email protected]>
+ Roozbeh Pournader <[email protected]>
+
+Copyright:
+
+ It may be redistributed under the terms of the GNU LGPL, Version 2 or
+ later, the license can be found in the file
+ /usr/share/common-licenses/LGPL-2.
--- fribidi-0.10.4.orig/patches/correct-types.diff
+++ fribidi-0.10.4/patches/correct-types.diff
@@ -0,0 +1,41 @@
+diff -Nur fribidi-0.10.4.orig/fribidi_mem.h fribidi-0.10.4/fribidi_mem.h
+--- fribidi-0.10.4.orig/fribidi_mem.h 2004-10-25 07:18:45.000000000 +0100
++++ fribidi-0.10.4/fribidi_mem.h 2004-10-25 07:24:46.000000000 +0100
+@@ -23,6 +23,7 @@
+ #define FRIBIDI_MEM_H
+
+ #include <stdlib.h>
++#include <stdint.h>
+
+ #include "fribidi_config.h"
+
+@@ -31,21 +32,16 @@
+ {
+ #endif
+
+-#define FRIBIDI_INT8 char
+-#define FRIBIDI_INT16 short
+-#define FRIBIDI_INT32 long
+-#define FRIBIDI_INT int
+-
+ typedef int fribidi_boolean;
+
+- typedef signed FRIBIDI_INT8 fribidi_int8;
+- typedef unsigned FRIBIDI_INT8 fribidi_uint8;
+- typedef signed FRIBIDI_INT16 fribidi_int16;
+- typedef unsigned FRIBIDI_INT16 fribidi_uint16;
+- typedef signed FRIBIDI_INT32 fribidi_int32;
+- typedef unsigned FRIBIDI_INT32 fribidi_uint32;
+- typedef signed FRIBIDI_INT fribidi_int;
+- typedef unsigned FRIBIDI_INT fribidi_uint;
++ typedef int8_t fribidi_int8;
++ typedef uint8_t fribidi_uint8;
++ typedef int16_t fribidi_int16;
++ typedef uint16_t fribidi_uint16;
++ typedef int32_t fribidi_int32;
++ typedef uint32_t fribidi_uint32;
++ typedef int fribidi_int;
++ typedef unsigned int fribidi_uint;
+
+ #define FRIBIDI_TRUE 1
+ #define FRIBIDI_FALSE 0
--- fribidi-0.10.4.orig/patches/new-glib2.diff.old
+++ fribidi-0.10.4/patches/new-glib2.diff.old
@@ -0,0 +1,228 @@
+diff -uNr fribidi-0.9.0.orig/acinclude.m4 fribidi-0.9.0/acinclude.m4
+--- fribidi-0.9.0.orig/acinclude.m4 Thu Sep 27 00:57:23 2001
++++ fribidi-0.9.0/acinclude.m4 Thu Sep 27 00:58:42 2001
+@@ -1,63 +1,74 @@
+ # Configure paths for GLIB
+-# Owen Taylor 97-11-3
++# Owen Taylor 1997-2001
+
+ dnl AM_PATH_GLIB_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
+-dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if "gmodule" or
+-dnl gthread is specified in MODULES, pass to glib-config
++dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if gmodule, gobject or
++dnl gthread is specified in MODULES, pass to pkg-config
+ dnl
+ AC_DEFUN(AM_PATH_GLIB_2_0,
+ [dnl
+-dnl Get the cflags and libraries from the glib-config-2.0 script
++dnl Get the cflags and libraries from pkg-config
+ dnl
+-AC_ARG_WITH(glib-prefix,[ --with-glib-prefix=PFX Prefix where GLIB is installed (optional)],
+- glib_config_prefix="$withval", glib_config_prefix="")
+-AC_ARG_WITH(glib-exec-prefix,[ --with-glib-exec-prefix=PFX Exec prefix where GLIB is installed (optional)],
+- glib_config_exec_prefix="$withval", glib_config_exec_prefix="")
+ AC_ARG_ENABLE(glibtest, [ --disable-glibtest Do not try to compile and run a test GLIB program],
+- , enable_glibtest=yes)
+-
+- if test x$glib_config_exec_prefix != x ; then
+- glib_config_args="$glib_config_args --exec-prefix=$glib_config_exec_prefix"
+- if test x${GLIB_CONFIG_2_0+set} != xset ; then
+- GLIB_CONFIG_2_0=$glib_config_exec_prefix/bin/glib-config-2.0
+- fi
+- fi
+- if test x$glib_config_prefix != x ; then
+- glib_config_args="$glib_config_args --prefix=$glib_config_prefix"
+- if test x${GLIB_CONFIG_2_0+set} != xset ; then
+- GLIB_CONFIG_2_0=$glib_config_prefix/bin/glib-config-2.0
+- fi
+- fi
++ , enable_glibtest=yes)
+
++ pkg_config_args=glib-2.0
+ for module in . $4
+ do
+ case "$module" in
+ gmodule)
+- glib_config_args="$glib_config_args gmodule"
++ pkg_config_args="$pkg_config_args gmodule-2.0"
+ ;;
+ gobject)
+- glib_config_args="$glib_config_args gobject"
++ pkg_config_args="$pkg_config_args gobject-2.0"
+ ;;
+ gthread)
+- glib_config_args="$glib_config_args gthread"
++ pkg_config_args="$pkg_config_args gthread-2.0"
+ ;;
+ esac
+ done
+
+- AC_PATH_PROG(GLIB_CONFIG_2_0, glib-config-2.0, no)
+- min_glib_version=ifelse([$1], ,1.3.1,$1)
+- AC_MSG_CHECKING(for GLIB - version >= $min_glib_version)
++ AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
++
+ no_glib=""
+- if test "$GLIB_CONFIG_2_0" = "no" ; then
+- no_glib=yes
++
++ if test x$PKG_CONFIG != xno ; then
++ if $PKG_CONFIG --atleast-pkgconfig-version 0.7 ; then
++ :
++ else
++ echo *** pkg-config too old; version 0.7 or better required.
++ no_glib=yes
++ PKG_CONFIG=no
++ fi
++ fi
++
++ ## don't try to run the test against uninstalled libtool libs
++ if $PKG_CONFIG --uninstalled $pkg_config_args; then
++ echo "Will use uninstalled version of GLib found in PKG_CONFIG_PATH"
++ enable_glibtest=no
++ fi
++
++ min_glib_version=ifelse([$1], ,1.3.3,$1)
++ AC_MSG_CHECKING(for GLIB - version >= $min_glib_version)
++
++ if $PKG_CONFIG --atleast-version $min_glib_version $pkg_config_args; then
++ :
+ else
+- GLIB_CFLAGS=`$GLIB_CONFIG_2_0 $glib_config_args --cflags`
+- GLIB_LIBS=`$GLIB_CONFIG_2_0 $glib_config_args --libs`
+- glib_config_major_version=`$GLIB_CONFIG_2_0 $glib_config_args --version | \
++ no_glib = yes
++ fi
++
++ if test x"$no_glib" = x ; then
++ GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0`
++ GOBJECT_QUERY=`$PKG_CONFIG --variable=gobject_query glib-2.0`
++ GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0`
++
++ GLIB_CFLAGS=`$PKG_CONFIG --cflags $pkg_config_args`
++ GLIB_LIBS=`$PKG_CONFIG --libs $pkg_config_args`
++ glib_config_major_version=`$PKG_CONFIG --modversion glib-2.0 | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
+- glib_config_minor_version=`$GLIB_CONFIG_2_0 $glib_config_args --version | \
++ glib_config_minor_version=`$PKG_CONFIG --modversion glib-2.0 | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
+- glib_config_micro_version=`$GLIB_CONFIG_2_0 $glib_config_args --version | \
++ glib_config_micro_version=`$PKG_CONFIG --modversion glib-2.0 | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
+ if test "x$enable_glibtest" = "xyes" ; then
+ ac_save_CFLAGS="$CFLAGS"
+@@ -66,7 +77,7 @@
+ LIBS="$GLIB_LIBS $LIBS"
+ dnl
+ dnl Now check if the installed GLIB is sufficiently new. (Also sanity
+-dnl checks the results of glib-config-2.0 to some extent
++dnl checks the results of pkg-config to some extent)
+ dnl
+ rm -f conf.glibtest
+ AC_TRY_RUN([
+@@ -93,26 +104,25 @@
+ (glib_minor_version != $glib_config_minor_version) ||
+ (glib_micro_version != $glib_config_micro_version))
+ {
+- printf("\n*** 'glib-config-2.0 --version' returned %d.%d.%d, but GLIB (%d.%d.%d)\n",
++ printf("\n*** 'pkg-config --modversion glib-2.0' returned %d.%d.%d, but GLIB (%d.%d.%d)\n",
+ $glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version,
+ glib_major_version, glib_minor_version, glib_micro_version);
+- printf ("*** was found! If glib-config-2.0 was correct, then it is best\n");
+- printf ("*** to remove the old version of GLIB. You may also be able to fix the error\n");
++ printf ("*** was found! If pkg-config was correct, then it is best\n");
++ printf ("*** to remove the old version of GLib. You may also be able to fix the error\n");
+ printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
+ printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
+ printf("*** required on your system.\n");
+- printf("*** If glib-config-2.0 was wrong, set the environment variable GLIB_CONFIG_2_0\n");
+- printf("*** to point to the correct copy of glib-config-2.0, and remove the file config.cache\n");
+- printf("*** before re-running configure\n");
++ printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n");
++ printf("*** to point to the correct configuration files\n");
+ }
+ else if ((glib_major_version != GLIB_MAJOR_VERSION) ||
+- (glib_minor_version != GLIB_MINOR_VERSION) ||
++ (glib_minor_version != GLIB_MINOR_VERSION) ||
+ (glib_micro_version != GLIB_MICRO_VERSION))
+ {
+ printf("*** GLIB header files (version %d.%d.%d) do not match\n",
+- GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION);
++ GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION);
+ printf("*** library (version %d.%d.%d)\n",
+- glib_major_version, glib_minor_version, glib_micro_version);
++ glib_major_version, glib_minor_version, glib_micro_version);
+ }
+ else
+ {
+@@ -127,14 +137,14 @@
+ printf("\n*** An old version of GLIB (%d.%d.%d) was found.\n",
+ glib_major_version, glib_minor_version, glib_micro_version);
+ printf("*** You need a version of GLIB newer than %d.%d.%d. The latest version of\n",
+- major, minor, micro);
++ major, minor, micro);
+ printf("*** GLIB is always available from ftp://ftp.gtk.org.\n");
+ printf("***\n");
+ printf("*** If you have already installed a sufficiently new version, this error\n");
+- printf("*** probably means that the wrong copy of the glib-config-2.0 shell script is\n");
++ printf("*** probably means that the wrong copy of the pkg-config shell script is\n");
+ printf("*** being found. The easiest way to fix this is to remove the old version\n");
+- printf("*** of GLIB, but you can also set the GLIB_CONFIG_2_0 environment to point to the\n");
+- printf("*** correct copy of glib-config-2.0. (In this case, you will have to\n");
++ printf("*** of GLIB, but you can also set the PKG_CONFIG environment to point to the\n");
++ printf("*** correct copy of pkg-config. (In this case, you will have to\n");
+ printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
+ printf("*** so that the correct libraries are found at run-time))\n");
+ }
+@@ -151,11 +161,9 @@
+ ifelse([$2], , :, [$2])
+ else
+ AC_MSG_RESULT(no)
+- if test "$GLIB_CONFIG_2_0" = "no" ; then
+- echo "*** The glib-config-2.0 script installed by GLIB could not be found"
+- echo "*** If GLIB was installed in PREFIX, make sure PREFIX/bin is in"
+- echo "*** your path, or set the GLIB_CONFIG_2_0 environment variable to the"
+- echo "*** full path to glib-config-2.0."
++ if test "$PKG_CONFIG" = "no" ; then
++ echo "*** A new enough version of pkg-config was not found."
++ echo "*** See http://www.freedesktop.org/software/pkgconfig/"
+ else
+ if test -f conf.glibtest ; then
+ :
+@@ -173,27 +181,28 @@
+ echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
+ echo "*** to the installed location Also, make sure you have run ldconfig if that"
+ echo "*** is required on your system"
+- echo "***"
++ echo "***"
+ echo "*** If you have an old version installed, it is best to remove it, although"
+- echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
+- echo "***"
+- echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
+- echo "*** came with the system with the command"
+- echo "***"
+- echo "*** rpm --erase --nodeps gtk gtk-devel" ],
++ echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
+ [ echo "*** The test program failed to compile or link. See the file config.log for the"
+ echo "*** exact error that occured. This usually means GLIB was incorrectly installed"
+ echo "*** or that you have moved GLIB since it was installed. In the latter case, you"
+- echo "*** may want to edit the glib-config-2.0 script: $GLIB_CONFIG_2_0" ])
++ echo "*** may want to edit the pkg-config script: $PKG_CONFIG" ])
+ CFLAGS="$ac_save_CFLAGS"
+ LIBS="$ac_save_LIBS"
+ fi
+ fi
+ GLIB_CFLAGS=""
+ GLIB_LIBS=""
++ GLIB_GENMARSHAL=""
++ GOBJECT_QUERY=""
++ GLIB_MKENUMS=""
+ ifelse([$3], , :, [$3])
+ fi
+ AC_SUBST(GLIB_CFLAGS)
+ AC_SUBST(GLIB_LIBS)
++ AC_SUBST(GLIB_GENMARSHAL)
++ AC_SUBST(GOBJECT_QUERY)
++ AC_SUBST(GLIB_MKENUMS)
+ rm -f conf.glibtest
+ ])
--- fribidi-0.10.4.orig/fribidi_test.c
+++ fribidi-0.10.4/fribidi_test.c
@@ -0,0 +1,73 @@
+/* Test program taken from the geresh configure.in test of fribidi, this is the
+ * program that exposed the problem.
+ */
+
+#include <stdio.h>
+
+#include "fribidi.h"
+
+typedef FriBidiChar unichar;
+typedef FriBidiCharType ctype_t;
+typedef FriBidiLevel level_t;
+typedef FriBidiStrIndex idx_t;
+
+int main()
+{
+ unichar unistr[] = { 0x5D0, 0x5D1, 0x5D2, 'A', 0 }; /* alef, bet, gimel, 'A' */
+#define UNISTRLEN 4
+ level_t levels[UNISTRLEN];
+ unichar deststr[UNISTRLEN + 1];
+ ctype_t ctype;
+ ctype_t base_dir = FRIBIDI_TYPE_RTL;
+ unichar lparen = '(';
+ unichar lparen_mirror;
+
+ /* make sure all these constants are defined. */
+ ctype = FRIBIDI_TYPE_LTR | FRIBIDI_TYPE_RTL | FRIBIDI_TYPE_ON | FRIBIDI_TYPE_NSM;
+
+ if (sizeof(unichar) != 4) {
+ printf("\nERROR: FriBiDi doesn't use UCS-4\n");
+ /* I'm planning support for 16 bit chars someday. */
+ return 1;
+ }
+
+ ctype = fribidi_get_type(unistr[0]);
+ if (!FRIBIDI_IS_LETTER(ctype) ||
+ !FRIBIDI_IS_RTL(ctype) ||
+ FRIBIDI_IS_SPACE(ctype) ||
+ FRIBIDI_IS_NUMBER(ctype))
+ {
+ printf("\nERROR: Wrong properties for the Hebrew letter Alef\n");
+ return 1;
+ }
+
+ fribidi_log2vis_get_embedding_levels(unistr, UNISTRLEN, &base_dir, levels);
+ if (levels[0] != 1 ||
+ levels[1] != 1 ||
+ levels[2] != 1 ||
+ levels[3] != 2)
+ {
+ printf("\nERROR: fribidi_log2vis_get_embedding_levels() "
+ "gives wrong results\n");
+ return 1;
+ }
+
+ fribidi_log2vis(unistr, UNISTRLEN, &base_dir, deststr, NULL, NULL, NULL);
+ if (deststr[0] != 'A' ||
+ deststr[1] != 0x5D2 ||
+ deststr[2] != 0x5D1 ||
+ deststr[3] != 0x5D0)
+ {
+ printf("\nERROR: fribidi_log2vis() gives wrong results\n");
+ return 1;
+ }
+
+ if (!fribidi_get_mirror_char(lparen, &lparen_mirror) ||
+ lparen_mirror != ')')
+ {
+ printf("\nERROR: fribidi_get_mirror_char() gives wrong results\n");
+ return 1;
+ }
+
+ return 0;
+}