1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-02-01 10:59:55 +00:00

Fix build by removing the perl config script and using OPTIONS instead.

Submitted by:	Autrijus Tang <autrijus@autrijus.org>
This commit is contained in:
Mathieu Arnold 2004-10-25 11:47:19 +00:00
parent f436a96993
commit ba23b77303
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=120133
2 changed files with 33 additions and 196 deletions

View File

@ -7,6 +7,7 @@
PORTNAME= Log-Dispatch
PORTVERSION= 2.10
PORTREVISION= 1
CATEGORIES= devel perl5
MASTER_SITES= ${MASTER_SITE_PERL_CPAN}
MASTER_SITE_SUBDIR= Log
@ -18,11 +19,6 @@ COMMENT= A suite of OO modules for logging messages to multiple outputs
BUILD_DEPENDS+= ${SITE_PERL}/${PERL_ARCH}/Params/Validate.pm:${PORTSDIR}/devel/p5-Params-Validate
RUN_DEPENDS= ${BUILD_DEPENDS}
.if !defined(BATCH)
IS_INTERACTIVE= yes
.endif
USE_SUBMAKE= yes
PERL_MODBUILD= yes
MAN3= Log::Dispatch.3 \
@ -40,24 +36,45 @@ MAN3= Log::Dispatch.3 \
Log::Dispatch::Screen.3 \
Log::Dispatch::Syslog.3
SCRIPTS_ENV+= WRKDIRPREFIX="${WRKDIRPREFIX}" \
MKDIR="${MKDIR}" \
REALCURDIR="${.CURDIR}"
OPTIONS= APACHELOG "Apache::Log support" off \
EMAIL_MIMELITE "MIME::Lite support" off \
EMAIL_MAILSEND "Mail::Send support" off \
EMAIL_MAILSENDMAIL "Mail::Sendmail support" on \
MAIL_SENDER "Mail::Sender support" off
.if !defined(NOPORTDOCS)
PORTDOCS= Changes README
post-install:
@${MKDIR} ${DOCSDIR}
@${INSTALL_DATA} ${PORTDOCS:S|^|${WRKSRC}/|} ${DOCSDIR}
@${ECHO_MSG} "===> Documentation installed in ${DOCSDIR}."
.endif
.include <bsd.port.pre.mk>
.if ${OSVERSION} >= 502126
BROKEN= Build fails
.if defined(WITH_APACHELOG)
.if defined(WITH_APACHE2)
BUILD_DEPENDS+= ${LOCALBASE}/libexec/apache2/mod_perl.so:${PORTSDIR}/www/mod_perl2
.else
BUILD_DEPENDS+= ${LOCALBASE}/libexec/apache/libperl.so:${PORTSDIR}/www/mod_perl
.endif
.endif
pre-fetch:
@${SETENV} ${SCRIPTS_ENV} ${PERL} ${SCRIPTDIR}/configure.pl
.if defined(WITH_EMAIL_MIMELITE)
BUILD_DEPENDS+= ${SITE_PERL}/MIME/Lite.pm:${PORTSDIR}/mail/p5-MIME-Lite
.endif
post-clean:
@${RM} -f ${WRKDIRPREFIX}${.CURDIR}/Makefile.inc
.if defined(WITH_EMAIL_MAILSEND)
BUILD_DEPENDS+= ${SITE_PERL}/Mail/Send.pm:${PORTSDIR}/mail/p5-Mail-Tools
.endif
.if exists(${WRKDIRPREFIX}${.CURDIR}/Makefile.inc)
.include "${WRKDIRPREFIX}${.CURDIR}/Makefile.inc"
.if defined(WITH_EMAIL_MAILSENDMAIL)
BUILD_DEPENDS+= ${SITE_PERL}/Mail/Sendmail.pm:${PORTSDIR}/mail/p5-Mail-Sendmail
.endif
.if defined(WITH_MAIL_SENDER)
BUILD_DEPENDS+= ${SITE_PERL}/Mail/Sender.pm:${PORTSDIR}/mail/p5-Mail-Sender
.endif
.include <bsd.port.post.mk>

View File

@ -1,180 +0,0 @@
#! /usr/bin/perl -w
# $FreeBSD$
use strict;
unless (defined $ENV{WRKDIRPREFIX} and
defined $ENV{REALCURDIR} and
defined $ENV{MKDIR} and
defined $ENV{LOCALBASE})
{
die "this script should not be run like that!\n";
}
my $batch = $ENV{BATCH} || 0;
my $makedir = "$ENV{WRKDIRPREFIX}$ENV{REALCURDIR}";
my $makefile = "$makedir/Makefile.inc";
my $mkdircmd = $ENV{MKDIR};
exit if -f $makefile;
my @modules = (
{
module => 'ApacheLog',
check => 'Apache::Log',
# file => '${PERL_ARCH}/Apache/Log.pm',
port => 'www/mod_perl',
# man3 => 'Log::Dispatch::ApacheLog',
},
{
module => 'Email::MIMELite',
check => 'MIME::Lite',
port => 'mail/p5-MIME-Lite',
},
{
module => 'Email::MailSend',
check => 'Mail::Send',
port => 'mail/p5-Mail-Tools',
},
{
module => 'Email::MailSendmail',
check => 'Mail::Sendmail',
port => 'mail/p5-Mail-Sendmail',
},
{
module => 'Mail::Sender',
check => 'Mail::Sender',
port => 'mail/p5-Mail-Sender',
},
{
module => 'Syslog',
check => 'Sys::Syslog',
port => 'base perl',
nodepend=> 1,
}
);
scan_modules(@modules);
@modules = select_modules(@modules);
generate_makefile_inc(@modules);
exit;
sub generate_makefile_inc
{
my @modules = @_;
system("$mkdircmd $makedir");
open INC, "> $makefile" or die "open: $makefile: $!\n";
for my $m (@modules) {
next if $m->{nodepend};
my $mpath = $m->{found} || "/nonexistent";
$mpath = varify_hardcoded_paths($mpath);
my $port = $m->{port};
print INC "BUILD_DEPENDS+= $mpath:\${PORTSDIR}/$port\n";
}
close INC;
}
sub varify_hardcoded_paths
{
local ($_) = @_;
s|(perl5/site_perl/)([\d._]+)/|$1\${PERL_VER}/|;
s|(perl5/site_perl/\${PERL_VER}/)mach/|$1\${PERL_ARCH}/|;
s|^$ENV{LOCALBASE}/|\${LOCALBASE}/|;
$_;
}
sub got_module
{
my ($m) = @_;
$m =~ s|::|/|g;
$m .= ".pm";
for (@INC) {
my $f = "$_/$m";
return $f if -r $f;
}
return 0;
}
sub scan_modules
{
my @modules = @_;
for my $module (@modules) {
$module->{found} = got_module($module->{check});
}
}
sub select_modules
{
my @modules = @_;
my @selected;
if ($batch) {
@selected = batch_select(@_);
} else {
@selected = ask_user(@_);
}
my @mod;
my %modules = map { $_->{module} => $_ } @modules;
for my $module (@selected) {
push @mod, $modules{$module} if exists $modules{$module};
}
@mod;
}
sub batch_select
{
my @modules = @_;
my @selected;
for my $module (@modules) {
push @selected, $module->{module} if $module->{found};
}
@selected;
}
sub ask_user
{
my @modules = @_;
my @dlg;
push @dlg, "/usr/bin/dialog";
push @dlg, "--title", "Log::Dispatch configuration";
push @dlg, "--clear", "--checklist", <<EOF;
Log::Dispatch distribution provides several predefined output objects.
Select output objects you will likely need. Those output objects for
which no extra software packages need to be installed are preselected.
Please choose options by pressing SPACE to TOGGLE on option ON/OFF
EOF
push @dlg, -1, -1, 9;
for my $module (@modules) {
push @dlg, $module->{module}, "requires $module->{check}" .
($module->{found} ? " (already installed)" : ""),
($module->{found} ? "ON" : "OFF");
}
my @selected;
my $pid = open(RESULT, "-|");
if ($pid) {
# parent
my $r = "";
while (<RESULT>) {
$r .= $_;
}
close(RESULT) or die "dialog(1) exited with non-zero return code\n";
$r =~ s/"//g;
$r =~ s/\s+/ /g;
@selected = split ' ', $r;
} elsif (defined $pid) {
# child
open XCHG, ">& STDOUT" or die "dup: $!\n";
open STDOUT, ">& STDERR" or die "dup: $!\n";
open STDERR, ">& XCHG" or die "dup: $!\n";
close XCHG if fileno(XCHG) > 2;
exec @dlg or die "cannot exec: $!\n";
} else {
die "cannot fork: $!\n";
}
return @selected;
}