[Bps-public-commit] r17247 - in Prophet/trunk: .

jesse at bestpractical.com jesse at bestpractical.com
Mon Dec 15 18:32:34 EST 2008


Author: jesse
Date: Mon Dec 15 18:32:33 2008
New Revision: 17247

Added:
   Prophet/trunk/inc/Module/Install/Share.pm
Modified:
   Prophet/trunk/   (props changed)

Log:
 r55871 at 173-101-55-142 (orig r17246):  jesse | 2008-12-15 15:32:25 -0800
  version M::I::Share


Added: Prophet/trunk/inc/Module/Install/Share.pm
==============================================================================
--- (empty file)
+++ Prophet/trunk/inc/Module/Install/Share.pm	Mon Dec 15 18:32:33 2008
@@ -0,0 +1,67 @@
+#line 1
+package Module::Install::Share;
+
+use strict;
+use Module::Install::Base;
+
+use vars qw{$VERSION $ISCORE @ISA};
+BEGIN {
+	$VERSION = '0.77';
+	$ISCORE  = 1;
+	@ISA     = qw{Module::Install::Base};
+}
+
+sub install_share {
+	my $self = shift;
+	my $dir  = @_ ? pop   : 'share';
+	my $type = @_ ? shift : 'dist';
+	unless ( defined $type and $type eq 'module' or $type eq 'dist' ) {
+		die "Illegal or invalid share dir type '$type'";
+	}
+	unless ( defined $dir and -d $dir ) {
+		die "Illegal or missing directory install_share param";
+	}
+
+	# Split by type
+	my $S = ($^O eq 'MSWin32') ? "\\" : "\/";
+	if ( $type eq 'dist' ) {
+		die "Too many parameters to install_share" if @_;
+
+		# Set up the install
+		$self->postamble(<<"END_MAKEFILE");
+config ::
+\t\$(NOECHO) \$(MOD_INSTALL) \\
+\t\t"$dir" \$(INST_LIB)${S}auto${S}share${S}dist${S}\$(DISTNAME)
+
+END_MAKEFILE
+	} else {
+		my $module = Module::Install::_CLASS($_[0]);
+		unless ( defined $module ) {
+			die "Missing or invalid module name '$_[0]'";
+		}
+		$module =~ s/::/-/g;
+
+		# Set up the install
+		$self->postamble(<<"END_MAKEFILE");
+config ::
+\t\$(NOECHO) \$(MOD_INSTALL) \\
+\t\t"$dir" \$(INST_LIB)${S}auto${S}share${S}module${S}$module
+
+END_MAKEFILE
+	}
+
+	# The above appears to behave incorrectly when used with old versions
+	# of ExtUtils::Install (known-bad on RHEL 3, with 5.8.0)
+	# So when we need to install a share directory, make sure we add a
+	# dependency on a moderately new version of ExtUtils::MakeMaker.
+	$self->build_requires( 'ExtUtils::MakeMaker' => '6.11' );
+
+	# 99% of the time we don't want to index a shared dir
+	$self->no_index( directory => $dir );
+}
+
+1;
+
+__END__
+
+#line 125



More information about the Bps-public-commit mailing list