diff mbox series

[2/3] package/perl-gd: needs perl-extutils-pkgconfig

Message ID 20210124112214.480254-2-fontaine.fabrice@gmail.com
State Superseded
Headers show
Series [1/3] package/perl-extutils-pkgconfig: new package | expand

Commit Message

Fabrice Fontaine Jan. 24, 2021, 11:22 a.m. UTC
Commit 3a291be2e89bc64388c10dae50233c751a86733d forgot to add
perl-extutils-pkgconfig dependency

Fixes:
 - http://autobuild.buildroot.org/results/e590f1990180eae21512b23b884755e105a4c588

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
 ...-fix-cross-compilation-with-gdlib.pc.patch | 34 +++++++++++++++++++
 package/perl-gd/perl-gd.mk                    |  7 +++-
 2 files changed, 40 insertions(+), 1 deletion(-)
 create mode 100644 package/perl-gd/0001-Makefile.PL-fix-cross-compilation-with-gdlib.pc.patch

Comments

Thomas Petazzoni Jan. 25, 2021, 8:48 p.m. UTC | #1
Hello,

+François in Cc.

On Sun, 24 Jan 2021 12:22:13 +0100
Fabrice Fontaine <fontaine.fabrice@gmail.com> wrote:

> +-@INC     = qw(-I/usr/include -I/usr/include/gd) unless @INC;
> ++#@INC     = qw(-I/usr/include -I/usr/include/gd) unless @INC;

I'm certainly not very good with Perl, but doesn't the "unless @INC"
means "if INC is not already specified" ?

> + @LIBPATH = qw(-L/usr/lib/X11 -L/usr/X11R6/lib -L/usr/X11/lib -L/usr/lib) unless @LIBPATH;

And isn't that a problem, too ? These library paths are pretty horrible
for cross-compilation.

Thomas
Fabrice Fontaine Jan. 25, 2021, 9:04 p.m. UTC | #2
Hello,

Le lun. 25 janv. 2021 à 21:48, Thomas Petazzoni
<thomas.petazzoni@bootlin.com> a écrit :
>
> Hello,
>
> +François in Cc.
>
> On Sun, 24 Jan 2021 12:22:13 +0100
> Fabrice Fontaine <fontaine.fabrice@gmail.com> wrote:
>
> > +-@INC     = qw(-I/usr/include -I/usr/include/gd) unless @INC;
> > ++#@INC     = qw(-I/usr/include -I/usr/include/gd) unless @INC;
>
> I'm certainly not very good with Perl, but doesn't the "unless @INC"
> means "if INC is not already specified" ?
I'm also not good with Perl but it seems to me that unless means
"unless @INC is empty (i.e. not already specified or empty)"
>
> > + @LIBPATH = qw(-L/usr/lib/X11 -L/usr/X11R6/lib -L/usr/X11/lib -L/usr/lib) unless @LIBPATH;
>
> And isn't that a problem, too ? These library paths are pretty horrible
> for cross-compilation.
LIBPATH will be overriden with the -L value added by our pkg-config
wrapper thanks to this piece of code:

@LIBS = split /\s+/,$libs;
if ($libdir) {
  if ($config) {
    @LIBPATH = map {s/^-L// && "-L$_"} split /\s+/,$ldflags;
    ($lib_gd_path = $libdir) =~ s!/[^/]+$!!;
  } else {
    $lib_gd_path = $libdir;
  }
  push @LIBPATH,"-L$libdir";
}

The issue is that INC will be empty because it is extracted from cflags:
@INC = map {s/^-I// && "-I$_"} split /\s+/,$cflags;

But a review from a Perl would be nice as this solution is indeed a bit ugly.
>
> Thomas
> --
> Thomas Petazzoni, CTO, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com
Best Regards,

Fabrice
François Perrad Feb. 11, 2021, 7:50 a.m. UTC | #3
Le dim. 24 janv. 2021 à 12:23, Fabrice Fontaine <fontaine.fabrice@gmail.com>
a écrit :

> Commit 3a291be2e89bc64388c10dae50233c751a86733d forgot to add
> perl-extutils-pkgconfig dependency
>
> Fixes:
>  -
> http://autobuild.buildroot.org/results/e590f1990180eae21512b23b884755e105a4c588
>
> Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> ---
>  ...-fix-cross-compilation-with-gdlib.pc.patch | 34 +++++++++++++++++++
>  package/perl-gd/perl-gd.mk                    |  7 +++-
>  2 files changed, 40 insertions(+), 1 deletion(-)
>  create mode 100644
> package/perl-gd/0001-Makefile.PL-fix-cross-compilation-with-gdlib.pc.patch
>
> diff --git
> a/package/perl-gd/0001-Makefile.PL-fix-cross-compilation-with-gdlib.pc.patch
> b/package/perl-gd/0001-Makefile.PL-fix-cross-compilation-with-gdlib.pc.patch
> new file mode 100644
> index 0000000000..af053c5605
> --- /dev/null
> +++
> b/package/perl-gd/0001-Makefile.PL-fix-cross-compilation-with-gdlib.pc.patch
> @@ -0,0 +1,34 @@
> +From 11dc017e902397c452331425eb6101b3315572fa Mon Sep 17 00:00:00 2001
> +From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> +Date: Sun, 24 Jan 2021 10:59:31 +0100
> +Subject: [PATCH] Makefile.PL: fix cross-compilation with gdlib.pc
> +
> +Cross-compilation will fail if gdlib.pc does not contain any cflags.
> +Indeed, if cflags is empty, Makefile.PL will use the default value for
> +INC (i.e. -I/usr/include -I/usr/include/gd)
> +
> +It should be noted that gdlib-config has been dropped from gd since
> +version 2.3.0
> +
> +Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> +[Upstream status: probably not upstreamable]
> +---
> + Makefile.PL | 2 +-
> + 1 file changed, 1 insertion(+), 1 deletion(-)
> +
> +diff --git a/Makefile.PL b/Makefile.PL
> +index 25f2f93..7da3651 100644
> +--- a/Makefile.PL
> ++++ b/Makefile.PL
> +@@ -47,7 +47,7 @@ If you want to try to compile anyway, please rerun this
> script with the option -
> + END
> + }
> +
> +-@INC     = qw(-I/usr/include -I/usr/include/gd) unless @INC;
> ++#@INC     = qw(-I/usr/include -I/usr/include/gd) unless @INC;
> + @LIBPATH = qw(-L/usr/lib/X11 -L/usr/X11R6/lib -L/usr/X11/lib -L/usr/lib)
> unless @LIBPATH;
> + @LIBS    = qw(-lgd) unless @LIBS;
> +
> +--
> +2.29.2
> +
> diff --git a/package/perl-gd/perl-gd.mk b/package/perl-gd/perl-gd.mk
> index b058672a23..1471cfb8bf 100644
> --- a/package/perl-gd/perl-gd.mk
> +++ b/package/perl-gd/perl-gd.mk
> @@ -7,11 +7,16 @@
>  PERL_GD_VERSION = 2.73
>  PERL_GD_SOURCE = GD-$(PERL_GD_VERSION).tar.gz
>  PERL_GD_SITE = $(BR2_CPAN_MIRROR)/authors/id/R/RU/RURBAN
> -PERL_GD_DEPENDENCIES = host-pkgconf zlib libpng freetype gd
> +PERL_GD_DEPENDENCIES = \
> +       host-pkgconf host-perl-extutils-pkgconfig zlib libpng freetype gd
>

Fabrice,

host-pkgconfig could be removed from PERL_GD_DEPENDENCIES (it comes with
host-perl-extutils-pkgconfig)

François


>  PERL_GD_LICENSE = Artistic or GPL-1.0+
>  PERL_GD_LICENSE_FILES = LICENSE
>  PERL_GD_DISTNAME = GD
>
> +PERL_GD_CONF_ENV = \
> +       PATH=$(BR_PATH) \
> +       PKG_CONFIG_PATH="$(STAGING_DIR)/usr/lib/pkgconfig"
> +
>  PERL_GD_CONF_OPTS = \
>         -lib_gd_path=$(STAGING_DIR)/usr \
>         -lib_ft_path=$(STAGING_DIR)/usr \
> --
> 2.29.2
>
>
François Perrad Feb. 11, 2021, 7:51 a.m. UTC | #4
Le lun. 25 janv. 2021 à 22:05, Fabrice Fontaine <fontaine.fabrice@gmail.com>
a écrit :

> Hello,
>
> Le lun. 25 janv. 2021 à 21:48, Thomas Petazzoni
> <thomas.petazzoni@bootlin.com> a écrit :
> >
> > Hello,
> >
> > +François in Cc.
> >
> > On Sun, 24 Jan 2021 12:22:13 +0100
> > Fabrice Fontaine <fontaine.fabrice@gmail.com> wrote:
> >
> > > +-@INC     = qw(-I/usr/include -I/usr/include/gd) unless @INC;
> > > ++#@INC     = qw(-I/usr/include -I/usr/include/gd) unless @INC;
> >
> > I'm certainly not very good with Perl, but doesn't the "unless @INC"
> > means "if INC is not already specified" ?
> I'm also not good with Perl but it seems to me that unless means
> "unless @INC is empty (i.e. not already specified or empty)"
> >
> > > + @LIBPATH = qw(-L/usr/lib/X11 -L/usr/X11R6/lib -L/usr/X11/lib
> -L/usr/lib) unless @LIBPATH;
> >
> > And isn't that a problem, too ? These library paths are pretty horrible
> > for cross-compilation.
> LIBPATH will be overriden with the -L value added by our pkg-config
> wrapper thanks to this piece of code:
>
> @LIBS = split /\s+/,$libs;
> if ($libdir) {
>   if ($config) {
>     @LIBPATH = map {s/^-L// && "-L$_"} split /\s+/,$ldflags;
>     ($lib_gd_path = $libdir) =~ s!/[^/]+$!!;
>   } else {
>     $lib_gd_path = $libdir;
>   }
>   push @LIBPATH,"-L$libdir";
> }
>
> The issue is that INC will be empty because it is extracted from cflags:
> @INC = map {s/^-I// && "-I$_"} split /\s+/,$cflags;
>
> But a review from a Perl would be nice as this solution is indeed a bit
> ugly.
>

the patch against Makefile.PL is fine.

François


> >
> > Thomas
> > --
> > Thomas Petazzoni, CTO, Bootlin
> > Embedded Linux and Kernel engineering
> > https://bootlin.com
> Best Regards,
>
> Fabrice
> _______________________________________________
> buildroot mailing list
> buildroot@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
>
diff mbox series

Patch

diff --git a/package/perl-gd/0001-Makefile.PL-fix-cross-compilation-with-gdlib.pc.patch b/package/perl-gd/0001-Makefile.PL-fix-cross-compilation-with-gdlib.pc.patch
new file mode 100644
index 0000000000..af053c5605
--- /dev/null
+++ b/package/perl-gd/0001-Makefile.PL-fix-cross-compilation-with-gdlib.pc.patch
@@ -0,0 +1,34 @@ 
+From 11dc017e902397c452331425eb6101b3315572fa Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+Date: Sun, 24 Jan 2021 10:59:31 +0100
+Subject: [PATCH] Makefile.PL: fix cross-compilation with gdlib.pc
+
+Cross-compilation will fail if gdlib.pc does not contain any cflags.
+Indeed, if cflags is empty, Makefile.PL will use the default value for
+INC (i.e. -I/usr/include -I/usr/include/gd)
+
+It should be noted that gdlib-config has been dropped from gd since
+version 2.3.0
+
+Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+[Upstream status: probably not upstreamable]
+---
+ Makefile.PL | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Makefile.PL b/Makefile.PL
+index 25f2f93..7da3651 100644
+--- a/Makefile.PL
++++ b/Makefile.PL
+@@ -47,7 +47,7 @@ If you want to try to compile anyway, please rerun this script with the option -
+ END
+ }
+ 
+-@INC     = qw(-I/usr/include -I/usr/include/gd) unless @INC;
++#@INC     = qw(-I/usr/include -I/usr/include/gd) unless @INC;
+ @LIBPATH = qw(-L/usr/lib/X11 -L/usr/X11R6/lib -L/usr/X11/lib -L/usr/lib) unless @LIBPATH;
+ @LIBS    = qw(-lgd) unless @LIBS;
+ 
+-- 
+2.29.2
+
diff --git a/package/perl-gd/perl-gd.mk b/package/perl-gd/perl-gd.mk
index b058672a23..1471cfb8bf 100644
--- a/package/perl-gd/perl-gd.mk
+++ b/package/perl-gd/perl-gd.mk
@@ -7,11 +7,16 @@ 
 PERL_GD_VERSION = 2.73
 PERL_GD_SOURCE = GD-$(PERL_GD_VERSION).tar.gz
 PERL_GD_SITE = $(BR2_CPAN_MIRROR)/authors/id/R/RU/RURBAN
-PERL_GD_DEPENDENCIES = host-pkgconf zlib libpng freetype gd
+PERL_GD_DEPENDENCIES = \
+	host-pkgconf host-perl-extutils-pkgconfig zlib libpng freetype gd
 PERL_GD_LICENSE = Artistic or GPL-1.0+
 PERL_GD_LICENSE_FILES = LICENSE
 PERL_GD_DISTNAME = GD
 
+PERL_GD_CONF_ENV = \
+	PATH=$(BR_PATH) \
+	PKG_CONFIG_PATH="$(STAGING_DIR)/usr/lib/pkgconfig"
+
 PERL_GD_CONF_OPTS = \
 	-lib_gd_path=$(STAGING_DIR)/usr \
 	-lib_ft_path=$(STAGING_DIR)/usr \