[283] | 1 | use 5.006001;
|
---|
[33] | 2 | use ExtUtils::MakeMaker;
|
---|
[867] | 3 | use strict;
|
---|
[33] | 4 |
|
---|
| 5 | # See lib/ExtUtils/MakeMaker.pm for details of how to influence
|
---|
| 6 | # the contents of the Makefile that is written.
|
---|
| 7 | WriteMakefile(
|
---|
[867] | 8 | NAME => 'PBPKG',
|
---|
| 9 | DISTNAME => 'PBPKG',
|
---|
| 10 | VERSION => 'PBVER',
|
---|
| 11 | INST_SCRIPT => 'blib/bin',
|
---|
[338] | 12 | INSTALLDIRS => 'perl',
|
---|
[867] | 13 | PREREQ_PM => {
|
---|
[33] | 14 | #HTTP::Headers => 1.59,
|
---|
| 15 | #Template => 0,
|
---|
[867] | 16 | }, # e.g., Module::Name => 1.1
|
---|
[63] | 17 | #ABSTRACT_FROM => 'bin/pb', # retrieve abstract from module
|
---|
[867] | 18 | AUTHOR => 'Bruno Cornec <bruno#project-builder.org>',
|
---|
[402] | 19 | EXE_FILES => [ qw( bin/pbdistrocheck ) ],
|
---|
[969] | 20 | MAN1PODS => { 'bin/pbdistrocheck' => '$(INST_MAN1DIR)/pbdistrocheck.$(MAN1EXT)', },
|
---|
[1290] | 21 | # MAN3PODS => { 'lib/ProjectBuilder/Distribution.pm' => '$(INST_MAN3DIR)/ProjectBuilder::Distribution.$(MAN3EXT)',
|
---|
| 22 | #'lib/ProjectBuilder/Conf.pm' => '$(INST_MAN3DIR)/ProjectBuilder::Conf.$(MAN3EXT)',
|
---|
| 23 | #'lib/ProjectBuilder/Display.pm' => '$(INST_MAN3DIR)/ProjectBuilder::Display.$(MAN3EXT)',
|
---|
| 24 | #'lib/ProjectBuilder/Log.pm' => '$(INST_MAN3DIR)/ProjectBuilder::Log.$(MAN3EXT)',
|
---|
| 25 | #'lib/ProjectBuilder/Log/Item.pm' => '$(INST_MAN3DIR)/ProjectBuilder::Log::Item.$(MAN3EXT)',
|
---|
| 26 | #'lib/ProjectBuilder/Base.pm' => '$(INST_MAN3DIR)/ProjectBuilder::Base.$(MAN3EXT)', },
|
---|
[33] | 27 | );
|
---|
[867] | 28 |
|
---|
| 29 | package MY;
|
---|
| 30 |
|
---|
| 31 | sub postamble {
|
---|
| 32 |
|
---|
| 33 | # Determine location of etc conf files
|
---|
| 34 | my $text ="";
|
---|
| 35 |
|
---|
[989] | 36 | # Grab out any CONFDIR or MANDIR param
|
---|
[1503] | 37 | my $etcdir = undef;
|
---|
[989] | 38 | my $mandir = undef;
|
---|
[1503] | 39 | my $prefix = undef;
|
---|
[867] | 40 |
|
---|
| 41 | while (my $arg = shift @ARGV) {
|
---|
| 42 | my ($key, $value) = split /=/, $arg;
|
---|
| 43 | if ($key =~ /^CONFDIR$/) {
|
---|
[1503] | 44 | $etcdir = $value;
|
---|
[989] | 45 | } elsif ($key =~ /^MANDIR$/) {
|
---|
| 46 | $mandir = $value;
|
---|
[1503] | 47 | } elsif ($key =~ /^PREFIX$/) {
|
---|
| 48 | $prefix = $value;
|
---|
[867] | 49 | }
|
---|
| 50 | }
|
---|
| 51 |
|
---|
[1509] | 52 | $etcdir ||= "$prefix/etc/pb" if (defined $prefix);
|
---|
| 53 | $mandir ||= "$prefix/share/man" if (defined $prefix);
|
---|
[1503] | 54 | $etcdir ||= "/usr/local/etc/pb";
|
---|
| 55 | $mandir ||= "/usr/local/share/man";
|
---|
[867] | 56 |
|
---|
| 57 | # Use that conf dir info to modify Distribution.pm
|
---|
| 58 | system("perl -pi -e \"s~CCCC~$etcdir~\" lib/ProjectBuilder/Distribution.pm");
|
---|
| 59 |
|
---|
| 60 | $text .= "install ::\n";
|
---|
[915] | 61 | $text .= "\t".'mkdir -p $(DESTDIR)'."$etcdir\n";
|
---|
| 62 | $text .= "\t".'chmod 755 $(DESTDIR)'."$etcdir\n";
|
---|
[867] | 63 | $text .= "\t".'cp etc/pb.conf $(DESTDIR)'."$etcdir\n";
|
---|
[989] | 64 |
|
---|
| 65 | # Produce the man page for pb.conf
|
---|
| 66 | $text .= "\t".'mkdir -p $(DESTDIR)'."$mandir/man5\n";
|
---|
[1081] | 67 | $text .= "\t".'pod2man --section=5 etc/pb.conf.pod > $(DESTDIR)'."$mandir/man5/pb.conf.5\n";
|
---|
[867] | 68 | return($text);
|
---|
| 69 | }
|
---|