Compiling Perl 5.22.0

#See https://adrhc.go.ro/wordpress/common-commands-when-building/ for building environment, x.sh script and other things not defined here.
#Before starting do declare the environment variables specified to the link above.

#search http://search.cpan.org/ for modules
#see http://www.thegeekstuff.com/2008/09/how-to-install-perl-modules-manually-and-using-cpan-command/
#Installing Perl modules from CPAN (didn't work): http://perl.about.com/od/packagesmodules/qt/perlcpan.htm

#environment
export CFLAGS="-march=armv5te -mfloat-abi=soft -mabi=aapcs-linux -fno-stack-protector -pthread -O2 -Wall -Wno-error"
export BUILD_FLAGS="$CFLAGS -I/ffp/include"
#export LIBS="-lintl"
#export LDFLAGS="-L/ffp/lib $LIBS"
unset LIBS
export LDFLAGS="-L/ffp/lib"
export CPPFLAGS="$BUILD_FLAGS"
export CXXFLAGS="$BUILD_FLAGS"

NEW_BUILD_NAME=perl
NEW_BUILD_VER=5.22.0
NEW_BUILD_NAME_AND_VER=$NEW_BUILD_NAME-$NEW_BUILD_VER
ls -l /tmp/$NEW_BUILD_NAME-*
ls -l ~/ffp_0.7_armv5/packages/$NEW_BUILD_NAME-*
NEW_BUILD_NR=0

#building perl
cd ~/compile
wget http://www.cpan.org/src/5.0/perl-5.22.0.tar.gz
tar xvzf perl-5.22.0.tar.gz
cd ~/compile/$NEW_BUILD_NAME_AND_VER
nohup ~/x.sh ffpg &

#build configuration
./Configure -Dprefix=/ffp -Dusethreads -Duseshrplib
Build a threading Perl? [n] y
What libraries to use? [-lpthread -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc -lgdbm_compat]
What optimizer/debugger flag should be used? [-O2] -O2 -march=armv5te
Any additional cc flags? -D_REENTRANT -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe $BUILD_FLAGS
Shall I use /ffp/bin/nm to extract C symbols from the libraries? [y] n
List of earlier versions to include in @INC? [5.20.1 5.14.2] none
Do you want to install perl as /ffp/bin/perl? [n] y
Do you wish to use dynamic loading? [y]
Any special flags to pass to cc to create a dynamically loaded library? -shared $BUILD_FLAGS -L/ffp/lib
Your host name appears to be "nsa310". Right? [y] n
Please type the (one word) name of your host: adrhc
What is your domain name? [.localdomain] .go.ro
What is your e-mail address? [root@adrhc.go.ro] ***************
What shall I put after the #! to start up perl ("none" to not use #!)? [/ffp/bin/perl5.22.0] /ffp/bin/perl
Shall I ignore gethostname() from now on? [n] y
Run make depend now? [y] n

#Manually modify config.sh:
cccdlflags='-fPIC'
ccdlflags='-Wl,-E -Wl,-rpath,/ffp/lib/perl5/5.22.0/armv5tel-linux-thread-multi/CORE'
ccflags='-D_REENTRANT -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -march=armv5te -mfloat-abi=soft -mabi=aapcs-linux -fno-stack-protector -pthread -O2 -Wall -Wno-error -I/ffp/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2'
ccflags_uselargefiles='-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
usrinc='/ffp/include'
glibpth='/ffp/lib /ffp/lib/386 /usr/shlib /lib /lib/386 /usr/ccs/lib /usr/ucblib /ffp/lib '

#run after config.sh is manually modified:
sh Configure -S

#ERROR
    "can't get tcp protocol by name" for perl dist/Net-Ping/t/ tests
#SOLUTION
    #see http://forum.nas-central.org/viewtopic.php?f=249&t=16561&hilit=iana
    #see http://www.iana.org/assignments/port-numbers
    #see http://sethwklein.net/iana-etc
    #you must have already installed one of these (they are the same considering the functionality gain): 
    https://adrhc.go.ro/ffp_0.7_armv5/packages/iana-etc-2.30-arm-0.txz -> this one has more comments (compared with stripped version)
    https://adrhc.go.ro/ffp_0.7_armv5/packages/iana-etc-2.30-arm-0-stripped.txz
    http://www.inreto.de/ffp/0.7/arm/packages/iana-etc-2.30-arm-1.txz
    #then add to fun_plug.local the commands below
    cp /ffp/etc/protocols /etc/protocols
    cp /ffp/etc/services /etc/services

#ERROR
    POSIX.xs:992:18: error: 'FE_TOWARDZERO' undeclared (first use in this function)
       case 0: return FE_TOWARDZERO;
#SOLUTION
    Comment three rows in ext/POSIX/POSIX.xs:
    /*#ifdef I_FENV
    #include 
    #endif*/

#make
make depend
nohup make -C . &
tail -f nohup.out
nohup /ffp/bin/make test -C . &
tail -f nohup.out

#install
rm /tmp/$NEW_BUILD_NAME-$NEW_BUILD_VER-arm-$NEW_BUILD_NR.txz
rm -r $HOME/temp/$NEW_BUILD_NAME_AND_VER
make install DESTDIR=$HOME/temp/$NEW_BUILD_NAME_AND_VER
cd $HOME/temp/$NEW_BUILD_NAME_AND_VER
makepkg $NEW_BUILD_NAME $NEW_BUILD_VER $NEW_BUILD_NR
cp -v /tmp/$NEW_BUILD_NAME-$NEW_BUILD_VER-arm-$NEW_BUILD_NR.txz ~/ffp_0.7_armv5/packages/
funpkg -q $NEW_BUILD_NAME
funpkg -i ~/ffp_0.7_armv5/packages/$NEW_BUILD_NAME-$NEW_BUILD_VER-arm-$NEW_BUILD_NR.txz

#Install CPAN minus module
wget http://search.cpan.org/CPAN/authors/id/M/MI/MIYAGAWA/App-cpanminus-1.7036.tar.gz
tar xvzf App-cpanminus-1.7036.tar.gz
ffpg-all
perl Makefile.PL
make
make test
make install

#In order to work CPAN minus requires:
#ln -s /ffp/etc/protocols /etc/protocols
#CPAN minus might require Mozilla's CA Bundle certificate (search /ffp/bin/cpanm for cert.pem after installation).
#download the Mozilla's CA Bundle certificate:
#wget -nv http://curl.haxx.se/ca/cacert.pem -O /ffp/etc/ssl/cert.pem

#Install cpan-outdated module (recommended way):
cpan install App::cpanoutdated
#or build yourself:
cd ~/compile
wget http://search.cpan.org/CPAN/authors/id/T/TO/TOKUHIROM/App-cpanoutdated-0.24.tar.gz
tar xvzf App-cpanoutdated-0.24.tar.gz
cd ~/compile/App-cpanoutdated-0.24
~/x.sh ffpg
perl Makefile.PL
#installing cpanoutdated required modules
cpanm CPAN::DistnameInfo
cpanm LWP
cpanm Module::Metadata
cpanm local::lib
... and others if asked ...
make
make test
make install
#In order to learn about outdated modules run:
cpan-outdated

#Install cpanlistchanges with CPAN (recommended way):
cpan install App::cpanlistchanges
#or with CPAN minus:
cpanm App::cpanlistchanges
#If you want to see what is changed (Change-log) for CPAN module than run:
cpan-listchanges CPAN

#Building & installing Module-Build module (installed anyway when running "cpan install App::cpanoutdated").
cd ~/compile
wget http://www.cpan.org/authors/id/L/LE/LEONT/Module-Build-0.4210.tar.gz
tar xvzf Module-Build-0.4210.tar.gz
cd Module-Build-0.4210
~/x.sh ffpg
perl Build.PL
./Build
./Build test
./Build install

#Building & installing gettext module.
#needs:
export LIBS="-lintl"
export LDFLAGS="-L/ffp/lib $LIBS"
cd ~/compile/
wget http://search.cpan.org/CPAN/authors/id/P/PV/PVANDRY/gettext-1.05.tar.gz
tar xvzf gettext-1.05.tar.gz
cd gettext-1.05
~/x.sh ffpg
perl Makefile.PL
make
make test
make install

#When building help2man and perl has the module Locale::gettext I get the error:
#sh: error while loading shared libraries: libintl.so.8: cannot open shared object file: No such file or directory
#solved by (adding /ffp/lib to the end):
#export LD_LIBRARY_PATH=/usr/local/zy-pkgs/lib:/ffp/opt/serf-1.3.6/lib:/ffp/lib
#and also the error:
#help2man: can't get `--help' info from ./help2man
#Try `--no-discard-stderr' if option outputs to stderr
#solved by removing Locale::gettext perl module:
perl ~/tools/uninstall_perl_module.pl Locale::gettext -> only shows what files should be removed
#then remove by hand the Locale::gettext specific files

#Listing PERL modules
#original article http://www.linuxquestions.org/questions/linux-general-1/how-to-list-all-installed-perl-modules-216603/
instmodsh   -> also have capabilities to show module's files
#or
perl -MFile::Find=find -MFile::Spec::Functions -Tlwe 'find { wanted => sub { print canonpath $_ if /\.pm\z/ }, no_chdir => 1 }, @INC'
#or
#Perl Module Tools (https://metacpan.org/release/pmtools)
pmall - get all installed modules pmdesc descriptions
pminst - find what's installed
#or
cpan -l

#using cpanm to install App::cpanlistchanges module
cpanm App::cpanlistchanges
#using cpanm to reinstall XML::Simple module
cpanm --reinstall XML::Simple
#Shows the primary maintainers for XML::Simple module
cpan -A XML::Simple
#Show the XML::Simple module details
cpan -D XML::Simple

#upgrade a module using CPAN
#enter CPAN shell using:
cpan
#press h then ENTER for CPAN shell help
#report updates for DB_File module:
r DB_File
#report updates for CGI::Fast module:
r CGI::Fast
#upgrade CGI::Fast module:
upgrade CGI::Fast

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.