Bring to the latest version. Link all of the little external libraries

needed by the tclhttpd into one file. I submitted this back in December,
but nobody cared since. Now I can commit this myself :)

PR:		ports/23310
Submitted by:	mi
This commit is contained in:
Mikhail Teterin 2001-02-07 22:36:13 +00:00
parent 09be483e35
commit cf390065f5
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=38084
13 changed files with 154 additions and 148 deletions

View file

@ -1,4 +1,4 @@
# New ports collection makefile for: thttpd
# New ports collection makefile for: thttpd
# Date created: 27 Apr 2000
# Whom: Mikhail Teterin <mi@aldan.algebra.com>
#
@ -6,7 +6,7 @@
#
PORTNAME= tclhttpd
PORTVERSION= 3.0.3
PORTVERSION= 3.2.1
CATEGORIES= www tcl${TCL_VER}
MASTER_SITES= ${MASTER_SITE_TCLTK}
MASTER_SITE_SUBDIR= httpd
@ -14,7 +14,7 @@ DISTNAME= ${PORTNAME}${PORTVERSION}
MAINTAINER= mi@aldan.algebra.com
RUN_DEPENDS= ${LOCALBASE}/lib/tcllib0.4/pkgIndex.tcl:${PORTSDIR}/devel/tcllib
RUN_DEPENDS= ${LOCALBASE}/lib/tcllib0.8/pkgIndex.tcl:${PORTSDIR}/devel/tcllib
LIB_DEPENDS= tcl${TCL_VER}:${PORTSDIR}/lang/tcl${TCL_VER}
TCL_DVER?= 8.3
@ -23,38 +23,35 @@ GNU_CONFIGURE= yes
CONFIGURE_ARGS= --with-tcl="${LOCALBASE}/lib/tcl${TCL_DVER}" \
--with-tclinclude="${LOCALBASE}/include/tcl${TCL_DVER}"
PLIST_SUB+= TCL_VER=${TCL_VER} PORTVERSION=${PORTVERSION} \
"LIBSUF=`echo ${PORTOBJFORMAT} | ${SED} -e s/elf/1/ -e s/aout/1.0/`"
RCD= ${LOCALBASE}/etc/rc.d/tclhttpd.sh
SCRIPTS_ENV+= LOCALBASE=${LOCALBASE} WRKSRC=${WRKSRC}} \
CFLAGS="${CFLAGS}" TCL_DVER=${TCL_DVER} \
TCL_VER=${TCL_VER}
.include <bsd.port.pre.mk>
SHLIB_NAME!= ${MAKE} -f "${FILESDIR}/Makefile.lib" ech
PLIST_SUB+= TCL_VER=${TCL_VER} PORTVERSION=${PORTVERSION} \
SHLIB_NAME=${SHLIB_NAME}
do-build:
cd ${WRKSRC} && ${MAKE} -j 2 TCL_DVER="${TCL_DVER}" \
FILESDIR="${FILESDIR}" -f "${FILESDIR}/Makefile.lib"
pre-install:
${MKDIR} ${LOCALBASE}/tclhttpd/custom
post-install:
test -e ${RCD} || ${SED} \
"s%COMMAND_LINE%${LOCALBASE}/bin/tclsh${TCL_DVER} ${PREFIX}/bin/httpd.tcl%" \
< ${FILESDIR}/tclhttpd.sh > ${RCD}
${MKDIR} ${LOCALBASE}/${PORTNAME}${PORTVERSION}
${CHOWN} -R nobody ${LOCALBASE}/share/${PORTNAME}${PORTVERSION}
#${LN} -sf ${LOCALBASE}/share/${PORTNAME}${PORTVERSION} \
#${LN} -sf ${LOCALBASE}/share/${PORTNAME} \
# ${LOCALBASE}/${PORTNAME}${PORTVERSION}/htdocs
${CHMOD} +x ${RCD}
${INSTALL_DATA} ${WRKSRC}/src/libcrypt.so.* \
${WRKSRC}/src/liblimit.so.* ${WRKSRC}/src/libsetuid.so.* \
${LOCALBASE}/lib/${PORTNAME}${PORTVERSION}/
${INSTALL_DATA} ${WRKSRC}/${SHLIB_NAME} \
${LOCALBASE}/lib/${PORTNAME}${PORTVERSION}/${SHLIB_NAME}
${INSTALL_SCRIPT} ${WRKSRC}/bin/httpd.tcl \
${WRKSRC}/bin/httpdthread.tcl ${LOCALBASE}/bin/
${INSTALL_DATA} ${WRKSRC}/bin/tclhttpd.rc ${LOCALBASE}/etc/
${CAT} ${FILESDIR}/pkgIndex.tcl >> \
${SED} 's%@LIB@%${SHLIB_NAME}%g' < \
${FILESDIR}/pkgIndex.tcl >> \
${LOCALBASE}/lib/${PORTNAME}${PORTVERSION}/pkgIndex.tcl
for f in ${LOCALBASE}/lib/${PORTNAME}${PORTVERSION}/lib*.so.* ; \
do \
${LN} -sf `basename $$f` \
`echo $$f | ${SED} 's@\(.*\.so\)\..*@\1@'` ; \
done
do-build: # empty -- everything done by ${SCRIPTDIR}/pre-build
.include <bsd.port.mk>
.include <bsd.port.post.mk>

View file

@ -1 +1 @@
MD5 (tclhttpd3.0.3.tar.gz) = d2b48707b786cf560c03740eb3557d50
MD5 (tclhttpd3.2.1.tar.gz) = 0b628a24333419532142242a286773c4

View file

@ -0,0 +1,20 @@
TCL_DVER?= 8.3
TCL_VER= ${TCL_DVER:S/.//}
SRCS=crypt.c setuid.c limit.c utime.c metaPackage.c
CFLAGS+=-I${LOCALBASE}/include/tcl${TCL_DVER} -DUSE_TCL_STUBS \
-DTclhttpdbin_Init=${LIB}_Init -Wall -Werror
LDADD+=-L${PREFIX}/lib -ltclstub${TCL_VER} -lcrypt
.PATH: ${.CURDIR}/src ${FILESDIR}
LIB= Tclhttpdbin
SHLIB_NAME= lib${LIB}.so
INTERNALLIB= no need for static version
NOPROFILE= no need for profiling this
ech:
@echo ${SHLIB_NAME}
.include <bsd.lib.mk>

View file

@ -0,0 +1,13 @@
#include <tcl.h>
Tcl_PackageInitProc Crypt_Init, Limit_Init, Setuid_Init, Utime_Init;
int Tclhttpdbin_Init(Tcl_Interp *I) {
Crypt_Init(I);
Limit_Init(I);
Setuid_Init(I);
Utime_Init(I);
return TCL_OK;
}

View file

@ -15,8 +15,3 @@
-install: all install-binaries install-libraries install-doc
+install: all install-libraries install-doc
@@ -315,3 +315,3 @@
installdirs:
- $(mkinstalldirs) $(pkglibdir) $(cryptlibdir) $(prefix)/bin $(htdocsdir)
+ $(mkinstalldirs) $(pkglibdir) $(prefix)/bin $(htdocsdir)

View file

@ -1,30 +1,5 @@
--- bin/httpd.tcl Wed Jun 14 13:25:50 2000
+++ bin/httpd.tcl Wed Jun 21 15:59:34 2000
@@ -82,21 +82,9 @@
# Search around for the Standard Tcl Library
-if {![catch {package require base64 2.0}]} {
- # Already available in environment
-} elseif {[file exist [file join $home ../tcllib]]} {
- lappend auto_path [file join $home ../tcllib]
-} else {
- # Look for the CVS development sources
- set cvs [lindex [lsort -decreasing \
- [glob -nocomplain [file join $home ../../tcllib*]]] 0]
- if {[file exist [file join $cvs modules]]} {
- lappend auto_path [file join $cvs modules]
- } elseif {[file exist [file join $cvs pkgIndex.tcl]]} {
- lappend auto_path $cvs
- } else {
- error "Cannot find Standard Tcl Library in auto_path:\n[join $auto_path \n]"
- }
+if {[catch {package require tcllib} e]} {
+ error "Cannot find Standard Tcl Library in auto_path:\n\
+ [join $auto_path \n($e)\n]"
}
set Config(home) $home
@@ -130,3 +130,3 @@
} else {
- set Config(config) [file join $Config(home) tclhttpd.rc]

View file

@ -1,9 +1,5 @@
--- bin/tclhttpd.rc Mon Apr 24 21:39:19 2000
+++ bin/tclhttpd.rc Fri Apr 28 19:23:21 2000
@@ -24,2 +24,3 @@
foreach d [list \
+ [file join [Config home] ../share/tclhttpd3.0.3] \
[file join [Config home] ../htdocs] \
@@ -36,3 +36,3 @@
-Config uid 50

View file

@ -0,0 +1,75 @@
--- src/limit.c Thu May 11 02:00:43 2000
+++ src/limit.c Fri Dec 1 20:04:58 2000
@@ -20,7 +20,6 @@
int
-LimitCmd(ClientData data, Tcl_Interp *interp, int argc, char *argv[])
+LimitCmd(ClientData data, Tcl_Interp *interp, int argc, Tcl_Obj *CONST objv[])
{
- int max;
- char buf[32];
struct rlimit limit;
+ Tcl_Obj *limObj[2];
Tcl_ResetResult(interp);
@@ -31,3 +30,4 @@
if (argc > 1) {
- Tcl_GetInt(interp, argv[1], (int *)&limit.rlim_cur);
+ if (Tcl_GetLongFromObj(interp, objv[1], (long *)&limit.rlim_cur)
+ != TCL_OK) return TCL_ERROR;
if (setrlimit(RLIMIT_NOFILE, &limit) < 0) {
@@ -37,3 +37,5 @@
}
- sprintf(interp->result, "%d %d", limit.rlim_cur, limit.rlim_max);
+ limObj[0] = Tcl_NewLongObj((long)limit.rlim_cur);
+ limObj[1] = Tcl_NewLongObj((long)limit.rlim_max);
+ Tcl_SetObjResult(interp, Tcl_NewListObj(2, limObj));
return TCL_OK;
@@ -54,3 +56,3 @@
{
- Tcl_CreateCommand(interp, "limit", LimitCmd, NULL, NULL);
+ Tcl_CreateObjCommand(interp, "limit", LimitCmd, NULL, NULL);
Tcl_PkgProvide(interp, "limit", "1.0");
--- src/setuid.c Tue Oct 6 20:12:11 1998
+++ src/setuid.c Fri Dec 1 20:05:52 2000
@@ -7,2 +7,3 @@
#include <sys/types.h>
+#include <unistd.h>
--- src/utime.c Tue Oct 6 20:12:11 1998
+++ src/utime.c Fri Dec 1 20:14:21 2000
@@ -20,13 +20,8 @@
int
-UtimeCmd(ClientData data, Tcl_Interp *interp, int argc, char *argv[])
+UtimeCmd(ClientData data, Tcl_Interp *interp, int argc, Tcl_Obj *CONST objv[])
{
struct utimbuf u = {0, 0};
+ char *file;
Tcl_ResetResult(interp);
- if (argc > 3) {
- Tcl_GetInt(interp, argv[3], &u.actime); /* new access time */
- }
- if (argc > 2) {
- Tcl_GetInt(interp, argv[2], &u.modtime); /* new modify time */
- }
if (argc > 4 || argc <= 1) {
@@ -35,4 +30,13 @@
}
- if (utime(argv[1], &u) < 0) {
- Tcl_AppendResult(interp, "utime: ", argv[1], Tcl_PosixError(interp), NULL);
+ if (argc > 3) {
+ if (Tcl_GetLongFromObj(interp, objv[3], (long *)&u.actime)
+ != TCL_OK) return TCL_ERROR; /* new access time */
+ }
+ if (argc > 2) {
+ if (Tcl_GetLongFromObj(interp, objv[2], (long *)&u.modtime)
+ != TCL_OK) return TCL_ERROR; /* new modify time */
+ }
+ file = Tcl_GetString(objv[1]);
+ if (utime(file, &u) < 0) {
+ Tcl_AppendResult(interp, "utime: ", file, Tcl_PosixError(interp), NULL);
return TCL_ERROR;
@@ -55,3 +59,3 @@
{
- Tcl_CreateCommand(interp, "utime", UtimeCmd, NULL, NULL);
+ Tcl_CreateObjCommand(interp, "utime", UtimeCmd, NULL, NULL);
Tcl_PkgProvide(interp, "utime", "1.0");

View file

@ -1,9 +0,0 @@
--- lib/httpd.tcl Sat Jun 10 05:59:52 2000
+++ lib/httpd.tcl Wed Aug 2 18:18:18 2000
@@ -1305,5 +1305,5 @@
[list HttpdCloseFinal $sock]]
- Httpd_GetPostDataAsync $sock "" HttpdCloseFinal
+ Httpd_GetPostDataAsync $sock "" $data(count) HttpdCloseFinal
} else {
HttpdCloseFinal $sock

View file

@ -1,52 +0,0 @@
This patch adds a way to add the functionality to the server by
specifying extra files it should source on startup. Those files can
define MIME type handlers, subtree handlers etc (see the server's
documentation for what they can do -- very powerful stuff).
According to the software's author, Brent Welch, there is currently no
other way to extend the server -- other then adding code to the
httpd.tcl (or other files) directly. The tclhttpd.rc file is executed by
a safe interpreter and so can not load any other files itself.
+++ bin/httpd.tcl 2000/05/16 23:09:50
@@ -152,4 +152,5 @@
[list threads.arg [cget threads] {Number of worker threads (zero for non-threaded)}] \
[list library.arg [cget library] {Directory list where custom packages and auto loads are}] \
+ [list extrafiles.arg [cget ExtraFiles] {Extra files to source}] \
[list debug.arg 0 {If true, start interactive command loop}] \
] \
@@ -228,7 +229,9 @@
}
}
-if ![catch {
+if {[catch {
setuid $Config(uid) $Config(gid)
-}] {
+} e]} {
+ Stderr "failed to suid to $Config(uid).$Config(gid): $e"
+} else {
Stderr "Running as user $Config(uid)"
}
@@ -256,4 +259,6 @@
append error "\n$errorInfo"
error $error
+} else {
+ puts stderr "Sourced [file nativename $Config(main)] nicely"
}
+++ bin/httpdthread.tcl 2000/05/10 19:32:55
@@ -142,2 +142,14 @@
}
+if {[info exists Config(extrafiles)]} {
+ puts stderr "Proceeding to source $Config(extrafiles)"
+ foreach f $Config(extrafiles) {
+ if {[catch "source $f" e]} {
+ puts stderr "Failed to source $f: $e"
+ } else {
+ puts stderr "Sourced $f ($e)."
+ }
+ }
+} else {
+ puts stderr "No extra files specified"
+}

View file

@ -1,5 +1,6 @@
# Tiny helper binaries for thc TclHttp-daemon providing the
# functionality not available in the TCL itself:
package ifneeded crypt 1.0 [list load [file join $dir libcrypt.so]]
package ifneeded setuid 1.0 [list load [file join $dir libsetuid.so]]
package ifneeded limit 1.0 [list load [file join $dir liblimit.so]]
package ifneeded crypt 1.0 [list load $dir/@LIB@]
package ifneeded setuid 1.0 [list load $dir/@LIB@]
package ifneeded limit 1.0 [list load $dir/@LIB@]
package ifneeded utime 1.0 [list load $dir/@LIB@]

View file

@ -2,12 +2,7 @@ bin/httpd.tcl
bin/httpdthread.tcl
etc/tclhttpd.rc
etc/rc.d/tclhttpd.sh
lib/tclhttpd%%PORTVERSION%%/libsetuid.so.%%LIBSUF%%
lib/tclhttpd%%PORTVERSION%%/libsetuid.so
lib/tclhttpd%%PORTVERSION%%/liblimit.so.%%LIBSUF%%
lib/tclhttpd%%PORTVERSION%%/liblimit.so
lib/tclhttpd%%PORTVERSION%%/libcrypt.so.%%LIBSUF%%
lib/tclhttpd%%PORTVERSION%%/libcrypt.so
lib/tclhttpd%%PORTVERSION%%/%%SHLIB_NAME%%
lib/tclhttpd%%PORTVERSION%%/admin.tcl
lib/tclhttpd%%PORTVERSION%%/auth.tcl
lib/tclhttpd%%PORTVERSION%%/cgi.tcl
@ -17,18 +12,20 @@ lib/tclhttpd%%PORTVERSION%%/debug.tcl
lib/tclhttpd%%PORTVERSION%%/demo.tcl
lib/tclhttpd%%PORTVERSION%%/direct.tcl
lib/tclhttpd%%PORTVERSION%%/dirlist.tcl
lib/tclhttpd%%PORTVERSION%%/discover.tcl
lib/tclhttpd%%PORTVERSION%%/doc.tcl
lib/tclhttpd%%PORTVERSION%%/httpd.tcl
lib/tclhttpd%%PORTVERSION%%/imagemap.tcl
lib/tclhttpd%%PORTVERSION%%/include.tcl
lib/tclhttpd%%PORTVERSION%%/log.tcl
lib/tclhttpd%%PORTVERSION%%/logstd.tcl
lib/tclhttpd%%PORTVERSION%%/mail.tcl
lib/tclhttpd%%PORTVERSION%%/maptcl.tcl
lib/tclhttpd%%PORTVERSION%%/maptk.tcl
lib/tclhttpd%%PORTVERSION%%/mtype.tcl
lib/tclhttpd%%PORTVERSION%%/open.tcl
lib/tclhttpd%%PORTVERSION%%/passcheck.tcl
lib/tclhttpd%%PORTVERSION%%/pkgIndex.tcl
lib/tclhttpd%%PORTVERSION%%/prodebug.tcl
lib/tclhttpd%%PORTVERSION%%/redirect.tcl
lib/tclhttpd%%PORTVERSION%%/safecgio.tcl
lib/tclhttpd%%PORTVERSION%%/session.tcl
@ -55,6 +52,7 @@ share/tclhttpd%%PORTVERSION%%/redirect
share/tclhttpd%%PORTVERSION%%/register.tml
share/tclhttpd%%PORTVERSION%%/test.tml
share/tclhttpd%%PORTVERSION%%/access/README.txt
share/tclhttpd%%PORTVERSION%%/access/index.tml
share/tclhttpd%%PORTVERSION%%/access/auth/hello.txt
share/tclhttpd%%PORTVERSION%%/access/auth/test.cgi
share/tclhttpd%%PORTVERSION%%/access/auth/.htaccess
@ -95,6 +93,7 @@ share/tclhttpd%%PORTVERSION%%/cgi-bin/testupload.cgi
share/tclhttpd%%PORTVERSION%%/cgi-bin/user.cgi
share/tclhttpd%%PORTVERSION%%/forms/file.tml
share/tclhttpd%%PORTVERSION%%/forms/form1.tml
share/tclhttpd%%PORTVERSION%%/forms/formget.tml
share/tclhttpd%%PORTVERSION%%/forms/headers.tml
share/tclhttpd%%PORTVERSION%%/forms/headerspost.tml
share/tclhttpd%%PORTVERSION%%/forms/index.tml
@ -108,6 +107,7 @@ share/tclhttpd%%PORTVERSION%%/forms/.tml
share/tclhttpd%%PORTVERSION%%/guestbook/guestbook.cgi
share/tclhttpd%%PORTVERSION%%/guestbook/newguest.cgi
share/tclhttpd%%PORTVERSION%%/guestbook/newguest.html
share/tclhttpd%%PORTVERSION%%/images/AjubaLogo.gif
share/tclhttpd%%PORTVERSION%%/images/Blue.gif
share/tclhttpd%%PORTVERSION%%/images/Red.gif
share/tclhttpd%%PORTVERSION%%/images/ScripticsLogo1.gif
@ -139,6 +139,10 @@ share/tclhttpd%%PORTVERSION%%/java/ServerDemo.class
share/tclhttpd%%PORTVERSION%%/java/ServerDemo.html
share/tclhttpd%%PORTVERSION%%/java/auth.js
share/tclhttpd%%PORTVERSION%%/java/test.html
share/tclhttpd%%PORTVERSION%%/links/INSTALL.txt
share/tclhttpd%%PORTVERSION%%/links/README.txt
share/tclhttpd%%PORTVERSION%%/links/README.ssl.txt
share/tclhttpd%%PORTVERSION%%/links/WHATSNEW.txt
share/tclhttpd%%PORTVERSION%%/libtml/Index
share/tclhttpd%%PORTVERSION%%/libtml/faq.tcl
share/tclhttpd%%PORTVERSION%%/libtml/htmlutils.tcl
@ -186,6 +190,7 @@ share/tclhttpd%%PORTVERSION%%/stats/doc.tml
share/tclhttpd%%PORTVERSION%%/stats/index.tml
share/tclhttpd%%PORTVERSION%%/stats/notfound.tml
share/tclhttpd%%PORTVERSION%%/stats/.tml
share/tclhttpd%%PORTVERSION%%/templates/faqfaq.tml
share/tclhttpd%%PORTVERSION%%/templates/form.tml
share/tclhttpd%%PORTVERSION%%/templates/index.tml
share/tclhttpd%%PORTVERSION%%/templates/simple.subst
@ -206,6 +211,7 @@ share/tclhttpd%%PORTVERSION%%/.tml
@dirrm share/tclhttpd%%PORTVERSION%%/include
@dirrm share/tclhttpd%%PORTVERSION%%/java
@dirrm share/tclhttpd%%PORTVERSION%%/libtml
@dirrm share/tclhttpd%%PORTVERSION%%/links
@dirrm share/tclhttpd%%PORTVERSION%%/manual
@dirrm share/tclhttpd%%PORTVERSION%%/map
@dirrm share/tclhttpd%%PORTVERSION%%/snmp/browser
@ -214,4 +220,11 @@ share/tclhttpd%%PORTVERSION%%/.tml
@dirrm share/tclhttpd%%PORTVERSION%%/stats
@dirrm share/tclhttpd%%PORTVERSION%%/templates
@dirrm share/tclhttpd%%PORTVERSION%%
@dirrm tclhttpd%%PORTVERSION%%
tclhttpd/custom/README
tclhttpd/custom/hello.tcl
tclhttpd/custom/snmpinit.tcl
tclhttpd/custom/tclpro.tcl
@dirrm tclhttpd/custom
tclhttpd/README
tclhttpd/README_custom
@dirrm tclhttpd

View file

@ -1,18 +0,0 @@
#!/bin/sh
crypt_SRCS="crypt.c cryptLib.c"
setuid_SRCS=setuid.c
limit_SRCS=limit.c
cd ${WRKSRC}/src
for l in crypt setuid limit
do
make INTERNALLIB=Y NOPROFILE=Y \
LIB=${l} SHLIB_MAJOR=1 SHLIB_MINOR=0 \
SRCS="`eval echo \\$${l}_SRCS`" -ECFLAGS \
CFLAGS="${CFLAGS} -I${PREFIX}/include/tcl${TCL_DVER} -DUSE_TCL_STUBS" \
LDADD="-L${PREFIX}/lib -ltclstub${TCL_VER} -lcrypt" \
-f bsd.lib.mk \
|| exit 1
done