HPUX-SDUX

 view release on metacpan or  search on metacpan

SDUX.pm  view on Meta::CPAN


};

my $__write_subproducts_section = sub {
	# optional in PSF layout version 1.0
	print STDERR "Writing subproducts section\n";
	
	# for now, we don't use this section
};

my $__write_products_section = sub {
	# filehandle PSFFILE should be open when this routine is called.
	# required in PSF layout version 1.0
	print STDERR "Writing products section\n";
	
	my $current_dir = cwd;
	$module_name =~ s/::/-/g;
	$module_name = 'CPAN-'.$module_name;

	print PSFFILE <<"PRODUCT_SECTION_PREAMBLE";
product
	tag $module_name
	revision	$module_version
	directory	$module_prefix
	readme		< $current_dir/README
	is_locatable	false
	is_patch		false
	os_name	HP-UX
	os_release	?.11.*
	os_version	?
	category_tag	language_perl
PRODUCT_SECTION_PREAMBLE

	my @dirs = &$__top_subdirs($sdux_install_dir);
	
	foreach my $dir (@dirs) {
		&$__write_filesets_section($dir);
	}

	print PSFFILE <<"PRODUCT_SECTION_POSTAMBLE";	# close 'product'
end
PRODUCT_SECTION_POSTAMBLE

};

######################################################################
#
# &HPUX::SDUX::wmf
#
######################################################################
sub wmf() {
	my $package_name = __PACKAGE__;
	my $sdux_makefile    = 'Makefile.SDUX';
	my $makefile = 'Makefile.PL';	# read Makefile.PL by default
	die "$makefile does not exist: $?" unless (-f $makefile);
	
	{
		# run Makefile.PL with appropriate arguments
		# save off @ARGV, just in case we need it later
		my @makefile_argv = @ARGV;
		local @ARGV;
		if (@makefile_argv) {
			# override any 'SITEPREFIX=' run-time option
			push @makefile_argv, ( "SITEPREFIX=$sdux_install_dir" );
		} else {
			@makefile_argv = ( "SITEPREFIX=$sdux_install_dir" )
		}
		@ARGV = @makefile_argv;
		open MYMAKEFILE, ">> $sdux_makefile" || die "Cannot write to $sdux_makefile: $?";
		File::Copy::copy ($makefile,$sdux_makefile);
		print MYMAKEFILE <<"END_MAKEFILE_PL";

# ExtUtils::MakeMaker methods overridden by $package_name
sub MY::clean {
	my \$clean = &ExtUtils::MM_Unix::clean;
	\$clean .= "\\t\\\$(RM_RF) HPUX sdux \\\$(DEV_NULL)\\n";
	\$clean .= "\\t-\\\$(MV) module.psf module.psf.old \\\$(DEV_NULL)\\n";
	\$clean .= "\\t-\\\$(MV) Makefile.SDUX Makefile.SDUX.old \\\$(DEV_NULL)";
	\$clean;
}

sub MY::realclean {
	my \$realclean = &ExtUtils::MM_Unix::realclean;
	\$realclean .= "\\t\\\$(RM_RF) module.psf module.psf.old \\\$(DEV_NULL)\\n";
	\$realclean .= "\\t\\\$(RM_RF) Makefile.SDUX Makefile.SDUX.old \\\$(DEV_NULL)";
	\$realclean;
}

sub MY::postamble {
	my \$postamble = <<'END_DEPOT';
depot: install
	\$(PERL) -M$package_name -e ${package_name}::write_psf
	swpackage -s module.psf -x write_remote_files=true \@$sdux_install_dir
END_DEPOT
}
END_MAKEFILE_PL
		close MYMAKEFILE;
		do $sdux_makefile or die "Cannot create Makefile: $!";
	}
	
}

######################################################################
#
# &HPUX::SDUX::write_psf
# This is called in the 'depot' target of our Makefile
#
######################################################################
sub write_psf() {

	# This routine should be called only from the "depot" target.
	# When we get here, 'make' should have made the target "install".
	# There should be a directory './sdux' whose content is what
	# the module needs.
	
	print STDERR "Writing PSF\n";

	# information about the module
	my $current_dir = cwd;
	my $psf_file         = 'module.psf';
	my $psf_version      = '1.0';	# just in case



( run in 2.684 seconds using v1.01-cache-2.11-cpan-c221a9de4ec )