Document-Manager

 view release on metacpan or  search on metacpan

Makefile.PL  view on Meta::CPAN

		'RDF::Simple'            => 0,
		'WebService::TicketAuth' => 0,
                },
	    'AUTHOR' => 'Bryce Harrington <bryce@bryceharrington.org>',
	    'ABSTRACT' => 'Manages collection of revision-controlled docs'
);

# This puts us in the site_perl directory, not dependant on any version
# of perl.
if (defined($Config{'sitelib_stem'}) && $Config{'sitelib_stem'} ne "") {
    print "stem is: $Config{'sitelib_stem'}\n";
    $opts{'INSTALLSITELIB'} = "";
    $opts{'INSTALLSITELIB'} = $args{'DESTDIR'}
                if ($] >= 5.008 ||
                    $ExtUtils::MakeMaker::VERSION =~ /5\.9[1-6]|6\.0[0-5]/);
    $opts{'INSTALLSITELIB'} .= $Config{'sitelib_stem'};
}

WriteMakefile( %opts );

sub install_clause {
    my ($source, $target_dir, $overwrite) = @_;
    $overwrite = 1 unless (defined($overwrite));

    my $text = '';

    $text .= "install :: $source\n";
    $text .= "\t\$(MKPATH) $target_dir\n";
    $text .= "\t\$(CHMOD) a+rx $target_dir\n";
    if ($source) {
        if (-d $source) {
            # If we're copying a directory, update all permissions of subdirs & files
            $text .= "\tfind $source -type d | xargs \$(CHMOD) a+rx\n";
            $text .= "\tfind $source -type f | xargs \$(CHMOD) a+r\n";
        }
        if ($overwrite) {
            # Copy everything recursively excluding CVS dirs and preserving permissions
            $text .= "\t\$(RSYNC) -Cpr $source $target_dir\n";
        } elsif (-f $source) {
            # Don't over-write
            # (This assumes we're installing a _file_, not a directory tree)
            my $dest_file = catfile( $target_dir, basename( $source ) );
            $text .= "\tif [ -f $dest_file ]; ";
            $text .= "then \$(CP) $source $dest_file.dist; ";
            $text .= "else \$(CP) $source $dest_file; fi\n";
            $text .= "\t\$(CHMOD) -R a+r $dest_file\n";
        } else {
            die "Can't install directory '$source' unless overwrite=1\n";
        }
    }
    $text .= "\n";
    return $text;
}

sub MY::postamble {
    my $self = shift;
    my $text = '';
    my $etcdir = '';

    $text .= "RSYNC = rsync\n";
    $text .= "CHOWN = chown\n\n";

    # Determine location of etc conf files
    my $destdir = $args{DESTDIR} || rootdir();

    my $etcdir   = catdir( $destdir,  'etc', $args{pkg_name} );
    my $etcfiles = catfile( 'etc', "dms.conf" );
  
#    $text .= install_clause($etcfiles, $etcdir, 0);

    if ($args{conf} ne $default_conf) {
	# Substitute config file location into perl module
	# (Yes, this is a bit of a hack...  I'd love to have a better way...)
	$text .= "all :: \$(INST_LIB)/Document/Manager.pm\n";
	$text .= "\techo Setting config path location in Document::Manager\n";
	$text .= qq|\t\$(PERL) -pi -e 's#$default_conf#$args{conf}#g' \$(INST_LIB)/Document/Manager.pm|;
	$text .= "\n\n";
    }

    return $text;
}
# vi:set ai ts=4 sw=4 expandtab:



( run in 0.808 second using v1.01-cache-2.11-cpan-71847e10f99 )