perl-infra enhancements (branch yem/autobuild-perl)
v3 cover perl-infra enhancements (branch yem/autobuild-perl)
Hello All!
This series enhances the pkg-erl infrastructure:
- add possibility for packages to pass extra environment variables at configure time
- fix perl-net-ssleay
- hide perl extensions written in C when doing static build
Changes v2 -> v3:
- aggregate Fran?ois' previous patches with mines
Regards,
Yann E. MORIN.
The following changes since commit 30252ae893298bf3f190b57d33c545e0e46c40db:
libgpgme: disable all tests (2014-07-12 20:47:38 +0200)
are available in the git repository at:
git://ymorin.is-a-geek.org/buildroot yem/autobuild-perl
for you to fetch changes up to fbe14dfcaa71d2c2ada7dc463b80d9898191f14c:
package/perl-xml-libxml: not available for static link (2014-07-13 14:56:09 +0200)
----------------------------------------------------------------
Francois Perrad (2):
infra/pkg-perl: add possibility to pass extra env at configure time package/perl-net-ssleay: fix buildsystem for cross-compilation
Yann E. MORIN (2):
package/perl-net-ssleay: not available for static link package/perl-xml-libxml: not available for static link
docs/manual/adding-packages-perl.txt | 4 +++ package/perl-net-ssleay/Config.in | 4 +++ .../perl-net-ssleay-0000-fix-build-system.patch | 36 ++++++++++++++++++++++ package/perl-net-ssleay/perl-net-ssleay.mk | 4 +++ package/perl-xml-libxml/Config.in | 4 +++ package/pkg-perl.mk | 4 +++ 6 files changed, 56 insertions(+) create mode 100644 package/perl-net-ssleay/perl-net-ssleay-0000-fix-build-system.patch
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH v3 1/4 infra/pkg-perl: add possibility to pass extra env at configure time
From: Francois Perrad <[email protected]>
Some perl packages may use environment variables as a hint to how to be configured.
That's for example the case for perl-net-ssleay that uses OPENSSL_PREFIX, if it is set in the environment, as the prefix to openssl.
Add a new variable that packages can set if they need extra environment variables. Update the manual accordingly.
--- docs/manual/adding-packages-perl.txt | 4 ++++ package/pkg-perl.mk | 4 ++++ 2 files changed, 8 insertions(+)
docs/manual/adding-packages-perl.txt +4 -0
@@ -100,6 +100,10 @@ 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_ENV+/+HOST_PERL_FOO_CONF_ENV+, to specify additional + environment variables to pass to the +perl Makefile.PL+ or +perl Build.PL+. + By default, empty. + * +PERL_FOO_CONF_OPT+/+HOST_PERL_FOO_CONF_OPT+, to specify additional configure options to pass to the +perl Makefile.PL+ or +perl Build.PL+. By default, empty.
package/pkg-perl.mk +4 -0
@@ -49,6 +49,7 @@ ifeq ($(4),target) # Configure package for target define $(2)_CONFIGURE_CMDS cd $$($$(PKG)_SRCDIR) && if [ -f Build.PL ] ; then \ + $$($(2)_CONF_ENV) \ PERL_MM_USE_DEFAULT=1 \ perl Build.PL \ --config ar="$$(TARGET_AR)" \
@@ -69,6 +70,7 @@ define $(2)_CONFIGURE_CMDS --install_path libdoc=/usr/share/man/man3 \ $$($(2)_CONF_OPT); \ else \ + $$($(2)_CONF_ENV) \ PERL_MM_USE_DEFAULT=1 \ PERL_AUTOINSTALL=--skipdeps \ perl Makefile.PL \
@@ -95,12 +97,14 @@ else # Configure package for host define $(2)_CONFIGURE_CMDS cd $$($$(PKG)_SRCDIR) && if [ -f Build.PL ] ; then \ + $$($(2)_CONF_ENV) \ PERL_MM_USE_DEFAULT=1 \ perl Build.PL \ --install_base $$(HOST_DIR)/usr \ --installdirs vendor \ $$($(2)_CONF_OPT); \ else \ + $$($(2)_CONF_ENV) \ PERL_MM_USE_DEFAULT=1 \ PERL_AUTOINSTALL=--skipdeps \ perl Makefile.PL \
Signature · 1 line
1.9.1
PATCH v3 2/4 package/perl-net-ssleay: fix buildsystem for cross-compilation
In reply to Yann E. MORINFrom: Francois Perrad <[email protected]>
The buildsystem for perl-net-ssleay is totally brain-damaged: it tries to execute the openssl program. It uses that to check the openssl version, detect the prefix to openssl, and set the include and library search paths.
Of course, it does not handle the destdir idiom, so it ends up finding the host system's openssl (not even ours!), so it sets search paths to /usr/inlcude and /usr/lib and /lib.
Well, guess what? It does not work.
Fix that by:
- passing the prefix to openssl in the environment, so it does not go
hunting for the host-system openssl;
- not checking the version string, since we can't run, and Buildroot
has the correct version anyway;- not setting any -I or -L paths since our compiler/linker already know where to look for for includes and libs.
Fixes:
http://autobuild.buildroot.net/results/135/135867ef85535863e3647cc5fb82accb6f77612c/
[me: enhance commit log, add patch to avoid running openssl and setting
wrong include and library search paths]
--- .../perl-net-ssleay-0000-fix-build-system.patch | 36 ++++++++++++++++++++++ package/perl-net-ssleay/perl-net-ssleay.mk | 4 +++ 2 files changed, 40 insertions(+) create mode 100644 package/perl-net-ssleay/perl-net-ssleay-0000-fix-build-system.patch
package/perl-net-ssleay/perl-net-ssleay-0000-fix-build-system.patch new file +36 -0
@@ -0,0 +1,36 @@ +buildsystem: fix for cross-compilation + +Avoid running the openssl binary, since it would break for +cross-compilation. Buildroot has a supported version, anyway. + +Also, avoid adding hard-coded includes and libraries search +paths, since they are missing the destdir; Buildroot compilers +and linkers already know where to search, anyway. + +Signed-off-by: "Yann E. MORIN" <[email protected]> + +diff -durN perl-net-ssleay-1.64.orig/inc/Module/Install/PRIVATE/Net/SSLeay.pm perl-net-ssleay-1.64/inc/Module/Install/PRIVATE/Net/SSLeay.pm +--- perl-net-ssleay-1.64.orig/inc/Module/Install/PRIVATE/Net/SSLeay.pm 2014-04-01 08:08:37.000000000 +0200 ++++ perl-net-ssleay-1.64/inc/Module/Install/PRIVATE/Net/SSLeay.pm 2014-07-13 00:38:46.281380282 +0200 +@@ -37,14 +37,18 @@ + exit 0; # according http://wiki.cpantesters.org/wiki/CPANAuthorNotes this is best-practice when "missing library" + } + +- $self->check_openssl_version($prefix, $exec); ++# Does not work for cross-compilation. ++# In Buildroot, we do have a supported version. ++# $self->check_openssl_version($prefix, $exec); + my $opts = $self->ssleay_get_build_opts($prefix, $exec); + + $self->makemaker_args( + CCCDLFLAGS => $opts->{cccdlflags}, + OPTIMIZE => $opts->{optimize}, +- INC => join(' ', map {"-I$_"} @{$opts->{inc_paths}}), +- LIBS => join(' ', (map {"-L$_"} @{$opts->{lib_paths}}), (map {"-l$_"} @{$opts->{lib_links}})), ++# Buildroot already has the correct include and library search paths. ++# INC => join(' ', map {"-I$_"} @{$opts->{inc_paths}}), ++# LIBS => join(' ', (map {"-L$_"} @{$opts->{lib_paths}}), (map {"-l$_"} @{$opts->{lib_links}})), ++ LIBS => join(' ', (map {"-l$_"} @{$opts->{lib_links}})), + ); + + if ( $self->prompt(
package/perl-net-ssleay/perl-net-ssleay.mk +4 -0
@@ -11,4 +11,8 @@ PERL_NET_SSLEAY_DEPENDENCIES = perl openssl PERL_NET_SSLEAY_LICENSE = OpenSSL PERL_NET_SSLEAY_LICENSE_FILES = LICENSE +# Try as hard as possible to remedy to the brain-damage their build-system +# suffers from: don't search for openssl, they pick the host-system one. +PERL_NET_SSLEAY_CONF_ENV = OPENSSL_PREFIX=$(STAGING_DIR)/usr + $(eval $(perl-package))
Signature · 1 line
1.9.1
PATCH v3 3/4 package/perl-net-ssleay: not available for static link
In reply to Yann E. MORINPerl extensions are loaded at runtime with dlopen(), so it does not make sense to even build extensions that are written in C.
perl-net-ssleay is (partly) written in C, so it is not available when doing a static build.
--- package/perl-net-ssleay/Config.in | 4 ++++ 1 file changed, 4 insertions(+)
package/perl-net-ssleay/Config.in +4 -0
@@ -1,7 +1,11 @@ config BR2_PACKAGE_PERL_NET_SSLEAY bool "perl-net-ssleay" + depends on !BR2_PREFER_STATIC_LIB select BR2_PACKAGE_OPENSSL help Perl extension for using OpenSSL https://metacpan.org/release/Net-SSLeay + +comment "perl-net-ssleay needs a toolchain w/ dynamic library" + depends on BR2_PREFER_STATIC_LIB
Signature · 1 line
1.9.1
PATCH v3 4/4 package/perl-xml-libxml: not available for static link
In reply to Yann E. MORINPerl extensions are loaded at runtime with dlopen(), so it does not make sense to even build extensions that are written in C.
perl-xml-libxml is written in C, so it is not available when doing a static build.
--- package/perl-xml-libxml/Config.in | 4 ++++ 1 file changed, 4 insertions(+)
package/perl-xml-libxml/Config.in +4 -0
@@ -1,5 +1,6 @@ config BR2_PACKAGE_PERL_XML_LIBXML bool "perl-xml-libxml" + depends on !BR2_PREFER_STATIC_LIB select BR2_PACKAGE_LIBXML2 select BR2_PACKAGE_ZLIB select BR2_PACKAGE_PERL_XML_NAMESPACESUPPORT
@@ -8,3 +9,6 @@ config BR2_PACKAGE_PERL_XML_LIBXML Interface to Gnome libxml2 xml parsing and DOM library https://bitbucket.org/shlomif/perl-xml-libxml + +comment "perl-xml-libxml needs a toolchain w/ dynamic library" + depends on BR2_PREFER_STATIC_LIB
Signature · 1 line
1.9.1
v3 cover perl-infra enhancements (branch yem/autobuild-perl)
In reply to Yann E. MORINDear Yann E. MORIN,
Quoted 5 lines · Yann E. MORIN
This series enhances the pkg-erl infrastructure:
- add possibility for packages to pass extra environment variables at configure time
- fix perl-net-ssleay
- hide perl extensions written in C when doing static build
Thanks, series applied. Indeed, the thing that was preventing Fran?ois patches from being applied is the fact that the commit logs were way too terse, despite me asking for better commit logs.
Thanks,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com