diff mbox

[v8,03/11] perl: add an option for miniperl

Message ID 1348593508-14254-3-git-send-email-francois.perrad@gadz.org
State Superseded
Headers show

Commit Message

Francois Perrad Sept. 25, 2012, 5:18 p.m. UTC
Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
---
 package/perl/Config.in                   |   10 +++
 package/perl/perl-install-miniperl.patch |  129 ++++++++++++++++++++++++++++++
 package/perl/perl.mk                     |    6 +-
 3 files changed, 144 insertions(+), 1 deletion(-)
 create mode 100644 package/perl/perl-install-miniperl.patch

Comments

Thomas Petazzoni Oct. 4, 2012, 8:41 p.m. UTC | #1
François,

On Tue, 25 Sep 2012 19:18:19 +0200, Francois Perrad wrote:

> diff --git a/package/perl/perl-install-miniperl.patch b/package/perl/perl-install-miniperl.patch
> new file mode 100644
> index 0000000..7e6f8e6
> --- /dev/null
> +++ b/package/perl/perl-install-miniperl.patch
> @@ -0,0 +1,129 @@
> +Add an option -miniperl
> +
> +Signed-off-by: Francois Perrad <francois.perrad@gadz.org>

Does this (fairly long) patch has a chance of being merged upstream? If
not, then I'd prefer if we simply didn't support miniperl.

Otherwise, it looks ok.

Thomas
Arnout Vandecappelle Oct. 6, 2012, 12:15 p.m. UTC | #2
On 25/09/12 19:18, Francois Perrad wrote:
> Signed-off-by: Francois Perrad<francois.perrad@gadz.org>

  Looks good, but I don't dare to ack without testing...

  Regards,
  Arnout
Arnout Vandecappelle Oct. 6, 2012, 12:17 p.m. UTC | #3
On 04/10/12 22:41, Thomas Petazzoni wrote:
> François,
>
> On Tue, 25 Sep 2012 19:18:19 +0200, Francois Perrad wrote:
>
>> diff --git a/package/perl/perl-install-miniperl.patch b/package/perl/perl-install-miniperl.patch
>> new file mode 100644
>> index 0000000..7e6f8e6
>> --- /dev/null
>> +++ b/package/perl/perl-install-miniperl.patch
>> @@ -0,0 +1,129 @@
>> +Add an option -miniperl
>> +
>> +Signed-off-by: Francois Perrad<francois.perrad@gadz.org>
>
> Does this (fairly long) patch has a chance of being merged upstream? If
> not, then I'd prefer if we simply didn't support miniperl.

  I don't agree.  There is definitely a need for a non-bloated perl in buildroot.
So if microperl is on its way out, this patch is needed even if upstream doesn't
accept it.

  Regards,
  Arnout
Francois Perrad Oct. 6, 2012, 1:38 p.m. UTC | #4
2012/10/6 Arnout Vandecappelle <arnout@mind.be>:
> On 04/10/12 22:41, Thomas Petazzoni wrote:
>>
>> François,
>>
>> On Tue, 25 Sep 2012 19:18:19 +0200, Francois Perrad wrote:
>>
>>> diff --git a/package/perl/perl-install-miniperl.patch
>>> b/package/perl/perl-install-miniperl.patch
>>> new file mode 100644
>>> index 0000000..7e6f8e6
>>> --- /dev/null
>>> +++ b/package/perl/perl-install-miniperl.patch
>>> @@ -0,0 +1,129 @@
>>> +Add an option -miniperl
>>> +
>>> +Signed-off-by: Francois Perrad<francois.perrad@gadz.org>
>>
>>
>> Does this (fairly long) patch has a chance of being merged upstream? If
>> not, then I'd prefer if we simply didn't support miniperl.
>
>
>  I don't agree.  There is definitely a need for a non-bloated perl in
> buildroot.
> So if microperl is on its way out, this patch is needed even if upstream
> doesn't
> accept it.
>

miniperl is not a non-bloated perl.
a custom install allows a small footprint, see patch 08/11.

>
>  Regards,
>  Arnout
> --
> Arnout Vandecappelle                               arnout at mind be
> Senior Embedded Software Architect                 +32-16-286540
> 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@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
Arnout Vandecappelle Oct. 6, 2012, 2:58 p.m. UTC | #5
On 06/10/12 15:38, François Perrad wrote:
> 2012/10/6 Arnout Vandecappelle<arnout@mind.be>:
>> On 04/10/12 22:41, Thomas Petazzoni wrote:
>>>
>>> François,
>>>
>>> On Tue, 25 Sep 2012 19:18:19 +0200, Francois Perrad wrote:
>>>
>>>> diff --git a/package/perl/perl-install-miniperl.patch
>>>> b/package/perl/perl-install-miniperl.patch
>>>> new file mode 100644
>>>> index 0000000..7e6f8e6
>>>> --- /dev/null
>>>> +++ b/package/perl/perl-install-miniperl.patch
>>>> @@ -0,0 +1,129 @@
>>>> +Add an option -miniperl
>>>> +
>>>> +Signed-off-by: Francois Perrad<francois.perrad@gadz.org>
>>>
>>>
>>> Does this (fairly long) patch has a chance of being merged upstream? If
>>> not, then I'd prefer if we simply didn't support miniperl.
>>
>>
>>   I don't agree.  There is definitely a need for a non-bloated perl in
>> buildroot.
>> So if microperl is on its way out, this patch is needed even if upstream
>> doesn't
>> accept it.
>>
>
> miniperl is not a non-bloated perl.
> a custom install allows a small footprint, see patch 08/11.

  Ah, in that case, I also don't see much point of having miniperl in the
target, is there?

  Regards,
  Arnout
diff mbox

Patch

diff --git a/package/perl/Config.in b/package/perl/Config.in
index 6b7a986..3e11574 100644
--- a/package/perl/Config.in
+++ b/package/perl/Config.in
@@ -7,3 +7,13 @@  config BR2_PACKAGE_PERL
 	  Army Chainsaw".
 
 	  http://www.perl.org/
+
+if BR2_PACKAGE_PERL
+
+config BR2_PACKAGE_PERL_ONLY_MINIPERL
+	bool "only miniperl"
+	help
+	  Install only miniperl (without dynamic module loader)
+	  Usually used to bootstrap a full Perl (@INC contains only .).
+
+endif
diff --git a/package/perl/perl-install-miniperl.patch b/package/perl/perl-install-miniperl.patch
new file mode 100644
index 0000000..7e6f8e6
--- /dev/null
+++ b/package/perl/perl-install-miniperl.patch
@@ -0,0 +1,129 @@ 
+Add an option -miniperl
+
+Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
+
+Index: b/installperl
+===================================================================
+--- a/installperl
++++ b/installperl
+@@ -14,7 +14,7 @@
+ use vars qw($Is_VMS $Is_W32 $Is_OS2 $Is_Cygwin $Is_Darwin $Is_NetWare
+ 	    %opts $packlist);
+ my ($dostrip, $versiononly, $force,
+-    $otherperls, $archname, $nwinstall, $nopods);
++    $otherperls, $archname, $nwinstall, $nopods, $miniperl);
+ 
+ BEGIN {
+     if ($Is_VMS) { eval 'use VMS::Filespec;' }
+@@ -83,6 +83,7 @@
+     $force = 1 if $ARGV[0] eq '-f';
+     $opts{verbose} = 1 if $ARGV[0] eq '-V' || $ARGV [0] eq '-n';
+     $archname = 1 if $ARGV[0] eq '-A';
++    $miniperl = 1 if $ARGV[0] eq '-miniperl';
+     $nwinstall = 1 if $ARGV[0] eq '-netware';
+     $nopods = 1 if $ARGV[0] eq '-p';
+     $opts{destdir} = $1 if $ARGV[0] =~ /^-?-destdir=(.*)$/;
+@@ -102,6 +103,7 @@
+   -A        Also install perl with the architecture's name in the perl binary's
+             name.
+   -p        Don't install the pod files. [This will break use diagnostics;]
++  -miniperl Install only miniperl.
+   -netware  Install correctly on a Netware server.
+   -destdir  Prefix installation directories by this string.
+ EOT
+@@ -114,6 +116,7 @@
+ my (@scripts, @tolink);
+ open SCRIPTS, "utils.lst" or die "Can't open utils.lst: $!";
+ while (<SCRIPTS>) {
++    next if $miniperl;
+     next if /^#/;
+     next if /a2p/; # a2p is binary, to be installed separately
+     chomp;
+@@ -310,7 +313,7 @@
+     link($Config{perlpath}, "$installbin/perl$ver$exe_ext");
+ }
+ elsif ($^O ne 'dos') {
+-    if (!$Is_NetWare) {
++    if (!$Is_NetWare && !$miniperl) {
+ 	safe_unlink("$installbin/$perl_verbase$ver$exe_ext");
+ 	copy("perl$exe_ext", "$installbin/$perl_verbase$ver$exe_ext");
+ 	strip("$installbin/$perl_verbase$ver$exe_ext");
+@@ -384,8 +387,9 @@
+       push(@corefiles, $coredll)
+     )
+ } else {
++    @corefiles = <*.h>;
+     # [als] hard-coded 'libperl' name... not good!
+-    @corefiles = <*.h libperl*.* perl*$Config{lib_ext}>;
++    push @corefiles, <libperl*.* perl*$Config{lib_ext}> unless $miniperl;
+ 
+     # AIX needs perl.exp installed as well.
+     push(@corefiles,'perl.exp') if $^O eq 'aix';
+@@ -411,7 +415,7 @@
+ # Install main perl executables
+ # Make links to ordinary names if installbin directory isn't current directory.
+ 
+-if (! $versiononly && ! samepath($installbin, '.') && ($^O ne 'dos') && ! $Is_VMS && ! $Is_NetWare) {
++if (! $versiononly && ! samepath($installbin, '.') && ($^O ne 'dos') && ! $Is_VMS && ! $Is_NetWare && ! $miniperl) {
+     safe_unlink("$installbin/$perl$exe_ext", "$installbin/suid$perl$exe_ext");
+     if ($^O eq 'mpeix') {
+ 	# MPE doesn't support hard links, so use a symlink.
+@@ -429,7 +433,7 @@
+ 
+ # For development purposes it can be very useful to have multiple perls
+ # build for different "architectures" (eg threading or not) simultaneously.
+-if ($archname && ! samepath($installbin, '.') && ($^O ne 'dos') && ! $Is_VMS) {
++if ($archname && ! samepath($installbin, '.') && ($^O ne 'dos') && ! $Is_VMS && ! $miniperl) {
+     my $archperl = "$perl_verbase$ver-$Config{archname}$exe_ext";
+     safe_unlink("$installbin/$archperl");
+     if ($^O eq 'mpeix') {
+@@ -451,7 +455,7 @@
+ 
+ if ($Config{installusrbinperl} && $Config{installusrbinperl} eq 'define' &&
+     !$versiononly && !$opts{notify} && !$Is_W32 && !$Is_NetWare && !$Is_VMS && -t STDIN && -t STDERR
+-	&& -w $mainperldir && ! samepath($mainperldir, $installbin)) {
++	&& -w $mainperldir && ! samepath($mainperldir, $installbin) && ! $miniperl) {
+     my($usrbinperl)	= "$mainperldir/$perl$exe_ext";
+     my($instperl)	= "$installbin/$perl$exe_ext";
+     my($expinstperl)	= "$binexp/$perl$exe_ext";
+@@ -480,7 +484,7 @@
+ }
+ 
+ # Make links to ordinary names if installbin directory isn't current directory.
+-if (!$Is_NetWare && $dbg eq '') {
++if (!$Is_NetWare && $dbg eq '' && !$miniperl) {
+     if (! samepath($installbin, 'x2p')) {
+ 	my $base = 'a2p';
+ 	$base .= $ver if $versiononly;
+@@ -495,12 +499,18 @@
+ # it can't safely be shared.  Place it in $installbin.
+ # Note that Configure doesn't build cppstin if it isn't needed, so
+ # we skip this if cppstdin doesn't exist.
+-if (! $versiononly && (-f 'cppstdin') && (! samepath($installbin, '.'))) {
++if (! $versiononly && (-f 'cppstdin') && (! samepath($installbin, '.')) && !$miniperl) {
+     safe_unlink("$installbin/cppstdin");
+     copy("cppstdin", "$installbin/cppstdin");
+     chmod(0755, "$installbin/cppstdin");
+ }
+ 
++if ($miniperl && (-f 'miniperl')) {
++    safe_unlink("$installbin/miniperl$exe_ext");
++    copy("miniperl$exe_ext", "$installbin/miniperl$exe_ext");
++    chmod(0755, "$installbin/miniperl$exe_ext");
++}
++
+ sub script_alias {
+     my ($installscript, $orig, $alias, $scr_ext) = @_;
+ 
+@@ -761,6 +771,11 @@
+ 
+     return if $name eq 'ExtUtils/XSSymSet.pm' and !$Is_VMS;
+ 
++    if ($miniperl && $dir =~ /^auto\//) {
++        # Don't copy
++        return;
++    }
++
+     my $installlib = $installprivlib;
+     if ($dir =~ /^auto\// ||
+ 	  ($name =~ /^(.*)\.(?:pm|pod)$/ && $archpms{$1}) ||
diff --git a/package/perl/perl.mk b/package/perl/perl.mk
index 7d60ca7..8f7ba15 100644
--- a/package/perl/perl.mk
+++ b/package/perl/perl.mk
@@ -21,6 +21,10 @@  ifneq ($(BR2_LARGEFILE),y)
     PERL_NO_LARGEFILE=-Uuselargefiles
 endif
 
+ifeq ($(BR2_PACKAGE_PERL_ONLY_MINIPERL),y)
+    PERL_INSTALL_ONLY_MINIPERL = -miniperl
+endif
+
 PERL_ARCH=$(ARCH)
 ifeq ($(PERL_ARCH),i686)
     PERL_ARCH=i386
@@ -87,7 +91,7 @@  endef
 
 define PERL_INSTALL_TARGET_CMDS
 	$(MAKE) INSTALL_DEPENDENCE= \
-		INSTALLFLAGS=-p \
+		INSTALLFLAGS="-p $(PERL_INSTALL_ONLY_MINIPERL)"\
 		DESTDIR="$(TARGET_DIR)" \
 		-C $(@D) install.perl
 endef