diff --git a/www/pserv/Makefile b/www/pserv/Makefile index 1bbbe6681f42..a49c10076efe 100644 --- a/www/pserv/Makefile +++ b/www/pserv/Makefile @@ -1,34 +1,47 @@ # New ports collection makefile for: pserv # Date created: Wed Oct 15 14:16:14 CEST 2003 # Whom: Alex Dupre # # $FreeBSD$ # PORTNAME= pserv PORTVERSION= 3.0.b3 PORTREVISION= 1 CATEGORIES= www MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} MASTER_SITE_SUBDIR= ${PORTNAME} DISTNAME= ${PORTNAME}-08-Jan-04 EXTRACT_SUFX= .tar.Z MAINTAINER= ale@FreeBSD.org COMMENT= A portable and small webserver written in C WRKSRC= ${WRKDIR}/${PORTNAME} BUILD_WRKSRC= ${WRKSRC}/sources USE_REINPLACE= yes +OPTIONS= LOG "Enable logging" on \ + PHP "Enable PHP support" on + +.include + post-patch: @${REINPLACE_CMD} "s|%%PREFIX%%|${PREFIX}|g;s|%%LOCALBASE%%|${LOCALBASE}|g" \ ${WRKSRC}/defaults/pserv.conf +.if defined(WITHOUT_LOG) + @${REINPLACE_CMD} "s|define LOG|undef LOG|" \ + ${WRKSRC}/sources/main.h +.endif +.if defined(WITHOUT_PHP) + @${REINPLACE_CMD} "s|define PHP|undef PHP|" \ + ${WRKSRC}/sources/main.h +.endif do-install: ${INSTALL_PROGRAM} ${WRKSRC}/sources/pserv ${PREFIX}/sbin/ ${INSTALL_DATA} ${WRKSRC}/defaults/mime_types.dat ${PREFIX}/etc/mime.types ${INSTALL_DATA} ${WRKSRC}/defaults/pserv.conf ${PREFIX}/etc/ ${INSTALL_SCRIPT} ${FILESDIR}/pserv.sh ${PREFIX}/etc/rc.d/ -.include +.include diff --git a/www/pserv/files/patch-log.c b/www/pserv/files/patch-log.c new file mode 100644 index 000000000000..0ff9c67e19a7 --- /dev/null +++ b/www/pserv/files/patch-log.c @@ -0,0 +1,45 @@ +--- sources/log.c.orig Wed May 5 12:12:12 2004 ++++ sources/log.c Wed May 5 12:04:57 2004 +@@ -20,6 +20,7 @@ + + int logFileOpen() + { ++#ifdef LOG + char timeStr[256]; + struct tm *timeStruct; + time_t timeTemp; +@@ -37,15 +38,18 @@ + #ifdef PRINTF_DEBUG + printf("Opened Log File.\n"); + #endif ++#endif + return 0; + } + + int logFileClose() + { ++#ifdef LOG + fclose(lf); + #ifdef PRINTF_DEBUG + printf("Closed Log File.\n"); + #endif ++#endif + return 0; + } + +@@ -57,6 +61,7 @@ + struct request req; + int code; + { ++#ifdef LOG + char timeStr[256]; + struct tm *timeStruct; + time_t timeTemp; +@@ -104,6 +109,7 @@ + printf ("Unknown event to log! Programming error!\n"); + } + fflush(lf); ++#endif + return 0; + } + diff --git a/www/pserv/files/patch-main.h b/www/pserv/files/patch-main.h index d5db8f3b8e22..becb85a99092 100644 --- a/www/pserv/files/patch-main.h +++ b/www/pserv/files/patch-main.h @@ -1,64 +1,65 @@ --- sources/main.h.orig Sat Dec 20 11:16:21 2003 -+++ sources/main.h Thu Jan 8 12:31:15 2004 -@@ -27,12 +27,13 @@ ++++ sources/main.h Wed May 5 12:06:07 2004 +@@ -27,12 +27,14 @@ /* --- CPP parsing options --- */ -#define PRINTF_DEBUG /* enable this to print some debugging messages */ +#undef PRINTF_DEBUG /* enable this to print some debugging messages */ #undef ON_THE_FLY_CONVERSION /* enable this for line ending conversion */ ++#define LOG /* enable logging to file */ #define BRAIN_DEAD_CAST /* if your compiler is brainwashed and does not cast standard types.h structures */ #define FORKING_SERVER /* enables to fork for every request */ #define AUTO_INDEX /* enables auto-index of directories */ #define SOCKADDR_REUSE /* enables reuse oth the socket (quick relaunch) */ +#define PHP /* enables transparent PHP support */ /* --- Configure options --- */ -@@ -44,18 +45,19 @@ +@@ -44,18 +46,19 @@ #define MIME_TYPE_DEFAULT "application/octet-stream" /* configuration file location */ -#define DEFAULT_CONFIG_LOCATION "/home/multix/pserv/defaults/" +#define DEFAULT_CONFIG_LOCATION "/usr/local/etc/" /* hard-wired defaults, if loading of config file fails */ -#define DEFAULT_PORT 2000 +#define DEFAULT_PORT 80 #define DEFAULT_MAX_CHILDREN 5 -#define DEFAULT_DOCS_LOCATION "/home/multix/public_html" +#define DEFAULT_DOCS_LOCATION "/usr/local/www/data" #define DEFAULT_FILE_NAME "index.html" #define DEFAULT_SEC_TO 1 #define DEFAULT_USEC_TO 100 -#define DEFAULT_LOG_FILE "/home/multix/pserv/pserv.log" -#define DEFAULT_MIME_FILE "/home/multix/pserv/mime_types.dat" -#define DEFAULT_CGI_ROOT "/home/multix/public_html/cgi-bin" +#define DEFAULT_LOG_FILE "/var/log/pserv.log" +#define DEFAULT_MIME_FILE "/usr/local/etc/mime.types" +#define DEFAULT_PHP_FILE "/usr/local/bin/php" +#define DEFAULT_CGI_ROOT "/usr/local/www/cgi-bin" #define DEFAULT_SERVER_NAME "localhost" /* amount of connections queued in listening */ -@@ -127,8 +129,10 @@ +@@ -127,8 +130,10 @@ #define ADDRESS_LEN 16 #define METHOD_LEN 16 #define PROTOCOL_LEN 16 +#define CONTENT_TYPE_LEN 256 #define USER_AGENT_LEN 256 #define MAX_QUERY_STRING_LEN 1024 +#define MAX_COOKIE_LEN 4096 /* the maximum path name of your system should be available in MAXNAMLEN defined in dirent.h. If not, set a reasonable value like 1024 */ -@@ -143,7 +147,9 @@ +@@ -143,7 +148,9 @@ char protocolVersion[PROTOCOL_LEN+1]; int keepAlive; char userAgent[USER_AGENT_LEN+1]; + char cookie[MAX_COOKIE_LEN+1]; long int contentLength; + char contentType[CONTENT_TYPE_LEN+1]; char rest[BUFFER_SIZE+1]; };