Cooking with UNIX/Linux
Cooking with UNIX/Linux > Compiling Perl and modules

Compiling Perl and modules

PERL+MODULES COMPILE RECIPE by Frederik Dannemare

1) Configure Perl:

# SOL8SPARC: This will build perl without large files support,
# without perl's malloc, and without perl5005 compatibility:

sh Configure -Dprefix=/usr/local/perl5.6.1 \
        -Uuselargefiles -Uusemymalloc -Ubincompat5005 -des

# Using "-Uusemymalloc -Ubincompat5005" makes it possible to create a shared
# libperl.so !


# LINUX: this will build perl with large files support, without perl's malloc,
# without perl5005 compatibility, and with a shared libperl:

sh Configure -Dprefix=/usr/local/perl5.6.1 \
        -Duselargefiles -Uusemymalloc -Ubincompat5005 \
        -Duseshrplib -Dlibperl=libperl.so.5.6.1 -des


2) Build and install Perl:

make
make test
make install


3) Build and install CPAN:

# Get it from http://www.perl.com/CPAN/modules/by-module/CPAN/
gunzip CPAN-1.59.tar.gz
tar xvf CPAN-1.59.tar
cd CPAN-1.59
perl Makefile.PL
make
make test
make install


4a) Now start CPAN - and let's install a few modules:
/usr/local/perl5.6.1/bin/cpan

cpan> install Bundle::CPAN
cpan> install MD5
cpan> install LWP
cpan> install Bundle::libnet
cpan> install Bundle::Apache
cpan> install Compress::Zlib


4b) Update all installed modules:

   cpan> b              # to get latest modules/bundles lists
   cpan> install CPAN
   cpan> reload cpan
   cpan> quit


4c) List all installed modules:
# Make sure module ExtUtils::Installed is installed.
# Then create and run this script (Sorry, forgot where I found it. The author
# may email me (admin AT sentinel DOT dk) for his credits).

======================================================
#!/usr/local/bin/perl

use ExtUtils::Installed;
my $instmod = ExtUtils::Installed->new();
foreach my $module ($instmod->modules()) {
my $version = $instmod->version($module) || "???";
       print "$module -- $version\n";
}

======================================================


5) Build mod_perl using apxs:

perl Makefile.PL PERL_USELARGEFILES=0 \
USE_APXS=1 WITH_APXS=/usr/local/apache/bin/apxs EVERYTHING=1
make
make install