New port: mod_v2h mass vhosting module for Apache

mod_v2h is a mass virtual hosting module for Apache, it
	uses mySQL for holding its data.  I needed to install on a
	system, so I figured I might as well write a port for it
	while I was at it :)

PR:		ports/37803
Submitted by:	hikari-chan <hikari@hikari.org.uk>
This commit is contained in:
Edwin Groothuis 2003-01-17 07:19:34 +00:00
parent 82449fb131
commit 86a8822091
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=73313
8 changed files with 147 additions and 0 deletions

View file

@ -208,6 +208,7 @@
SUBDIR += mod_ticket
SUBDIR += mod_trigger
SUBDIR += mod_tsunami
SUBDIR += mod_v2h
SUBDIR += mod_watch
# SUBDIR += mod_webapp-apache2
SUBDIR += mod_zap

44
www/mod_v2h/Makefile Normal file
View file

@ -0,0 +1,44 @@
# ports collection makefile for: mod_v2h
# Date created: 6th May 2002
# Whom: hikari-chan
#
# $FreeBSD$
#
PORTNAME= mod_v2h
PORTVERSION= 2.0
CATEGORIES= www
MASTER_SITES= http://www.fractal.net/files/
DISTNAME= mod_v2h
MAINTAINER= hikari@hikari.org.uk
BUILD_DEPENDS= ${LOCALBASE}/sbin/httpd:${PORTSDIR}/www/apache2 \
${LOCALBASE}/lib/mysql/libmysqlclient.so:${PORTSDIR}/databases/mysql323-client
RUN_DEPENDS= ${LOCALBASE}/sbin/httpd:${PORTSDIR}/www/apache2 \
${LOCALBASE}/lib/mysql/libmysqlclient.so:${PORTSDIR}/databases/mysql323-client
WRKSRC= ${WRKDIR}/$(DISTNAME)-2
USE_REINPLACE= yes
USE_PERL5_RUN= yes
post-patch:
${CP} ${FILESDIR}/add-module ${WRKSRC}
${CP} ${FILESDIR}/files-Makefile ${WRKSRC}/Makefile
${REINPLACE_CMD} \
-e 's,@@PERL@@,${PERL},g' \
-e 's,@@LOCAL@@,${LOCALBASE},g' \
${WRKSRC}/Makefile ${WRKSRC}/add-module
post-install:
@${ECHO_MSG} ""
@${ECHO_MSG} "===> Stripping ${LOCALBASE}/libexec/apache2/mod_v2h.so"
@${STRIP_CMD} ${LOCALBASE}/libexec/apache2/mod_v2h.so
@${ECHO_MSG} ""
@${ECHO_MSG} "---------------------------------------"
@${ECHO_MSG} "Remember to check the documentation on:"
@${ECHO_MSG} "http://www.fractal.net/mod_v2h.tm"
@${ECHO_MSG} "---------------------------------------"
@${ECHO_MSG} ""
.include <bsd.port.mk>

1
www/mod_v2h/distinfo Normal file
View file

@ -0,0 +1 @@
MD5 (mod_v2h.tar.gz) = 8333be4ea39c043ad0bdfe0950709d64

View file

@ -0,0 +1,61 @@
#!@@PERL@@
# This was stolen from the Apache apxs script
$CFG_SYSCONFDIR = "@@LOCAL@@/etc/apache2";
$CFG_TARGET = "httpd";
$name = "v2h";
$dir = "libexec/apache2/";
$t = "mod_v2h.so";
push(@lmd, sprintf("LoadModule %-18s %s", "${name}_module", "$dir$t"));
open(FP, "<$CFG_SYSCONFDIR/$CFG_TARGET.conf") || die("Couldn't open conf file");
my $content = join('', <FP>);
close(FP);
if ($content !~ m|\n#?\s*LoadModule\s+|) {
error("Activation failed for custom $CFG_SYSCONFDIR/$CFG_TARGET.conf file.");
error("At least one `LoadModule' directive already has to exist.");
exit(1);
}
my $lmd;
my $c = '';
foreach $lmd (@lmd) {
if ($content !~ m|\n#?\s*$lmd|) {
$content =~ s|^(.*\n#?\s*LoadModule\s+[^\n]+\n)|$1$c$lmd\n|sg;
} else {
$content =~ s|^(.*\n)#?\s*$lmd[^\n]*\n|$1$c$lmd\n|sg;
}
$lmd =~ m|LoadModule\s+(.+?)_module.*|;
notice("[activating module `$1' in $CFG_SYSCONFDIR/$CFG_TARGET.conf]");
}
my $amd;
foreach $amd (@amd) {
if ($content !~ m|\n#?\s*$amd|) {
$content =~ s|^(.*\n#?\s*AddModule\s+[^\n]+\n)|$1$c$amd\n|sg;
} else {
$content =~ s|^(.*\n)#?\s*$amd[^\n]*\n|$1$c$amd\n|sg;
}
}
if (@lmd or @amd) {
if (open(FP, ">$CFG_SYSCONFDIR/$CFG_TARGET.conf.new")) {
print FP $content;
close(FP);
system("cp $CFG_SYSCONFDIR/$CFG_TARGET.conf $CFG_SYSCONFDIR/$CFG_TARGET.conf.bak && " . "cp $CFG_SYSCONFDIR/$CFG_TARGET.conf.new $CFG_SYSCONFDIR/$CFG_TARGET.conf && " . "rm $CFG_SYSCONFDIR/$CFG_TARGET.conf.new");
} else {
notice("unable to open configuration file");
}
}
sub notice{
print STDERR "$_[0]\n";
}

View file

@ -0,0 +1,26 @@
APXS=${LOCALBASE}/sbin/apxs
PERL=@@PERL@@
RM=/bin/rm
CP=/bin/cp
MKDIR=/bin/mkdir
CXX=g++
CFLAGS+=-shared
EXTRA_INCLUDES+=-I${LOCALBASE}/include/mysql -I${LOCALBASE}/include/apache2
LIBS+=-lmysqlclient
LDFLAGS+=-L${LOCALBASE}/lib/mysql -Wl,-R,/usr/local/lib/mysql \
-Wl,-soname,mod_v2h.so
all:
$(CXX) $(CFLAGS) $(EXTRA_INCLUDES) $(LDFLAGS) $(LIBS) -o mod_v2h.so mod_v2h.cpp
install:
$(CP) mod_v2h.so ${LOCALBASE}/libexec/apache2/mod_v2h.so
$(PERL) add-module
$(MKDIR) -p ${LOCALBASE}/share/doc/mod_v2h
$(CP) README AUTHORS ${LOCALBASE}/share/doc/mod_v2h/
clean:
$(RM) -rf .libs
$(RM) -f mod_v2h.la

1
www/mod_v2h/pkg-comment Normal file
View file

@ -0,0 +1 @@
A mass virtual hosting module for Apache with support

9
www/mod_v2h/pkg-descr Normal file
View file

@ -0,0 +1,9 @@
mod_v2h is a mass virtual hosting module for Apache with support
for referencing translation paths from MySQL. mod_v2h also has
the ability to cache translation rules into a memory image for
faster performance.
WWW: http://www.fractal.net/mod_v2h.tm
- hikari-chan
hikari@hikari.org.uk

4
www/mod_v2h/pkg-plist Normal file
View file

@ -0,0 +1,4 @@
libexec/apache2/mod_v2h.so
%%PORTDOCS%%share/doc/mod_v2h/AUTHORS
%%PORTDOCS%%share/doc/mod_v2h/README
%%PORTDOCS%%@dirrm share/doc/mod_v2h