You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
707 lines
22 KiB
707 lines
22 KiB
#!@l_prefix@/bin/perl -w |
|
## |
|
## perl-openpkg -- OpenPKG Perl Module Build Utility |
|
## Copyright (c) 2000-2004 The OpenPKG Project <http://www.openpkg.org/> |
|
## Copyright (c) 2000-2004 Ralf S. Engelschall <rse@engelschall.com> |
|
## Copyright (c) 2000-2004 Cable & Wireless <http://www.cw.com/> |
|
## |
|
## Permission to use, copy, modify, and distribute this software for |
|
## any purpose with or without fee is hereby granted, provided that |
|
## the above copyright notice and this permission notice appear in all |
|
## copies. |
|
## |
|
## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED |
|
## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
|
## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
|
## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR |
|
## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
|
## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
|
## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
|
## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
|
## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
|
## SUCH DAMAGE. |
|
## |
|
|
|
require 5; |
|
use strict; |
|
use Getopt::Long; |
|
use IO qw(Handle Seekable File Pipe Socket Dir); |
|
|
|
# program information |
|
my $ME = { |
|
prog_path => $0, |
|
prog_name => "perl-openpkg", |
|
prog_vers => "2.0.0", |
|
prog_date => "26-Jan-2004" |
|
}; |
|
|
|
# program configuration |
|
my $CF = { |
|
path_prefix => '@l_prefix@', |
|
path_libdir => "", |
|
path_tmpdir => ($ENV{"TMPDIR"} || "/tmp"), |
|
path_wrkdir => "", |
|
path_buildroot => ($ENV{"RPM_BUILD_ROOT"} || ""), |
|
path_buildwork => ($ENV{"RPM_BUILD_DIR"} || ""), |
|
pkg_name => ($ENV{"RPM_PACKAGE_NAME"} || ""), |
|
perl_schema => "vendor", |
|
perl_args => [], |
|
perl_stdin => "/dev/null", |
|
rpm_files => "-", |
|
prog_rpm => '%path_prefix%/bin/rpm', |
|
prog_perl => '%path_prefix%/bin/perl', |
|
mode_quiet => 0, |
|
mode_verbose => 0, |
|
run_version => 0, |
|
run_help => 0, |
|
}; |
|
|
|
# cleanup support |
|
my @cleanup = (); |
|
sub cleanup_remember { |
|
my ($cmd) = @_; |
|
push(@cleanup, $cmd); |
|
} |
|
sub cleanup_perform { |
|
foreach my $cmd (reverse @cleanup) { |
|
&runcmd($cmd); |
|
} |
|
} |
|
|
|
# exception handling support |
|
$SIG{__DIE__} = sub { |
|
my ($err) = @_; |
|
$err =~ s|\s+at\s+.*||s if (not $CF->{mode_verbose}); |
|
print STDERR "$ME->{prog_name}:ERROR: $err ". ($! ? "($!)" : "") . "\n"; |
|
&cleanup_perform() if (not $CF->{mode_verbose}); |
|
exit(1); |
|
}; |
|
|
|
# verbose message printing |
|
sub verbose { |
|
my ($msg) = @_; |
|
print STDERR "++ $msg\n" if (not $CF->{mode_quiet}); |
|
} |
|
|
|
# expand into a full filesystem path |
|
sub fullpath { |
|
my ($prog) = @_; |
|
my $fullprog = ''; |
|
foreach my $path (split(/:/, $ENV{PATH})) { |
|
if (-x "$path/$prog") { |
|
$fullprog = "$path/$prog"; |
|
last; |
|
} |
|
} |
|
return $fullprog; |
|
} |
|
|
|
# execution of external commands |
|
sub runcmd { |
|
my ($cmd) = @_; |
|
print STDERR "\$ $cmd\n" if ($CF->{mode_verbose}); |
|
$cmd = "($cmd) >/dev/null 2>&1" if ($CF->{mode_quiet}); |
|
return (system($cmd) == 0); |
|
} |
|
|
|
# create a directory (plus its missing parent dirs) |
|
sub mkdirp { |
|
my ($dir) = @_; |
|
my $pdir = $dir; |
|
$pdir =~ s|/[^/]*$||s; |
|
if (not -d $pdir) { |
|
&mkdirp($pdir, 0755); |
|
} |
|
if (not -d $dir) { |
|
&runcmd("umask 022 && mkdir $dir"); |
|
} |
|
} |
|
|
|
# command line parsing |
|
Getopt::Long::Configure("bundling"); |
|
my $result = GetOptions( |
|
'p|prefix=s' => \$CF->{path_prefix}, |
|
'l|libdir=s' => \$CF->{path_libdir}, |
|
't|tmpdir=s' => \$CF->{path_tmpdir}, |
|
'd|wrkdir=s' => \$CF->{path_wrkdir}, |
|
'r|buildroot=s' => \$CF->{path_buildroot}, |
|
'w|buildwork=s' => \$CF->{path_buildwork}, |
|
'R|rpm=s' => \$CF->{prog_rpm}, |
|
'P|perl=s' => \$CF->{prog_perl}, |
|
's|schema=s' => \$CF->{perl_schema}, |
|
'A|args=s' => \@{$CF->{perl_args}}, |
|
'I|stdin=s' => \$CF->{perl_stdin}, |
|
'F|files=s' => \$CF->{rpm_files}, |
|
'n|pkgname=s' => \$CF->{pkg_name}, |
|
'q|quiet' => \$CF->{mode_quiet}, |
|
'v|verbose' => \$CF->{mode_verbose}, |
|
'V|version' => \$CF->{run_version}, |
|
'h|help' => \$CF->{run_help} |
|
) || die "option parsing failed"; |
|
if ($CF->{run_help}) { |
|
print "Usage: $ME->{prog_name} [options]\n" . |
|
"Available options:\n" . |
|
"\n" . |
|
" -p, --prefix <dir-path> filesystem path to OpenPKG instance\n" . |
|
" -l, --libdir <dir-path> filesystem path to Perl lib directory\n" . |
|
" -t, --tmpdir <dir-path> filesystem path to temporary directory\n" . |
|
" -d, --wrkdir <dir-path> filesystem path to working directory\n" . |
|
" -r, --buildroot <dir-path> filesystem path to RPM build root directory\n" . |
|
" -w, --buildwork <dir-path> filesystem path to RPM build work directory\n" . |
|
" -R, --rpm <file-path> filesystem path to RPM program\n" . |
|
" -P, --perl <file-path> filesystem path to Perl program\n" . |
|
"\n" . |
|
" -s, --schema <schema> Perl INSTALLDIRS schema\n" . |
|
" -A, --args <arguments> Perl Makefile.PL passed through arguments\n" . |
|
" -I, --stdin <file-path> filesystem path to connect to stdin\n" . |
|
" -F, --files <file-path> filesystem path to write RPM \%files list to\n" . |
|
" -n, --pkgname <package-name> name of involved RPM package\n" . |
|
"\n" . |
|
" -q, --quiet operate in quiet run-time mode\n" . |
|
" -v, --verbose operate in verbose run-time mode\n" . |
|
"\n" . |
|
" -V, --version print out program version\n" . |
|
" -h, --help print out program usage help\n"; |
|
exit(0); |
|
} |
|
if ($CF->{run_version}) { |
|
print "OpenPKG $ME->{prog_name} $ME->{prog_vers} ($ME->{prog_date})\n"; |
|
exit(0); |
|
} |
|
|
|
# fix configuration parameters |
|
foreach my $cf (keys(%{$CF})) { |
|
$CF->{$cf} =~ s|\%([A-Za-z_][A-Za-z0-9_]*)\%|$CF->{$1}|sge; |
|
} |
|
|
|
# determine operation steps |
|
my @steps_exist = qw(prolog prepare configure build install fixate cleanup epilog); |
|
my @steps_run = (); |
|
if (@ARGV > 0) { |
|
foreach my $step (@ARGV) { |
|
if (not grep { $_ eq $step } @steps_exist) { |
|
die "operation step \"$step\" not existing"; |
|
} |
|
push(@steps_run, $step); |
|
} |
|
my $steps_exist = "-".join("-", @steps_exist)."-"; |
|
my $steps_run = "-".join("-", @steps_run)."-"; |
|
if ($steps_exist !~ m|^.*${steps_run}.*$|s) { |
|
die "invalid operation step order \"".join(" ", @ARGV)."\""; |
|
} |
|
} |
|
else { |
|
@steps_run = @steps_exist; |
|
} |
|
|
|
# friendly header ;-) |
|
&verbose("OpenPKG $ME->{prog_name} $ME->{prog_vers} ($ME->{prog_date})"); |
|
|
|
# determine RPM program |
|
if (not -x $CF->{prog_rpm}) { |
|
$CF->{prog_rpm} = &fullpath($CF->{prog_rpm}); |
|
} |
|
my $V = `$CF->{prog_rpm} --version 2>/dev/null`; |
|
$V =~ s/^(RPM version|OpenPKG RPM)\s+([0-9.]+)\s*$/$2/s || |
|
die "program '$CF->{prog_rpm}' seems to be not RPM"; |
|
&verbose("determined RPM program: $CF->{prog_rpm} ($V)"); |
|
|
|
# determine Perl program |
|
if (not -x $CF->{prog_perl}) { |
|
$CF->{prog_perl} = &fullpath($CF->{prog_perl}); |
|
} |
|
$V = `$CF->{prog_perl} --version 2>/dev/null`; |
|
$V =~ s|^.*This is perl, v?([\d+.]+) .*$|$1|s || |
|
die "program '$CF->{prog_perl}' seems to be not Perl"; |
|
&verbose("determined Perl program: $CF->{prog_perl} ($V)"); |
|
|
|
# check for existing paths |
|
if ($CF->{path_buildroot} eq '') { |
|
die "RPM build root directory not known (specify one with option --buildroot)"; |
|
} |
|
if ($CF->{path_buildwork} eq '') { |
|
die "RPM build work directory not known (specify one with option --buildwork)"; |
|
} |
|
mkdir($CF->{path_buildroot}, 0700); |
|
mkdir($CF->{path_buildwork}, 0700); |
|
|
|
## |
|
## OPERATION SEQUENCE |
|
## |
|
|
|
# establish standard environment |
|
umask(022); |
|
|
|
# determine name of temporary directory |
|
my $tmpdir = $CF->{path_tmpdir}; |
|
$tmpdir =~ s|/+$||s; |
|
my $user = (getlogin() || getpwuid($<) || $ENV{LOGNAME} || $ENV{USERNAME} || "unknown"); |
|
my $program = $ME->{prog_name}; |
|
my $package = ($CF->{pkg_name} || "unknown"); |
|
$tmpdir .= "/$user-$program-$package"; |
|
|
|
# determine name of perl wrapper script |
|
my $perlwrap = "$tmpdir/perl.sh"; |
|
|
|
# optionally change working directory |
|
my $dir = $CF->{path_wrkdir}; |
|
if ($dir ne '') { |
|
if (not -d $dir) { |
|
# be smart and guess correct directory to |
|
# reduce special cases during packaging |
|
$dir =~ s|^.+/||s; |
|
my $parent = ""; |
|
my $child = $dir; |
|
$child =~ s|^(.+/)([^/]+)$|$parent = $1, $2|se; |
|
LOOP: while ($child ne '') { |
|
foreach my $dir (glob("${parent}${child}*")) { |
|
if (-d "$parent$dir") { |
|
$child = $dir; |
|
last LOOP; |
|
} |
|
} |
|
$child =~ s|\W\w+$||s || last; |
|
last if (-d "$parent$child"); |
|
} |
|
$dir = "$parent$child"; |
|
} |
|
chdir($dir) || die "cannot change to working directory \"$dir\""; |
|
} |
|
|
|
# determine Perl configuration |
|
my $pcfg = {}; |
|
my $cmd = "$CF->{prog_perl}" . |
|
" -V:installarchlib -V:installprivlib" . |
|
" -V:installsitearch -V:installsitelib -V:sitelib_stem" . |
|
" -V:installvendorarch -V:installvendorlib -V:vendorlib_stem"; |
|
my $out = `$cmd 2>/dev/null || true`; |
|
$out =~ s|^(\S+)='([^'']*)';$|$pcfg->{$1} = $2, ''|mge; |
|
|
|
# ==== COMPAT prolog/epilog ==== |
|
if (grep { $_ eq "prolog" or $_ eq "epilog" } @steps_run) { |
|
print "This is the perl-openpkg >= 20040126 version.\n" . |
|
"It was redesigned and is incompatible to previous\n" . |
|
"versions. It does not support prolog/epilog steps.\n" . |
|
"Please upgrade the package that uses perl-openpkg\n" . |
|
"or, as a temporary workaround, downgrade perl-openpkg\n"; |
|
die "package/perl-openpkg incompatiblity"; |
|
} |
|
|
|
# ==== STEP: 1. prepare ==== |
|
if (grep { $_ eq "prepare" } @steps_run) { |
|
&verbose("step 1: prepare"); |
|
|
|
# establish temporary directory |
|
system("rm -rf $tmpdir >/dev/null 2>&1"); |
|
mkdir($tmpdir, 0700) || die "cannot create temporary directory '$tmpdir'"; |
|
|
|
# create Perl executable wrapper script |
|
my $io = new IO::File ">$perlwrap" |
|
|| die "unable to open \"$perlwrap\" for writing"; |
|
print $io |
|
"#!/bin/sh\n" . |
|
"exec $CF->{prog_perl} \\\n" . |
|
" -I$CF->{path_buildroot}$pcfg->{installarchlib} \\\n" . |
|
" -I$CF->{path_buildroot}$pcfg->{installprivlib} \\\n" . |
|
" -I$CF->{path_buildroot}$pcfg->{installsitearch} \\\n" . |
|
" -I$CF->{path_buildroot}$pcfg->{installsitelib} \\\n" . |
|
" -I$CF->{path_buildroot}$pcfg->{installvendorarch} \\\n" . |
|
" -I$CF->{path_buildroot}$pcfg->{installvendorlib} \\\n" . |
|
" \"\$@\"\n"; |
|
$io->close(); |
|
&runcmd("chmod 755 $perlwrap"); |
|
|
|
# establish Perl module installation areas |
|
&mkdirp("$CF->{path_buildroot}$pcfg->{installarchlib}"); |
|
&mkdirp("$CF->{path_buildroot}$pcfg->{installprivlib}"); |
|
&mkdirp("$CF->{path_buildroot}$pcfg->{installsitearch}"); |
|
&mkdirp("$CF->{path_buildroot}$pcfg->{installsitelib}"); |
|
&mkdirp("$CF->{path_buildroot}$pcfg->{installvendorarch}"); |
|
&mkdirp("$CF->{path_buildroot}$pcfg->{installvendorlib}"); |
|
} |
|
|
|
# ==== STEP: 2. configure ==== |
|
if (grep { $_ eq "configure" } @steps_run) { |
|
&verbose("step 2: configure"); |
|
|
|
# sanity check |
|
if (not -f "Makefile.PL") { |
|
die "file \"Makefile.PL\" not found in working directory"; |
|
} |
|
|
|
# determine Makefile.PL arguments |
|
my $perl_args = " PERL=$perlwrap FULLPERL=$perlwrap"; |
|
$perl_args .= " INSTALLDIRS=$CF->{perl_schema}"; |
|
$perl_args .= " INSTALLMAN3DIR=none INSTALLSITEMAN3DIR=none INSTALLVENDORMAN3DIR=none"; |
|
$perl_args .= " PREFIX=$CF->{path_buildroot}$CF->{path_prefix}"; |
|
if ($CF->{path_libdir} ne '') { |
|
$perl_args .= " LIB=$CF->{path_buildroot}$CF->{path_libdir}"; |
|
} |
|
if ($#{@{$CF->{perl_args}}} >= 0) { |
|
my $user_args = join(" ", @{$CF->{perl_args}}); |
|
if ($user_args =~ m|#|) { |
|
$user_args =~ s|#| $perl_args |; |
|
$perl_args = $user_args; |
|
} |
|
else { |
|
$perl_args .= " " . $user_args; |
|
} |
|
} |
|
|
|
# fixate Makefile.PL |
|
&runcmd("chmod -R u+rw Makefile.PL"); |
|
&runcmd("cp Makefile.PL Makefile.PL.orig"); |
|
&runcmd("sed -e \"s:\\\$^X:'$perlwrap':g\" <Makefile.PL.orig >Makefile.PL"); |
|
|
|
# determine stdin |
|
if ($CF->{perl_stdin} ne "-") { |
|
$perl_args .= " <$CF->{perl_stdin}"; |
|
} |
|
|
|
# execute Makefile.PL |
|
&runcmd("$perlwrap Makefile.PL $perl_args"); |
|
} |
|
|
|
# ==== STEP: 3. build ==== |
|
if (grep { $_ eq "build" } @steps_run) { |
|
&verbose("step 3: build"); |
|
|
|
# sanity check |
|
if (not -f "Makefile") { |
|
die "file \"Makefile\" not found in working directory"; |
|
} |
|
|
|
# determine make(1) command and flags |
|
my $make = `$CF->{prog_rpm} --eval '\%{l_make} \%{l_mflags}'`; |
|
$make =~ s|\n+$||s; |
|
my $make_args = "PERL=$perlwrap FULLPERL=$perlwrap"; |
|
|
|
# execute make(1) |
|
&runcmd("$make $make_args pure_all"); |
|
} |
|
|
|
# ==== STEP: 4. install ==== |
|
if (grep { $_ eq "install" } @steps_run) { |
|
&verbose("step 4: install"); |
|
|
|
# sanity check |
|
if (not -f "Makefile") { |
|
die "file \"Makefile\" not found in working directory"; |
|
} |
|
|
|
# determine make(1) command and flags |
|
my $make = `$CF->{prog_rpm} --eval '\%{l_make} \%{l_mflags}'`; |
|
$make =~ s|\n+$||s; |
|
my $make_args = "PERL=$perlwrap FULLPERL=$perlwrap"; |
|
|
|
# execute make(1) |
|
&runcmd("$make $make_args pure_install"); |
|
} |
|
|
|
# ==== STEP: 5. fixate ==== |
|
if (grep { $_ eq "fixate" } @steps_run) { |
|
&verbose("step 5: fixate"); |
|
|
|
# prune installation files |
|
my $libdir; |
|
if ($CF->{path_libdir} ne '') { |
|
$libdir = "$CF->{path_buildroot}$CF->{path_libdir}"; |
|
} |
|
else { |
|
$libdir = "$CF->{path_buildroot}$CF->{path_prefix}/lib/perl"; |
|
} |
|
&runcmd("find $libdir -name perllocal.pod -print | xargs rm -f"); |
|
&runcmd("find $libdir -name .packlist -print | xargs rm -f"); |
|
&runcmd("find $libdir -type d -depth -print | (xargs rmdir >/dev/null 2>&1 || true)"); |
|
|
|
# determine RPM installation file list |
|
my $files = ''; |
|
$files .= '"%not %dir '.$CF->{path_prefix}.'"'."\n"; |
|
$files .= '"%not %dir '.$CF->{path_prefix}.'/lib/perl"'."\n" if ($CF->{path_libdir} eq ''); |
|
$files .= '"%not %dir '.$CF->{path_libdir}.'"'."\n" if ($CF->{path_libdir} ne ''); |
|
$files .= '"%not %dir '.$pcfg->{installarchlib}.'"'."\n"; |
|
$files .= '"%not %dir '.$pcfg->{installarchlib}.'/auto'.'"'."\n"; |
|
$files .= '"%not %dir '.$pcfg->{installprivlib}.'"'."\n"; |
|
$files .= '"%not %dir '.$pcfg->{installprivlib}.'/auto'.'"'."\n"; |
|
$files .= '"%not %dir '.$pcfg->{sitelib_stem}.'"'."\n"; |
|
$files .= '"%not %dir '.$pcfg->{installsitearch}.'"'."\n"; |
|
$files .= '"%not %dir '.$pcfg->{installsitearch}.'/auto'.'"'."\n"; |
|
$files .= '"%not %dir '.$pcfg->{installsitelib}.'"'."\n"; |
|
$files .= '"%not %dir '.$pcfg->{installsitelib}.'/auto'.'"'."\n"; |
|
$files .= '"%not %dir '.$pcfg->{vendorlib_stem}.'"'."\n"; |
|
$files .= '"%not %dir '.$pcfg->{installvendorarch}.'"'."\n"; |
|
$files .= '"%not %dir '.$pcfg->{installvendorarch}.'/auto'.'"'."\n"; |
|
$files .= '"%not %dir '.$pcfg->{installvendorlib}.'"'."\n"; |
|
$files .= '"%not %dir '.$pcfg->{installvendorlib}.'/auto'.'"'."\n"; |
|
|
|
my $out; |
|
if ($CF->{rpm_files} eq "-") { |
|
$out = new IO::Handle; |
|
$out->fdopen(fileno(STDOUT), "w"); |
|
} |
|
else { |
|
$out = new IO::File ">$CF->{rpm_files}"; |
|
} |
|
print $out $files; |
|
} |
|
|
|
# ==== STEP: 6. cleanup ==== |
|
if (grep { $_ eq "cleanup" } @steps_run) { |
|
&verbose("step 6: cleanup"); |
|
|
|
# remove temporary directory and its contents |
|
&runcmd("rm -rf $tmpdir"); |
|
} |
|
|
|
# die gracefully... |
|
&verbose("cleaning up environment"); |
|
&cleanup_perform(); |
|
exit(0); |
|
|
|
__END__ |
|
|
|
## |
|
## UNIX MANUAL PAGE |
|
## |
|
|
|
=pod |
|
|
|
=head1 NAME |
|
|
|
B<perl-openpkg> - B<OpenPKG Perl Module Build Utility> |
|
|
|
=head1 SYNOPSIS |
|
|
|
B<perl-openpkg> |
|
[B<-p>|B<--prefix> I<dir-path>] |
|
[B<-D>|B<--libdir> I<dir-path>] |
|
[B<-t>|B<--tmpdir> I<dir-path>] |
|
[B<-d>|B<--wrkdir> I<dir-path>] |
|
[B<-r>|B<--buildroot> I<dir-path>] |
|
[B<-w>|B<--buildwork> I<dir-path>] |
|
[B<-R>|B<--rpm> I<file-path>] |
|
[B<-P>|B<--perl> I<file-path>] |
|
[B<-s>|B<--schema> I<schema> |
|
[B<-A>|B<--args> I<arguments>] |
|
[B<-I>|B<--stdin> I<file-path>] |
|
[B<-F>|B<--files> I<file-path>] |
|
[B<-n>|B<--pkgname> I<name>] |
|
[B<-q>|B<--quiet>] |
|
[B<-v>|B<--verbose>] |
|
[I<step> ...] |
|
|
|
B<perl-openpkg> |
|
[B<-v>|B<--version>] |
|
[B<-h>|B<--help>] |
|
|
|
=head1 DESCRIPTION |
|
|
|
The B<perl-openpkg> program is an internal B<OpenPKG> packaging utility |
|
for building C<ExtUtils::MakeMaker> based Perl modules during the build |
|
procedure of Perl module based B<OpenPKG> packages. It provides an |
|
adjustable C<ExtUtils::MakeMaker> environment. |
|
|
|
=head1 OPTIONS |
|
|
|
The following command line options are available: |
|
|
|
=head2 Filesystem Paths |
|
|
|
The following command-line options set various filesystem paths. |
|
|
|
=over 4 |
|
|
|
=item B<-p>, B<--prefix> I<dir-path> |
|
|
|
Filesystem path to OpenPKG instance. Default is C<@l_prefix@>. |
|
|
|
=item B<-D>, B<--libdir> I<dir-path> |
|
|
|
Filesystem path to Perl lib directory. Default is |
|
"I<prefix>C</lib/perl>". |
|
|
|
=item B<-t>, B<--tmpdir> I<dir-path> |
|
|
|
Filesystem path to temporary directory. Default is C<$TMPDIR>, |
|
as provided by the RPM build-time environment. |
|
|
|
=item B<-d>, B<--wrkdir> I<dir-path> |
|
|
|
Filesystem path to working directory. Default is current working directory |
|
as provided by the RPM build-time environment. |
|
|
|
=item B<-r>, B<--buildroot> I<dir-path> |
|
|
|
Filesystem path to RPM build root directory. Default is C<$RPM_BUILD_ROOT>, |
|
as provided by the RPM build-time environment. |
|
|
|
=item B<-w>, B<--buildwork> I<dir-path> |
|
|
|
Filesystem path to RPM build work directory. Default is C<$RPM_BUILD_DIR>, |
|
as provided by the RPM build-time environment. |
|
|
|
=item B<-R>, B<--rpm> I<file-path> |
|
|
|
Filesystem path to RPM program. Default is I<prefix>C</bin/rpm>. |
|
|
|
=item B<-P>, B<--perl> I<file-path> |
|
|
|
Filesystem path to Perl program. Default is I<prefix>C</bin/perl>. |
|
|
|
=back |
|
|
|
=head2 OpenPKG Package Information |
|
|
|
The following command-line options set various package information. |
|
|
|
=over 4 |
|
|
|
=item B<-s>, B<--schema> I<schema> |
|
|
|
Sets the Perl C<INSTALLDIRS> schema. Allowed values are |
|
"C<perl>", "C<site>" and "C<vendor>". The default is "C<vendor>". |
|
|
|
=item B<-A>, B<--args> I<arguments> |
|
|
|
Sets additional arguments which are passed through on the "C<perl |
|
Makefile.PL>" command line. This option can be specified multiple times, |
|
args are joined with a space between them. If joined args contain a '#' then |
|
it is substituted by the automatically generated args otherwise joined args |
|
are appended to automatically generated args. Default is empty. |
|
|
|
=item B<-I>, B<--stdin> I<file-path> |
|
|
|
Filesystem path to connect to F<stdin> on the "C<perl Makefile.PL>" |
|
command line. Default is "C</dev/null>". A value of "C<->" means reading |
|
from F<stdin>. |
|
|
|
=item B<-F>, B<--files> I<file-path> |
|
|
|
Filesystem path to write the RPM C<%files> entries to describing the |
|
packaging list of all installed files. The default is "C<->" meaning |
|
that the list is written to F<stdout>. |
|
|
|
=item B<-n>, B<--pkgname> I<name> |
|
|
|
Name of involved RPM package. |
|
|
|
=back |
|
|
|
=head2 Run-Time Modes |
|
|
|
The following command-line options set various run-time modes. |
|
|
|
=over 4 |
|
|
|
=item B<-q>, B<--quiet> |
|
|
|
Operate in quiet run-time mode. |
|
|
|
=item B<-v>, B<--verbose> |
|
|
|
Operate in verbose run-time mode. |
|
|
|
=back |
|
|
|
=head2 Stand-Alone Operations |
|
|
|
The following command-line options trigger various stand-alone operations. |
|
|
|
=over 4 |
|
|
|
=item B<-v>, B<--version> |
|
|
|
Print program version only. |
|
|
|
=item B<-h>, B<--help> |
|
|
|
Print program usage help only. |
|
|
|
=back |
|
|
|
=head1 OPERATION STEPS |
|
|
|
The operation procedure of B<perl-openpkg> is divided into the following |
|
six distinguished steps: |
|
|
|
=over 3 |
|
|
|
=item B<1. prepare> |
|
|
|
This prepares the build environment by optionally creating a temporary |
|
directory and establishing a Perl wrapper script. |
|
This step can be shared between the configuration, building and installation |
|
of multiple modules. |
|
|
|
=item B<2. configure> |
|
|
|
This configures the Perl module by performing the equivalent of |
|
the command "C<perl Makefile.PL>". This step has to be performed |
|
individually for each particular module. |
|
|
|
=item B<3. build> |
|
|
|
This builds the Perl module by performing the equivalent of the command |
|
"C<make all>". This step has to be performed individually for each |
|
particular module. |
|
|
|
=item B<4. install> |
|
|
|
This installs the Perl module by performing the equivalent of the |
|
command "C<make install>". This step has to be performed individually |
|
for each particular module. |
|
|
|
=item B<5. fixate> |
|
|
|
This fixates the installed files by removing unnecessary ones, fixing |
|
permissions and determining the resulting file list. This step can be |
|
shared between the configuration, building and installation of multiple |
|
modules. |
|
|
|
=item B<6. cleanup> |
|
|
|
This cleans up the build environment by removing all temporary files. |
|
This step can be shared between the configuration, building and |
|
installation of multiple modules. |
|
|
|
=back |
|
|
|
By default all operation steps are performed in sequence. Alternatively, |
|
the sequence of steps can be individually specified on the command |
|
line as one or more I<step> arguments. The given sequence of I<step>s |
|
has to be exactly a contiguous sub-sequence of the sequence listed |
|
above. As the extrem cases, it can be "C<prepare configure build install |
|
fixate cleanup>" (the same as not specifying any steps) or just perhaps |
|
"C<build>" (for executing only a particular step). |
|
|
|
=head1 EXAMPLE |
|
|
|
# packaging of single module |
|
perl-openpkg |
|
|
|
# packaging of multiple modules |
|
perl-openpkg prepare |
|
perl-openpkg -d Foo-1 configure build install |
|
perl-openpkg -d Bar-2 configure build install |
|
perl-openpkg -d Baz-3 configure build install |
|
perl-openpkg fixate cleanup |
|
|
|
=head1 HISTORY |
|
|
|
The B<perl-openpkg> utility was originally implemented as a small |
|
Bourne-Shell script for use in OpenPKG 1.1. It was later rewritten from |
|
scratch in Perl for OpenPKG 2.0 and especially made more flexible to |
|
reduce the complexity in numerious packages. |
|
|
|
=head1 SEE ALSO |
|
|
|
perl(1), "C<perldoc ExtUtils::MakeMaker>". |
|
|
|
=head1 AUTHORS |
|
|
|
Ralf S. Engelschall E<lt>rse@engelschall.comE<gt>. |
|
|
|
=cut |
|
|
|
|