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