scancpan: fix detection of native module

When a module is native or depends of a native module, it must be
disabled for static builds via its Config.in

We detect native modules by looking at the filenames listed in the
MANIFEST. If there is a file which looks like it contains code that
much be compiled (e.g. .c, .h and so on...), then we exclude that
module (and its dependencies) from static builds.

That's what we tried to do so far, but failed when there was a
comment on the same line as the filename in the manifest, like so:
    foo-bar.c # Bla bla bla

Fix that by detecting either endof-line (as currently done) or
end-of-string.

For an example of failed build of perl-html-parser, see
http://autobuild.buildroot.net/results/128/128671dfa23d843698a63220c2fac1f44e1d5845/

[Thomas: use better commit log proposed by Yann E. Morin.]

Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
This commit is contained in:
Francois Perrad 2015-09-06 10:32:50 +02:00 committed by Thomas Petazzoni
parent 259fe50be7
commit ceb1214632
5 changed files with 17 additions and 1 deletions

View File

@ -1,8 +1,12 @@
config BR2_PACKAGE_PERL_HTML_PARSER config BR2_PACKAGE_PERL_HTML_PARSER
bool "perl-html-parser" bool "perl-html-parser"
depends on !BR2_STATIC_LIBS
select BR2_PACKAGE_PERL_HTML_TAGSET select BR2_PACKAGE_PERL_HTML_TAGSET
help help
The HTML-Parser distribution is is a collection of modules that parse The HTML-Parser distribution is is a collection of modules that parse
and extract information from HTML documents and extract information from HTML documents
http://github.com/gisle/html-parser http://github.com/gisle/html-parser
comment "perl-html-parser needs a toolchain w/ dynamic library"
depends on BR2_STATIC_LIBS

View File

@ -1,5 +1,6 @@
config BR2_PACKAGE_PERL_LIBWWW_PERL config BR2_PACKAGE_PERL_LIBWWW_PERL
bool "perl-libwww-perl" bool "perl-libwww-perl"
depends on !BR2_STATIC_LIBS
select BR2_PACKAGE_PERL_ENCODE_LOCALE select BR2_PACKAGE_PERL_ENCODE_LOCALE
select BR2_PACKAGE_PERL_FILE_LISTING select BR2_PACKAGE_PERL_FILE_LISTING
select BR2_PACKAGE_PERL_HTML_PARSER select BR2_PACKAGE_PERL_HTML_PARSER
@ -16,3 +17,6 @@ config BR2_PACKAGE_PERL_LIBWWW_PERL
The World-Wide Web library for Perl The World-Wide Web library for Perl
https://metacpan.org/release/libwww-perl https://metacpan.org/release/libwww-perl
comment "perl-libwww-perl needs a toolchain w/ dynamic library"
depends on BR2_STATIC_LIBS

View File

@ -1,7 +1,11 @@
config BR2_PACKAGE_PERL_MIME_BASE64 config BR2_PACKAGE_PERL_MIME_BASE64
bool "perl-mime-base64" bool "perl-mime-base64"
depends on !BR2_STATIC_LIBS
help help
This package contains a base64 encoder/decoder and a quoted-printable This package contains a base64 encoder/decoder and a quoted-printable
encoder/decoder. encoder/decoder.
http://github.com/gisle/mime-base64 http://github.com/gisle/mime-base64
comment "perl-mime-base64 needs a toolchain w/ dynamic library"
depends on BR2_STATIC_LIBS

View File

@ -1,6 +1,10 @@
config BR2_PACKAGE_PERL_TIME_HIRES config BR2_PACKAGE_PERL_TIME_HIRES
bool "perl-time-hires" bool "perl-time-hires"
depends on !BR2_STATIC_LIBS
help help
High resolution alarm, sleep, gettimeofday, interval timers High resolution alarm, sleep, gettimeofday, interval timers
http://search.cpan.org/dist/Time-HiRes/HiRes.pm http://search.cpan.org/dist/Time-HiRes/HiRes.pm
comment "perl-time-hires needs a toolchain w/ dynamic library"
depends on BR2_STATIC_LIBS

View File

@ -534,7 +534,7 @@ sub is_xs {
# This heuristic determines if a module is a native extension, by searching # This heuristic determines if a module is a native extension, by searching
# some file extension types in the MANIFEST of the distribution. # some file extension types in the MANIFEST of the distribution.
# It was inspired by http://deps.cpantesters.org/static/purity.html # It was inspired by http://deps.cpantesters.org/static/purity.html
return $manifest =~ m/\.(swg|xs|c|h|i)\n/; return $manifest =~ m/\.(swg|xs|c|h|i)[\n\s]/;
} }
sub find_license_files { sub find_license_files {