* [Buildroot] [PATCH 1/4 v3] infra/pkg-perl: add possibility to pass extra env at configure time
2014-07-13 13:03 [Buildroot] [PATCH 0/4 v3] perl-infra enhancements (branch yem/autobuild-perl) Yann E. MORIN
@ 2014-07-13 13:03 ` Yann E. MORIN
2014-07-13 13:03 ` [Buildroot] [PATCH 2/4 v3] package/perl-net-ssleay: fix buildsystem for cross-compilation Yann E. MORIN
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Yann E. MORIN @ 2014-07-13 13:03 UTC (permalink / raw)
To: buildroot
From: Francois Perrad <fperrad@gmail.com>
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.
Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Tested-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
[yann.morin.1998 at free.fr: enhance the commit log]
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
docs/manual/adding-packages-perl.txt | 4 ++++
package/pkg-perl.mk | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/docs/manual/adding-packages-perl.txt b/docs/manual/adding-packages-perl.txt
index 4062646..d1a1616 100644
--- a/docs/manual/adding-packages-perl.txt
+++ b/docs/manual/adding-packages-perl.txt
@@ -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.
diff --git a/package/pkg-perl.mk b/package/pkg-perl.mk
index 5cfdc77..8c45001 100644
--- a/package/pkg-perl.mk
+++ b/package/pkg-perl.mk
@@ -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 \
--
1.9.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* [Buildroot] [PATCH 2/4 v3] package/perl-net-ssleay: fix buildsystem for cross-compilation
2014-07-13 13:03 [Buildroot] [PATCH 0/4 v3] perl-infra enhancements (branch yem/autobuild-perl) Yann E. MORIN
2014-07-13 13:03 ` [Buildroot] [PATCH 1/4 v3] infra/pkg-perl: add possibility to pass extra env at configure time Yann E. MORIN
@ 2014-07-13 13:03 ` Yann E. MORIN
2014-07-13 13:03 ` [Buildroot] [PATCH 3/4 v3] package/perl-net-ssleay: not available for static link Yann E. MORIN
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Yann E. MORIN @ 2014-07-13 13:03 UTC (permalink / raw)
To: buildroot
From: Francois Perrad <fperrad@gmail.com>
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/
Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
[me: enhance commit log, add patch to avoid running openssl and setting
wrong include and library search paths]
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
.../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
diff --git a/package/perl-net-ssleay/perl-net-ssleay-0000-fix-build-system.patch b/package/perl-net-ssleay/perl-net-ssleay-0000-fix-build-system.patch
new file mode 100644
index 0000000..a6cd0f9
--- /dev/null
+++ b/package/perl-net-ssleay/perl-net-ssleay-0000-fix-build-system.patch
@@ -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" <yann.morin.1998@free.fr>
+
+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(
diff --git a/package/perl-net-ssleay/perl-net-ssleay.mk b/package/perl-net-ssleay/perl-net-ssleay.mk
index 413fdf0..4a362fb 100644
--- a/package/perl-net-ssleay/perl-net-ssleay.mk
+++ b/package/perl-net-ssleay/perl-net-ssleay.mk
@@ -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))
--
1.9.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* [Buildroot] [PATCH 3/4 v3] package/perl-net-ssleay: not available for static link
2014-07-13 13:03 [Buildroot] [PATCH 0/4 v3] perl-infra enhancements (branch yem/autobuild-perl) Yann E. MORIN
2014-07-13 13:03 ` [Buildroot] [PATCH 1/4 v3] infra/pkg-perl: add possibility to pass extra env at configure time Yann E. MORIN
2014-07-13 13:03 ` [Buildroot] [PATCH 2/4 v3] package/perl-net-ssleay: fix buildsystem for cross-compilation Yann E. MORIN
@ 2014-07-13 13:03 ` Yann E. MORIN
2014-07-13 13:03 ` [Buildroot] [PATCH 4/4 v3] package/perl-xml-libxml: " Yann E. MORIN
2014-07-14 11:11 ` [Buildroot] [PATCH 0/4 v3] perl-infra enhancements (branch yem/autobuild-perl) Thomas Petazzoni
4 siblings, 0 replies; 6+ messages in thread
From: Yann E. MORIN @ 2014-07-13 13:03 UTC (permalink / raw)
To: buildroot
Perl 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.
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Francois Perrad <francois.perrad@gadz.org>
Cc: Gustavo Zacarias <gustavo@zacarias.com.ar>
---
package/perl-net-ssleay/Config.in | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/package/perl-net-ssleay/Config.in b/package/perl-net-ssleay/Config.in
index bc219b0..7cc5157 100644
--- a/package/perl-net-ssleay/Config.in
+++ b/package/perl-net-ssleay/Config.in
@@ -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
--
1.9.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH 4/4 v3] package/perl-xml-libxml: not available for static link
2014-07-13 13:03 [Buildroot] [PATCH 0/4 v3] perl-infra enhancements (branch yem/autobuild-perl) Yann E. MORIN
` (2 preceding siblings ...)
2014-07-13 13:03 ` [Buildroot] [PATCH 3/4 v3] package/perl-net-ssleay: not available for static link Yann E. MORIN
@ 2014-07-13 13:03 ` Yann E. MORIN
2014-07-14 11:11 ` [Buildroot] [PATCH 0/4 v3] perl-infra enhancements (branch yem/autobuild-perl) Thomas Petazzoni
4 siblings, 0 replies; 6+ messages in thread
From: Yann E. MORIN @ 2014-07-13 13:03 UTC (permalink / raw)
To: buildroot
Perl 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.
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Francois Perrad <francois.perrad@gadz.org>
Cc: Gustavo Zacarias <gustavo@zacarias.com.ar>
---
package/perl-xml-libxml/Config.in | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/package/perl-xml-libxml/Config.in b/package/perl-xml-libxml/Config.in
index 9e3a44e..639a1e4 100644
--- a/package/perl-xml-libxml/Config.in
+++ b/package/perl-xml-libxml/Config.in
@@ -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
--
1.9.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* [Buildroot] [PATCH 0/4 v3] perl-infra enhancements (branch yem/autobuild-perl)
2014-07-13 13:03 [Buildroot] [PATCH 0/4 v3] perl-infra enhancements (branch yem/autobuild-perl) Yann E. MORIN
` (3 preceding siblings ...)
2014-07-13 13:03 ` [Buildroot] [PATCH 4/4 v3] package/perl-xml-libxml: " Yann E. MORIN
@ 2014-07-14 11:11 ` Thomas Petazzoni
4 siblings, 0 replies; 6+ messages in thread
From: Thomas Petazzoni @ 2014-07-14 11:11 UTC (permalink / raw)
To: buildroot
Dear Yann E. MORIN,
On Sun, 13 Jul 2014 15:03:20 +0200, Yann E. MORIN wrote:
> 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
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 6+ messages in thread