[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>',
|
---|
[1899] | 22 | EXE_FILES => [ qw(bin/pbdistrocheck bin/pbgetparam) ],
|
---|
[1694] | 23 | MAN1PODS => {
|
---|
| 24 | 'bin/pbdistrocheck' => '$(INST_MAN1DIR)/pbdistrocheck.$(MAN1EXT)',
|
---|
[1899] | 25 | 'bin/pbgetparam' => '$(INST_MAN1DIR)/pbgetparam.$(MAN1EXT)',
|
---|
[1694] | 26 | },
|
---|
[1290] | 27 | # MAN3PODS => { 'lib/ProjectBuilder/Distribution.pm' => '$(INST_MAN3DIR)/ProjectBuilder::Distribution.$(MAN3EXT)',
|
---|
| 28 | #'lib/ProjectBuilder/Conf.pm' => '$(INST_MAN3DIR)/ProjectBuilder::Conf.$(MAN3EXT)',
|
---|
| 29 | #'lib/ProjectBuilder/Display.pm' => '$(INST_MAN3DIR)/ProjectBuilder::Display.$(MAN3EXT)',
|
---|
| 30 | #'lib/ProjectBuilder/Log.pm' => '$(INST_MAN3DIR)/ProjectBuilder::Log.$(MAN3EXT)',
|
---|
| 31 | #'lib/ProjectBuilder/Log/Item.pm' => '$(INST_MAN3DIR)/ProjectBuilder::Log::Item.$(MAN3EXT)',
|
---|
| 32 | #'lib/ProjectBuilder/Base.pm' => '$(INST_MAN3DIR)/ProjectBuilder::Base.$(MAN3EXT)', },
|
---|
[33] | 33 | );
|
---|
[867] | 34 |
|
---|
| 35 | package MY;
|
---|
| 36 |
|
---|
| 37 | sub postamble {
|
---|
| 38 |
|
---|
| 39 | # Determine location of etc conf files
|
---|
| 40 | my $text ="";
|
---|
| 41 |
|
---|
[989] | 42 | # Grab out any CONFDIR or MANDIR param
|
---|
[1503] | 43 | my $etcdir = undef;
|
---|
[989] | 44 | my $mandir = undef;
|
---|
[1503] | 45 | my $prefix = undef;
|
---|
[867] | 46 |
|
---|
| 47 | while (my $arg = shift @ARGV) {
|
---|
| 48 | my ($key, $value) = split /=/, $arg;
|
---|
| 49 | if ($key =~ /^CONFDIR$/) {
|
---|
[1503] | 50 | $etcdir = $value;
|
---|
[989] | 51 | } elsif ($key =~ /^MANDIR$/) {
|
---|
| 52 | $mandir = $value;
|
---|
[1503] | 53 | } elsif ($key =~ /^PREFIX$/) {
|
---|
| 54 | $prefix = $value;
|
---|
[867] | 55 | }
|
---|
| 56 | }
|
---|
| 57 |
|
---|
[1509] | 58 | $etcdir ||= "$prefix/etc/pb" if (defined $prefix);
|
---|
| 59 | $mandir ||= "$prefix/share/man" if (defined $prefix);
|
---|
[1503] | 60 | $etcdir ||= "/usr/local/etc/pb";
|
---|
| 61 | $mandir ||= "/usr/local/share/man";
|
---|
[867] | 62 |
|
---|
| 63 | # Use that conf dir info to modify Distribution.pm
|
---|
| 64 | system("perl -pi -e \"s~CCCC~$etcdir~\" lib/ProjectBuilder/Distribution.pm");
|
---|
| 65 |
|
---|
| 66 | $text .= "install ::\n";
|
---|
[915] | 67 | $text .= "\t".'mkdir -p $(DESTDIR)'."$etcdir\n";
|
---|
| 68 | $text .= "\t".'chmod 755 $(DESTDIR)'."$etcdir\n";
|
---|
[867] | 69 | $text .= "\t".'cp etc/pb.conf $(DESTDIR)'."$etcdir\n";
|
---|
[989] | 70 |
|
---|
| 71 | # Produce the man page for pb.conf
|
---|
| 72 | $text .= "\t".'mkdir -p $(DESTDIR)'."$mandir/man5\n";
|
---|
[1081] | 73 | $text .= "\t".'pod2man --section=5 etc/pb.conf.pod > $(DESTDIR)'."$mandir/man5/pb.conf.5\n";
|
---|
[867] | 74 | return($text);
|
---|
| 75 | }
|
---|