Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#17 add SYSROOT handling to libpng-config

closed
None
5
2010-01-18
2009-12-29
Robert Schwebel
No

libpng-config isn't SYSROOT aware, which is bad if you try to package it, for example in a cross build system.~/

Discussion

  • patch that fixes the issue

     
  • I forwarded the request to png-mng-implement@lists.sf.net. Thanks for the patch.

     
  • Don't libdir and includedir also need to be modified?

     
  • I've made libpng-1.5.0alpha01 (in the "alpha" branch of
    the GIT repository) sysroot-aware.

    They don't use the $SYSROOT environment variable
    that was suggested.

    libpng-config.in takes a --sysroot=DIR option, with "" as
    the default value.

    libpng.pc.in also takes a --sysroot=DIR option, with
    $PKG_CONFIG_SYSROOT_DIR as the default value.

    Further modifications are probably needed, to CMakeLists.txt,
    the configure scripts, and the scripts/makefiles, to
    use the --sysroot option properly.

    I HAVE NOT TESTED THIS except to verify that things
    still work when the --sysroot option or the
    PKG_CONFIG_SYSROOT_DIR environment variable is not
    supplied.

    Glenn

     
    • assigned_to: nobody --> glennrp
     
  • glennrp,

    Thanks for the commit; I'd like to test the branch, but unfortunately there are some issues.

    1) The sourceforge git doesn't contain the branches (like alpha). So I checked it out with
    git checkout 8c8e58a2ee673b5dbd79c3d18c3a43680e917a87
    2) The tree seems to be in a strange shape: after running "sh autogen.sh", I get this when I try to
    package it for testing in my build system:

    rsc@thebe:libpng$ make dist
    make: *** No rule to make target `dist'. Stop.

    3) If I try to build "as it is", without running autogen, I get this:

    rsc@thebe:libpng$ ./configure && make
    [...]
    (cd .libs && rm -f libpng14.la && ln -s ../libpng14.la libpng14.la)
    make[1]: *** No rule to make target `libpng14-config', needed by `all-am'. Stop.
    make[1]: Leaving directory `/home/rsc/git/libpng'
    make: *** [all] Error 2

    Do you have an idea what may be wrong?

    rsc

     
  • 1) I don't know what that is about. Sourceforge branches are in a "libpng" subdirectory.
    You should see branches "master", "devel", "stable", and "alpha".
    2) There might not be a "dist" target. I see "distclean:" but no "dist:" in Makefile.in
    3) It was still (partly) trying to build libpng14 instead of libpng15. I think that is fixed now; try again.

     
  • Hello,

    libpng-config.in doesn't has any parser for the --sysroot option, thus it won't work.

    IMHO adding an option to libpng-config isn't such a good idea, because it requires "fixing" each packet using it. With the proposed approach it's not possible to set a default without the --sysroot option from outside.

     
  • Hi Glenn,

    Thanks for your feedback.

    > 1) I don't know what that is about. Sourceforge branches are in a "libpng"
    > subdirectory.
    > You should see branches "master", "devel", "stable", and "alpha".

    Ah, sorry, pilot error.

    > 2) There might not be a "dist" target. I see "distclean:" but no "dist:"
    > in Makefile.in

    Automake *always* generates a 'make dist' target. It is usually be used to actually create your distribution tarball. In fact, you should use 'make distcheck' (which builds the tarball, extracts it, makes it read-only and performs an out-of-tree build).

    However, it doesn't seem to be your favourite method to create tarballs :-) Are you interested in patches in that area?

    > 3) It was still (partly) trying to build libpng14 instead of libpng15. I
    > think that is fixed now; try again.

    Builds now, compile-tested on arm1136, thanks.

    rsc

     
  • the .pc file fix doesn't work either:

    [frogger@hardanger:local]$ export PKG_CONFIG_SYSROOT_DIR=/foo/bar
    [frogger@hardanger:local]$ export PKG_CONFIG_LIBDIR=/tmp/install/usr/local/lib/pkgconfig
    [frogger@hardanger:local]$ ~/pengutronix/bsp/OSELAS.BSP-Pengutronix-AllYes-trunk/platform-ARM-reference/sysroot-host/bin/pkg-config --cflags libpng
    Variable 'PKG_CONFIG_SYSROOT_DIR' not defined in '/tmp/install/usr/local/lib/pkgconfig/libpng.pc'

    If I understand pkg-config correct, you don't have to fiddle around with PKG_CONFIG_SYSROOT_DIR in your .pc files. pkg-config does this transparently for you. With the attached patch in works for me.....

    cheers, Marc

    From 5c183c639d9fa7037c19883bb6559582478e0a52 Mon Sep 17 00:00:00 2001
    From: Marc Kleine-Budde <mkl@pengutronix.de>
    Date: Sun, 3 Jan 2010 01:25:11 +0100
    Subject: [PATCH] libpng.pc.in: don't fiddle with PKG_CONFIG_SYSROOT_DIR

    pkg-config does this for you transparently.

    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
    ---
    libpng.pc.in | 9 ++++-----
    1 files changed, 4 insertions(+), 5 deletions(-)

    diff --git a/libpng.pc.in b/libpng.pc.in
    index 4ba1c62..3e7e2c5 100644
    --- a/libpng.pc.in
    +++ b/libpng.pc.in
    @@ -1,8 +1,7 @@
    -sysroot=${PKG_CONFIG_SYSROOT_DIR}
    -prefix=${sysroot}@prefix@
    -exec_prefix=${sysroot}@exec_prefix@
    -libdir=${sysroot}@libdir@
    -includedir=${sysroot}@includedir@/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@
    +prefix=@prefix@
    +exec_prefix=@exec_prefix@
    +libdir=@libdir@
    +includedir=@includedir@/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@

    Name: libpng
    Description: Loads and saves PNG files
    --
    1.6.5.7

     
  • The discussion on png-mng-implement (and marc's comment) leads me to believe
    that it would be a mistake to put sysroot processing in any foo.pc. The change
    in libpng_alpha, which I'm about to remove, would work on old versions of
    pkg-config that don't recognize the variable, but the current version would
    end up prepending the directory twice, once by libpng.pc and again by
    pkg-config.

     
  • ...or it wouldn't work at all, as marc observed!

     
    • status: open --> pending
     
    • status: pending --> closed
     
  • This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 14 days (the time period specified by
    the administrator of this Tracker).