Last active
December 29, 2015 04:09
-
-
Save beppu/7612982 to your computer and use it in GitHub Desktop.
notes for making a customized perl .deb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# step 1 - compile perl {{{ | |
/root/perl5/perlbrew/perls/perl-5.16.3/bin/perl /root/p/bin/perlbrew install perl-5.18.1 --notest -Dusethreads -Duselargefiles -Dcccdlflags=-fPIC -Dpager=/usr/bin/sensible-pager -Doptimize=-O2 -Duseshrplib -Dcf_by=Dave -Dcf_email=dave@instantchannelinc.com -Duse64bitall -Darchname=x86_64-linux-gnu -Dccflags=-DDEBIAN | |
# }}} | |
# step 2 - install cpan modules with newly compiled perl {{{ | |
PERL5=/root/perl5/perlbrew/perls/perl-5.18.1 | |
BIN_PERL5=$PERL5/bin/perl | |
BIN_CPANM=/root/bin/cpanm | |
PERL5_IC=/root/deb/perl5-ic | |
# change Config_heavy.pl before any `make install`s happen so that the shebang of installed programs points to /opt/perl5/bin | |
perl -i.bak -pe "s,startperl=.*$,startperl='#!/opt/perl5/bin/perl'," $PERL5/lib/5.18.1/x86_64-linux-gnu-thread-multi/Config_heavy.pl | |
# Unfortunately, some modules still install their binaries to the wrong place. | |
$BIN_PERL5 $BIN_CPANM --notest \ | |
App::Ack \ | |
App::cpanminus \ | |
Carp \ | |
Crypt::CBC \ | |
Crypt::Rijndael \ | |
Crypt::TEA \ | |
Data::Dumper \ | |
Data::Random::WordList \ | |
Data::UUID \ | |
Data::Validate::IP \ | |
DateTime \ | |
Email::Date::Format \ | |
Email::Format \ | |
Email::Send \ | |
Email::Sender::Simple \ | |
Email::Sender::Transport::SMTP::Persistent \ | |
Encode \ | |
Exporter \ | |
ExtUtils::MakeMaker \ | |
File::Copy \ | |
File::Spec \ | |
File::Temp \ | |
File::Touch \ | |
Getopt::Long \ | |
Getopt::Std \ | |
HTML::FormatText::WithLinks \ | |
HTTP::Cookies \ | |
HTTP::Lite \ | |
HTTP::Request \ | |
HTTP::Response \ | |
IO::File \ | |
IO::Socket::Telnet \ | |
IPC::Open2 \ | |
JSON \ | |
List::Util \ | |
LWP \ | |
LWP::Protocol::https \ | |
LWP::UserAgent \ | |
Mail::RFC822::Address \ | |
MIME::Base64 \ | |
MIME::Base64::Perl \ | |
MIME::QuotedPrint \ | |
Modern::Perl \ | |
Net::DNS \ | |
Net::Nslookup \ | |
parent \ | |
Pod::Usage \ | |
POSIX \ | |
Schedule::RateLimiter \ | |
String::Random \ | |
Template \ | |
Template::Stash::XS \ | |
Text::Wrap \ | |
Thread::Queue \ | |
threads \ | |
threads::shared \ | |
Thread::Use \ | |
Time::Duration \ | |
Time::HiRes \ | |
XML::Bare \ | |
XML::LibXML \ | |
YAML | |
# Email::Format = doesn't exist | |
# Crypt::TEA = build error | |
# }}} | |
# step 2.5 - recompile perl again with right paths {{{ | |
perl -i.bak -pe 's,/root/perl5/perlbrew/perls/perl-5.18.1,/opt/perl5,g' /root/perl5/perlbrew/build/perl-5.18.1/config.h | |
pushd /root/perl5/perlbrew/build/perl-5.18.1 | |
make && make install | |
popd | |
# }}} | |
# step 3 - copy to debian directory {{{ | |
mkdir -p $PERL5_IC/DEBIAN | |
mkdir -p $PERL5_IC/opt/perl5 | |
cp -a $PERL5/* $PERL5_IC/opt/perl5 | |
cat <<EOF > $PERL5_IC/DEBIAN/control | |
Package: perl5-ic | |
Version: 5.18.1-1 | |
Section: perl | |
Priority: optional | |
Architecture: amd64 | |
Depends: | |
Maintainer: Instant Channel | |
Description: Our binary Perl dist | |
EOF | |
# }}} | |
# step 4 - change paths in Config.pm, Config_heavy.pl, and elsewhere {{{ | |
sed 's,/root/perl5/perlbrew/perls/perl-5.18.1,/opt/perl5,g' < $PERL5/lib/5.18.1/x86_64-linux-gnu-thread-multi/Config.pm > $PERL5_IC/opt/perl5/lib/5.18.1/x86_64-linux-gnu-thread-multi/Config.pm | |
sed 's,/root/perl5/perlbrew/perls/perl-5.18.1,/opt/perl5,g' < $PERL5/lib/5.18.1/x86_64-linux-gnu-thread-multi/Config_heavy.pl > $PERL5_IC/opt/perl5/lib/5.18.1/x86_64-linux-gnu-thread-multi/Config_heavy.pl | |
chrpath -r /opt/perl5/lib/5.18.1/x86_64-linux-gnu-thread-multi/CORE $PERL5_IC/opt/perl5/bin/perl | |
chrpath -r /opt/perl5/lib/5.18.1/x86_64-linux-gnu-thread-multi/CORE $PERL5_IC/opt/perl5/bin/perl5.18.1 | |
# }}} | |
# step 5 - create .deb {{{ | |
dpkg-deb --build $PERL5_IC | |
## How to install and uninstall | |
# dpkg -i perl5-ic.deb | |
# dpkg -r perl5-ic | |
# }}} | |
# vim:fdm=marker |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment