|
Packit |
745a47 |
use strict;
|
|
Packit |
745a47 |
use warnings;
|
|
Packit |
745a47 |
|
|
Packit |
745a47 |
use ExtUtils::MakeMaker;
|
|
Packit |
745a47 |
use File::Copy;
|
|
Packit |
745a47 |
use File::Find;
|
|
Packit |
745a47 |
|
|
Packit |
745a47 |
my $perl_ns = "perl";
|
|
Packit |
745a47 |
my $suffix = "";
|
|
Packit |
745a47 |
|
|
Packit |
745a47 |
if (defined $ENV{'PERL_NS'} && $ENV{'PERL_NS'} !~ /^$/) {
|
|
Packit |
745a47 |
$perl_ns = $ENV{'PERL_NS'} . "-" . $perl_ns;
|
|
Packit |
745a47 |
$suffix = "." . $ENV{'PERL_NS'};
|
|
Packit |
745a47 |
}
|
|
Packit |
745a47 |
|
|
Packit |
745a47 |
my @directories_to_search = ("template");
|
|
Packit |
745a47 |
File::Find::find({
|
|
Packit |
745a47 |
wanted => \&wanted,
|
|
Packit |
745a47 |
untaint => 1,
|
|
Packit |
745a47 |
no_chdir => 1,
|
|
Packit |
745a47 |
}, @directories_to_search);
|
|
Packit |
745a47 |
|
|
Packit |
745a47 |
sub wanted {
|
|
Packit |
745a47 |
my $tmpl = $File::Find::name;
|
|
Packit |
745a47 |
my $dir = $File::Find::dir;
|
|
Packit |
745a47 |
if ( -f $tmpl) {
|
|
Packit |
745a47 |
my $file = $tmpl;
|
|
Packit |
745a47 |
$file =~ s/template\///;
|
|
Packit |
745a47 |
$dir =~ s/template\///;
|
|
Packit |
745a47 |
system("mkdir $dir") if (! -d $dir);
|
|
Packit |
745a47 |
$file = $file.$suffix if ($file =~ m/bin/);
|
|
Packit |
745a47 |
copy("$tmpl", "$file") or die "Copy failed: $!";
|
|
Packit |
745a47 |
system("sed -i 's/__PERL_NS__/$perl_ns/' $file");
|
|
Packit |
745a47 |
system("sed -i 's/__PERL_SUFFIX__/$suffix/' $file");
|
|
Packit |
745a47 |
system("chmod 755 $file") if ($file =~ m/bin/);
|
|
Packit |
745a47 |
}
|
|
Packit |
745a47 |
}
|
|
Packit |
745a47 |
|
|
Packit |
745a47 |
WriteMakefile(
|
|
Packit |
745a47 |
'NAME' => 'generators',
|
|
Packit |
745a47 |
'VERSION' => '1.10',
|
|
Packit |
745a47 |
'AUTHOR' => 'Jitka Plesnikova <jplesnik@redhat.com>',
|
|
Packit |
745a47 |
'LICENSE' => 'gpl',
|
|
Packit |
745a47 |
'EXE_FILES' => [ "bin/perl.prov$suffix", "bin/perl.req$suffix" ],
|
|
Packit |
745a47 |
'BUILD_REQUIRES' => {
|
|
Packit |
745a47 |
},
|
|
Packit |
745a47 |
'PREREQ_PM' => {
|
|
Packit |
745a47 |
'Fedora::VSP' => 0,
|
|
Packit |
745a47 |
'version' => 0,
|
|
Packit |
745a47 |
},
|
|
Packit |
745a47 |
TEST_REQUIRES => {
|
|
Packit |
745a47 |
'Test::More' => 0,
|
|
Packit |
745a47 |
'strict' => 0,
|
|
Packit |
745a47 |
'warnings' => 0,
|
|
Packit |
745a47 |
},
|
|
Packit |
745a47 |
'CONFIGURE_REQUIRES' => {
|
|
Packit |
745a47 |
'ExtUtils::MakeMaker' => 0,
|
|
Packit |
745a47 |
},
|
|
Packit |
745a47 |
'META_MERGE' => {
|
|
Packit |
745a47 |
'resources' => {
|
|
Packit |
745a47 |
'homepage' =>
|
|
Packit |
745a47 |
'http://jplesnik.fedorapeople.org/generators/',
|
|
Packit |
745a47 |
},
|
|
Packit |
745a47 |
},
|
|
Packit |
745a47 |
'test' => {
|
|
Packit |
745a47 |
'TESTS' => 't/*.t',
|
|
Packit |
745a47 |
},
|
|
Packit |
745a47 |
);
|