Linux-DVB-DVBT

 view release on metacpan or  search on metacpan

plib/Makeutils.pm  view on Meta::CPAN

				$ModuleInfo{'make_defines'} .= "$key=$defines_href->{$key} " ;
			}
			else
			{
				$ModuleInfo{'mod_defines'} .= "-D$key " ;
				$ModuleInfo{'make_defines'} .= "$key=1 " ;
			}
		}
	}
}

##-------------------------------------------------------------------------------------------
sub get_makeopts
{
	## -D = debug 
	$Makeutils::DEBUG = 0 ;
	if ( 
		grep $_ eq '-D', @main::ARGV
	) 
	{
		$Makeutils::DEBUG = 1 ;
	} 
	
	## -d = debug 
	if ( 
		grep $_ eq '-d', @main::ARGV
	) 
	{
		@main::ARGV = grep $_ ne '-d', @main::ARGV;
		warn "Buidling version with extra debugging enabled...\n";
		add_defines({
			'DEBUG'		=> 1,
		}) ;
		
		# compile for debug
		$ModuleInfo{'OPTIMIZE'} = '-ggdb -O0' ;
	} 
	
	## -M = udpate MANIFEST 
	$Makeutils::UPDATE_MANIFEST = 0 ;
	if ( 
		grep $_ eq '-M', @main::ARGV
	) 
	{
		$Makeutils::UPDATE_MANIFEST = 1 ;
	} 
	
}


##-------------------------------------------------------------------------------------------
sub process_makeopts
{
	if ($Makeutils::UPDATE_MANIFEST)
	{
		update_manifest() ;
	}	
}

##-------------------------------------------------------------------------------------------
sub update_manifest
{
	## Read file
	my %manifest ;
	my $line ;
	open my $fh, "<MANIFEST" or die "Error: Unable to read MANIFEST file" ;
	while(defined($line = <$fh>))
	{
		chomp $line ;
		$line =~ s/[^[:ascii:]]/ /g;
		$line =~ s/^\s+// ;
		$line =~ s/\s+$// ;
		$line =~ s/^#.*// ;
		next unless $line ;

		$manifest{$line} = 1 ;		
	}
	close $fh ;
	
	## Build expected list
	my @expected = qw(
		MANIFEST
		README
		COPYING
		Changes
		Makefile.PL
		plib/Makeutils.pm
		ppport.h
		typemap
	) ;
	
	# xs
	push @expected, "$ModuleInfo{'root'}.xs" ;
	push @expected, find_recurse("xs", "*.xs") ;
	
	# t
	push @expected, find_recurse("t", "*.t") ;
	
	# scripts
	push @expected, @{$ModuleInfo{'programs'}} ;
	
	# Perl
	push @expected, find_recurse("lib", "*.pm") ;
	
	# C
	push @expected, find_recurse("clib", "*.c") ;
	push @expected, find_recurse("clib", "*.h") ;
	
	
	## Find any missing
	my @missing ;
	foreach my $file (@expected)
	{
		if (!exists($manifest{$file}))
		{
			push @missing, $file ;
		}
	}

	print "\nUpdating MANIFEST\n" ;
	print   "=================\n" ;



( run in 2.580 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )