diff options
author | Edwin Groothuis <edwin@FreeBSD.org> | 2003-01-17 07:19:34 +0000 |
---|---|---|
committer | Edwin Groothuis <edwin@FreeBSD.org> | 2003-01-17 07:19:34 +0000 |
commit | 86a8822091f7ce95cbc64b9132f73c6bde2c4a0c (patch) | |
tree | bfa476f91b3855920de4d6bfded9a829c0ec53ef /www/mod_v2h/files | |
parent | Update to 2.0.5. (diff) |
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>
Notes
Notes:
svn path=/head/; revision=73313
Diffstat (limited to 'www/mod_v2h/files')
-rw-r--r-- | www/mod_v2h/files/add-module | 61 | ||||
-rw-r--r-- | www/mod_v2h/files/files-Makefile | 26 |
2 files changed, 87 insertions, 0 deletions
diff --git a/www/mod_v2h/files/add-module b/www/mod_v2h/files/add-module new file mode 100644 index 000000000000..754fc6903924 --- /dev/null +++ b/www/mod_v2h/files/add-module @@ -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"; +} + + diff --git a/www/mod_v2h/files/files-Makefile b/www/mod_v2h/files/files-Makefile new file mode 100644 index 000000000000..cca2a129c9d9 --- /dev/null +++ b/www/mod_v2h/files/files-Makefile @@ -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 + |