pkgsrc-wip/ap-frontpage/patches/patch-aa
Eric Schnoebelen 7daec2a6bd cat DESCR
2003-06-03 16:38:35 +00:00

152 lines
4.4 KiB
Text

$NetBSD: patch-aa,v 1.1.1.1 2003/06/03 16:39:03 schnoebe Exp $
--- Makefile.PL.orig Tue Mar 12 15:07:07 2002
+++ Makefile.PL
@@ -9,14 +9,36 @@
# FP extensions 5.0 from Martin Blapp <mbr@freebsd.org>
#
-$flavor=`uname`;
-if (-e "/etc/mandrake-release") {$flavor="Mandrake";}
-
-if ($flavor eq "FreeBSD") { $thechoice="/usr/local/sbin/httpd";
-} elsif ($flavor eq "Mandrake") { $thechoice="/usr/sbin/httpd";
+use Symbol;
+use POSIX qw(:errno_h);
+use Cwd;
+
+$prefix= $ENV{PREFIX};
+if (!$prefix) {
+ $prefix = "/usr/pkg/";
+} else {
+ if ($prefix =~ /^(.*?)[\/]{1,}$/) {
+ $prefix = $1;
+ }
+}
+
+$ostype=`uname`;
+chop $ostype;
+if (-e "/etc/mandrake-release") {
+ $flavor="Mandrake";
+}
+
+if ($ostype eq "FreeBSD" && -e "$prefix/sbin/httpd") {
+ $thechoice="$prefix/sbin/httpd";
+} elsif ($ostype eq "NetBSD" && -e "$prefix/sbin/httpd") {
+ $thechoice="$prefix/sbin/httpd";
+} elsif ($ostype eq "SunOS" && -e "$prefix/sbin/httpd") {
+ $thechoice="$prefix/sbin/httpd";
+} elsif ($ostype eq "Linux" && -e "/usr/sbin/httpd") {
+ $thechoice="/usr/sbin/httpd";
} else {
print "Enter the path of your httpd binary.\n";
- print "It should be something like /usr/local/apache/bin).\n";
+ print "It should be something like $prefix/apache/bin).\n";
print "If you don't know, enter the word 'findit'. I will try to look\n";
print "for you... but it will take a few minutes.\n";
print "Your choice: ";
@@ -49,7 +71,6 @@ print "sbindir is $thechoice, trying to
$sbindir=$thechoice;
$apxs="$thechoice/apxs";
-$apachectl="$thechoice/apachectl";
$_=`file $apxs`;
if (/can't stat/) {die "\nSorry, can't find $apxs\n";}
print "Found!\n";
@@ -74,12 +95,6 @@ $tmpfile="/tmp/frontpage.$$";
open(FILE,"$tmpfile") or die "Can't find $tmpfile!\n";
print "Reading httpd.conf...\n";
while(<FILE>) {
- if (!$user && /^\s*User (\w*)/i) {
- $user=$1;
- }
- if (!$group && /^\s*Group (\w*)/i) {
- $group=$1;
- }
if (!$userdir && /^\s*UserDir (\w*)/i) {
$userdir=$1;
}
@@ -97,10 +112,10 @@ while(<FILE>) {
close(FILE);
`rm -f $tmpfile`;
-print "Apache user: $user, group: $group\n";
print "Userdir: $userdir\n";
print "ServerRoot: $serverroot\n";
print "ErrorLog: $errorlog\n";
+
$_=$errorlog;
if (/^\//) {
print "ErrorLog is absolute\n";
@@ -109,60 +124,22 @@ if (/^\//) {
$errorlog="$serverroot/$errorlog";
print "$errorlog\n";
}
-print "DocumentRoot: $documentroot\n";
-
-$_=`ls -dln $documentroot|cut -c 17-30`;
-if (/^(\d*)(\s*)(\d*)/) {
- $uid=$1; $gid=$3;
- print "Content uid $uid, gid $gid\n";
-}
-
-#
-# Check the user for sanity
-# Should be 48 for Mandrake, 80 for BSD
-
-if ($flavor eq "FreeBSD") { $defaultid=80;
-} elsif ($flavor eq "Mandrake") { $defaultid=48;
-} else { $defaultid=99; }
-
-if ($uid < $defaultid) {
- print "UID too low! Using default value 100\n";
- $uid=100;
-}
-if ($gid < $defaultid) {
- print "GID too low! Using default value 100\n";
- $gid=100;
-}
### Create Makefile
-$install=`which install`;
-chop $install;
open(MTMP,"Makefile.in") or die "Can't find Makefile.tmpl\n";
open(MAKF,"> Makefile") or die "Can't create Makefile\n";
print "Creating Makefile\n";
while(<MTMP>) {
-$_=~ s|\$\(apxs\)|$apxs|;
-$_=~ s|\$\(apachectl\)|$apachectl|;
-$_=~ s|\$\(cc\)|$cc|;
-$_=~ s|\$\(includedir\)|$includedir|;
-$_=~ s|\$\(cflags\)|$cflags|;
-$_=~ s|\$\(sbindir\)|$sbindir|;
-$_=~ s|\$\(install\)|$install|;
-#$_=~ s|\$\(\)|$|;
-#$_=~ s|\$\(\)|$|;
-$_=~ s|\$\(fpexec_uidcaller\)|$user|;
-$_=~ s|\$\(fpexec_gidcaller\)|$group|;
-$_=~ s|\$\(fpexec_uidmin\)|$uid|;
-$_=~ s|\$\(fpexec_gidmin\)|$gid|;
-$_=~ s|\$\(fpexec_logexec\)|$errorlog|;
-$_=~ s|\$\(fpexec_userdir\)|$userdir|;
-$_=~ s|\$\(fpexec_docroot\)|$documentroot|;
-$_=~ s|"\$\(fpexec_bin\)|\\\\\"$sbindir\/fpexec\\\\|;
-$_=~ s|"\$\(fpstatic_bin\)|\\\\\"$sbindir\/fpstatic\\\\|;
-$_=~ s|\$\(httpdconf\)|$httpdconf|;
-$_=~ s|\$\(libexecdir\)|$libexecdir|;
-if ($flavor eq "FreeBSD") { $_=~ s|root.root|root:wheel|;}
-print MAKF $_;
+ $_=~ s|\$\(apxs\)|$apxs|;
+ $_=~ s|\$\(cc\)|$cc|;
+ $_=~ s|\$\(includedir\)|$includedir|;
+ $_=~ s|\$\(cflags\)|$cflags|;
+ $_=~ s|\$\(fpexec_logexec\)|$errorlog|;
+ $_=~ s|\$\(fpexec_userdir\)|$userdir|;
+ $_=~ s|"\$\(fpexec_bin\)|\\\\\"$prefix\/sbin\/fpexec\\\\|;
+ $_=~ s|"\$\(fpstatic_bin\)|\\\\\"$prefix\/sbin\/fpstatic\\\\|;
+ $_=~ s|\$\(prefix\)|$prefix|;
+ if ($ostype =~ /NetBSD|FreeBSD/) { $_=~ s|root.root|root:wheel|;}
+ print MAKF $_;
}
-