Skip to contentSkip to conversation

a package infrastructure for Perl/CPAN modules

PATCH Superseded Francois Perrad 5 participants 26 messages Feb 5, 2014 – Feb 6, 2014

v4 of 11 Superseded Latest is v11 →

lore
Share & tools
lore
#0 lore raw

v4 cover a package infrastructure for Perl/CPAN modules

Full refactor after the review at BR developer days.

- new convention : package/perl-<pkgname> instead of package/cpan/lib<pkgname>-perl

Francois Perrad (9):
pkg-perl: refactor and rename PERL5LIB
pkg-perl: new infrastructure
scancpan: a new script
host-perl-xml-parser: rename and refactor with perl infrastructure
host-perl-module-build: new package
perl: remove useless patch
manual: adding packages perl
cpanminus: remove it
qemu: add a Config.in.host

 Config.in                                        |   10 +
 docs/manual/adding-packages-perl.txt             |  110 ++++
 docs/manual/adding-packages.txt                  |    2 +
 package/Config.in                                |    2 -
 package/Config.in.host                           |    1 +
 package/Makefile.in                              |   13 +-
 package/cpanminus/Config.in                      |   40 --
 package/cpanminus/cpanminus.mk                   |   47 --
 package/intltool/intltool.mk                     |    5 +-
 package/libxml-parser-perl/Config.in             |   10 -
 package/libxml-parser-perl/libxml-parser-perl.mk |   35 --
 package/metacity/metacity.mk                     |    2 +-
 package/perl-module-build/perl-module-build.mk   |   12 +
 package/perl-xml-parser/perl-xml-parser.mk       |   16 +
 package/perl/perl-fix-Module-Build.patch         |   16 -
 package/pkg-perl.mk                              |  198 ++++++
 package/qemu/Config.in.host                      |   10 +
 support/scripts/scancpan                         |  694 ++++++++++++++++++++++
 18 files changed, 1065 insertions(+), 158 deletions(-)
 create mode 100644 docs/manual/adding-packages-perl.txt
 delete mode 100644 package/cpanminus/Config.in
 delete mode 100644 package/cpanminus/cpanminus.mk
 delete mode 100644 package/libxml-parser-perl/Config.in
 delete mode 100644 package/libxml-parser-perl/libxml-parser-perl.mk
 create mode 100644 package/perl-module-build/perl-module-build.mk
 create mode 100644 package/perl-xml-parser/perl-xml-parser.mk
 delete mode 100644 package/perl/perl-fix-Module-Build.patch
 create mode 100644 package/pkg-perl.mk
 create mode 100644 package/qemu/Config.in.host
 create mode 100755 support/scripts/scancpan
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH v4 1/9 pkg-perl: refactor and rename PERL5LIB

---
 package/Makefile.in          |   11 +++++++----
 package/intltool/intltool.mk |    3 +--
 2 files changed, 8 insertions(+), 6 deletions(-)
package/Makefile.in +7 -4
index 2e433fd..d0b1cfd 100644
@@ -206,6 +206,8 @@ HOST_PATH=$(HOST_DIR)/bin:$(HOST_DIR)/usr/bin:$(PATH)
 HOSTCC_VERSION:=$(shell $(HOSTCC_NOCCACHE) --version | \
 	sed -n 's/^.* \([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)[ ]*.*$$/\1\2\3/p')
 
+HOST_PERL5LIB = $(HOST_DIR)/usr/lib/perl
+
 TARGET_CONFIGURE_OPTS=PATH=$(TARGET_PATH) \
 		AR="$(TARGET_AR)" \
 		AS="$(TARGET_AS)" \
@@ -241,11 +243,12 @@ TARGET_CONFIGURE_OPTS=PATH=$(TARGET_PATH) \
 		LDFLAGS="$(TARGET_LDFLAGS)" \
 		FCFLAGS="$(TARGET_FCFLAGS)" \
 		PKG_CONFIG="$(PKG_CONFIG_HOST_BINARY)" \
-		PERLLIB="$(HOST_DIR)/usr/lib/perl" \
+		PERL5LIB=$(HOST_PERL5LIB) \
 		STAGING_DIR="$(STAGING_DIR)"
 
 TARGET_MAKE_ENV=PATH=$(TARGET_PATH) \
-		PERLLIB="$(HOST_DIR)/usr/lib/perl"
+		PERL5LIB=$(HOST_PERL5LIB)
+
 
 HOST_CONFIGURE_OPTS=PATH=$(HOST_PATH) \
 		AR="$(HOSTAR)" \
@@ -267,7 +270,7 @@ HOST_CONFIGURE_OPTS=PATH=$(HOST_PATH) \
 		PKG_CONFIG="$(PKG_CONFIG_HOST_BINARY)" \
 		PKG_CONFIG_SYSROOT_DIR="/" \
 		PKG_CONFIG_LIBDIR="$(HOST_DIR)/usr/lib/pkgconfig:$(HOST_DIR)/usr/share/pkgconfig" \
-		PERLLIB="$(HOST_DIR)/usr/lib/perl" \
+		PERL5LIB=$(HOST_PERL5LIB) \
 		LD_LIBRARY_PATH="$(HOST_DIR)/usr/lib:$(LD_LIBRARY_PATH)"
 
 HOST_MAKE_ENV=PATH=$(HOST_PATH) \
@@ -275,7 +278,7 @@ HOST_MAKE_ENV=PATH=$(HOST_PATH) \
 		PKG_CONFIG="$(PKG_CONFIG_HOST_BINARY)" \
 		PKG_CONFIG_SYSROOT_DIR="/" \
 		PKG_CONFIG_LIBDIR="$(HOST_DIR)/usr/lib/pkgconfig" \
-		PERLLIB="$(HOST_DIR)/usr/lib/perl"
+		PERL5LIB=$(HOST_PERL5LIB)
 
 # This extra environment we can not export ourselves (eg. because some
 # packages use that variable internally, eg. uboot), so we have to
package/intltool/intltool.mk +1 -2
index b2418fe..4235606 100644
@@ -10,8 +10,7 @@ INTLTOOL_LICENSE = GPLv2+
 INTLTOOL_LICENSE_FILES = COPYING
 
 HOST_INTLTOOL_DEPENDENCIES = host-gettext host-libxml-parser-perl
-HOST_INTLTOOL_CONF_OPT = \
-  PERLLIB=$(HOST_DIR)/usr/lib/perl
+HOST_INTLTOOL_CONF_ENV = PERL5LIB=$(HOST_PERL5LIB)
 
 $(eval $(autotools-package))
 $(eval $(host-autotools-package))
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH v4 1/9 pkg-perl: refactor and rename PERL5LIB

Dear Francois Perrad,

Quoted 6 lines · Francois Perrad
---
 package/Makefile.in          |   11 +++++++----
 package/intltool/intltool.mk |    3 +--
 2 files changed, 8 insertions(+), 6 deletions(-)

I think it was requested in a previous review: the commit log should indicate *why* PERL5LIB should be used instead of PERLLIB.

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#3 lore raw

PATCH v4 1/9 pkg-perl: refactor and rename PERL5LIB

2014-02-05 Thomas Petazzoni <[email protected]>:

Quoted 4 lines

Dear Francois Perrad,

Quoted 1 line · Francois Perrad
Quoted 9 lines
Quoted 5 lines
---
 package/Makefile.in          |   11 +++++++----
 package/intltool/intltool.mk |    3 +--
 2 files changed, 8 insertions(+), 6 deletions(-)

I think it was requested in a previous review: the commit log should indicate *why* PERL5LIB should be used instead of PERLLIB.

The official Perl documentation refers only to PERL5LIB. PERLLIB is obsolete, we don't need to be compatible with Perl4.

Fran?ois

Quoted 11 lines

Thanks!

Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

#4 lore raw

PATCH v4 1/9 pkg-perl: refactor and rename PERL5LIB

Dear Fran?ois Perrad,

Quoted 5 lines · Fran?ois Perrad
Quoted 2 lines

I think it was requested in a previous review: the commit log should indicate *why* PERL5LIB should be used instead of PERLLIB.

The official Perl documentation refers only to PERL5LIB. PERLLIB is obsolete, we don't need to be compatible with Perl4.

Thanks for the explanation, but please include it in the commit log for the next revision of your perl infrastructure patch series.

Thanks a lot!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#5 lore raw

PATCH v4 1/9 pkg-perl: refactor and rename PERL5LIB

In reply to Francois Perrad
Quoted 58 lines · Francois Perrad
---
 package/Makefile.in          |   11 +++++++----
 package/intltool/intltool.mk |    3 +--
 2 files changed, 8 insertions(+), 6 deletions(-)
package/Makefile.in +7 -4
index 2e433fd..d0b1cfd 100644
@@ -206,6 +206,8 @@ HOST_PATH=$(HOST_DIR)/bin:$(HOST_DIR)/usr/bin:$(PATH)
 HOSTCC_VERSION:=$(shell $(HOSTCC_NOCCACHE) --version | \
 	sed -n 's/^.* \([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)[ ]*.*$$/\1\2\3/p')
 
+HOST_PERL5LIB = $(HOST_DIR)/usr/lib/perl
+
 TARGET_CONFIGURE_OPTS=PATH=$(TARGET_PATH) \
 		AR="$(TARGET_AR)" \
 		AS="$(TARGET_AS)" \
@@ -241,11 +243,12 @@ TARGET_CONFIGURE_OPTS=PATH=$(TARGET_PATH) \
 		LDFLAGS="$(TARGET_LDFLAGS)" \
 		FCFLAGS="$(TARGET_FCFLAGS)" \
 		PKG_CONFIG="$(PKG_CONFIG_HOST_BINARY)" \
-		PERLLIB="$(HOST_DIR)/usr/lib/perl" \
+		PERL5LIB=$(HOST_PERL5LIB) \
 		STAGING_DIR="$(STAGING_DIR)"
 
 TARGET_MAKE_ENV=PATH=$(TARGET_PATH) \
-		PERLLIB="$(HOST_DIR)/usr/lib/perl"
+		PERL5LIB=$(HOST_PERL5LIB)
+
 
 HOST_CONFIGURE_OPTS=PATH=$(HOST_PATH) \
 		AR="$(HOSTAR)" \
@@ -267,7 +270,7 @@ HOST_CONFIGURE_OPTS=PATH=$(HOST_PATH) \
 		PKG_CONFIG="$(PKG_CONFIG_HOST_BINARY)" \
 		PKG_CONFIG_SYSROOT_DIR="/" \
 		PKG_CONFIG_LIBDIR="$(HOST_DIR)/usr/lib/pkgconfig:$(HOST_DIR)/usr/share/pkgconfig" \
-		PERLLIB="$(HOST_DIR)/usr/lib/perl" \
+		PERL5LIB=$(HOST_PERL5LIB) \
 		LD_LIBRARY_PATH="$(HOST_DIR)/usr/lib:$(LD_LIBRARY_PATH)"
 
 HOST_MAKE_ENV=PATH=$(HOST_PATH) \
@@ -275,7 +278,7 @@ HOST_MAKE_ENV=PATH=$(HOST_PATH) \
 		PKG_CONFIG="$(PKG_CONFIG_HOST_BINARY)" \
 		PKG_CONFIG_SYSROOT_DIR="/" \
 		PKG_CONFIG_LIBDIR="$(HOST_DIR)/usr/lib/pkgconfig" \
-		PERLLIB="$(HOST_DIR)/usr/lib/perl"
+		PERL5LIB=$(HOST_PERL5LIB)
 
 # This extra environment we can not export ourselves (eg. because some
 # packages use that variable internally, eg. uboot), so we have to
package/intltool/intltool.mk +0 -0
index b2418fe..4235606 100644

package/intltool/intltool.mk INTLTOOL_LICENSE = GPLv2+ · line 13

Quoted 6 lines
package/intltool/intltool.mk +1 -2
@@ -10,8 +10,7 @@ INTLTOOL_LICENSE = GPLv2+
 INTLTOOL_LICENSE_FILES = COPYING
 
 HOST_INTLTOOL_DEPENDENCIES = host-gettext host-libxml-parser-perl
-HOST_INTLTOOL_CONF_OPT = \
-  PERLLIB=$(HOST_DIR)/usr/lib/perl
+HOST_INTLTOOL_CONF_ENV = PERL5LIB=$(HOST_PERL5LIB)

Can't this one just be removed, since it's already in HOST_CONFIGURE_OPTS?

If so, indicate this explicitly in your commit message please.

Regards,
Arnout

Quoted 4 lines
package/intltool/intltool.mk +0 -0
 $(eval $(autotools-package))
 $(eval $(host-autotools-package))
 
Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#6 lore raw

PATCH v4 1/9 pkg-perl: refactor and rename PERL5LIB

2014-02-06 7:29 GMT+01:00 Arnout Vandecappelle <[email protected]>:

Quoted 61 lines · Francois Perrad
Quoted 60 lines
---
 package/Makefile.in          |   11 +++++++----
 package/intltool/intltool.mk |    3 +--
 2 files changed, 8 insertions(+), 6 deletions(-)
package/Makefile.in +7 -4
index 2e433fd..d0b1cfd 100644
@@ -206,6 +206,8 @@ HOST_PATH=$(HOST_DIR)/bin:$(HOST_DIR)/usr/bin:$(PATH)
 HOSTCC_VERSION:=$(shell $(HOSTCC_NOCCACHE) --version | \
      sed -n 's/^.* \([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)[ ]*.*$$/\1\2\3/p')
 
+HOST_PERL5LIB = $(HOST_DIR)/usr/lib/perl
+
 TARGET_CONFIGURE_OPTS=PATH=$(TARGET_PATH) \
              AR="$(TARGET_AR)" \
              AS="$(TARGET_AS)" \
@@ -241,11 +243,12 @@ TARGET_CONFIGURE_OPTS=PATH=$(TARGET_PATH) \
              LDFLAGS="$(TARGET_LDFLAGS)" \
              FCFLAGS="$(TARGET_FCFLAGS)" \
              PKG_CONFIG="$(PKG_CONFIG_HOST_BINARY)" \
-             PERLLIB="$(HOST_DIR)/usr/lib/perl" \
+             PERL5LIB=$(HOST_PERL5LIB) \
              STAGING_DIR="$(STAGING_DIR)"
 
 TARGET_MAKE_ENV=PATH=$(TARGET_PATH) \
-             PERLLIB="$(HOST_DIR)/usr/lib/perl"
+             PERL5LIB=$(HOST_PERL5LIB)
+
 
 HOST_CONFIGURE_OPTS=PATH=$(HOST_PATH) \
              AR="$(HOSTAR)" \
@@ -267,7 +270,7 @@ HOST_CONFIGURE_OPTS=PATH=$(HOST_PATH) \
              PKG_CONFIG="$(PKG_CONFIG_HOST_BINARY)" \
              PKG_CONFIG_SYSROOT_DIR="/" \
              PKG_CONFIG_LIBDIR="$(HOST_DIR)/usr/lib/pkgconfig:$(HOST_DIR)/usr/share/pkgconfig" \
-             PERLLIB="$(HOST_DIR)/usr/lib/perl" \
+             PERL5LIB=$(HOST_PERL5LIB) \
              LD_LIBRARY_PATH="$(HOST_DIR)/usr/lib:$(LD_LIBRARY_PATH)"
 
 HOST_MAKE_ENV=PATH=$(HOST_PATH) \
@@ -275,7 +278,7 @@ HOST_MAKE_ENV=PATH=$(HOST_PATH) \
              PKG_CONFIG="$(PKG_CONFIG_HOST_BINARY)" \
              PKG_CONFIG_SYSROOT_DIR="/" \
              PKG_CONFIG_LIBDIR="$(HOST_DIR)/usr/lib/pkgconfig" \
-             PERLLIB="$(HOST_DIR)/usr/lib/perl"
+             PERL5LIB=$(HOST_PERL5LIB)
 
 # This extra environment we can not export ourselves (eg. because some
 # packages use that variable internally, eg. uboot), so we have to
package/intltool/intltool.mk +0 -0
index b2418fe..4235606 100644
@@ -10,8 +10,7 @@ INTLTOOL_LICENSE = GPLv2+
 INTLTOOL_LICENSE_FILES = COPYING
 
Quoted 6 lines

package/intltool/intltool.mk INTLTOOL_LICENSE = GPLv2+ · line 13

Quoted 4 lines
package/intltool/intltool.mk +1 -2
 HOST_INTLTOOL_DEPENDENCIES = host-gettext host-libxml-parser-perl
-HOST_INTLTOOL_CONF_OPT = \
-  PERLLIB=$(HOST_DIR)/usr/lib/perl
+HOST_INTLTOOL_CONF_ENV = PERL5LIB=$(HOST_PERL5LIB)

Can't this one just be removed, since it's already in HOST_CONFIGURE_OPTS?

You are right, there is a duplication.

Fran?ois

Quoted 24 lines

If so, indicate this explicitly in your commit message please.

Regards,
Arnout

package/intltool/intltool.mk INTLTOOL_LICENSE = GPLv2+

Quoted 4 lines
package/intltool/intltool.mk +0 -0
 $(eval $(autotools-package))
 $(eval $(host-autotools-package))
 

--

Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

#7 lore raw

PATCH v4 2/9 pkg-perl: new infrastructure

In reply to Francois Perrad
---
 Config.in           |   10 +++
 package/Makefile.in |    4 +-
 package/pkg-perl.mk |  198 +++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 211 insertions(+), 1 deletion(-)
 create mode 100644 package/pkg-perl.mk
Config.in +10 -0
index 7ec7c2a..678fe8d 100644
@@ -225,6 +225,16 @@ config BR2_LUAROCKS_MIRROR
 
 	  See http://luarocks.org
 
+config BR2_CPAN_MIRROR
+	string "CPAN mirror"
+	default "http://search.cpan.org/CPAN"
+	help
+	  CPAN has multiple software mirrors scattered around the world.
+	  This option allows you to select a mirror.
+
+	  The list of mirrors is available at:
+	  http://search.cpan.org/mirror
+
 endmenu
 
 config BR2_JLEVEL
package/Makefile.in +3 -1
index d0b1cfd..41f73cb 100644
@@ -206,7 +206,8 @@ HOST_PATH=$(HOST_DIR)/bin:$(HOST_DIR)/usr/bin:$(PATH)
 HOSTCC_VERSION:=$(shell $(HOSTCC_NOCCACHE) --version | \
 	sed -n 's/^.* \([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)[ ]*.*$$/\1\2\3/p')
 
-HOST_PERL5LIB = $(HOST_DIR)/usr/lib/perl
+HOST_PERL_ARCHNAME := $(shell perl -MConfig -e "print Config->{archname}")
+HOST_PERL5LIB = $(HOST_DIR)/usr/lib/perl5/$(HOST_PERL_ARCHNAME):$(HOST_DIR)/usr/lib/perl5
 
 TARGET_CONFIGURE_OPTS=PATH=$(TARGET_PATH) \
 		AR="$(TARGET_AR)" \
@@ -376,4 +377,5 @@ include package/pkg-autotools.mk
 include package/pkg-cmake.mk
 include package/pkg-luarocks.mk
 include package/pkg-python.mk
+include package/pkg-perl.mk
 include package/pkg-generic.mk
package/pkg-perl.mk new file +198 -0

198 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#8 lore raw

PATCH v4 2/9 pkg-perl: new infrastructure

Hi Francois,

Someone (Yann?) suggested to call this infrastructure "cpan" rather than
"perl", similar like how it's done for luarocks. What do you think about that?

Actually, now I have looked at the patch again, I can see the answer:
there is nothing CPAN-specific about this patch (except for the definition of the mirror variable), it can just as well be used for packages downloaded from somewhere else or local packages.

Quoted 17 lines · Francois Perrad
---
 Config.in           |   10 +++
 package/Makefile.in |    4 +-
 package/pkg-perl.mk |  198 +++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 211 insertions(+), 1 deletion(-)
 create mode 100644 package/pkg-perl.mk
Config.in +0 -0
index 7ec7c2a..678fe8d 100644
@@ -225,6 +225,16 @@ config BR2_LUAROCKS_MIRROR
 
 	  See http://luarocks.org
 

Config.in config BR2_LUAROCKS_MIRROR · line 237

Quoted 10 lines
Config.in +10 -0
+config BR2_CPAN_MIRROR
+	string "CPAN mirror"
+	default "http://search.cpan.org/CPAN"
+	help
+	  CPAN has multiple software mirrors scattered around the world.
+	  This option allows you to select a mirror.
+
+	  The list of mirrors is available at:
+	  http://search.cpan.org/mirror
+

Side-track: like BR2_DL_DIR, these mirror variables should really be
overridden by the environment, because they are a kind of local configuration. I mean, if I prefer to use a particular mirror, I want that one for all my configurations. Conversely, if I pass my defconfig to someone in Australia, they'll want to use a different mirror.

Quoted 8 lines
Config.in +0 -0
 endmenu
 
 config BR2_JLEVEL
package/Makefile.in +0 -0
index d0b1cfd..41f73cb 100644

package/Makefile.in HOST_PATH=$(HOST_DIR)/bin:$(HOST_DIR)/usr/bin:$(PATH) · line 210

Quoted 6 lines
package/Makefile.in +2 -1
@@ -206,7 +206,8 @@ HOST_PATH=$(HOST_DIR)/bin:$(HOST_DIR)/usr/bin:$(PATH)
 HOSTCC_VERSION:=$(shell $(HOSTCC_NOCCACHE) --version | \
 	sed -n 's/^.* \([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)[ ]*.*$$/\1\2\3/p')
 
-HOST_PERL5LIB = $(HOST_DIR)/usr/lib/perl
+HOST_PERL_ARCHNAME := $(shell perl -MConfig -e "print Config->{archname}")
+HOST_PERL5LIB = $(HOST_DIR)/usr/lib/perl5/$(HOST_PERL_ARCHNAME):$(HOST_DIR)/usr/lib/perl5

This change has no direct bearing on the cpan infrastructure.

Also, I see the following in my $(HOST_DIR)/usr/lib:

$ ls host/usr/lib/perl*
host/usr/lib/perl:
XML/  auto/  perllocal.pod

host/usr/lib/perl5:
ExtUtils/ x86_64-linux-gnu-thread-multi/

So I guess $(HOST_DIR)/usr/lib/perl should also be in there?

Quoted 15 lines
package/Makefile.in +1 -0
 TARGET_CONFIGURE_OPTS=PATH=$(TARGET_PATH) \
 		AR="$(TARGET_AR)" \
@@ -376,4 +377,5 @@ include package/pkg-autotools.mk
 include package/pkg-cmake.mk
 include package/pkg-luarocks.mk
 include package/pkg-python.mk
+include package/pkg-perl.mk
 include package/pkg-generic.mk
package/pkg-perl.mk new file +1 -0
new file mode 100644
index 0000000..a049bce
@@ -0,0 +1,198 @@
+################################################################################

package/pkg-perl.mk line 11

Quoted 10 lines
package/pkg-perl.mk new file +10 -0
+# Perl package infrastructure
+#
+# This file implements an infrastructure that eases development of
+# package .mk files for Perl packages.
+#
+# See the Buildroot documentation for details on the usage of this
+# infrastructure
+#
+# In terms of implementation, this perl infrastructure requires
+# the .mk file to only specify metadata informations about the

s/informations/information/

package/pkg-perl.mk line 18

Quoted 7 lines
package/pkg-perl.mk new file +7 -0
+# package: name, version, download URL, etc.
+#
+# We still allow the package .mk file to override what the different
+# steps are doing, if needed. For example, if <PKG>_BUILD_CMDS is
+# already defined, it is used as the list of commands to perform to
+# build the package, instead of the default perl behaviour. The
+# package can also define some post operation hooks.

Side-track: I wonder about the usefulness of these comments. They
duplicate the documentation in the manual, which risks inconsistency. Would anybody ever look at the comments in pkg-*.mk to learn about using the package infrastructure?

Quoted 16 lines
package/pkg-perl.mk new file +16 -0
+#
+################################################################################
+
+PKG_PERL_ARCHNAME	= $(ARCH)-linux
+
+################################################################################
+# inner-perl-package -- defines how the configuration, compilation and
+# installation of a perl package should be done, implements a
+# few hooks to tune the build process for perl specifities and
+# calls the generic package infrastructure to generate the necessary
+# make targets
+#
+#  argument 1 is the lowercase package name
+#  argument 2 is the uppercase package name, including an HOST_ prefix
+#             for host packages
+#  argument 3 is the uppercase package name, without the HOST_ prefix

package/pkg-perl.mk line 44

Quoted 10 lines
package/pkg-perl.mk new file +10 -0
+#             for host packages
+#  argument 4 is the type (target or host)
+################################################################################
+
+define inner-perl-package
+
+$(2)_CONF_OPT			?=
+$(2)_BUILD_OPT			?=
+$(2)_INSTALL_OPT		?=
+$(2)_INSTALL_TARGET_OPT		?=

Something funky with the alignment of these. Perhaps better to just
remove them, they're useless anyway.

Quoted 16 lines
package/pkg-perl.mk new file +16 -0
+
+#
+# Configure step. Only define it if not already defined by the package
+# .mk file. And take care of the differences between host and target
+# packages.
+#
+ifndef $(2)_CONFIGURE_CMDS
+ifeq ($(4),target)
+
+# Configure package for target
+define $(2)_CONFIGURE_CMDS
+	cd $$($$(PKG)_SRCDIR) && if [ -f Build.PL ] ; then \
+		PERL5LIB=$(HOST_PERL5LIB) \
+		perl Build.PL \
+			--config ar="$(TARGET_AR)" \
+			--config full_ar="$(TARGET_AR)" \

package/pkg-perl.mk line 70

Quoted 10 lines
package/pkg-perl.mk new file +10 -0
+			--config cc="$(TARGET_CC)" \
+			--config ccflags="$(TARGET_CFLAGS)" \
+			--config ld="$(TARGET_CC)" \
+			--config lddlflags="-shared $(TARGET_LDFLAGS)" \
+			--config ldflags="$(TARGET_LDFLAGS)" \
+			--include_dirs $$(STAGING_DIR)/usr/lib/perl5/$$(PERL_VERSION)/$(PKG_PERL_ARCHNAME)/CORE \
+			--destdir $$(TARGET_DIR) \
+			--installdirs vendor \
+			--install_path lib=/usr/lib/perl5/site_perl/$$(PERL_VERSION) \
+			--install_path arch=/usr/lib/perl5/site_perl/$$(PERL_VERSION)/$(PKG_PERL_ARCHNAME) \

Why install in site_perl and not directly in the perl directories?
That's a bit like /usr/local, isn't it?

Actually, wouldn't setting installdirs to core make most of these redundant?

package/pkg-perl.mk line 74

Quoted 4 lines
package/pkg-perl.mk new file +4 -0
+			--install_path bin=/usr/bin \
+			--install_path script=/usr/bin \
+			--install_path bindoc=/usr/share/man/man1 \
+			--install_path libdoc=/usr/share/man/man3 \

Since we don't want documentation on target, is there a way to define
this so that documentation is thrown away immediately? And is there an option to avoid building documentation?

Quoted 52 lines
package/pkg-perl.mk new file +52 -0
+			$$($(2)_CONF_OPT); \
+	else \
+		PERL5LIB=$(HOST_PERL5LIB) \
+		PERL_AUTOINSTALL=--skipdeps \
+		perl Makefile.PL \
+			AR="$(TARGET_AR)" \
+			FULL_AR="$(TARGET_AR)" \
+			CC="$(TARGET_CC)" \
+			CCFLAGS="$(TARGET_CFLAGS)" \
+			LD="$(TARGET_CC)" \
+			LDDLFLAGS="-shared $(TARGET_LDFLAGS)" \
+			LDFLAGS="$(TARGET_LDFLAGS)" \
+			DESTDIR=$$(TARGET_DIR) \
+			INSTALLDIRS=vendor \
+			INSTALLVENDORLIB=/usr/lib/perl5/site_perl/$$(PERL_VERSION) \
+			INSTALLVENDORARCH=/usr/lib/perl5/site_perl/$$(PERL_VERSION)/$(PKG_PERL_ARCHNAME) \
+			INSTALLVENDORBIN=/usr/bin \
+			INSTALLVENDORSCRIPT=/usr/bin \
+			INSTALLVENDORMAN1DIR=/usr/share/man/man1 \
+			INSTALLVENDORMAN3DIR=/usr/share/man/man3 \
+			$$($(2)_CONF_OPT); \
+	fi
+endef
+else
+
+# Configure package for host
+define $(2)_CONFIGURE_CMDS
+	cd $$($$(PKG)_SRCDIR) && if [ -f Build.PL ] ; then \
+		PERL5LIB=$(HOST_PERL5LIB) \
+		perl Build.PL \
+			--install_base $$(HOST_DIR)/usr \
+			--installdirs vendor \
+			$$($(2)_CONF_OPT); \
+	else \
+		PERL5LIB=$(HOST_PERL5LIB) \
+		PERL_AUTOINSTALL=--skipdeps \
+		perl Makefile.PL \
+			INSTALL_BASE=$$(HOST_DIR)/usr \
+			INSTALLDIRS=vendor \
+			$$($(2)_CONF_OPT); \
+	fi
+endef
+endif
+endif
+
+#
+# Build step. Only define it if not already defined by the package .mk
+# file. And take care of the differences between host and target
+# packages.
+#
+ifndef $(2)_BUILD_CMDS
+ifeq ($(4),target)

package/pkg-perl.mk line 136

Quoted 10 lines
package/pkg-perl.mk new file +10 -0
+
+# Build package for target
+define $(2)_BUILD_CMDS
+	cd $$($$(PKG)_SRCDIR) && if [ -f Build.PL ] ; then \
+		PERL5LIB=$(HOST_PERL5LIB) \
+		perl Build $$($(2)_BUILD_OPT) build; \
+	else \
+		PERL5LIB=$(HOST_PERL5LIB) \
+		$(MAKE1) \
+			PERL_INC=$$(STAGING_DIR)/usr/lib/perl5/$$(PERL_VERSION)/$(PKG_PERL_ARCHNAME)/CORE \

How come you don't need this in the configure step?

Regards,
Arnout

Quoted 63 lines
package/pkg-perl.mk new file +62 -0
+			$$($(2)_BUILD_OPT) pure_all; \
+	fi
+endef
+else
+
+# Build package for host
+define $(2)_BUILD_CMDS
+	cd $$($$(PKG)_SRCDIR) && if [ -f Build.PL ] ; then \
+		PERL5LIB=$(HOST_PERL5LIB) \
+		perl Build $$($(2)_BUILD_OPT) build; \
+	else \
+		PERL5LIB=$(HOST_PERL5LIB) \
+		$(MAKE1) $$($(2)_BUILD_OPT) pure_all; \
+	fi
+endef
+endif
+endif
+
+#
+# Host installation step. Only define it if not already defined by the
+# package .mk file.
+#
+ifndef $(2)_INSTALL_CMDS
+define $(2)_INSTALL_CMDS
+	cd $$($$(PKG)_SRCDIR) && if [ -f Build.PL ] ; then \
+		PERL5LIB=$(HOST_PERL5LIB) \
+		perl Build $$($(2)_INSTALL_TARGET_OPT) install; \
+	else \
+		PERL5LIB=$(HOST_PERL5LIB) \
+		$(MAKE1) $$($(2)_INSTALL_TARGET_OPT) pure_install; \
+	fi
+endef
+endif
+
+#
+# Target installation step. Only define it if not already defined by
+# the package .mk file.
+#
+ifndef $(2)_INSTALL_TARGET_CMDS
+define $(2)_INSTALL_TARGET_CMDS
+	cd $$($$(PKG)_SRCDIR) && if [ -f Build.PL ] ; then \
+		PERL5LIB=$(HOST_PERL5LIB) \
+		perl Build $$($(2)_INSTALL_TARGET_OPT) install; \
+	else \
+		PERL5LIB=$(HOST_PERL5LIB) \
+		$(MAKE1) $$($(2)_INSTALL_TARGET_OPT) pure_install; \
+	fi
+endef
+endif
+
+# Call the generic package infrastructure to generate the necessary
+# make targets
+$(call inner-generic-package,$(1),$(2),$(3),$(4))
+
+endef
+
+################################################################################
+# perl-package -- the target generator macro for Perl packages
+################################################################################
+
+perl-package = $(call inner-perl-package,$(pkgname),$(call UPPERCASE,$(pkgname)),$(call UPPERCASE,$(pkgname)),target)
+host-perl-package = $(call inner-perl-package,host-$(pkgname),$(call UPPERCASE,host-$(pkgname)),$(call UPPERCASE,$(pkgname)),host)
Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#9 lore raw

[Buildroot] [UNSURE]Re: [pkg-perl infra V4 2/9] pkg-perl: new infrastructure

2014-02-06 8:11 GMT+01:00 Arnout Vandecappelle <[email protected]>:

Quoted 11 lines

Hi Francois,

Someone (Yann?) suggested to call this infrastructure "cpan" rather than
"perl", similar like how it's done for luarocks. What do you think about that?

Actually, now I have looked at the patch again, I can see the answer:
there is nothing CPAN-specific about this patch (except for the definition of the mirror variable), it can just as well be used for packages downloaded from somewhere else or local packages.

I agree with you, Arnout.
It is a "perl" infrastructure.

Quoted 46 lines · Francois Perrad
Quoted 17 lines
---
 Config.in           |   10 +++
 package/Makefile.in |    4 +-
 package/pkg-perl.mk |  198 +++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 211 insertions(+), 1 deletion(-)
 create mode 100644 package/pkg-perl.mk
Config.in +0 -0
index 7ec7c2a..678fe8d 100644
@@ -225,6 +225,16 @@ config BR2_LUAROCKS_MIRROR
 
        See http://luarocks.org
 

Config.in config BR2_LUAROCKS_MIRROR · line 237

Quoted 10 lines
Config.in +10 -0
+config BR2_CPAN_MIRROR
+     string "CPAN mirror"
+     default "http://search.cpan.org/CPAN"
+     help
+       CPAN has multiple software mirrors scattered around the world.
+       This option allows you to select a mirror.
+
+       The list of mirrors is available at:
+       http://search.cpan.org/mirror
+

Side-track: like BR2_DL_DIR, these mirror variables should really be
overridden by the environment, because they are a kind of local configuration. I mean, if I prefer to use a particular mirror, I want that one for all my configurations. Conversely, if I pass my defconfig to someone in Australia, they'll want to use a different mirror.

Quoted 11 lines
Config.in +0 -0
 endmenu
 
 config BR2_JLEVEL
package/Makefile.in +0 -0
index d0b1cfd..41f73cb 100644
@@ -206,7 +206,8 @@ HOST_PATH=$(HOST_DIR)/bin:$(HOST_DIR)/usr/bin:$(PATH)
 HOSTCC_VERSION:=$(shell $(HOSTCC_NOCCACHE) --version | \
      sed -n 's/^.* \([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)[ ]*.*$$/\1\2\3/p')
 
Quoted 5 lines

package/Makefile.in HOST_PATH=$(HOST_DIR)/bin:$(HOST_DIR)/usr/bin:$(PATH) · line 210

Quoted 3 lines
package/Makefile.in +2 -1
-HOST_PERL5LIB = $(HOST_DIR)/usr/lib/perl
+HOST_PERL_ARCHNAME := $(shell perl -MConfig -e "print Config->{archname}")
+HOST_PERL5LIB = $(HOST_DIR)/usr/lib/perl5/$(HOST_PERL_ARCHNAME):$(HOST_DIR)/usr/lib/perl5

This change has no direct bearing on the cpan infrastructure.

Package using host-perl-package infrastructure, installs module in $(HOST_DIR)/usr/lib/perl5.
The host perl finds these modules with a PERL5LIB which refers this new path.

Quoted 105 lines

Also, I see the following in my $(HOST_DIR)/usr/lib:

$ ls host/usr/lib/perl*
host/usr/lib/perl:
XML/  auto/  perllocal.pod

host/usr/lib/perl5:
ExtUtils/ x86_64-linux-gnu-thread-multi/

So I guess $(HOST_DIR)/usr/lib/perl should also be in there?

Quoted 15 lines
package/Makefile.in +1 -0
 TARGET_CONFIGURE_OPTS=PATH=$(TARGET_PATH) \
              AR="$(TARGET_AR)" \
@@ -376,4 +377,5 @@ include package/pkg-autotools.mk
 include package/pkg-cmake.mk
 include package/pkg-luarocks.mk
 include package/pkg-python.mk
+include package/pkg-perl.mk
 include package/pkg-generic.mk
package/pkg-perl.mk new file +1 -0
new file mode 100644
index 0000000..a049bce
@@ -0,0 +1,198 @@
+################################################################################

package/pkg-perl.mk line 11

Quoted 10 lines
package/pkg-perl.mk new file +10 -0
+# Perl package infrastructure
+#
+# This file implements an infrastructure that eases development of
+# package .mk files for Perl packages.
+#
+# See the Buildroot documentation for details on the usage of this
+# infrastructure
+#
+# In terms of implementation, this perl infrastructure requires
+# the .mk file to only specify metadata informations about the

s/informations/information/

package/pkg-perl.mk line 18

Quoted 7 lines
package/pkg-perl.mk new file +7 -0
+# package: name, version, download URL, etc.
+#
+# We still allow the package .mk file to override what the different
+# steps are doing, if needed. For example, if <PKG>_BUILD_CMDS is
+# already defined, it is used as the list of commands to perform to
+# build the package, instead of the default perl behaviour. The
+# package can also define some post operation hooks.

Side-track: I wonder about the usefulness of these comments. They
duplicate the documentation in the manual, which risks inconsistency. Would anybody ever look at the comments in pkg-*.mk to learn about using the package infrastructure?

Quoted 16 lines
package/pkg-perl.mk new file +16 -0
+#
+################################################################################
+
+PKG_PERL_ARCHNAME    = $(ARCH)-linux
+
+################################################################################
+# inner-perl-package -- defines how the configuration, compilation and
+# installation of a perl package should be done, implements a
+# few hooks to tune the build process for perl specifities and
+# calls the generic package infrastructure to generate the necessary
+# make targets
+#
+#  argument 1 is the lowercase package name
+#  argument 2 is the uppercase package name, including an HOST_ prefix
+#             for host packages
+#  argument 3 is the uppercase package name, without the HOST_ prefix

package/pkg-perl.mk line 44

Quoted 10 lines
package/pkg-perl.mk new file +10 -0
+#             for host packages
+#  argument 4 is the type (target or host)
+################################################################################
+
+define inner-perl-package
+
+$(2)_CONF_OPT                        ?=
+$(2)_BUILD_OPT                       ?=
+$(2)_INSTALL_OPT             ?=
+$(2)_INSTALL_TARGET_OPT              ?=

Something funky with the alignment of these. Perhaps better to just
remove them, they're useless anyway.

Quoted 21 lines
package/pkg-perl.mk new file +21 -0
+
+#
+# Configure step. Only define it if not already defined by the package
+# .mk file. And take care of the differences between host and target
+# packages.
+#
+ifndef $(2)_CONFIGURE_CMDS
+ifeq ($(4),target)
+
+# Configure package for target
+define $(2)_CONFIGURE_CMDS
+     cd $$($$(PKG)_SRCDIR) && if [ -f Build.PL ] ; then \
+             PERL5LIB=$(HOST_PERL5LIB) \
+             perl Build.PL \
+                     --config ar="$(TARGET_AR)" \
+                     --config full_ar="$(TARGET_AR)" \
+                     --config cc="$(TARGET_CC)" \
+                     --config ccflags="$(TARGET_CFLAGS)" \
+                     --config ld="$(TARGET_CC)" \
+                     --config lddlflags="-shared $(TARGET_LDFLAGS)" \
+                     --config ldflags="$(TARGET_LDFLAGS)" \
Quoted 8 lines

package/pkg-perl.mk line 70

Quoted 5 lines
package/pkg-perl.mk new file +5 -0
+                     --include_dirs $$(STAGING_DIR)/usr/lib/perl5/$$(PERL_VERSION)/$(PKG_PERL_ARCHNAME)/CORE \
+                     --destdir $$(TARGET_DIR) \
+                     --installdirs vendor \
+                     --install_path lib=/usr/lib/perl5/site_perl/$$(PERL_VERSION) \
+                     --install_path arch=/usr/lib/perl5/site_perl/$$(PERL_VERSION)/$(PKG_PERL_ARCHNAME) \

Why install in site_perl and not directly in the perl directories?
That's a bit like /usr/local, isn't it?

The Perl policy segregates the core modules and the additionnal ones.
- core modules in /usr/lib/perl5
- CPAN modules in /usr/lib/perl5/site_perl
By default, the target perl knows and uses these 2 paths.

Fran?ois

Quoted 158 lines

Actually, wouldn't setting installdirs to core make most of these redundant?

package/pkg-perl.mk line 74

Quoted 4 lines
package/pkg-perl.mk new file +4 -0
+                     --install_path bin=/usr/bin \
+                     --install_path script=/usr/bin \
+                     --install_path bindoc=/usr/share/man/man1 \
+                     --install_path libdoc=/usr/share/man/man3 \

Since we don't want documentation on target, is there a way to define
this so that documentation is thrown away immediately? And is there an option to avoid building documentation?

Quoted 52 lines
package/pkg-perl.mk new file +52 -0
+                     $$($(2)_CONF_OPT); \
+     else \
+             PERL5LIB=$(HOST_PERL5LIB) \
+             PERL_AUTOINSTALL=--skipdeps \
+             perl Makefile.PL \
+                     AR="$(TARGET_AR)" \
+                     FULL_AR="$(TARGET_AR)" \
+                     CC="$(TARGET_CC)" \
+                     CCFLAGS="$(TARGET_CFLAGS)" \
+                     LD="$(TARGET_CC)" \
+                     LDDLFLAGS="-shared $(TARGET_LDFLAGS)" \
+                     LDFLAGS="$(TARGET_LDFLAGS)" \
+                     DESTDIR=$$(TARGET_DIR) \
+                     INSTALLDIRS=vendor \
+                     INSTALLVENDORLIB=/usr/lib/perl5/site_perl/$$(PERL_VERSION) \
+                     INSTALLVENDORARCH=/usr/lib/perl5/site_perl/$$(PERL_VERSION)/$(PKG_PERL_ARCHNAME) \
+                     INSTALLVENDORBIN=/usr/bin \
+                     INSTALLVENDORSCRIPT=/usr/bin \
+                     INSTALLVENDORMAN1DIR=/usr/share/man/man1 \
+                     INSTALLVENDORMAN3DIR=/usr/share/man/man3 \
+                     $$($(2)_CONF_OPT); \
+     fi
+endef
+else
+
+# Configure package for host
+define $(2)_CONFIGURE_CMDS
+     cd $$($$(PKG)_SRCDIR) && if [ -f Build.PL ] ; then \
+             PERL5LIB=$(HOST_PERL5LIB) \
+             perl Build.PL \
+                     --install_base $$(HOST_DIR)/usr \
+                     --installdirs vendor \
+                     $$($(2)_CONF_OPT); \
+     else \
+             PERL5LIB=$(HOST_PERL5LIB) \
+             PERL_AUTOINSTALL=--skipdeps \
+             perl Makefile.PL \
+                     INSTALL_BASE=$$(HOST_DIR)/usr \
+                     INSTALLDIRS=vendor \
+                     $$($(2)_CONF_OPT); \
+     fi
+endef
+endif
+endif
+
+#
+# Build step. Only define it if not already defined by the package .mk
+# file. And take care of the differences between host and target
+# packages.
+#
+ifndef $(2)_BUILD_CMDS
+ifeq ($(4),target)

package/pkg-perl.mk line 136

Quoted 10 lines
package/pkg-perl.mk new file +10 -0
+
+# Build package for target
+define $(2)_BUILD_CMDS
+     cd $$($$(PKG)_SRCDIR) && if [ -f Build.PL ] ; then \
+             PERL5LIB=$(HOST_PERL5LIB) \
+             perl Build $$($(2)_BUILD_OPT) build; \
+     else \
+             PERL5LIB=$(HOST_PERL5LIB) \
+             $(MAKE1) \
+                     PERL_INC=$$(STAGING_DIR)/usr/lib/perl5/$$(PERL_VERSION)/$(PKG_PERL_ARCHNAME)/CORE \

How come you don't need this in the configure step?

Regards,
Arnout

Quoted 53 lines
package/pkg-perl.mk new file +52 -0
+                     $$($(2)_BUILD_OPT) pure_all; \
+     fi
+endef
+else
+
+# Build package for host
+define $(2)_BUILD_CMDS
+     cd $$($$(PKG)_SRCDIR) && if [ -f Build.PL ] ; then \
+             PERL5LIB=$(HOST_PERL5LIB) \
+             perl Build $$($(2)_BUILD_OPT) build; \
+     else \
+             PERL5LIB=$(HOST_PERL5LIB) \
+             $(MAKE1) $$($(2)_BUILD_OPT) pure_all; \
+     fi
+endef
+endif
+endif
+
+#
+# Host installation step. Only define it if not already defined by the
+# package .mk file.
+#
+ifndef $(2)_INSTALL_CMDS
+define $(2)_INSTALL_CMDS
+     cd $$($$(PKG)_SRCDIR) && if [ -f Build.PL ] ; then \
+             PERL5LIB=$(HOST_PERL5LIB) \
+             perl Build $$($(2)_INSTALL_TARGET_OPT) install; \
+     else \
+             PERL5LIB=$(HOST_PERL5LIB) \
+             $(MAKE1) $$($(2)_INSTALL_TARGET_OPT) pure_install; \
+     fi
+endef
+endif
+
+#
+# Target installation step. Only define it if not already defined by
+# the package .mk file.
+#
+ifndef $(2)_INSTALL_TARGET_CMDS
+define $(2)_INSTALL_TARGET_CMDS
+     cd $$($$(PKG)_SRCDIR) && if [ -f Build.PL ] ; then \
+             PERL5LIB=$(HOST_PERL5LIB) \
+             perl Build $$($(2)_INSTALL_TARGET_OPT) install; \
+     else \
+             PERL5LIB=$(HOST_PERL5LIB) \
+             $(MAKE1) $$($(2)_INSTALL_TARGET_OPT) pure_install; \
+     fi
+endef
+endif
+
+# Call the generic package infrastructure to generate the necessary
+# make targets

package/pkg-perl.mk line 198

Quoted 10 lines
package/pkg-perl.mk new file +10 -0
+$(call inner-generic-package,$(1),$(2),$(3),$(4))
+
+endef
+
+################################################################################
+# perl-package -- the target generator macro for Perl packages
+################################################################################
+
+perl-package = $(call inner-perl-package,$(pkgname),$(call UPPERCASE,$(pkgname)),$(call UPPERCASE,$(pkgname)),target)
+host-perl-package = $(call inner-perl-package,host-$(pkgname),$(call UPPERCASE,host-$(pkgname)),$(call UPPERCASE,$(pkgname)),host)

--

Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

#10 lore raw

PATCH v4 3/9 scancpan: a new script

In reply to Francois Perrad

which creates Perl/CPAN package files

---
 support/scripts/scancpan |  694 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 694 insertions(+)
 create mode 100755 support/scripts/scancpan
support/scripts/scancpan new file +694 -0
new file mode 100755
index 0000000..90ecae4
@@ -0,0 +1,694 @@
+#!/usr/bin/env perl
+
+# This chunk of stuff was generated by App::FatPacker. To find the original
+# file's code, look for the end of this BEGIN block or the string 'FATPACK'
+BEGIN {
+my %fatpacked;
+
+$fatpacked{"MetaCPAN/API/Tiny.pm"} = <<'METACPAN_API_TINY';
+  package MetaCPAN::API::Tiny;
+  {
+    $MetaCPAN::API::Tiny::VERSION = '1.131730';
+  }
+  use strict;
+  use warnings;
+  # ABSTRACT: A Tiny API client for MetaCPAN
+  
+  use Carp;
+  use JSON::PP 'encode_json', 'decode_json';
+  use HTTP::Tiny;
+  
+  
+  sub new {
+      my ($class, @args) = @_;
+  
+      $#_ % 2 == 0
+          or croak 'Arguments must be provided as name/value pairs';
+      
+      my %params = @args;
+  
+      die 'ua_args must be an array reference'
+          if $params{ua_args} && ref($params{ua_args}) ne 'ARRAY';
+  
+      my $self = +{
+          base_url => $params{base_url} || 'http://api.metacpan.org/v0',
+          ua => $params{ua} || HTTP::Tiny->new(
+              $params{ua_args}
+                  ? @{$params{ua_args}}
+                  : (agent => 'MetaCPAN::API::Tiny/'
+                      . ($MetaCPAN::API::VERSION || 'xx'))),
+      };
+      
+      return bless($self, $class);
+  }
+  
+  sub _build_extra_params {
+      my $self = shift;
+  
+      @_ % 2 == 0
+          or croak 'Incorrect number of params, must be key/value';
+  
+      my %extra = @_;
+      my $ua = $self->{ua};
+  
+      foreach my $key (keys %extra)
+      {
+          # The implementation in HTTP::Tiny uses + instead of %20, fix that
+          $extra{$key} = $ua->_uri_escape($extra{$key});
+          $extra{$key} =~ s/\+/%20/g;
+      }
+  
+      my $params = join '&', map { "$_=" . $extra{$_} } sort keys %extra;
+  
+      return $params;
+  }
+  
+  
+  # /source/{author}/{release}/{path}
+  sub source {
+      my $self  = shift;
+      my %opts  = @_ ? @_ : ();
+      my $url   = '';
+      my $error = "Provide 'author' and 'release' and 'path'";
+  
+      %opts or croak $error;
+  
+      if (
+          defined ( my $author  = $opts{'author'}  ) &&
+          defined ( my $release = $opts{'release'} ) &&
+          defined ( my $path    = $opts{'path'}    )
+        ) {
+          $url = "source/$author/$release/$path";
+      } else {
+          croak $error;
+      }
+  
+      $url = $self->{base_url} . "/$url";
+      
+      my $result = $self->{ua}->get($url);
+      $result->{'success'}
+          or croak "Failed to fetch '$url': " . $result->{'reason'};
+  
+      return $result->{'content'};
+  }
+  
+  
+  # /release/{distribution}
+  # /release/{author}/{release}
+  sub release {
+      my $self  = shift;
+      my %opts  = @_ ? @_ : ();
+      my $url   = '';
+      my $error = "Either provide 'distribution', or 'author' and 'release', " .
+                  "or 'search'";
+  
+      %opts or croak $error;
+  
+      my %extra_opts = ();
+  
+      if ( defined ( my $dist = $opts{'distribution'} ) ) {
+          $url = "release/$dist";
+      } elsif (
+          defined ( my $author  = $opts{'author'}  ) &&
+          defined ( my $release = $opts{'release'} )
+        ) {
+          $url = "release/$author/$release";
+      } elsif ( defined ( my $search_opts = $opts{'search'} ) ) {
+          ref $search_opts && ref $search_opts eq 'HASH'
+              or croak $error;
+  
+          %extra_opts = %{$search_opts};
+          $url        = 'release/_search';
+      } else {
+          croak $error;
+      }
+  
+      return $self->fetch( $url, %extra_opts );
+  }
+  
+  
+  # /pod/{module}
+  # /pod/{author}/{release}/{path}
+  sub pod {
+      my $self  = shift;
+      my %opts  = @_ ? @_ : ();
+      my $url   = '';
+      my $error = "Either provide 'module' or 'author and 'release' and 'path'";
+  
+      %opts or croak $error;
+  
+      if ( defined ( my $module = $opts{'module'} ) ) {
+          $url = "pod/$module";
+      } elsif (
+          defined ( my $author  = $opts{'author'}  ) &&
+          defined ( my $release = $opts{'release'} ) &&
+          defined ( my $path    = $opts{'path'}    )
+        ) {
+          $url = "pod/$author/$release/$path";
+      } else {
+          croak $error;
+      }
+  
+      # check content-type
+      my %extra = ();
+      if ( defined ( my $type = $opts{'content-type'} ) ) {
+          $type =~ m{^ text/ (?: html|plain|x-pod|x-markdown ) $}x
+              or croak 'Incorrect content-type provided';
+  
+          $extra{headers}{'content-type'} = $type;
+      }
+  
+      $url = $self->{base_url}. "/$url";
+      
+      my $result = $self->{ua}->get( $url, \%extra );
+      $result->{'success'}
+          or croak "Failed to fetch '$url': " . $result->{'reason'};
+  
+      return $result->{'content'};
+  }
+  
+  
+  # /module/{module}
+  sub module {
+      my $self = shift;
+      my $name = shift;
+  
+      $name or croak 'Please provide a module name';
+  
+      return $self->fetch("module/$name");
+  }
+  
+  
+  # file() is a synonym of module
+  sub file { goto &module }
+  
+  
+  # /author/{author}
+  sub author {
+      my $self = shift;
+      my ( $pause_id, $url, %extra_opts );
+  
+      if ( @_ == 1 ) {
+          $url = 'author/' . shift;
+      } elsif ( @_ == 2 ) {
+          my %opts = @_;
+  
+          if ( defined $opts{'pauseid'} ) {
+              $url = "author/" . $opts{'pauseid'};
+          } elsif ( defined $opts{'search'} ) {
+              my $search_opts = $opts{'search'};
+  
+              ref $search_opts && ref $search_opts eq 'HASH'
+                  or croak "'search' key must be hashref";
+  
+              %extra_opts = %{$search_opts};
+              $url        = 'author/_search';
+          } else {
+              croak 'Unknown option given';
+          }
+      } else {
+          croak 'Please provide an author PAUSEID or a "search"';
+      }
+  
+      return $self->fetch( $url, %extra_opts );
+  }
+  
+  
+  
+  sub fetch {
+      my $self    = shift;
+      my $url     = shift;
+      my $extra   = $self->_build_extra_params(@_);
+      my $base    = $self->{base_url};
+      my $req_url = $extra ? "$base/$url?$extra" : "$base/$url";
+      
+      my $result  = $self->{ua}->get($req_url);
+      return $self->_decode_result( $result, $req_url );
+  }
+  
+  
+  sub post {
+      my $self  = shift;
+      my $url   = shift;
+      my $query = shift;
+      my $base  = $self->{base_url};
+  
+      defined $url
+          or croak 'First argument of URL must be provided';
+  
+      ref $query and ref $query eq 'HASH'
+          or croak 'Second argument of query hashref must be provided';
+  
+      my $query_json = encode_json( $query );
+      my $result     = $self->{ua}->request(
+          'POST',
+          "$base/$url",
+          {
+              headers => { 'Content-Type' => 'application/json' },
+              content => $query_json,
+          }
+      );
+  
+      return $self->_decode_result( $result, $url, $query_json );
+  }
+  
+  sub _decode_result {
+      my $self = shift;
+      my ( $result, $url, $original ) = @_;
+      my $decoded_result;
+  
+      ref $result and ref $result eq 'HASH'
+          or croak 'First argument must be hashref';
+  
+      defined $url
+          or croak 'Second argument of a URL must be provided';
+  
+      if ( defined ( my $success = $result->{'success'} ) ) {
+          my $reason = $result->{'reason'} || '';
+          $reason .= ( defined $original ? " (request: $original)" : '' );
+  
+          $success or croak "Failed to fetch '$url': $reason";
+      } else {
+          croak 'Missing success in return value';
+      }
+  
+      defined ( my $content = $result->{'content'} )
+          or croak 'Missing content in return value';
+  
+      eval { $decoded_result = decode_json $content; 1 }
+      or do { croak "Couldn't decode '$content': $@" };
+  
+      return $decoded_result;
+  }
+  
+  1;
+  
+  __END__
+  
+  =pod
+  
+  =head1 NAME
+  
+  MetaCPAN::API::Tiny - A Tiny API client for MetaCPAN
+  
+  =head1 VERSION
+  
+  version 1.131730
+  
+  =head1 DESCRIPTION
+  
+  This is the Tiny version of L<MetaCPAN::API>. It implements a compatible API
+  with a few notable exceptions:
+  
+  =over 4
+  
+  =item Attributes are direct hash access
+  
+  The attributes defined using Mo(o|u)se are now accessed via the blessed hash
+  directly. There are no accessors defined to access this elements.
+  
+  =item Exception handling
+  
+  Instead of using Try::Tiny, raw evals are used. This could potentially cause
+  issues, so just be aware.
+  
+  =item Testing
+  
+  Test::Fatal was replaced with an eval implementation of exception().
+  Test::TinyMocker usage is retained, but may be absorbed since it is pure perl
+  
+  =back
+  
+  =head1 CLASS_METHODS
+  
+  =head2 new
+  
+  new is the constructor for MetaCPAN::API::Tiny. In the non-tiny version of this
+  module, this is provided via Any::Moose built from the attributes defined. In
+  the tiny version, we define our own constructor. It takes the same arguments
+  and provides similar checks to MetaCPAN::API with regards to arguments passed.
+  
+  =head1 PUBLIC_METHODS
+  
+  =head2 source
+  
+      my $source = $mcpan->source(
+          author  => 'DOY',
+          release => 'Moose-2.0201',
+          path    => 'lib/Moose.pm',
+      );
+  
+  Searches MetaCPAN for a module or a specific release and returns the plain source.
+  
+  =head2 release
+  
+      my $result = $mcpan->release( distribution => 'Moose' );
+  
+      # or
+      my $result = $mcpan->release( author => 'DOY', release => 'Moose-2.0001' );
+  
+  Searches MetaCPAN for a dist.
+  
+  You can do complex searches using 'search' parameter:
+  
+      # example lifted from MetaCPAN docs
+      my $result = $mcpan->release(
+          search => {
+              author => "OALDERS AND ",
+              filter => "status:latest",
+              fields => "name",
+              size   => 1,
+          },
+      );
+  
+  =head2 pod
+  
+      my $result = $mcpan->pod( module => 'Moose' );
+  
+      # or
+      my $result = $mcpan->pod(
+          author  => 'DOY',
+          release => 'Moose-2.0201',
+          path    => 'lib/Moose.pm',
+      );
+  
+  Searches MetaCPAN for a module or a specific release and returns the POD.
+  
+  =head2 module
+  
+      my $result = $mcpan->module('MetaCPAN::API');
+  
+  Searches MetaCPAN and returns a module's ".pm" file.
+  
+  =head2 file
+  
+  A synonym of L</module>
+  
+  =head2 author
+  
+      my $result1 = $mcpan->author('XSAWYERX');
+      my $result2 = $mcpan->author( pauseid => 'XSAWYERX' );
+  
+  Searches MetaCPAN for a specific author.
+  
+  You can do complex searches using 'search' parameter:
+  
+      # example lifted from MetaCPAN docs
+      my $result = $mcpan->author(
+          search => {
+              q    => 'profile.name:twitter',
+              size => 1,
+          },
+      );
+  
+  =head2 fetch
+  
+      my $result = $mcpan->fetch('/release/distribution/Moose');
+  
+      # with parameters
+      my $more = $mcpan->fetch(
+          '/release/distribution/Moose',
+          param => 'value',
+      );
+  
+  This is a helper method for API implementations. It fetches a path from MetaCPAN, decodes the JSON from the content variable and returns it.
+  
+  You don't really need to use it, but you can in case you want to write your own extension implementation to MetaCPAN::API.
+  
+  It accepts an additional hash as "GET" parameters.
+  
+  =head2 post
+  
+      # /release&content={"query":{"match_all":{}},"filter":{"prefix":{"archive":"Cache-Cache-1.06"}}}
+      my $result = $mcpan->post(
+          'release',
+          {   
+              query  => { match_all => {} },
+              filter => { prefix => { archive => 'Cache-Cache-1.06' } },
+          },
+      );
+  
+  The POST equivalent of the "fetch()" method. It gets the path and JSON request.
+  
+  =head1 THANKS
+  
+  Overall the tests and code were ripped directly from MetaCPAN::API and
+  tiny-fied. A big thanks to Sawyer X for writing the original module.
+  
+  =head1 AUTHOR
+  
+  Nicholas R. Perez <[email protected]>
+  
+  =head1 COPYRIGHT AND LICENSE
+  
+  This software is copyright (c) 2013 by Nicholas R. Perez <[email protected]>.
+  
+  This is free software; you can redistribute it and/or modify it under
+  the same terms as the Perl 5 programming language system itself.
+  
+  =cut
+METACPAN_API_TINY
+
+s/^  //mg for values %fatpacked;
+
+unshift @INC, sub {
+  if (my $fat = $fatpacked{$_[1]}) {
+    if ($] < 5.008) {
+      return sub {
+        return 0 unless length $fat;
+        $fat =~ s/^([^\n]*\n?)//;
+        $_ = $1;
+        return 1;
+      };
+    }
+    open my $fh, '<', \$fat
+      or die "FatPacker error loading $_[1] (could be a perl installation issue?)";
+    return $fh;
+  }
+  return
+};
+
+} # END OF FATPACK CODE
+
+
+use 5.010;
+use strict;
+use warnings;
+use Fatal qw(open close);
+
+use Getopt::Long;
+use Pod::Usage;
+use File::Basename;
+use Module::CoreList;
+use MetaCPAN::API::Tiny;
+
+my ($help, $man, $quiet, $force, $recommend);
+GetOptions( 'help|?' => \$help,
+            'man' => \$man,
+            'quiet|q' => \$quiet,
+            'force|f' => \$force,
+            'recommend' => \$recommend
+) or pod2usage(-exitval => 1);
+pod2usage(-exitval => 0) if $help;
+pod2usage(-exitval => 0, -verbose => 2) if $man;
+pod2usage(-exitval => 1) if scalar @ARGV == 0;
+
+my %dist;
+my %deps_build;
+my %deps_runtime;
+my $mcpan = MetaCPAN::API::Tiny->new();
+
+sub fetch {
+    my $name = shift;
+    unless ($dist{$name}) {
+        say qq{fetch ${name}} unless $quiet;
+        my $result = $mcpan->release( distribution => $name );
+        $dist{$name} = $result;
+        my @deps_build = ();
+        my @deps_runtime = ();
+        my $mb;
+        foreach my $dep (@{$result->{dependency}}) {
+            my $modname = ${$dep}{module};
+            $mb = 1 if $modname eq q{Module::Build};
+            next if $modname eq q{perl};
+            next if $modname =~ m|^Alien|;
+            next if $modname =~ m|^Win32|;
+            next if Module::CoreList::first_release( $modname );
+            next if ${$dep}{phase} eq q{develop};
+            next if ${$dep}{phase} eq q{test};
+            next if !$recommend && ${$dep}{relationship} ne q{requires};
+            my $distname = $mcpan->module( $modname )->{distribution};
+            if (${$dep}{phase} eq q{runtime}) {
+                push @deps_runtime, $distname;
+            }
+            else { # configure, build
+                push @deps_build, $distname;
+            }
+            fetch( $distname );
+        }
+        unshift @deps_build, q{Module-Build} if $mb;
+        $deps_build{$name} = \@deps_build;
+        $deps_runtime{$name} = \@deps_runtime;
+    }
+    return;
+}
+
+foreach my $distname (@ARGV) {
+    fetch( $distname );
+}
+say scalar keys %dist, q{ packages fetched.} unless $quiet;
+
+sub fsname {
+    my $name = shift;
+    return q{perl-} . lc $name;
+}
+
+sub brname {
+    my $name = shift;
+    $name =~ s|-|_|g;
+    return uc $name;
+}
+
+while (my ($distname, $dist) = each %dist) {
+    my $fsname = fsname( $distname );
+    my $dirname = q{package/} . $fsname;
+    my $cfgname = $dirname . q{/Config.in};
+    my $mkname = $dirname . q{/} . $fsname . q{.mk};
+    my $brname = brname( $fsname );
+    mkdir $dirname unless -d $dirname;
+    if ($force || !-f $cfgname) {
+        my $abstract = $dist->{abstract} || q{NO ABSTRACT};
+        say qq{write ${cfgname}} unless $quiet;
+        open my $fh, q{>}, $cfgname;
+        say {$fh} qq{config BR2_PACKAGE_${brname}};
+        say {$fh} qq{\tbool "${fsname}"};
+        foreach my $dep (@{$deps_runtime{$distname}}) {
+            my $brdep = brname( fsname( $dep ) );
+            say {$fh} qq{\tselect BR2_PACKAGE_${brdep}};
+        }
+        say {$fh} qq{\thelp};
+        say {$fh} qq{\t  ${abstract}};
+        say {$fh} qq{};
+        close $fh;
+    }
+    if ($force || !-f $mkname) {
+        my $version = $dist->{version};
+        my $site = dirname( $dist->{download_url} );
+        my($scheme, $auth, $path) = $dist->{download_url} =~ m|(?:([^:/?#]+):)?(?://([^/?#]*))?([^?#]*)|;
+        my($filename, $directories, $suffix) = fileparse( $path, q{tar.gz}, q{tgz} );
+        my $dependencies = join q{ }, map( { q{host-} . fsname( $_ ); } @{$deps_build{$distname}} ),
+                                      map( { fsname( $_ ); } @{$deps_runtime{$distname}} );
+        my $host_dependencies = join q{ }, map { q{host-} . fsname( $_ ); } @{$deps_build{$distname}},
+                                                                            @{$deps_runtime{$distname}};
+        my $license = ref $dist->{license} eq 'ARRAY'
+                    ? join q{ }, @{$dist->{license}}
+                    : $dist->{license};
+        say qq{write ${mkname}} unless $quiet;
+        open my $fh, q{>}, $mkname;
+        say {$fh} qq{################################################################################};
+        say {$fh} qq{#};
+        say {$fh} qq{# ${fsname}};
+        say {$fh} qq{#};
+        say {$fh} qq{################################################################################};
+        say {$fh} qq{};
+        say {$fh} qq{${brname}_VERSION = ${version}};
+        say {$fh} qq{${brname}_SOURCE = ${distname}-\$(${brname}_VERSION).${suffix}};
+        say {$fh} qq{${brname}_SITE = \$(BR2_CPAN_MIRROR)${directories}};
+        say {$fh} qq{${brname}_DEPENDENCIES = perl ${dependencies}};
+        say {$fh} qq{#HOST_${brname}_DEPENDENCIES = ${host_dependencies}};
+        say {$fh} qq{${brname}_LICENSE = ${license}} if $license && $license ne q{unknown};
+        say {$fh} qq{};
+        say {$fh} qq{\$(eval \$(perl-package))};
+        say {$fh} qq{#\$(eval \$(host-perl-package))};
+        close $fh;
+    }
+}
+
+my %pkg;
+my $cfgname = q{package/Config.in};
+if (-f $cfgname) {
+    open my $fh, q{<}, $cfgname;
+    while (<$fh>) {
+        chomp;
+        $pkg{$_} = 1 if m|package/perl-|;
+    }
+    close $fh;
+}
+
+foreach my $distname (sort keys %dist) {
+    my $fsname = fsname( $distname );
+    $pkg{qq{source "package/${fsname}/Config.in"}} = 1;
+}
+
+say qq{${cfgname} must contains the following lines:};
+say join qq{\n}, sort keys %pkg;
+
+__END__
+
+=head1 NAME
+
+support/scripts/scancpan Try-Tiny Moo
+
+=head1 SYNOPSIS
+
+supports/scripts/scancpan [options] [distname ...]
+
+ Options:
+   -help
+   -man
+   -quiet
+   -force
+   -recommend
+
+=head1 OPTIONS
+
+=over 8
+
+=item B<-help>
+
+Print a brief help message and exits.
+
+=item B<-man>
+
+Prints the manual page and exits.
+
+=item B<-quiet>
+
+Executes without output
+
+=item B<-force>
+
+Forces the overwritting of existing files.
+
+=item B<-recommend>
+
+Adds I<recommended> dependencies.
+
+=back
+
+=head1 DESCRIPTION
+
+This script creates the BR package files for all Perl/CPAN
+distributions required by all distname. These data are fetched from
+https://metacpan.org/.
+
+See the Buildroot documentation for details on the usage of the Perl
+infrastructure.
+
+=head1 LICENSE
+
+This script is a part of Buildroot.
+
+This script requires the module C<MetaCPAN::API::Tiny> (version 1.131730)
+which was included at the beginning of this file by the tool C<fatpack>.
+
+See L<http://search.cpan.org/~nperez/MetaCPAN-API-Tiny-1.131730/>.
+
+See L<http://search.cpan.org/search?query=App-FatPacker&mode=dist>.
+
+These both libraries are free software and may be distributed under the same
+terms as perl itself.
+
+And perl may be distributed under the terms of Artistic v1 or GPL v1 license.
+
+=cut
Signature · 1 line
1.7.9.5
#11 lore raw

PATCH v4 4/9 host-perl-xml-parser: rename and refactor with perl infrastructure

In reply to Francois Perrad

note: only the host variant is used

---
 package/Config.in                                |    1 -
 package/intltool/intltool.mk                     |    2 +-
 package/libxml-parser-perl/Config.in             |   10 -------
 package/libxml-parser-perl/libxml-parser-perl.mk |   35 ----------------------
 package/metacity/metacity.mk                     |    2 +-
 package/perl-xml-parser/perl-xml-parser.mk       |   16 ++++++++++
 6 files changed, 18 insertions(+), 48 deletions(-)
 delete mode 100644 package/libxml-parser-perl/Config.in
 delete mode 100644 package/libxml-parser-perl/libxml-parser-perl.mk
 create mode 100644 package/perl-xml-parser/perl-xml-parser.mk
package/Config.in +0 -1
index ee2a68e..0d81a7f 100644
@@ -621,7 +621,6 @@ source "package/json-c/Config.in"
 source "package/json-glib/Config.in"
 source "package/libjson/Config.in"
 source "package/libroxml/Config.in"
-source "package/libxml-parser-perl/Config.in"
 source "package/libxml2/Config.in"
 source "package/libxmlpp/Config.in"
 source "package/libxslt/Config.in"
package/intltool/intltool.mk +1 -1
index 4235606..ebad7d8 100644
@@ -9,7 +9,7 @@ INTLTOOL_SITE = https://launchpad.net/intltool/trunk/$(INTLTOOL_VERSION)/+downlo
 INTLTOOL_LICENSE = GPLv2+
 INTLTOOL_LICENSE_FILES = COPYING
 
-HOST_INTLTOOL_DEPENDENCIES = host-gettext host-libxml-parser-perl
+HOST_INTLTOOL_DEPENDENCIES = host-gettext host-perl-xml-parser
 HOST_INTLTOOL_CONF_ENV = PERL5LIB=$(HOST_PERL5LIB)
 
 $(eval $(autotools-package))
package/libxml-parser-perl/Config.in deleted +0 -10
deleted file mode 100644
index bdda236..0000000
@@ -1,10 +0,0 @@
-config BR2_PACKAGE_LIBXML_PARSER_PERL
-	bool "libxml-parser-perl"
-	select BR2_PACKAGE_EXPAT
-	# Hide from configuration as we only support the host package
-	# for the moment
-	depends on BR2_HOST_ONLY
-	help
-	  The Perl XML::Parser module.
-
-	  http://www.cpan.org/modules/by-module/XML/
package/libxml-parser-perl/libxml-parser-perl.mk deleted +0 -35
deleted file mode 100644
index 53f3bcf..0000000
@@ -1,35 +0,0 @@
-################################################################################
-#
-# libxml-parser-perl
-#
-################################################################################
-
-LIBXML_PARSER_PERL_VERSION = 2.36
-LIBXML_PARSER_PERL_SOURCE = XML-Parser-$(LIBXML_PARSER_PERL_VERSION).tar.gz
-LIBXML_PARSER_PERL_SITE = http://www.cpan.org/modules/by-module/XML/
-
-LIBXML_PARSER_PERL_DEPENDENCIES = expat
-
-define HOST_LIBXML_PARSER_PERL_CONFIGURE_CMDS
- (cd $(@D) ; \
-   $(HOST_CONFIGURE_OPTS) perl Makefile.PL \
-        PREFIX=$(HOST_DIR)/usr \
-        EXPATLIBPATH=$(HOST_DIR)/usr/lib \
-        EXPATINCPATH=$(HOST_DIR)/usr/include \
-        INSTALLDIRS=site \
-        INSTALLSITELIB=$(HOST_DIR)/usr/lib/perl \
-        INSTALLSITEARCH=$(HOST_DIR)/usr/lib/perl \
-        USE_MM_LD_RUN_PATH=1 \
- )
-endef
-
-define HOST_LIBXML_PARSER_PERL_BUILD_CMDS
- $(HOST_MAKE_ENV) $(MAKE) -C $(@D)
-endef
-
-define HOST_LIBXML_PARSER_PERL_INSTALL_CMDS
- $(HOST_MAKE_ENV) $(MAKE) -C $(@D) install
-endef
-
-$(eval $(generic-package))
-$(eval $(host-generic-package))
package/metacity/metacity.mk +1 -1
index 9306b00..18f5c76 100644
@@ -19,7 +19,7 @@ METACITY_CONF_OPT = --x-includes=$(STAGING_DIR)/usr/include/X11 \
 
 METACITY_DEPENDENCIES = libgtk2 \
 	xlib_libX11 \
-	host-libxml-parser-perl \
+	host-perl-xml-parser \
 	xlib_libXcomposite \
 	xlib_libXfixes \
 	xlib_libXrender \
package/perl-xml-parser/perl-xml-parser.mk new file +16 -0
new file mode 100644
index 0000000..70a0f6e
@@ -0,0 +1,16 @@
+################################################################################
+#
+# perl-xml-parser
+#
+################################################################################
+
+PERL_XML_PARSER_VERSION = 2.41
+PERL_XML_PARSER_SOURCE = XML-Parser-$(PERL_XML_PARSER_VERSION).tar.gz
+PERL_XML_PARSER_SITE = $(BR2_CPAN_MIRROR)/authors/id/T/TO/TODDR/
+PERL_XML_PARSER_DEPENDENCIES = expat
+PERL_XML_PARSER_LICENSE = perl_5
+
+HOST_LIBXML_PARSER_PERL_CONF_OPT += EXPATLIBPATH=$(HOST_DIR)/usr/lib
+HOST_LIBXML_PARSER_PERL_CONF_OPT += EXPATINCPATH=$(HOST_DIR)/usr/include
+
+$(eval $(host-perl-package))
Signature · 1 line
1.7.9.5
#12 lore raw

PATCH v4 4/9 host-perl-xml-parser: rename and refactor with perl infrastructure

Dear Francois Perrad,

Quoted 1 line · Francois Perrad

note: only the host variant is used

It would be good to have much more verbose commit logs. Something such as:

"""
Even though libxml-parser-perl had a Config.in file with an option to enable it on the target, this option was hidden by a dependency on BR2_HOST_ONLY. So in practice, it was not possible to enable libxml-parser-perl on the target. This allows us to rename libxml-parser-perl to perl-xml-parser to follow the new naming convention of Perl packages, without having to introduce Config.in.legacy material.

In addition to this rename, the package is converted to use the newly introduced Perl package infrastructure.

"""

package/perl-xml-parser/perl-xml-parser.mk line 14

Quoted 2 lines
package/perl-xml-parser/perl-xml-parser.mk new file +2 -0
+HOST_LIBXML_PARSER_PERL_CONF_OPT += EXPATLIBPATH=$(HOST_DIR)/usr/lib
+HOST_LIBXML_PARSER_PERL_CONF_OPT += EXPATINCPATH=$(HOST_DIR)/usr/include

We normally do:

HOST_LIBXML_PARSER_PERL_CONF_OPT = \
	EXPATLIBPATH=$(HOST_DIR)/usr/lib \
	EXPATINCPATH=$(HOST_DIR)/usr/include

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#13 lore raw

PATCH v4 5/9 host-perl-module-build: new package

In reply to Francois Perrad

the version coming with host-perl is too old

---
 package/perl-module-build/perl-module-build.mk |   12 ++++++++++++
 1 file changed, 12 insertions(+)
 create mode 100644 package/perl-module-build/perl-module-build.mk
package/perl-module-build/perl-module-build.mk new file +12 -0
new file mode 100644
index 0000000..c726c2a
@@ -0,0 +1,12 @@
+################################################################################
+#
+# perl-module-build
+#
+################################################################################
+
+PERL_MODULE_BUILD_VERSION = 0.4204
+PERL_MODULE_BUILD_SOURCE = Module-Build-$(PERL_MODULE_BUILD_VERSION).tar.gz
+PERL_MODULE_BUILD_SITE = $(BR2_CPAN_MIRROR)/authors/id/L/LE/LEONT/
+PERL_MODULE_BUILD_LICENSE = perl_5
+
+$(eval $(host-perl-package))
Signature · 1 line
1.7.9.5
#14 lore raw

PATCH v4 6/9 perl: remove useless patch

In reply to Francois Perrad
---
 package/perl/perl-fix-Module-Build.patch |   16 ----------------
 1 file changed, 16 deletions(-)
 delete mode 100644 package/perl/perl-fix-Module-Build.patch
package/perl/perl-fix-Module-Build.patch deleted +0 -16
deleted file mode 100644
index 9101c11..0000000
@@ -1,16 +0,0 @@
-
-Signed-off-by: Francois Perrad <[email protected]>
-
-Index: b/cpan/Module-Build/lib/Module/Build/Base.pm
-===================================================================
---- a/cpan/Module-Build/lib/Module/Build/Base.pm
-+++ b/cpan/Module-Build/lib/Module/Build/Base.pm
-@@ -460,7 +460,7 @@
-   my $proto = shift;
-   my $c     = ref($proto) ? $proto->{config} : 'Module::Build::Config';
- 
--  my $perl  = $^X;
-+  my $perl  = $ENV{RUN_PERL} || $^X;
-   my $perl_basename = File::Basename::basename($perl);
- 
-   my @potential_perls;
Signature · 1 line
1.7.9.5
#15 lore raw

PATCH v4 6/9 perl: remove useless patch

Dear Francois Perrad,

Quoted 6 lines · Francois Perrad
---
 package/perl/perl-fix-Module-Build.patch |   16 ----------------
 1 file changed, 16 deletions(-)
 delete mode 100644 package/perl/perl-fix-Module-Build.patch

It would be good to indicate in the commit log why the patch was useless.

Sorry to bother you so much about commit logs, but they are *really* important. I can't tell you the number of times I look at the git commit logs in the history of Buildroot to understand why such or such choice was made. So I really want to have good commit logs, and a commit log such as "remove useless patch" is not a good commit log, as it doesn't explain *why* the change was made.

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#16 lore raw

PATCH v4 6/9 perl: remove useless patch

2014-02-05 Thomas Petazzoni <[email protected]>:

Quoted 4 lines

Dear Francois Perrad,

Quoted 1 line · Francois Perrad
Quoted 9 lines
Quoted 5 lines
---
 package/perl/perl-fix-Module-Build.patch |   16 ----------------
 1 file changed, 16 deletions(-)
 delete mode 100644 package/perl/perl-fix-Module-Build.patch

It would be good to indicate in the commit log why the patch was useless.

The Perl infrastructure uses a host version of Module-Build (see previous commit "host-perl-module-build: new package"). The target version is never used.

Fran?ois

Quoted 18 lines

Sorry to bother you so much about commit logs, but they are *really* important. I can't tell you the number of times I look at the git commit logs in the history of Buildroot to understand why such or such choice was made. So I really want to have good commit logs, and a commit log such as "remove useless patch" is not a good commit log, as it doesn't explain *why* the change was made.

Thanks!

Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

#17 lore raw

PATCH v4 6/9 perl: remove useless patch

Dear Fran?ois Perrad,

Quoted 10 lines · Fran?ois Perrad
Quoted 6 lines
Quoted 3 lines
 package/perl/perl-fix-Module-Build.patch |   16 ----------------
 1 file changed, 16 deletions(-)
 delete mode 100644 package/perl/perl-fix-Module-Build.patch

It would be good to indicate in the commit log why the patch was useless.

The Perl infrastructure uses a host version of Module-Build (see previous commit "host-perl-module-build: new package"). The target version is never used.

Ok, but the relation with the removal of this patch still isn't very clear.

And the entire explanation should be part of the commit log :-)

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#18 lore raw

PATCH v4 7/9 manual: adding packages perl

In reply to Francois Perrad
---
 docs/manual/adding-packages-perl.txt |  110 ++++++++++++++++++++++++++++++++++
 docs/manual/adding-packages.txt      |    2 +
 2 files changed, 112 insertions(+)
 create mode 100644 docs/manual/adding-packages-perl.txt
docs/manual/adding-packages-perl.txt new file +110 -0
new file mode 100644
index 0000000..1e48df9
@@ -0,0 +1,110 @@
+// -*- mode:doc; -*-
+// vim: set syntax=asciidoc:
+
+Infrastructure for Perl/CPAN packages
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+[[perl-package-tutorial]]
+
++perl-package+ tutorial
+^^^^^^^^^^^^^^^^^^^^^^^
+
+First, let's see how to write a +.mk+ file for a Perl/CPAN package,
+with an example :
+
+------------------------
+01: ################################################################################
+02: #
+03: # perl-foo-bar
+04: #
+05: ################################################################################
+06:
+07: PERL_FOO_BAR_VERSION = 0.02
+08: PERL_FOO_BAR_SOURCE = Foo-Bar-$(PERL_FOO_BAR_VERSION).tar.gz
+09: PERL_FOO_BAR_SITE = $(BR2_CPAN_MIRROR)/authors/id/M/MO/MONGER/
+10: PERL_FOO_BAR_DEPENDENCIES = perl-strictures
+11: PERL_FOO_BAR_LICENSE = perl_5
+12: PERL_FOO_BAR_LICENSE_FILES = LICENSE
+13:
+14: $(eval $(perl-package))
+------------------------
+
+On line 7, we declare the version of the package.
+
+On line 8 and 9, we declare the name of the tarball and the location
+of the tarball on a CPAN server. Buildroot will automatically download
+the tarball from this location.
+
+On line 10, we declare our dependencies, so that they are built
+before the build process of our package starts.
+
+On line 11 and 12, we give licensing details about the package (its
+license on line 11, and the file containing the license text on line
+12).
+
+Finally, on line 14, we invoke the +perl-package+ macro that
+generates all the Makefile rules that actually allow the package to be
+built.
+
+Most of these data could be retrieved from https://metacpan.org/.
+So, this file and the Config.in could be generated by running
+the script +supports/scripts/scancpan Foo-Bar+ in the +TOPDIR+ directory
+(or in the +BR2_EXTERNAL+ directory).
+This script recursively creates packages for all required Perl/CPAN
+dependencies.
+
+[[perl-package-reference]]
+
++perl-package+ reference
+^^^^^^^^^^^^^^^^^^^^^^^^
+
+As a policy, packages that provide Perl/CPAN modules should all be
+named +perl-<something>+ in Buildroot.
+
+This infrastructure handles various Perl build systems :
++ExtUtils-MakeMaker+, +Module-Build+ and +Module-Build-Tiny+.
++Build.PL+ is always prefered when a package provides a +Makefile.PL+
+and a +Build.PL+.
+
+The main macro of the Perl/CPAN package infrastructure is
++perl-package+. It is similar to the +generic-package+ macro. The ability to
+have target and host packages is also available, with the
++host-perl-package+ macro.
+
+Just like the generic infrastructure, the Perl/CPAN infrastructure
+works by defining a number of variables before calling the
++perl-package+ macro.
+
+First, all the package metadata information variables that exist in the
+generic infrastructure also exist in the Perl/CPAN infrastructure:
++PERL_FOO_VERSION+, +PERL_FOO_SOURCE+,
++PERL_FOO_PATCH+, +PERL_FOO_SITE+,
++PERL_FOO_SUBDIR+, +PERL_FOO_DEPENDENCIES+,
++PERL_FOO_INSTALL_TARGET+.
+
+Note that:
+
+ * Setting +PERL_FOO_INSTALL_STAGING+ to +YES+ has no effect (unless
+   a +PERL_FOO_INSTALL_STAGING_CMDS+ variable is defined), since
+   Perl modules generally don't need to be installed to the
+   +staging+ directory.
+
+A few additional variables, specific to the Perl/CPAN infrastructure,
+can also be defined. Many of them are only useful in very specific
+cases, typical packages will therefore only use a few of them.
+
+* +PERL_FOO_CONF_OPT+, to specify additional configure
+  options to pass to the +perl Makefile.PL+ or +perl Build.PL+.
+  By default, empty.
+
+* +PERL_FOO_BUILD_OPT+, to specify additional options to
+  pass to +make pure_all+ or +perl Build build+ in the build step.
+  By default, empty.
+
+* +PERL_FOO_INSTALL_TARGET_OPT+, to specify additional options to
+  pass to +make pure_install+ or +perl Build install+ in the install step.
+  By default, empty.
+
+* +HOST_PERL_FOO_INSTALL_OPT+, to specify additional options to
+  pass to +make pure_install+ or +perl Build install+ in the install step.
+  By default, empty.
docs/manual/adding-packages.txt +2 -0
index cc86529..745e33a 100644
@@ -22,6 +22,8 @@ include::adding-packages-python.txt[]
 
 include::adding-packages-luarocks.txt[]
 
+include::adding-packages-perl.txt[]
+
 include::adding-packages-hooks.txt[]
 
 include::adding-packages-gettext.txt[]
Signature · 1 line
1.7.9.5
#19 lore raw

PATCH v4 8/9 cpanminus: remove it

In reply to Francois Perrad
---
 package/Config.in              |    1 -
 package/cpanminus/Config.in    |   40 ----------------------------------
 package/cpanminus/cpanminus.mk |   47 ----------------------------------------
 3 files changed, 88 deletions(-)
 delete mode 100644 package/cpanminus/Config.in
 delete mode 100644 package/cpanminus/cpanminus.mk
package/Config.in +0 -1
index 0d81a7f..c4dac6c 100644
@@ -395,7 +395,6 @@ source "package/nodejs/Config.in"
 source "package/perl/Config.in"
 if BR2_PACKAGE_PERL
 menu "Perl libraries/modules"
-source "package/cpanminus/Config.in"
 endmenu
 endif
 source "package/php/Config.in"
package/cpanminus/Config.in deleted +0 -40
deleted file mode 100644
index b10d211..0000000
@@ -1,40 +0,0 @@
-config BR2_PACKAGE_CPANMINUS
-	bool "cpanminus"
-	# Requires host-qemu, which cannot work properly due to kernel
-	# headers mismatch between the build environment and the
-	# target.
-	depends on BR2_BROKEN
-	help
-	  cpanminus is a script to get, unpack, build and install Perl modules
-	  from CPAN.
-
-	  Why? It's dependency free, requires zero configuration, and stands
-	  alone. When running, it requires only 10MB of RAM.
-
-	  http://github.com/miyagawa/cpanminus
-
-if BR2_PACKAGE_CPANMINUS
-
-config BR2_PACKAGE_CPANMINUS_MIRROR
-	string "mirror"
-	help
-	  Specifies the base URL for the CPAN mirror to use,
-	  such as http://cpan.cpantesters.org/.
-
-config BR2_PACKAGE_CPANMINUS_MODULES
-	string "Perl modules from CPAN"
-	default "Curses::UI"
-	help
-	  List of space-separated Perl modules to install from CPAN.
-
-	  Examples: Try::Tiny Dancer YAML Moo
-
-	  Install the listed modules and their dependencies.
-
-config BR2_PACKAGE_CPANMINUS_NATIVE_DEPENDENCIES
-	string "native dependencies"
-	default "ncurses"
-	help
-	  Some XS modules require native libraries.
-
-endif
package/cpanminus/cpanminus.mk deleted +0 -47

47 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#20 lore raw

PATCH v4 9/9 qemu: add a Config.in.host

In reply to Francois Perrad

after the removal of cpanminus

---
 package/Config.in.host      |    1 +
 package/qemu/Config.in.host |   10 ++++++++++
 2 files changed, 11 insertions(+)
 create mode 100644 package/qemu/Config.in.host
package/Config.in.host +1 -0
index 599ab9e..ca047e3 100644
@@ -12,6 +12,7 @@ source "package/mtools/Config.in.host"
 source "package/omap-u-boot-utils/Config.in.host"
 source "package/openocd/Config.in.host"
 source "package/parted/Config.in.host"
+source "package/qemu/Config.in.host"
 source "package/sam-ba/Config.in.host"
 source "package/sunxi-tools/Config.in.host"
 source "package/uboot-tools/Config.in.host"
package/qemu/Config.in.host new file +10 -0
new file mode 100644
index 0000000..cfab922
@@ -0,0 +1,10 @@
+config BR2_PACKAGE_HOST_QEMU
+	bool "host qemu"
+	help
+	  QEMU is a generic and open source machine emulator and virtualizer.
+
+	  In user mode emulation, QEMU runs single cross-compiled programs.
+	  Fast cross-compilation and cross-debugging are the main targets
+	  for user-mode emulation.
+
+	  http://qemu.org/
Signature · 1 line
1.7.9.5
#21 lore raw

PATCH v4 9/9 qemu: add a Config.in.host

Dear Francois Perrad,

Quoted 8 lines · Francois Perrad

after the removal of cpanminus

---
 package/Config.in.host      |    1 +
 package/qemu/Config.in.host |   10 ++++++++++
 2 files changed, 11 insertions(+)
 create mode 100644 package/qemu/Config.in.host

I'm not sure this should be part of the Perl patch series. At the meeting, I think we all agreed that building the Qemu user-mode emulation for the host is not useful as it cannot work properly. Instead the qemu package should build the system-mode emulation for the host, which is something that Gustavo proposed some time ago.

So I'd say to leave Qemu on the side for now, and focus on the Perl side of things in this patch series.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#22 lore raw

PATCH v4 9/9 qemu: add a Config.in.host

2014-02-05 Thomas Petazzoni <[email protected]>:

Quoted 12 lines

Dear Francois Perrad,

Quoted 8 lines · Francois Perrad

after the removal of cpanminus

---
 package/Config.in.host      |    1 +
 package/qemu/Config.in.host |   10 ++++++++++
 2 files changed, 11 insertions(+)
 create mode 100644 package/qemu/Config.in.host
Quoted 9 lines

I'm not sure this should be part of the Perl patch series. At the meeting, I think we all agreed that building the Qemu user-mode emulation for the host is not useful as it cannot work properly. Instead the qemu package should build the system-mode emulation for the host, which is something that Gustavo proposed some time ago.

So I'd say to leave Qemu on the side for now, and focus on the Perl side of things in this patch series.

Frank Hunleth needs it.
See http://lists.busybox.net/pipermail/buildroot/2013-December/084131.html
& http://patchwork.ozlabs.org/patch/299014/

Fran?ois

Quoted 9 lines

Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

#23 lore raw

PATCH v4 9/9 qemu: add a Config.in.host

Quoted 19 lines · Fran?ois Perrad

2014-02-05 Thomas Petazzoni <[email protected]>:

Quoted 18 lines
Quoted 18 lines

Dear Francois Perrad,

Quoted 8 lines · Francois Perrad
Quoted 8 lines

after the removal of cpanminus

---
 package/Config.in.host      |    1 +
 package/qemu/Config.in.host |   10 ++++++++++
 2 files changed, 11 insertions(+)
 create mode 100644 package/qemu/Config.in.host

I'm not sure this should be part of the Perl patch series. At the meeting, I think we all agreed that building the Qemu user-mode emulation for the host is not useful as it cannot work properly. Instead the qemu package should build the system-mode emulation for the host, which is something that Gustavo proposed some time ago.

Quoted 6 lines
Quoted 3 lines
Quoted 3 lines

So I'd say to leave Qemu on the side for now, and focus on the Perl side of things in this patch series.

Frank Hunleth needs it.
See http://lists.busybox.net/pipermail/buildroot/2013-December/084131.html
& http://patchwork.ozlabs.org/patch/299014/

It's true that qemu-user would be nice to have, but unless we can find a
way to guarantee that it works, I'm also against keeping it. When the kernel version is inconsistent, it can really break in hard to debug ways.

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#24 lore raw

PATCH v4 9/9 qemu: add a Config.in.host

Hi Arnout and all,

Quoted 21 lines · Arnout Vandecappelle
Quoted 19 lines · Fran?ois Perrad

2014-02-05 Thomas Petazzoni <[email protected]>:

Quoted 18 lines
Quoted 18 lines

Dear Francois Perrad,

Quoted 8 lines · Francois Perrad
Quoted 8 lines

after the removal of cpanminus

---
 package/Config.in.host      |    1 +
 package/qemu/Config.in.host |   10 ++++++++++
 2 files changed, 11 insertions(+)
 create mode 100644 package/qemu/Config.in.host

I'm not sure this should be part of the Perl patch series. At the meeting, I think we all agreed that building the Qemu user-mode emulation for the host is not useful as it cannot work properly. Instead the qemu package should build the system-mode emulation for the host, which is something that Gustavo proposed some time ago.

Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
Quoted 3 lines

So I'd say to leave Qemu on the side for now, and focus on the Perl side of things in this patch series.

Frank Hunleth needs it.
See http://lists.busybox.net/pipermail/buildroot/2013-December/084131.html
& http://patchwork.ozlabs.org/patch/299014/

That's true. I do use it for regression tests that I run against a few really large data sets. The data set is too large to run on the target.

Quoted 3 lines

It's true that qemu-user would be nice to have, but unless we can find a
way to guarantee that it works, I'm also against keeping it. When the kernel version is inconsistent, it can really break in hard to debug ways.

The processing that I do is algorithmic so I assume that I'm not running into the kernel version issue. I'm not sure that I understand the versioning issue, though. Should I be concerned?

Also, I'd happily switch to running the regression tests using system-mode, but qemu-user is just really convenient since I run the tests against the same binaries that run on the target. Just out of curiosity, are there any other ways that people run regression tests?

The final point that I'd make is that using qemu-user is the only way that I know of to compile Erlang bytecode to the target's machine code. E.g. I use qemu-user to run the cross-compiled Erlang compiler which then can be used to turn Erlang source code into machine code for the target. Normally interpreted Erlang bytecode works plenty fast, but it would be nice to get a performance boost. I haven't tried submitting a patch for this, since I know that the prerequisite qemu-user patch isn't a favorite. Do any other interpreted languages have this problem and if so, how have they solved it?

Given the opinions here, it sounds like the qemu-user issue is either really hard or impossible to fix. I'd rather not waste anyone's time, but if there were any ideas or someone just needed help finishing them up or testing them, I'd offer some of my time to assist.

Thanks,
Frank

p.s. I have no opinion on including/excluding this patch with the Perl series, so feel free to defer this aspect of the thread to a more convenient time.

Quoted 15 lines

Regards,
Arnout

--

Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

Signature · 4 lines
Frank Hunleth
Troodon Software LLC
Embedded Software Development
http://troodon-software.com/
#25 lore raw

PATCH v4 9/9 qemu: add a Config.in.host

Quoted 35 lines · Frank Hunleth

Hi Arnout and all,

Quoted 21 lines · Arnout Vandecappelle
Quoted 19 lines · Fran?ois Perrad

2014-02-05 Thomas Petazzoni <[email protected]>:

Quoted 18 lines
Quoted 18 lines

Dear Francois Perrad,

Quoted 8 lines · Francois Perrad
Quoted 8 lines

after the removal of cpanminus

---
 package/Config.in.host      |    1 +
 package/qemu/Config.in.host |   10 ++++++++++
 2 files changed, 11 insertions(+)
 create mode 100644 package/qemu/Config.in.host

I'm not sure this should be part of the Perl patch series. At the meeting, I think we all agreed that building the Qemu user-mode emulation for the host is not useful as it cannot work properly. Instead the qemu package should build the system-mode emulation for the host, which is something that Gustavo proposed some time ago.

Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
Quoted 3 lines

So I'd say to leave Qemu on the side for now, and focus on the Perl side of things in this patch series.

Frank Hunleth needs it.
See http://lists.busybox.net/pipermail/buildroot/2013-December/084131.html
& http://patchwork.ozlabs.org/patch/299014/

That's true. I do use it for regression tests that I run against a few really large data sets. The data set is too large to run on the target.

Quoted 7 lines
Quoted 3 lines

It's true that qemu-user would be nice to have, but unless we can find a
way to guarantee that it works, I'm also against keeping it. When the kernel version is inconsistent, it can really break in hard to debug ways.

The processing that I do is algorithmic so I assume that I'm not running into the kernel version issue. I'm not sure that I understand the versioning issue, though. Should I be concerned?

The problem is that qemu handles system calls by passing them to the
host kernel. If the application or library is making a system call that doesn't exist (yet) on the host's kernel, then the application will fail. I believe glibc checks for it at startup, so it will error out immediately, but I don't think uClibc does such a check.

In addition, there may be issues with the way syscall arguments are
passed when the host and target arch are different, but it's possible that qemu handles that.

Quoted 4 lines

Also, I'd happily switch to running the regression tests using system-mode, but qemu-user is just really convenient since I run the tests against the same binaries that run on the target.

You can still use the binaries; only in system mode you need a kernel
and full userspace as well. But it's perfectly possible to boot qemu-system with an initramfs (cpio) rootfs, and point init to /usr/bin/mytests.

Quoted 13 lines

Just out of
curiosity, are there any other ways that people run regression tests?

The final point that I'd make is that using qemu-user is the only way that I know of to compile Erlang bytecode to the target's machine code. E.g. I use qemu-user to run the cross-compiled Erlang compiler which then can be used to turn Erlang source code into machine code for the target. Normally interpreted Erlang bytecode works plenty fast, but it would be nice to get a performance boost. I haven't tried submitting a patch for this, since I know that the prerequisite qemu-user patch isn't a favorite. Do any other interpreted languages have this problem and if so, how have they solved it?

Quoted 4 lines

Given the opinions here, it sounds like the qemu-user issue is either really hard or impossible to fix. I'd rather not waste anyone's time, but if there were any ideas or someone just needed help finishing them up or testing them, I'd offer some of my time to assist.

The problem to be fixed is to detect that the host's kernel is
compatible with the target's kernel headers. You can do that by checking linux/version.h in the cross-compiler with uname -r on the host.

Regards,
Arnout

Quoted 26 lines

Thanks,
Frank

p.s. I have no opinion on including/excluding this patch with the Perl series, so feel free to defer this aspect of the thread to a more convenient time.

Quoted 15 lines

Regards,
Arnout

--

Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F