Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Gentoo Embedded (http://www.linux-archive.org/gentoo-embedded/)
-   -   Stripping down Perl install (http://www.linux-archive.org/gentoo-embedded/502636-stripping-down-perl-install.html)

Ed W 03-18-2011 10:41 AM

Stripping down Perl install
 
Hi, I'm trying to strip perl down as much as possible for a small
embedded server. The end app will just run server type applications
(and possibly a perl based web application for configuration). All
modules needed will be bundled in the build so I have removed CPAN,
debugger, headers, etc

Another design point is that I have decided that I don't need to support
locale's other than the main english, unicode (and unicode european
languages).

OK, so this is my INSTALL_MASK to install perl (ignore the line breaks)

export INSTALL_MASK="${INSTALL_MASK} */usr/lib/perl5/*.h
usr/lib/perl5/5.*/ExtUtils/
usr/lib/perl5/5.*/CPAN/
usr/lib/perl5/5.*/CPANPLUS/
usr/lib/perl5/5.*/*-linux-*/auto/Encode/JP
usr/lib/perl5/5.*/*-linux-*/auto/Encode/KR
usr/lib/perl5/5.*/*-linux-*/auto/Encode/CN
usr/lib/perl5/5.*/*-linux-*/auto/Encode/TW
usr/lib/perl5/5.*/*-linux-*/Devel/
usr/lib/perl5/5.*/*-linux-*/auto/Devel/
usr/lib/perl5/5.*/Module/CoreList.pm
usr/lib/perl5/5.*/Module/Build*
usr/lib/perl5/5.*/perl5db.pl usr/lib
/perl5/5.*/[Pp]od
usr/lib/perl5/5.*/unicore/mktables
usr/lib/perl5/5.*/unicore/TestProp.pl
*/usr/lib/perl5/5.*/unicore/*.txt
*/usr/lib/perl5/*.pod"

Afterwards I then strip a huge bunch of comments out of some perl files:
sed -i -e 's/^#.*//' -e '/^$/d'
${TARGET}/usr/lib/perl5/5.12.2/unicore/lib/*/*.pl


Now that gets me down to some 20-30MB install size, but the squashfs
size of the same is around 4MB (vs around 10-12MB normal).

The main size reduction from here is reducing the unicode file sizes. I
have had a quick hack at this above by eliminating some of the
JP/KR/CN/TW stuff, but there is still some 10s MB that could be removed.
I think the solution is to understand how mktables works and customise
it so that it generates only the required lookup tables? Anyone got any
experience or solutions?

Any other ideas on shrinking the install further? (I'm a bit reluctant
to strip too many core modules at this stage until the final build is
decided - also most only consume a few KBs...)

Thanks

Ed W

Arkadi Shishlov 03-18-2011 12:53 PM

Stripping down Perl install
 
On 03/18/11 13:41, Ed W wrote:
> Any other ideas on shrinking the install further? (I'm a bit reluctant
> to strip too many core modules at this stage until the final build is
> decided - also most only consume a few KBs...)

If the perl workload is fixed, then 'strace -efile' the scripts and package only
necessary files. Worked for me some time ago.

Ed W 03-18-2011 01:43 PM

Stripping down Perl install
 
On 18/03/2011 13:53, Arkadi Shishlov wrote:
> On 03/18/11 13:41, Ed W wrote:
>> Any other ideas on shrinking the install further? (I'm a bit reluctant
>> to strip too many core modules at this stage until the final build is
>> decided - also most only consume a few KBs...)
>
> If the perl workload is fixed, then 'strace -efile' the scripts and package only
> necessary files. Worked for me some time ago.
>

This is certainly true.

In my case I want to allow a little room for future customisation, so it
would be good to keep the packages fairly generic.

Without going into too much unnecessary detail I'm trying to use a
stacked (aufs2) set of squashfs modules to implement my embedded
environment. (Think Slax). So I'm trying to build a base installation
which will support add-on modules that are as yet unwritten...

I'm not all that constrained on storage actually. At the moment I think
in terms of "a few MB saved" being useful rather than "a few hundred
bytes" saved.

I reckon I can keep nearly all the base perl install in just a few MB if
only I can figure out how to cut down the various character translations...

I guess this is best posted to the perl mailing list - anyway, hopefully
interesting to some

Cheers

Ed W


All times are GMT. The time now is 07:01 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.