Changeset 867 in ProjectBuilder for devel/pb-modules/Makefile.PL


Ignore:
Timestamp:
Oct 21, 2009, 11:48:11 AM (15 years ago)
Author:
Bruno Cornec
Message:
  • Transition static distribution into a configuration file typically /etc/pb/pb.conf
  • function pb_distro_init adapted to use the new conf file
  • function pb_distro_get_param adapted to support osfamily and ostype
  • Adapt the package building of pb to the need of the new configuration file
File:
1 edited

Legend:

Unmodified
Added
Removed
  • devel/pb-modules/Makefile.PL

    r539 r867  
    11use 5.006001;
    22use ExtUtils::MakeMaker;
     3use strict;
    34
    45# See lib/ExtUtils/MakeMaker.pm for details of how to influence
    56# the contents of the Makefile that is written.
    67WriteMakefile(
    7     NAME         => 'PBPKG',
    8     DISTNAME     => 'PBPKG',
    9     VERSION      => 'PBVER',
    10     INST_SCRIPT  => 'blib/bin',
     8    NAME         => 'PBPKG',
     9    DISTNAME     => 'PBPKG',
     10    VERSION      => 'PBVER',
     11    INST_SCRIPT  => 'blib/bin',
    1112    INSTALLDIRS  => 'perl',
    12     PREREQ_PM    => {
     13    PREREQ_PM    => {
    1314            #HTTP::Headers                    => 1.59,
    1415            #Template                         => 0,
    15     },    # e.g., Module::Name => 1.1
     16    },    # e.g., Module::Name => 1.1
    1617    #ABSTRACT_FROM => 'bin/pb',   # retrieve abstract from module
    17     AUTHOR        => 'Bruno Cornec <bruno#project-builder.org>',
     18    AUTHOR        => 'Bruno Cornec <bruno#project-builder.org>',
    1819    EXE_FILES     => [ qw( bin/pbdistrocheck ) ],
    1920    MAN3PODS      => {  'lib/ProjectBuilder/Distribution.pm' => '$(INST_MAN3DIR)/ProjectBuilder::Distribution.$(MAN3EXT)',
     
    2223                        'lib/ProjectBuilder/Base.pm' => '$(INST_MAN3DIR)/ProjectBuilder::Base.$(MAN3EXT)', },
    2324);
     25
     26package MY;
     27
     28sub postamble {
     29
     30    # Determine location of etc conf files
     31    my $text ="";
     32
     33    # Grab out any CONFDIR param
     34    my $confdir = undef;
     35
     36    while (my $arg = shift @ARGV) {
     37        my ($key, $value) = split /=/, $arg;
     38        if ($key =~ /^CONFDIR$/) {
     39            $confdir = $value;
     40        }
     41    }
     42
     43    my $etcdir = $confdir || "/usr/local/etc/pb";
     44
     45    # Use that conf dir info to modify Distribution.pm
     46    system("perl -pi -e \"s~CCCC~$etcdir~\" lib/ProjectBuilder/Distribution.pm");
     47
     48    $text .= "install ::\n";
     49    $text .= "\t".'install -m 755 -d $(DESTDIR)'."$etcdir\n";
     50    $text .= "\t".'cp etc/pb.conf $(DESTDIR)'."$etcdir\n";
     51    return($text);
     52}
Note: See TracChangeset for help on using the changeset viewer.