[fontforge-devel] writing a patch to use pkg-config to determine CFLAGS/LDFLAGS for libspiro, libuninameslist

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[fontforge-devel] writing a patch to use pkg-config to determine CFLAGS/LDFLAGS for libspiro, libuninameslist

suzuki toshiya
Hi,

Just yesterday I found that the latest fontforge configure
script could not configure CFLAGS/LDFLAGS for libspiro and
libuninameslist appropriately, if they are installed in
irregular directories (the directories which CC does not
search by default).

Fortunately, fontforge's configure has already adopted the
use of pkg-config, and both libraries provide pkg-config
database. So, I could made a small patch for configure to
try pkg-config for these libraries, as pasted at the end
of this post.

I think it could useful to help the people who wants to
build fontforge and required libraries at once, in same
directory structure (e.g. fontforge-latest/libspiro/...).

Yet I'm unfamiliar with the convention of ff-specific
autoconf macro. I wish if anybody help me to improve the
patch to the level considerable to be applied in main
trunk.

Regards,
mpsuzuki

---
diff --git a/configure.ac b/configure.ac
index ee9b6e4..325fb2a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -382,8 +382,54 @@ FONTFORGE_ARG_WITH_LIBJPEG
 FONTFORGE_ARG_WITH_LIBPNG
 FONTFORGE_ARG_WITH_LIBTIFF
 FONTFORGE_ARG_WITH_CAIRO # do this test only 'after' zlib and png checks
-FONTFORGE_ARG_WITH_LIBSPIRO
-FONTFORGE_ARG_WITH_LIBUNINAMESLIST
+PKG_CHECK_MODULES([libspiro],[libspiro],
+ [
+ i_do_have_libspiro="yes"
+ LIBSPIRO_CPPFLAGS=`$PKG_CONFIG --cflags libspiro`
+ LIBSPIRO_CFLAGS="${LIBSPIRO_CPPFLAGS}"
+ LIBSPIRO_LDFLAGS=`$PKG_CONFIG --libs-only-other --libs-only-L libspiro`
+ LIBSPIRO_LIBS=`$PKG_CONFIG --libs libspiro`
+ orig_CPPFLAGS="${CFLAGS}"
+ orig_CFLAGS="${CFLAGS}"
+ orig_LDFLAGS="${LDFLAGS}"
+ orig_LIBS="${LIBS}"
+ CPPFLAGS="${orig_CFLAGS} ${LIBSPIRO_CPPFLAGS}"
+ CFLAGS="${orig_CFLAGS} ${LIBSPIRO_CFLAGS}"
+ LDFLAGS="${orig_LDFLAGS} ${LIBSPIRO_LDFLAGS}"
+ LIBS="${orig_LIBS} ${LIBSPIRO_LDFLAGS}"
+ FONTFORGE_ARG_WITH_LIBSPIRO
+ CPPFLAGS="${orig_CFLAGS}"
+ CFLAGS="${orig_CFLAGS}"
+ LDFLAGS="${orig_LDFLAGS}"
+ LIBS="${orig_LIBS}"
+ ],
+ [
+ FONTFORGE_ARG_WITH_LIBSPIRO
+ ])
+PKG_CHECK_MODULES([libuninameslist],[libuninameslist],
+ [
+ i_do_have_libspiro="yes"
+ LIBUNINAMESLIST_CPPFLAGS=`$PKG_CONFIG --cflags libuninameslist`
+ LIBUNINAMESLIST_CFLAGS="${LIBUNINAMESLIST_CPPFLAGS}"
+ LIBUNINAMESLIST_LDFLAGS=`$PKG_CONFIG --libs-only-other --libs-only-L
libuninameslist`
+ LIBUNINAMESLIST_LIBS=`$PKG_CONFIG --libs libuninameslist`
+ orig_CPPFLAGS="${CFLAGS}"
+ orig_CFLAGS="${CFLAGS}"
+ orig_LDFLAGS="${LDFLAGS}"
+ orig_LIBS="${LIBS}"
+ CPPFLAGS="${orig_CFLAGS} ${LIBUNINAMESLIST_CPPFLAGS}"
+ CFLAGS="${orig_CFLAGS} ${LIBUNINAMESLIST_CFLAGS}"
+ LDFLAGS="${orig_LDFLAGS} ${LIBUNINAMESLIST_LDFLAGS}"
+ LIBS="${orig_LIBS} ${LIBUNINAMESLIST_LDFLAGS}"
+ FONTFORGE_ARG_WITH_LIBUNINAMESLIST
+ CPPFLAGS="${orig_CFLAGS}"
+ CFLAGS="${orig_CFLAGS}"
+ LDFLAGS="${orig_LDFLAGS}"
+ LIBS="${orig_LIBS}"
+ ],
+ [
+ FONTFORGE_ARG_WITH_LIBUNINAMESLIST
+ ])
 #FONTFORGE_ARG_WITH_LIBUNICODENAMES
 FONTFORGE_ARG_WITH_ZEROMQ
 FONTFORGE_ARG_WITH_LIBREADLINE


------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
fontforge-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/fontforge-devel
http://fontforge.10959.n7.nabble.com/Developer-f3.html
Joe
Reply | Threaded
Open this post in threaded view
|

Re: writing a patch to use pkg-config to determine CFLAGS/LDFLAGS for libspiro, libuninameslist

Joe
Hi mpsuzuki,
There are some distros and operating systems that have broken pkg-config, so
we do need a substitute method to find the libraries. I've noted recently,
some appear able to find what they need with AC_CHECK, but have trouble with
AC_SEARCH, while others can use AC_SEARCH, but have trouble with AC_CHECK.

The configure in FontForge was created earlier in time, while the one found
in libspiro and libuninamelist was created later in time with a bit more
from a few distro maintainers, so these two should accomidate more.

I recommend, if you want to modify the search in Fontforge, that you look
at the m4 directory and modify the functions inside there and not add a
patch after the initial search (we're running into some patched-in problems
with python due to a patch on a patch in configure).
...so, my recommendation is, look at fixing the one in the m4 directory, and
use the example in libspiro's configure as a template.

Please note, FontForge's configure is expecting to have libspiro and
libuninameslist built before you begin building FontForge (this is where
the AC_SEARCH AC_CHECK become a necessary search method for distros with
broken pkg-config).

or

If you are currently having trouble with CFLAGS and LDFLAGS, type
./configure --help
and it will show you indiviualized inputs for libspiro and libuninameslist.

LIBSPIRO_CFLAGS = C compiler flags for LIBSPIRO, overriding pkg-config
LIBSPIRO_LIBS = linker flags for LIBSPIRO, overriding pkg-config
LIBUNINAMESLIST_CFLAGS = C compiler flags for LIBUNINAMESLIST, overriding
pkg-config
LIBUNINAMESLIST_LIBS = linker flags for LIBUNINAMESLIST, overriding pkg-
config


On April 26, 2016 08:03:24 PM suzuki toshiya wrote:

> Hi,
>
> Just yesterday I found that the latest fontforge configure
> script could not configure CFLAGS/LDFLAGS for libspiro and
> libuninameslist appropriately, if they are installed in
> irregular directories (the directories which CC does not
> search by default).
>
> Fortunately, fontforge's configure has already adopted the
> use of pkg-config, and both libraries provide pkg-config
> database. So, I could made a small patch for configure to
> try pkg-config for these libraries, as pasted at the end
> of this post.
>
> I think it could useful to help the people who wants to
> build fontforge and required libraries at once, in same
> directory structure (e.g. fontforge-latest/libspiro/...).
>
> Yet I'm unfamiliar with the convention of ff-specific
> autoconf macro. I wish if anybody help me to improve the
> patch to the level considerable to be applied in main
> trunk.
>
> Regards,
> mpsuzuki
>
> ---
> diff --git a/configure.ac b/configure.ac
> index ee9b6e4..325fb2a 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -382,8 +382,54 @@ FONTFORGE_ARG_WITH_LIBJPEG
>  FONTFORGE_ARG_WITH_LIBPNG
>  FONTFORGE_ARG_WITH_LIBTIFF
>  FONTFORGE_ARG_WITH_CAIRO # do this test only 'after' zlib and png
> checks -FONTFORGE_ARG_WITH_LIBSPIRO
> -FONTFORGE_ARG_WITH_LIBUNINAMESLIST
> +PKG_CHECK_MODULES([libspiro],[libspiro],
> + [
> + i_do_have_libspiro="yes"
> + LIBSPIRO_CPPFLAGS=`$PKG_CONFIG --cflags libspiro`
> + LIBSPIRO_CFLAGS="${LIBSPIRO_CPPFLAGS}"
> + LIBSPIRO_LDFLAGS=`$PKG_CONFIG --libs-only-other --libs-only-L
> libspiro` + LIBSPIRO_LIBS=`$PKG_CONFIG --libs libspiro`
> + orig_CPPFLAGS="${CFLAGS}"
> + orig_CFLAGS="${CFLAGS}"
> + orig_LDFLAGS="${LDFLAGS}"
> + orig_LIBS="${LIBS}"
> + CPPFLAGS="${orig_CFLAGS} ${LIBSPIRO_CPPFLAGS}"
> + CFLAGS="${orig_CFLAGS} ${LIBSPIRO_CFLAGS}"
> + LDFLAGS="${orig_LDFLAGS} ${LIBSPIRO_LDFLAGS}"
> + LIBS="${orig_LIBS} ${LIBSPIRO_LDFLAGS}"
> + FONTFORGE_ARG_WITH_LIBSPIRO
> + CPPFLAGS="${orig_CFLAGS}"
> + CFLAGS="${orig_CFLAGS}"
> + LDFLAGS="${orig_LDFLAGS}"
> + LIBS="${orig_LIBS}"
> + ],
> + [
> + FONTFORGE_ARG_WITH_LIBSPIRO
> + ])
> +PKG_CHECK_MODULES([libuninameslist],[libuninameslist],
> + [
> + i_do_have_libspiro="yes"
> + LIBUNINAMESLIST_CPPFLAGS=`$PKG_CONFIG --cflags libuninameslist`
> + LIBUNINAMESLIST_CFLAGS="${LIBUNINAMESLIST_CPPFLAGS}"
> + LIBUNINAMESLIST_LDFLAGS=`$PKG_CONFIG --libs-only-other --libs-
only-L

> libuninameslist`
> + LIBUNINAMESLIST_LIBS=`$PKG_CONFIG --libs libuninameslist`
> + orig_CPPFLAGS="${CFLAGS}"
> + orig_CFLAGS="${CFLAGS}"
> + orig_LDFLAGS="${LDFLAGS}"
> + orig_LIBS="${LIBS}"
> + CPPFLAGS="${orig_CFLAGS} ${LIBUNINAMESLIST_CPPFLAGS}"
> + CFLAGS="${orig_CFLAGS} ${LIBUNINAMESLIST_CFLAGS}"
> + LDFLAGS="${orig_LDFLAGS} ${LIBUNINAMESLIST_LDFLAGS}"
> + LIBS="${orig_LIBS} ${LIBUNINAMESLIST_LDFLAGS}"
> + FONTFORGE_ARG_WITH_LIBUNINAMESLIST
> + CPPFLAGS="${orig_CFLAGS}"
> + CFLAGS="${orig_CFLAGS}"
> + LDFLAGS="${orig_LDFLAGS}"
> + LIBS="${orig_LIBS}"
> + ],
> + [
> + FONTFORGE_ARG_WITH_LIBUNINAMESLIST
> + ])
>  #FONTFORGE_ARG_WITH_LIBUNICODENAMES
>  FONTFORGE_ARG_WITH_ZEROMQ
>  FONTFORGE_ARG_WITH_LIBREADLINE

------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
fontforge-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/fontforge-devel
http://fontforge.10959.n7.nabble.com/Developer-f3.html