3 # This is a make+ file. Make+ is a set of scripts which enhance GNU
4 # make and let you build RPMs, and other package types with just one
5 # control file. To build this package you will need to download make+
6 # from this site: http://www.annexia.org/freeware/makeplus/
11 VERSION := $(VERSION_MAJOR).$(VERSION_MINOR)
13 SUMMARY := Rich\'s Web Server
15 AUTHOR := Richard W.M. Jones <rich@annexia.org>
18 RWS is a tiny, fast and elegant web server. It can serve simple files
19 or run CGI scripts. It supports virtual hosts.
22 RPM_REQUIRES := pthrlib >= 3.2.0, c2lib >= 1.3.0
23 RPM_GROUP := System Environment/Daemons
25 CFLAGS += -Wall -Werror -g -O2 -I$(includedir)/c2lib \
26 -I$(shell pg_config --includedir)
27 ifneq ($(shell uname), SunOS)
28 # Avoid a warning about reordering system include paths.
29 CFLAGS += $(shell pcre-config --cflags)
32 LIBS += -L$(libdir) -lpthrlib -lc2lib \
33 -L$(shell pg_config --libdir) -lpq \
34 $(shell pcre-config --libs)
36 # make+ needs to support a better method of handling libraries than this:
37 ifneq ($(shell uname), OpenBSD)
38 ifneq ($(shell uname), FreeBSD)
43 ifeq ($(shell uname), SunOS)
44 LIBS += -lnsl -lsocket
49 OBJS := main.o cfg.o dir.o errors.o exec.o exec_so.o file.o mime_types.o \
50 process_rq.o rewrite.o
51 HEADERS := $(srcdir)/rws_request.h
57 $(MP_CHECK_LIB) precomp c2lib
58 $(MP_CHECK_LIB) current_pth pthrlib
59 $(MP_CHECK_FUNCS) dlclose dlerror dlopen dlsym glob globfree \
61 $(MP_CHECK_HEADERS) alloca.h arpa/inet.h dirent.h dlfcn.h fcntl.h \
62 glob.h grp.h netinet/in.h pwd.h setjmp.h signal.h string.h \
63 sys/mman.h sys/socket.h sys/stat.h sys/syslimits.h sys/types.h \
64 sys/wait.h syslog.h time.h unistd.h
67 build: librws.a librws.so rwsd manpages conffiles syms \
68 examples/hello.so examples/show_params.so
73 $(CC) $(CFLAGS) $^ -L. -lrws $(LIBS) -o $@
77 librws.a: rws_request.o
78 $(MP_LINK_STATIC) $@ $^
80 librws.so: rws_request.lo
81 $(MP_LINK_DYNAMIC) $@ $^
85 examples/%.so: examples/%.lo
86 ifneq ($(shell uname), SunOS)
87 $(CC) $(CFLAGS) -shared -Wl,-soname,$@ $^ -L. -lrws $(LIBS) -o $@
89 # XXX make+ needs to support this.
90 $(CC) $(CFLAGS) -shared -Wl,-h,$@ $^ -L. -lrws $(LIBS) -o $@
93 # Build the manual pages.
95 manpages: $(srcdir)/*.h
99 --author '$(AUTHOR)' \
100 --license '$(COPYRIGHT)' \
101 --version '$(PACKAGE)-$(VERSION)' \
105 # Build the configuration files.
107 conffiles: conf/default conf/rws.conf
109 conf/default: conf/default.in
110 sed 's,@pkgdatadir@,$(pkgdatadir),g' < $^ > $@
112 conf/rws.conf: conf/rws.conf.in
113 sed 's,@pkgdatadir@,$(pkgdatadir),g' < $^ > $@
115 # Build the symbols table.
117 syms: rwsd.syms librws.syms
120 nm $< | sort | grep -i '^[0-9a-f]' | awk '{print $$1 " " $$3}' > $@
122 librws.syms: librws.so
123 nm $< | sort | grep -i '^[0-9a-f]' | awk '{print $$1 " " $$3}' > $@
125 # Run the simple test.
128 LD_LIBRARY_PATH=.:$(LD_LIBRARY_PATH) $(MP_RUN_TESTS) $^
131 install -d $(DESTDIR)$(sbindir)
132 install -d $(DESTDIR)$(libdir)
133 install -d $(DESTDIR)$(includedir)
134 install -d $(DESTDIR)$(sysconfdir)/init.d
135 install -d $(DESTDIR)$(sysconfdir)/rws
136 install -d $(DESTDIR)$(sysconfdir)/rws/hosts
137 install -d $(DESTDIR)$(pkgdatadir)/symtabs
138 install -d $(DESTDIR)$(pkgdatadir)/so-bin
139 install -d $(DESTDIR)$(pkgdatadir)/html
140 install -d $(DESTDIR)$(man1dir)
141 install -d $(DESTDIR)$(man3dir)
143 install -m 0755 rwsd $(DESTDIR)$(sbindir)
145 $(MP_INSTALL_STATIC_LIB) librws.a
146 $(MP_INSTALL_DYNAMIC_LIB) librws.so
148 install -m 0644 $(HEADERS) $(DESTDIR)$(includedir)
150 install -m 0755 $(srcdir)/rws.rc $(DESTDIR)$(sysconfdir)/init.d/rws
152 if [ ! -f $(DESTDIR)$(sysconfdir)/rws/rws.conf ]; then \
153 install -m 0644 conf/rws.conf $(DESTDIR)$(sysconfdir)/rws; \
155 if [ ! -f $(DESTDIR)$(sysconfdir)/rws/hosts/default ]; then \
156 install -m 0644 conf/default $(DESTDIR)$(sysconfdir)/rws/hosts; \
158 install -m 0644 *.syms $(DESTDIR)$(pkgdatadir)/symtabs
159 install -m 0755 examples/*.so $(DESTDIR)$(pkgdatadir)/so-bin
160 install -m 0644 $(srcdir)/html/*.html $(DESTDIR)$(pkgdatadir)/html
161 install -m 0644 $(srcdir)/rwsd.1 $(DESTDIR)$(man1dir)
162 install -m 0644 *.3 $(DESTDIR)$(man3dir)
165 <% include page_header.msp %>
167 <h1>$(PACKAGE) - $(SUMMARY)</h1>
170 <code>rws</code> is a small, fast web server written in
171 C. It uses the <a href="../pthrlib/">pthrlib</a>
172 threading/server library and the <a href="../c2lib/">c2lib</a>
173 library of Perl-like basics for C. These make it
174 amongst the smallest, fastest and most straightforwardly
175 written web servers available now.
179 As of version 1.0.11, the stripped binary is 27K and
180 <code>size</code> reports:
184 text data bss dec hex filename
185 24332 828 88 25248 62a0 rwsd
189 Of course, most of the magic is in <a href="../pthrlib/">pthrlib</a>.
193 It supports a fairly minimal set of features so far:
197 <li> Complies (mostly) with <code>HTTP/1.1</code>.
198 <li> Serves files and includes an <code>mmap(2)</code>
200 <li> Directory listings.
201 <li> CGI script execution (NPH scripts only!)
202 <li> Virtual hosts and aliases.
203 <li> Shared object scripts: essentially CGI scripts
204 written in C which are dynamically linked into the
205 server memory at runtime. Very fast.
206 <li> Rewrite rules using regular expressions.
210 <a href="doc/">There is extensive documentation and a tutorial here.</a>
222 <td> <a href="$(PACKAGE)-$(VERSION).tar.gz">$(PACKAGE)-$(VERSION).tar.gz</a> </td>
224 <td> Latest source distribution </td>
227 <td> <a href="$(PACKAGE)-$(VERSION)-1.i686.rpm">$(PACKAGE)-$(VERSION)-1.i686.rpm</a> </td>
228 <td> i686 binary RPM </td>
229 <td> Binary server, header files, man pages
230 for Red Hat Linux </td>
233 <td> <a href="$(PACKAGE)-$(VERSION)-1.src.rpm">$(PACKAGE)-$(VERSION)-1.src.rpm</a> </td>
234 <td> source RPM </td>
235 <td> Source files for Red Hat Linux </td>
240 You must install the latest <a href="../pthrlib/">pthrlib</a>
241 and <a href="../c2lib/">c2lib</a> libraries first!
246 <a href="/cgi-bin/autopatch.pl?dir=rws">Patches between versions
254 <b>Sat Feb 8 17:00:47 GMT 2003:</b>
255 Ported to Solaris, OpenBSD and FreeBSD (thanks to
256 <a href="http://www.azazel.net/">Jeremy Sowden</a>
257 and <a href="http://www.mondaymorning.org/">Richard Baker</a>
258 for help and equipment).
259 Added a test script which actually starts up and runs
260 rws and verifies static file serving, CGI scripts and shared
261 object scripts. Added <code>-ldl</code> to <code>LIBS</code>
262 (thanks to jeffrey at box-sol.com). Build fixes for RH 7.3.
266 <b>Sun Dec 8 16:07:20 GMT 2002:</b>
267 Enabled debugging and optimisations. Converted to use
268 <a href="../makeplus/">make+</a>. Changed to support
269 changes in the <code>pthrlib</code> API. The
270 <code>-f</code> option prevents the server from
271 changing directory as well. More descriptive thread
272 names. Give idle threads a different name.
276 <b>Mon Nov 25 09:31:37 GMT 2002:</b>
277 Added a symbols file for full symbol resolution in monolith.
278 Added <code>debian/conffiles</code> so that Debian package
279 won't splat configuration files.
280 Changed <code>process_rq</code> to set thread name to the
281 canonical path (useful for debugging, stats).
282 Set a maximum number of requests that we will service with
288 <b>Sun Nov 17 23:31:32 GMT 2002:</b> Debian packages. Added MSP files.
289 <code>rws_request_*</code> symbols are now in a separate
290 library. Added <code>rwsd.1</code> manual page. RWS now
291 forces connection close on bad requests. Multiple fixes
292 to the way directories/subdirectories are handled. <code>exec_so</code>
293 catches <code>pth_die</code> exceptions and prints a
294 message. More rewrite fixes. Change the default root
295 to <code>/var/www</code>. Added <code>postinst</code> script
300 <b>Thu Nov 14 15:33:29 GMT 2002:</b> Major checkpoint release
305 <b>Sun Oct 20 14:57:29 BST 2002:</b> Allow empty entries
306 in rws configuration file. Correct compilation flags for
307 PCRE. Allow the stack size to be selected from the configuration
308 file. Fixed path parsing. Added include files to RPM. Added
309 example MSP configuration to configuration file.
313 <b>Tue Oct 15 23:40:42 BST 2002:</b> Multiple bug fixes.
317 <b>Sun Oct 13 19:04:16 BST 2002:</b> Added
318 <code>-a</code>, <code>-d</code> and <code>-f</code>
319 flags which allow you to run the server on only
320 a single interface and make it simpler to debug.
321 (Thanks to Steve Atkins, steve at blighty com, for
322 this patch). You need the most recent <a href="../pthrlib/">pthrlib</a>.
326 <b>Sun Oct 6 13:00:39 BST 2002:</b> New <q>rewrite</q>
327 module allows comprehensive URL rewriting. Updated to use
328 the newest version of <a href="../c2lib/">c2lib</a>.
332 <b>Sat Sep 7 15:51:10 BST 2002:</b> Packages are now
333 available as i686 binary RPMs and source RPMs.
336 <h2>Old news and old versions</h2>
339 <b>Sat Aug 31 17:39:36 BST 2002</b>
343 <a href="rws-1.0.0.tar.gz">rws-1.0.0.tar.gz</a> released.
344 This includes a tutorial.
348 <b>Thu Aug 22 13:20:32 BST 2002</b>
352 <a href="rws-0.9.6.tar.gz">rws-0.9.6.tar.gz</a> released.
353 This includes manual pages.
357 <b>Thu Aug 22 12:27:16 BST 2002</b>
361 <a href="rws-0.9.5.tar.gz">rws-0.9.5.tar.gz</a> released.
362 I have changed the interface to shared object scripts to
363 allow me to extend it in the future without ever changing
364 it again (hopefully :-) See the README file and
365 <rws_request.h> for more
370 <b>Wed Aug 21 14:20:12 BST 2002</b>
374 <a href="rws-0.9.4.tar.gz">rws-0.9.4.tar.gz</a> released.
375 Support for shared object scripts.
379 <b>Thu Jun 21 23:14:48 BST 2001</b>
383 <a href="rws-0.9.2.tar.gz">rws-0.9.2.tar.gz</a> released.
384 Directory listings are sorted alphabetically. Server
385 signature is printed at the bottom of directory listings.
386 Make sure you have <a href="../c2lib/">c2lib >= 1.2.12</a>.
390 <b>Tue May 22 14:22:06 BST 2001</b>
394 <a href="rws-0.0.9.tar.gz">rws-0.0.9.tar.gz</a> released.
395 URL paths are now unescaped correctly.
396 Make sure you have <a href="../pthrlib/">pthrlib >= 2.0.5</a>.
400 <b>Tue May 22 11:37:10 BST 2001</b>
404 <a href="rws-0.0.8.tar.gz">rws-0.0.8.tar.gz</a> released.
405 Added configuration files and init scripts to RPM.
406 Don't hold file descriptors open for files in the mmapped file cache.
407 Fixes to example rws.conf file. Fixed the mmapped file cache
408 so it no longer grows indefinitely (:-)
409 Make sure you have <a href="../pthrlib/">pthrlib >= 2.0.4</a>.
413 <b>Tue Apr 10 16:04:41 BST 2001</b>
417 <a href="rws-0.0.7.tar.gz">rws-0.0.7.tar.gz</a> released.
418 Generates <code>access_log</code> file. Directory
419 listings have been improved considerably.
423 <b>Mon Apr 9 17:34:31 BST 2001</b>
427 <a href="rws-0.0.6.tar.gz">rws-0.0.6.tar.gz</a> released.
428 This is the first public version.
431 <% include page_footer.msp %>
436 scp $(PACKAGE)-$(VERSION).tar.gz $(PACKAGE)-$(VERSION)-1.*.rpm \
437 $(PACKAGE)-$(VERSION).bin.tar.gz \
438 10.0.0.248:annexia.org/freeware/$(PACKAGE)/
440 10.0.0.248:annexia.org/freeware/$(PACKAGE)/index.msp
442 .PHONY: build configure test upload_website