summaryrefslogtreecommitdiff
path: root/www/neowebscript/files
diff options
context:
space:
mode:
authorMikhail Teterin <mi@FreeBSD.org>2001-10-28 08:37:27 +0000
committerMikhail Teterin <mi@FreeBSD.org>2001-10-28 08:37:27 +0000
commit40df45352156d24ae7ab2105eaf4b894900455f0 (patch)
tree5f9afb850e66875f994e795c1cb436bef20eb4b3 /www/neowebscript/files
parentPrevent build from breaking when the user has incompatible version of (diff)
NeoWebScript[tm] is a module for the Apache webserver that allows you to
embed the Tcl/Tk programming language in your webpages as a scripting tool. It was invented by Karl Lehenbauer, NeoSoft's Chief Technical Officer, and documented, enhanced and extended by NeoSoft's programmers and technical writers. WWW: http://www.sourceforge.net/projects/nws/ The changes: . don't build the Apache, TclX, gd, db, neo-tcl bundled in the tarball, but use those that are installed by their ports . don't generate GIFs -- use PNGs . look in /var/log for Apache's log file . use /var/db/neowebscript for caches and per-user databases . expose some configuration knobs into the neowebscript.conf -- there should be no need to edit init.tcl itself anymore All of the bundled demos work, except for the gd-based banner generator. The demo code uses Gdtclft commands that don't exist in the modern Gdtclft.
Notes
Notes: svn path=/head/; revision=49283
Diffstat (limited to 'www/neowebscript/files')
-rw-r--r--www/neowebscript/files/Makefile.bsd18
-rw-r--r--www/neowebscript/files/Makefile.lib35
-rw-r--r--www/neowebscript/files/neowebscript.conf45
-rw-r--r--www/neowebscript/files/patch-common19
-rw-r--r--www/neowebscript/files/patch-db29
-rw-r--r--www/neowebscript/files/patch-docs9
-rw-r--r--www/neowebscript/files/patch-gd12
-rw-r--r--www/neowebscript/files/patch-init62
-rw-r--r--www/neowebscript/files/patch-neoscript54
9 files changed, 283 insertions, 0 deletions
diff --git a/www/neowebscript/files/Makefile.bsd b/www/neowebscript/files/Makefile.bsd
new file mode 100644
index 000000000000..6ab4574d374b
--- /dev/null
+++ b/www/neowebscript/files/Makefile.bsd
@@ -0,0 +1,18 @@
+MODULES=neoscript neo_userdir log_neo auth_tcl # neo_include
+
+.SUFFIXES:
+.SUFFIXES: .so .c
+
+.c.so:
+ ${MAKE} -f ${FILESDIR}/Makefile.lib SRCS=${.ALLSRC}
+
+all: ${MODULES:%=mod_%.so}
+
+SYSCONFDIR!= ${PREFIX}/sbin/apxs -q SYSCONFDIR
+
+install:
+ ${INSTALL_DATA} ${MODULES:%=mod_%.so} ${PREFIX}/libexec/apache/
+#.for m in ${MODULES}
+# ${PREFIX}/sbin/apxs -e -A -n $m ${PREFIX}/libexec/apache/mod_$m.so
+#.endfor
+ cp -Rp ${.CURDIR}/../neowebscript ${PREFIX}/share/
diff --git a/www/neowebscript/files/Makefile.lib b/www/neowebscript/files/Makefile.lib
new file mode 100644
index 000000000000..bc014befe903
--- /dev/null
+++ b/www/neowebscript/files/Makefile.lib
@@ -0,0 +1,35 @@
+TCL_VERSION?=8.3
+TCL_NDVER?=${TCL_VERSION:S/.//} # same, but without the dot
+
+PREFIX?= /usr/local
+
+INCLUDES= -I${PREFIX}/include/apache \
+ -I${PREFIX}/include/tcl${TCL_VERSION} \
+ -I${PREFIX}/include
+
+CC!= ${PREFIX}/sbin/apxs -q CC
+CFLAGS!= ${PREFIX}/sbin/apxs -q CFLAGS CFLAGS_SHLIB
+CFLAGS+= ${INCLUDES} -DGDTCL
+# Ridiculous!
+#CFLAGS+= -Dneo_log_module=log_neo_module \
+# -Dtcl_auth_module=auth_tcl_module
+
+SHLIB_NAME= ${SRCS:R}.so
+
+LDADD= -L${PREFIX}/lib -ltcl${TCL_NDVER} -lm
+
+USE_DB!= grep -l db.h ${.CURDIR}/${SRCS}
+.if !empty(USE_DB)
+LDADD+= -ldb2
+.endif
+
+#LDFLAGS= ${LDADD}
+
+NOPROFILE= True # to avoid building profiled library
+INTERNALLIB= True # to avoid building a static version
+
+NOMAN= True # don't bother with the man-page here, let the port handle it
+
+all: ${SHLIB_NAME}
+
+.include <bsd.lib.mk>
diff --git a/www/neowebscript/files/neowebscript.conf b/www/neowebscript/files/neowebscript.conf
new file mode 100644
index 000000000000..f192a623b3ac
--- /dev/null
+++ b/www/neowebscript/files/neowebscript.conf
@@ -0,0 +1,45 @@
+####
+#### NeoWebScript-specific Apache configuration lines
+#### (uncomment to activate)
+####
+
+LoadModule neoscript_module libexec/apache/mod_neoscript.so
+#LoadModule neo_userdir_module libexec/apache/mod_neo_userdir.so
+#LoadModule log_neo_module libexec/apache/mod_log_neo.so
+#LoadModule auth_tcl_module libexec/apache/mod_auth_tcl.so
+
+## Enable the NeoWebScript handler
+AddType text/html .nhtml .nws
+AddHandler neo-server-parsed .nhtml .nws
+
+## Enable the NeoWebScript subst handler
+AddType text/html .shtml
+AddHandler neo-server-subst .shtml
+DirectoryIndex index.nhtml
+
+## Enable these two lines if you want GD Image Generation support turned on.
+AddType image/png .gd
+AddHandler neo-generate-image .gd
+
+## Comment this lines out to disable nws-common in VirtualHosts
+Alias /nws/ /usr/local/share/doc/neowebscript/
+Alias /neowebscript/ /usr/local/share/doc/neowebscript/
+Alias /nws-common/ /usr/local/share/doc/neowebscript/nws-common/
+
+#### End of NeoWebScript configuration ####
+###########################################
+
+<Directory /usr/local/share/doc/neowebscript>
+ Options Includes
+</Directory>
+
+# Uncomment and modify this to change the default locations.
+# This is where the user-specific and system-wide database files
+# will be created. You'll need to create this directories
+# manually and set the apropriate permissions:
+
+#NeoWebDirConf parallelUserBase /var/db/neowebscript/users
+#NeoWebDirConf parallelSystemBase /var/db/neowebscript/system
+
+# To turn debugging on uncomment:
+#NeoWebDirConf debugging 1
diff --git a/www/neowebscript/files/patch-common b/www/neowebscript/files/patch-common
new file mode 100644
index 000000000000..2dd036c4c2bd
--- /dev/null
+++ b/www/neowebscript/files/patch-common
@@ -0,0 +1,19 @@
+--- ../neowebscript/common.tcl Fri Nov 19 19:36:10 1999
++++ ../neowebscript/common.tcl Mon Sep 3 13:32:49 2001
+@@ -31,7 +31,7 @@
+
+ if {[catch {mkdir -path $parallelDir$plusSubDir} result] == 1} {
+ if {[lrange $errorCode 0 1] != "POSIX EEXIST"} {
+- error "$errorCode"
++ error "can not create $parallelDir $plusSubDir: $errorCode"
+ }
+ }
+ }
+@@ -512 +512,7 @@
+ }
++
++proc emit_full_header {title} {
++ html <HTML><HEAD><TITLE>
++ html $title
++ html </TITLE><HEAD>
++}
diff --git a/www/neowebscript/files/patch-db b/www/neowebscript/files/patch-db
new file mode 100644
index 000000000000..02edd6c63025
--- /dev/null
+++ b/www/neowebscript/files/patch-db
@@ -0,0 +1,29 @@
+--- ../neowebscript/db.tcl Fri Nov 19 19:36:10 1999
++++ ../neowebscript/db.tcl Mon Sep 3 14:02:50 2001
+@@ -6,6 +6,8 @@
+ # for the trusted interp
+ #
+
++package require Neo
++
+ proc dbtransaction {code args} {
+ global errorCode parallelDir webenv
+
+@@ -115,7 +117,7 @@
+ if {[catch {db open $dbFileName hash cl 0664} db] == 1} {
+ create_user_dir db
+ if {[catch {db open $dbFileName hash cl 0664} db] == 1} {
+- return -code error "$dbFileName: $errorCode" $errorInfo
++ return -code error "$dbFileName: $errorCode $errorInfo"
+ }
+ }
+
+@@ -271,7 +273,7 @@
+ if {[catch {db open $dbFileName hash cl 0664} db] == 1} {
+ create_user_dir db
+ if {[catch {db open $dbFileName hash cl 0664} db] == 1} {
+- return -code error "$dbFileName: $errorCode" $errorInfo
++ return -code error "$dbFileName: $errorCode $errorInfo"
+ }
+ }
+
diff --git a/www/neowebscript/files/patch-docs b/www/neowebscript/files/patch-docs
new file mode 100644
index 000000000000..d08c049f7897
--- /dev/null
+++ b/www/neowebscript/files/patch-docs
@@ -0,0 +1,9 @@
+--- ../htdocs/index.nhtml Tue Jul 25 00:12:50 2000
++++ ../htdocs/index.nhtml Mon Sep 3 13:04:23 2001
+@@ -36,4 +36,4 @@
+
+-if {[file exists manual]} {
+- html "Local Apache <a href=manual/>Documentation</a><p>"
++if {[file isdirectory $webenv(DOCUMENT_ROOT)/manual]} {
++ html "Local Apache <a href=/manual/>Documentation</a><p>"
+ }
diff --git a/www/neowebscript/files/patch-gd b/www/neowebscript/files/patch-gd
new file mode 100644
index 000000000000..46f27353594d
--- /dev/null
+++ b/www/neowebscript/files/patch-gd
@@ -0,0 +1,12 @@
+--- ../neowebscript/image.tcl Fri Nov 19 19:36:10 1999
++++ ../neowebscript/image.tcl Mon Sep 3 14:22:03 2001
+@@ -8,4 +8,6 @@
+ #
+
++package require Gdtclft
++
+ proc send_image_request {safeInterp} {
+ global webenv imageInfo
+@@ -25,1 +27,1 @@
+- load {} Gd $safeInterp
++ load {} Gdtclft $safeInterp
diff --git a/www/neowebscript/files/patch-init b/www/neowebscript/files/patch-init
new file mode 100644
index 000000000000..6858adf950a3
--- /dev/null
+++ b/www/neowebscript/files/patch-init
@@ -0,0 +1,62 @@
+--- ../neowebscript/init.tcl Wed Nov 24 19:47:41 1999
++++ ../neowebscript/init.tcl Sun Oct 28 03:07:00 2001
+@@ -18,5 +18,10 @@
+ #
+
+-set debugging 1
++package require Tclx
++if {[info exists NeoWebDirConf(debugging)]} {
++ set debugging $NeoWebDirConf(debugging)
++} else {
++ set debugging 0
++}
+ catch {rename copyfile ""}
+ catch {rename unsupported0 copyfile}
+@@ -25,9 +30,17 @@
+ set binPath [file join $server(SERVER_ROOT) bin]
+ set libPath [file join $server(SERVER_ROOT) lib]
+-set nwsPath [file join $server(SERVER_ROOT) neowebscript]
+-set logPath [file join $server(SERVER_ROOT) logs]
++set nwsPath [file dirname [info script]]
++set logPath /var/log
+
+-set parallelUserBase [file join $server(SERVER_ROOT) neowebscript neoscript-data users]
+-set parallelSystemBase [file join $server(SERVER_ROOT) neowebscript neoscript-data system]
++if {[info exists NeoWebDirConf(parallelUserBase)]} {
++ set parallelUserBase $NeoWebDirConf(parallelUserBase)
++} else {
++ set parallelUserBase /var/db/neowebscript/users
++}
++if {[info exists NeoWebDirConf(parallelSystemBase)]} {
++ set parallelSystemBase $NeoWebDirConf(parallelSystemBase)
++} else {
++ set parallelSystemBase /var/db/neowebscript/system
++}
+
+ set nwsLocalPath [file join $nwsPath nwslocal]
+@@ -299,5 +312,5 @@
+ set bytesPerLogEntry 131
+
+- set fp [open [file join $logPath access_log]]
++ set fp [open [file join $logPath httpd-access.log]]
+ set size [fstat $fp size]
+ set offset [expr $size - $hitsInInterval * $bytesPerLogEntry]
+@@ -313,5 +326,10 @@
+ if {$result < 0} {return 0}
+
+- set ET [expr [clock seconds] - [lindex $line 0]]
++ if {![regexp {\[([[:digit:]]{1,2})/(...)/([[:digit:]]{4}):([[:digit:]]{2}:[[:digit:]]{2}:[[:digit:]]{2})} \
++ [lindex $line 3] j day month year time]} {
++ return "unable to parse the log entry"
++ }
++
++ set ET [expr [clock seconds] - [clock scan "$time $month $day $year"]]
+ return [expr ($hitsInInterval * 3600) / $ET]
+ }
+@@ -404,4 +422,6 @@
+ $safeInterp alias remote_hostname remote_hostname
+ $safeInterp alias gm_timestr_822 gm_timestr_822
++
++ $safeInterp alias emit_full_header emit_full_header
+
+ if [interp issafe $safeInterp] {
diff --git a/www/neowebscript/files/patch-neoscript b/www/neowebscript/files/patch-neoscript
new file mode 100644
index 000000000000..ceca90785f39
--- /dev/null
+++ b/www/neowebscript/files/patch-neoscript
@@ -0,0 +1,54 @@
+--- mod_neoscript.c Fri Jul 21 19:49:29 2000
++++ mod_neoscript.c Fri Aug 17 11:41:58 2001
+@@ -68,1 +68,1 @@
+-#include <db.h>
++#include <db2/db.h>
+@@ -72,3 +72,5 @@
+ #include "tcl.h"
+-#include "tclExtend.h"
++#ifdef STATIC_TCLX
++# include "tclExtend.h"
++#endif
+
+@@ -862,2 +864,3 @@
+
++#ifdef STATIC_TCLX
+ /* Extended Tcl */
+@@ -871,2 +874,3 @@
+ /* Tclx does its own call to Tcl_StaticPackage */
++#endif
+
+@@ -908,6 +908,6 @@
+ #endif
+
+-#ifdef GDTCL
+- /* GIF generation*/
++#ifdef STATIC_GDTCL
++ /* Image generation */
+ if (Gd_Init(interp) == TCL_ERROR) {
+ fprintf(stderr,
+@@ -916,2 +920,3 @@
+
++#ifdef STATIC_NEO
+ /* NeoSoft Extensions */
+@@ -924,2 +929,3 @@
+ Tcl_StaticPackage(interp, "Neo", Neo_Init, NULL);
++#endif
+
+@@ -956 +956 @@
+- ap_server_root_relative(p, "neowebscript/init.tcl"), (char *)NULL)
++ ap_server_root_relative(p, "share/neowebscript/init.tcl"), (char *)NULL)
+@@ -1687,2 +1687,3 @@
+- srand((int)(getpid() * 17 + time((long *) 0)));
+- for (whichLine = rand() % nLines; whichLine-- >= 0; ) {
++ /* Use BSD's random(4) device and the random(3) functions */
++ srandomdev();
++ for (whichLine = random() % nLines; whichLine-- >= 0; ) {
+@@ -2164 +2165,6 @@
+- if (!(ap_allow_options(r) & OPT_INCLUDES)) return DECLINED;
++ if (!(ap_allow_options(r) & OPT_INCLUDES)) {
++ ap_log_rerror(APLOG_MARK, APLOG_ERR, r, "Apache configuration "
++ "does not allow SSI parsing for ``%s''",
++ r->filename, mode);
++ return DECLINED;
++ }