pBLADE
view release on metacpan or search on metacpan
Makefile.PL view on Meta::CPAN
'DISTNAME' => $distname,
'VERSION_FROM' => $pmfile, # finds $VERSION
'LIBS' => [$libs],
'DEFINE' => '',
'INC' => $cflags,
'OBJECT' => join(' ',@objects),
'dist' => { 'COMPRESS' => 'gzip -f --best' },
);
exit 0;
# create the rpm, special document targets
sub MY::postamble {
my $doc_dir = "\$(install_prefix)/$blade_prefix/doc/blade/pBLADE";
my $pod2text = "$Config{prefix}/bin/pod2text";
(-x $pod2text) or $pod2text = undef;
my $pod2html = "$Config{prefix}/bin/pod2html";
(-x $pod2html) or $pod2html = undef;
my @doc_files = ('README', 'ChangeLog', 'LICENSE', $specfile);
$pod2text and push @doc_files, "$distname.txt";
$pod2html and push @doc_files, "$distname.html";
my $postamble = <<EOP;
rpm: dist
rpm -ta $distname-$version.tar.gz
install :: install_mydocs
uninstall :: uninstall_mydocs
install_mydocs: uninstall_mydocs
EOP
$pod2text and $postamble .= "\t$pod2text $pmfile > $distname.txt\n";
$pod2html and $postamble .= "\t$pod2html $pmfile > $distname.html\n";
$postamble .= <<EOP;
\$(MKPATH) $doc_dir
EOP
foreach my $file (@doc_files) {
$postamble .= "\t\$(CP) $file $doc_dir/$file\n";
}
$postamble .= "\nuninstall_mydocs:\n";
foreach my $file (@doc_files) {
$postamble .= "\t\$(RM_F) $doc_dir/$file\n";
}
return $postamble;
}
# function for writing an rpm spec file
sub write_spec_file($$$$) {
my ($distname, $version, $prefix, $outfile) = @_;
open(SPEC,">$outfile") or die "Could not open output spec file '$outfile': $!";
print SPEC <<EOP;
# Note that this is NOT a relocatable package
\%define rel 1
Summary: Write BLADE applications in Perl
Name: $distname
Version: $version
Release: \%rel
License: GPL or Artistic License
Group: Development/Libraries
Source: $distname-$version.tar.gz
URL: http://www.thestuff.net/bob/projects/blade
BuildRoot: /tmp/$distname-\%{PACKAGE_VERSION}-root
Packager: Pete Ratzlaff <pratzlaff\@cfa.harvard.edu>
\%description
$distname is a Perl interface to the BLADE web development environment.
\%changelog
\%prep
\%setup
perl Makefile.PL PREFIX=\$RPM_BUILD_ROOT$prefix
\%build
make
\%install
rm -rf \$RPM_BUILD_ROOT
make install install_prefix=\$RPM_BUILD_ROOT
\%clean
rm -rf \$RPM_BUILD_ROOT
\%files
\%defattr(-, root, root)
/*
EOP
}
# not pretty, but gets the job done
sub get_version($) {
my $pmfile = shift;
open(PMFILE,$pmfile) or die "Could not open file '$pmfile': $!";
my @lines = grep /^\s*\$VERSION\s*=\s*\'.*\'/, <PMFILE> or
die "No version found in file '$pmfile'";
my $version;
($version) = ($lines[0] =~ /^\$VERSION\s*=\s*\'(.*)\'/);
return $version;
}
( run in 1.669 second using v1.01-cache-2.11-cpan-5511b514fd6 )