Mail-SpamCannibal

 view release on metacpan or  search on metacpan

DNSBLserver/Makefile.PL  view on Meta::CPAN

use ExtUtils::MakeMaker;
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.

##########################################################
##         if built from a parent directory,             #
##    at install, the parent Makefile must execute       #
##                                                       #
##       as the first step in the install process        #
##  @cd DNSBLserver && $(MAKE) install_daemon $(PASTHRU) #    
##                                                       #
##       as the step immediately following 'all'         #
##  @cd DNSBLserver && $(MAKE) clean_CTest $(PASTHRU)    #
##                                                       #
##########################################################

use Config;
use vars qw($CONFIG);
use Cwd qw(abs_path getcwd);
IPTables::IPv4::DBTarpit::SiteConfig;
use IPTables::IPv4::DBTarpit::Inst qw(:all);

my $conf = 'config.db';
my $home = abs_path('./');
my $pwd = getcwd();
my $localconf = $home .'/'. $conf;

# what to do with dialog if called from MAKE or parent Makefile
my $configtxt;

if ((caller)[0]) {      # exists, the called by another routine
  my $master = abs_path('../').'/'.$conf;
  hard_fail("failed to access $_")
        if ($_ = cpfromto($master,$localconf));

  $CONFIG = do $localconf;
  $configtxt = make_text($CONFIG);
}
# If rebuilding the make file, skip the dialog
elsif (join(' ',@INC) =~ /$home/) {     # checkfor rebuild flag
  $CONFIG = do $localconf;
  $configtxt = make_text($CONFIG);
} else {
  $configtxt = do 'inst/dialog.pl';
  $CONFIG = do 'config.db';
}

my $pmname = 'DNSBLserver.pm';
open(V,$pmname)
	or hard_fail("could not open $pmname to get version number");
my $c_version;
while (<V>) {
  next unless $_ =~ /\$VERSION.+(char[^;]+;)/;
  $c_version = $1;
  last;
}
close V;
hard_fail("could not find version number in $pmname")
	unless $c_version;
hard_fail("could not open 'c_version.h' for local write")
	unless open(H,'>./c_version.h');
print H qq|
/*	c_version.h
 *
 *	Do not edit this file. It was automatically created by
 *	Makefile.PL and contains the most recent version number
 */
$c_version
|;
close H;

my $BDBTARPIT_CONF = new IPTables::IPv4::DBTarpit::SiteConfig;
my $objects	= 'host_info.o main.o netio.o ns.o util_pid.o zonefile.o';
my $daemon	= 'dnsbls';
my $rcfile	= 'rc.'.$daemon;

my $include = '-I'. $BDBTARPIT_CONF->{DBTP_INCLUDE_DIR};
my $extralibs = '-L'. $BDBTARPIT_CONF->{DBTP_LIBRARY_DIR};

WriteMakefile(
    'NAME'		=> 'Mail::SpamCannibal::DNSBLserver::CTest',
    'DISTNAME'		=> 'Mail-SpamCannibal-DNSBLserver',
    'VERSION_FROM'	=> $pmname, # finds $VERSION
    'PM'		=> {'DNSBLserver.pm' => '$(INST_LIB)/Mail/SpamCannibal/DNSBLserver.pm'},
    'MAN1PODS'		=> {$daemon .'.pod' => '$(INST_MAN1DIR)/'. $daemon .'.$(MAN1EXT)',},
    'MAN3PODS'		=> { 'DNSBLserver.pm' => '$(INST_MAN3DIR)/Mail::SpamCannibal::DNSBLserver.$(MAN3EXT)'},
    'LIBS'		=> ['-ldb -lresolv '. $extralibs . ' -ldbtarpit'], # e.g., '-lm'
    'DEFINE'		=> '', # e.g., '-DHAVE_SOMETHING'
	# Insert -I. if you add *.h files later:
    'INC'		=> "$include", # e.g., '-I/usr/include/other'
	# Un-comment this if you add C files to link with later:



( run in 1.840 second using v1.01-cache-2.11-cpan-b16cb0d3907 )