Re: [ft-devel] using pkg-config

2013-09-17 Thread Miles Bader
2013/9/17 Behdad Esfahbod beh...@behdad.org:
 It also used to the case that pkg-config didn't handle
 cross-compilation properly (I haven't checked this in a while), which
 seems like it would be an issue for freetype.

 Works just fine for cross-compiling.  I do that every day.

It does?  How does it work?

At least with standard autoconf practices, pkg-config doesn't even
seem to notice if you're cross-compiling, and just gives info for the
cross-compilation host, which is usually incorrect...

This isn't entirely surprising, as pkg-config doesn't use the compiler
like most autoconf tests, and so won't automatically reflect changes
in the toolchain used.  The pkg-config autoconf macros could
conceivably detect this situation (and do... what, I don't know, but
they could at least disable pkg-config), but don't appear to even try.

E.g. if you use the following basic configure.ac file:

AC_INIT([t1], [0.0], [Miles Bader mi...@gnu.org])
AC_CONFIG_HEADERS([config.h])
AC_PROG_CC
PKG_PROG_PKG_CONFIG
have_libpng=no
PKG_CHECK_MODULES([libpng], [libpng], [have_libpng=yes], [:])
if test $have_libpng = yes; then
  AC_DEFINE([HAVE_LIBPNG], [1], [Define if libpng is installed])
fi
AC_CONFIG_FILES([Makefile])
AC_OUTPUT

and then try to cross-compile with it:

./configure --host=x86_64-w64-mingw32

... then the wrong thing will happen, and the build will fail.  By
contrast, a traditional library check using AC_CHECK_LIB will behave
as expected.

So at the least, it looks like some sort of special care is needed
either on the part of the configure script or on the part of the user,
to deal with pkg-config during cross-compilation.

Thanks,

-miles

-- 
Cat is power.  Cat is peace.

___
Freetype-devel mailing list
Freetype-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/freetype-devel


Re: [ft-devel] using pkg-config

2013-09-17 Thread John Tytgat

On 9/17/2013 8:50 AM, Miles Bader wrote:

2013/9/17 Behdad Esfahbod beh...@behdad.org:

It also used to the case that pkg-config didn't handle
cross-compilation properly (I haven't checked this in a while), which
seems like it would be an issue for freetype.

Works just fine for cross-compiling.  I do that every day.

It does?  How does it work?

Define PKG_CONFIG_LIBDIR

At least with standard autoconf practices, pkg-config doesn't even
seem to notice if you're cross-compiling, and just gives info for the
cross-compilation host, which is usually incorrect...
True, that's the current situation but with PKG_CONFIG_LIBDIR defined 
you can avoid this.


There are plans for a --host option 
(http://www.freedesktop.org/wiki/Software/pkg-config/CrossCompileProposal/) 
but I don't know what the current state is.


John.


___
Freetype-devel mailing list
Freetype-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/freetype-devel


Re: [ft-devel] using pkg-config

2013-09-17 Thread Behdad Esfahbod
On 13-09-17 07:14 AM, Khaled Hosny wrote:
 On Tue, Sep 17, 2013 at 07:58:27AM +0200, Werner LEMBERG wrote:

 I will soon need the HarfBuzz library which doesn't provide a
 `harfbuzz-config' script.

 That would be for GSUB closure I assume?

 Yep.

 This will be tricky since it will cause a circular dependency
 between harfbuzz and freetype.  Let me think about it a bit.

 Uh, oh.  I currently see only two solutions:

   (1) split HarfBuzz into two libraries
   (2) copy the GSUB closure stuff into FreeType

 Solution (1) means a lot of work for you, making HarfBuzz probably
 more difficult to maintain, and (2) would be a nasty hack, with the
 additional complication that HarfBuzz is written in C++...
 
 I think harfbuzz-ft part can be split just like harfbuzz-icu, then
 freetype would only depend on the plain harfbuzz, but its will have to
 maintain its own harfbuzz font functions implementation (you probably do
 not even need most of them).

FreeType itself doesn't need harfbuzz-ft.  I can split, but this time it has
to be split into separate tarballs such that distros can build harfbuzz, then
freetype, then harfbuzz-ft.  But then hb-view and hb-shape depend on
harfbuzz-ft currently...

Let me think about it a bit.

 Regards,
 Khaled
 

-- 
behdad
http://behdad.org/

___
Freetype-devel mailing list
Freetype-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/freetype-devel


Re: [ft-devel] using pkg-config

2013-09-17 Thread Behdad Esfahbod
On 13-09-17 03:56 AM, John Tytgat wrote:
 On 9/17/2013 8:50 AM, Miles Bader wrote:
 2013/9/17 Behdad Esfahbod beh...@behdad.org:
 It also used to the case that pkg-config didn't handle
 cross-compilation properly (I haven't checked this in a while), which
 seems like it would be an issue for freetype.
 Works just fine for cross-compiling.  I do that every day.
 It does?  How does it work?
 Define PKG_CONFIG_LIBDIR

My favorite is in fact a wrapper. Eg.

$ cat ~/.local/i686-w64-mingw32/bin/i686-w64-mingw32-pkg-config
#!/bin/sh
PKG_CONFIG_LIBDIR=$HOME/.local/i686-w64-mingw32/lib/pkgconfig
export PKG_CONFIG_LIBDIR
exec pkg-config $@




 At least with standard autoconf practices, pkg-config doesn't even
 seem to notice if you're cross-compiling, and just gives info for the
 cross-compilation host, which is usually incorrect...
 True, that's the current situation but with PKG_CONFIG_LIBDIR defined you can
 avoid this.
 
 There are plans for a --host option
 (http://www.freedesktop.org/wiki/Software/pkg-config/CrossCompileProposal/)
 but I don't know what the current state is.
 
 John.

-- 
behdad
http://behdad.org/

___
Freetype-devel mailing list
Freetype-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/freetype-devel


Re: [ft-devel] using pkg-config

2013-09-16 Thread Behdad Esfahbod
On 13-09-15 08:26 AM, Miles Bader wrote:
 Werner LEMBERG w...@gnu.org writes:
 Does it make sense to completely switch to pkg-config?  All of the
 above libraries provide .pc files.  However, I wonder whether there
 are situations where there usage of pkg-config is problematic.

 A certain burden is that pkg-config itself must be installed (or
 pkgconf, which does the same in a probably better way).  Is this a
 hassle on some platforms?
 
 My impression is that although on mainstream linux distros it's a
 pretty good bet pkg-config is available, it's far from universal if
 you care about the fringes -- and freetype looks very much like the
 sort of library that tends to care more about the fringes than usual.

Users can install pkg-config.  No big deal.  Really, it's 2013.


 It also used to the case that pkg-config didn't handle
 cross-compilation properly (I haven't checked this in a while), which
 seems like it would be an issue for freetype.

Works just fine for cross-compiling.  I do that every day.

-
behdad
http://behdad.org/

___
Freetype-devel mailing list
Freetype-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/freetype-devel


Re: [ft-devel] using pkg-config

2013-09-16 Thread Behdad Esfahbod
On 13-09-15 05:06 AM, Werner LEMBERG wrote:
 I will soon need the HarfBuzz library which doesn't provide a 
 `harfbuzz-config' script.

That would be for GSUB closure I assume?

This will be tricky since it will cause a circular dependency between harfbuzz
and freetype.  Let me think about it a bit.

-- 
behdad
http://behdad.org/

___
Freetype-devel mailing list
Freetype-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/freetype-devel


Re: [ft-devel] using pkg-config

2013-09-16 Thread Werner LEMBERG

 I will soon need the HarfBuzz library which doesn't provide a
 `harfbuzz-config' script.
 
 That would be for GSUB closure I assume?

Yep.

 This will be tricky since it will cause a circular dependency
 between harfbuzz and freetype.  Let me think about it a bit.

Uh, oh.  I currently see only two solutions:

  (1) split HarfBuzz into two libraries
  (2) copy the GSUB closure stuff into FreeType

Solution (1) means a lot of work for you, making HarfBuzz probably
more difficult to maintain, and (2) would be a nasty hack, with the
additional complication that HarfBuzz is written in C++...

Sigh.


Werner

___
Freetype-devel mailing list
Freetype-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/freetype-devel


[ft-devel] using pkg-config

2013-09-15 Thread Werner LEMBERG

Folks,


FreeType's configure script currently uses the `AC_CHECK_LIB' m4 macro
to detect the presence of libz and libbz2.  For libpng, it uses the
`libpng-config' script.  I will soon need the HarfBuzz library which
doesn't provide a `harfbuzz-config' script.

Does it make sense to completely switch to pkg-config?  All of the
above libraries provide .pc files.  However, I wonder whether there
are situations where there usage of pkg-config is problematic.

A certain burden is that pkg-config itself must be installed (or
pkgconf, which does the same in a probably better way).  Is this a
hassle on some platforms?

If possible, I would like to avoid a hybrid approach (this is, first
checking for `foo.pc', then trying `foo-config', then using
`AC_CHECK_LIB[foo]').

Any advice is highly welcomed.


Werner

___
Freetype-devel mailing list
Freetype-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/freetype-devel


Re: [ft-devel] using pkg-config

2013-09-15 Thread suzuki toshiya
Excuse me, just a small off-topic question,

 `libpng-config' script.  I will soon need the HarfBuzz library which
 doesn't provide a `harfbuzz-config' script.

Future release of FreeType2 will depend on HarfBuzz?

Regards,
mpsuzuki

On 09/15/2013 06:06 PM, Werner LEMBERG wrote:
 
 Folks,
 
 
 FreeType's configure script currently uses the `AC_CHECK_LIB' m4 macro
 to detect the presence of libz and libbz2.  For libpng, it uses the
 `libpng-config' script.  I will soon need the HarfBuzz library which
 doesn't provide a `harfbuzz-config' script.
 
 Does it make sense to completely switch to pkg-config?  All of the
 above libraries provide .pc files.  However, I wonder whether there
 are situations where there usage of pkg-config is problematic.
 
 A certain burden is that pkg-config itself must be installed (or
 pkgconf, which does the same in a probably better way).  Is this a
 hassle on some platforms?
 
 If possible, I would like to avoid a hybrid approach (this is, first
 checking for `foo.pc', then trying `foo-config', then using
 `AC_CHECK_LIB[foo]').
 
 Any advice is highly welcomed.
 
 
  Werner
 
 ___
 Freetype-devel mailing list
 Freetype-devel@nongnu.org
 https://lists.nongnu.org/mailman/listinfo/freetype-devel
 


___
Freetype-devel mailing list
Freetype-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/freetype-devel


Re: [ft-devel] using pkg-config

2013-09-15 Thread Miles Bader
Werner LEMBERG w...@gnu.org writes:
 Does it make sense to completely switch to pkg-config?  All of the
 above libraries provide .pc files.  However, I wonder whether there
 are situations where there usage of pkg-config is problematic.

 A certain burden is that pkg-config itself must be installed (or
 pkgconf, which does the same in a probably better way).  Is this a
 hassle on some platforms?

My impression is that although on mainstream linux distros it's a
pretty good bet pkg-config is available, it's far from universal if
you care about the fringes -- and freetype looks very much like the
sort of library that tends to care more about the fringes than usual.

It also used to the case that pkg-config didn't handle
cross-compilation properly (I haven't checked this in a while), which
seems like it would be an issue for freetype.

It's not very hard to try both in turn, e.g.:

   have_libfoo=no
   PKG_CHECK_MODULES([luafoo], [luafoo], [have_luafoo=yes], [:])
   if test $have_libfoo = no; then
 AC_CHECK_LIB([foo], [somefun], [have_luafoo=yes])
   fi
   if test $have_libfoo = yes; then
 ...do stuff for libfoo...
   fi

Should fallback gracefully to traditional checking if pkg-config isn't
installed..

[When libraries are installed in funny places it can be a little more
annoying without pkg-config, but AFAIK, libpng usually isn't one of
those libraries...]

-miles

-- 
Innards, n. pl. The stomach, heart, soul, and other bowels.

___
Freetype-devel mailing list
Freetype-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/freetype-devel


Re: [ft-devel] using pkg-config

2013-09-15 Thread Werner LEMBERG

 `libpng-config' script.  I will soon need the HarfBuzz library
 which doesn't provide a `harfbuzz-config' script.
 
 Future release of FreeType2 will depend on HarfBuzz?

Optionally only, as with the other libraries.


Werner

___
Freetype-devel mailing list
Freetype-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/freetype-devel