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 := a framework for web applications
15 AUTHOR := Richard W.M. Jones <rich@annexia.org>
18 Monolith is a framework for web applications. Instead of thinking of
19 your web application as a series of pages and forms, Monolith gives
20 you basic widgets like buttons, images, form fields, tables and so on,
21 which you can use to build up your web application or construct
22 reusable "super-widgets". In this way, building a web application is
23 rather like constructing a traditional GUI application using Gtk,
24 Motif, Windows/MFC, Java/JFC, etc.
26 Monolith applications are written in C or C++ (we may support other
27 languages in future, particularly Perl and Java).
29 Monolith applications compile down to standalone shared object scripts
30 which can be run directly from the rws micro web server.
32 Monolith comes with a full featured discussion system, chat server and
36 RPM_REQUIRES := rws >= 1.2.0, pthrlib >= 3.3.0, c2lib >= 1.4.0
37 RPM_GROUP := Development/Libraries
39 iconsdir = $(datadir)/rws/ml-icons
40 solibdir = $(datadir)/rws/so-bin
41 sqldir = $(datadir)/rws/sql
42 styledir = $(datadir)/rws/ml-styles
43 symtabsdir = $(datadir)/rws/symtabs
44 botsdir = $(pkgdatadir)/chat/bots
46 CFLAGS += -Wall -Werror -g -O2 -I$(srcdir)/src -I$(srcdir)/widgets \
47 -DSYMTABSDIR=\"$(symtabsdir)\" -D_GNU_SOURCE \
49 ifneq ($(shell uname), SunOS)
50 # Avoid a warning about reordering system include paths.
51 CFLAGS += $(shell pcre-config --cflags)
54 LIBS += -lrws -lpthrlib -lc2lib -lpq $(shell pcre-config --libs) -lm
56 LOBJS := src/ml_smarttext.lo \
61 src/ml_close_button.lo \
63 src/ml_flow_layout.lo \
65 src/ml_form_checkbox.lo \
66 src/ml_form_input.lo \
67 src/ml_form_layout.lo \
68 src/ml_form_password.lo \
69 src/ml_form_radio.lo \
70 src/ml_form_radio_group.lo \
71 src/ml_form_select.lo \
72 src/ml_form_submit.lo \
74 src/ml_form_textarea.lo \
76 src/ml_horizontal_layout.lo \
81 src/ml_multicol_layout.lo \
82 src/ml_select_layout.lo \
83 src/ml_table_layout.lo \
84 src/ml_text_label.lo \
85 src/ml_toggle_button.lo\
86 src/ml_vertical_layout.lo \
90 HEADERS := $(srcdir)/src/ml_smarttext.h \
91 $(srcdir)/src/monolith.h \
92 $(srcdir)/src/ml_box.h \
93 $(srcdir)/src/ml_button.h \
94 $(srcdir)/src/ml_close_button.h \
95 $(srcdir)/src/ml_dialog.h \
96 $(srcdir)/src/ml_flow_layout.h \
97 $(srcdir)/src/ml_form.h \
98 $(srcdir)/src/ml_form_checkbox.h \
99 $(srcdir)/src/ml_form_input.h \
100 $(srcdir)/src/ml_form_layout.h \
101 $(srcdir)/src/ml_form_password.h \
102 $(srcdir)/src/ml_form_radio.h \
103 $(srcdir)/src/ml_form_radio_group.h \
104 $(srcdir)/src/ml_form_select.h \
105 $(srcdir)/src/ml_form_submit.h \
106 $(srcdir)/src/ml_form_text.h \
107 $(srcdir)/src/ml_form_textarea.h \
108 $(srcdir)/src/ml_heading.h \
109 $(srcdir)/src/ml_horizontal_layout.h \
110 $(srcdir)/src/ml_iframe.h \
111 $(srcdir)/src/ml_image.h \
112 $(srcdir)/src/ml_label.h \
113 $(srcdir)/src/ml_menu.h \
114 $(srcdir)/src/ml_multicol_layout.h \
115 $(srcdir)/src/ml_select_layout.h \
116 $(srcdir)/src/ml_table_layout.h \
117 $(srcdir)/src/ml_text_label.h \
118 $(srcdir)/src/ml_toggle_button.h \
119 $(srcdir)/src/ml_vertical_layout.h \
120 $(srcdir)/src/ml_widget.h \
121 $(srcdir)/src/ml_window.h
123 WIDGETS_LOBJS := widgets/ml_bulletins.lo \
124 widgets/ml_login_nopw.lo \
126 widgets/ml_user_directory.lo
128 WIDGETS_HEADERS := $(srcdir)/widgets/ml_bulletins.h \
129 $(srcdir)/widgets/ml_login_nopw.h \
130 $(srcdir)/widgets/ml_msp.h \
131 $(srcdir)/widgets/ml_user_directory.h
133 APPS := apps/msp.so apps/stats.so
135 EXAMPLES := examples/01_label_and_button.so examples/02_toy_calculator.so \
136 examples/03_many_toy_calculators.so \
137 examples/04_animal_vegetable_mineral.so \
138 examples/05_popup_windows_and_frames.so \
139 examples/06_big_form.so examples/07_toggle_buttons.so \
141 # examples/expenses.so
143 CALENDAR_LOBJS := calendar/ml_calendar.lo \
144 calendar/ml_calendar_day.lo \
145 calendar/ml_calendar_lib.lo \
146 calendar/ml_calendar_month.lo \
147 calendar/ml_calendar_notes.lo \
148 calendar/ml_calendar_visible.lo
150 CALENDAR_HEADERS := $(srcdir)/calendar/ml_calendar.h
152 CHAT_LOBJS := chat/chatroom.lo \
155 chat/messages_pane.lo \
156 chat/ml_chat_button.lo \
157 chat/ml_chat_window.lo \
161 CHAT_HEADERS := $(srcdir)/chat/ml_chat_button.h \
162 $(srcdir)/chat/ml_chat_window.h
164 CHAT_BOTS := $(wildcard $(srcdir)/chat/bots/*.pl)
166 DISCUSSION_LOBJS := discussion/ml_discussion.lo \
167 discussion/ml_discussion_panel.lo
169 DISCUSSION_HEADERS := $(srcdir)/discussion/ml_discussion.h \
170 $(srcdir)/discussion/ml_discussion_panel.h
176 $(MP_CONFIGURE_START)
177 $(MP_CHECK_LIB) precomp c2lib
178 $(MP_CHECK_LIB) current_pth pthrlib
179 $(MP_CHECK_LIB) new_rws_request rws
180 $(MP_CHECK_FUNCS) dladdr
181 $(MP_CHECK_HEADERS) arpa/inet.h assert.h dlfcn.h fcntl.h \
182 netinet/in.h string.h sys/socket.h sys/types.h time.h unistd.h
185 build: src/libmonolithcore.so widgets/libmonolithwidgets.so \
186 $(APPS) $(EXAMPLES) \
187 calendar/libmonolithcalendar.so \
188 chat/libmonolithchat.so \
189 discussion/libmonolithdiscussion.so \
193 # Build the core library.
195 src/libmonolithcore.so: $(LOBJS)
196 $(MP_LINK_DYNAMIC) $@ $^ $(LIBS)
198 src/ml_smarttext.c: src/ml_smarttext.l
199 flex -B -8 -Cem -Pml_smarttext_ -i $<
200 mv lex.ml_smarttext_.c $@
202 # Build the widgets library.
204 widgets/libmonolithwidgets.so: $(WIDGETS_LOBJS)
205 $(MP_LINK_DYNAMIC) $@ $^ $(LIBS)
207 # Build the applications.
210 ifneq ($(shell uname), SunOS)
211 $(CC) $(CFLAGS) -shared -Wl,-soname,$@ $^ \
212 -Lwidgets -lmonolithwidgets -Lsrc -lmonolithcore $(LIBS) -o $@
214 # XXX make+ needs to support this.
215 $(CC) $(CFLAGS) -shared -Wl,-h,$@ $^ \
216 -Lwidgets -lmonolithwidgets -Lsrc -lmonolithcore $(LIBS) -o $@
219 # Build the example programs.
221 examples/03_many_toy_calculators.so: examples/03_many_toy_calculators.lo \
222 examples/toy_calculator.lo
223 ifneq ($(shell uname), SunOS)
224 $(CC) $(CFLAGS) -shared -Wl,-soname,$@ $^ \
225 -Lwidgets -lmonolithwidgets -Lsrc -lmonolithcore $(LIBS) -o $@
227 # XXX make+ needs to support this.
228 $(CC) $(CFLAGS) -shared -Wl,-h,$@ $^ \
229 -Lwidgets -lmonolithwidgets -Lsrc -lmonolithcore $(LIBS) -o $@
232 examples/expenses.so: examples/expenses.lo examples/expenses_widget.lo
233 ifneq ($(shell uname), SunOS)
234 $(CC) $(CFLAGS) -shared -Wl,-soname,$@ $^ \
235 -Lwidgets -lmonolithwidgets -Lsrc -lmonolithcore $(LIBS) -o $@
237 # XXX make+ needs to support this.
238 $(CC) $(CFLAGS) -shared -Wl,-h,$@ $^ \
239 -Lwidgets -lmonolithwidgets -Lsrc -lmonolithcore $(LIBS) -o $@
242 ifeq ($(shell uname), OpenBSD)
243 # .. This is required for unknown reasons by OpenBSD.
244 examples/04_animal_vegetable_mineral.so: \
245 examples/04_animal_vegetable_mineral.lo
246 $(CC) $(CFLAGS) -shared $^ \
247 -Lwidgets -lmonolithwidgets -Lsrc -lmonolithcore $(LIBS) -o $@
250 examples/%.so: examples/%.lo
251 ifneq ($(shell uname), SunOS)
252 $(CC) $(CFLAGS) -shared -Wl,-soname,$@ $^ \
253 -Lwidgets -lmonolithwidgets -Lsrc -lmonolithcore $(LIBS) -o $@
255 # XXX make+ needs to support this.
256 $(CC) $(CFLAGS) -shared -Wl,-h,$@ $^ \
257 -Lwidgets -lmonolithwidgets -Lsrc -lmonolithcore $(LIBS) -o $@
260 # Build the calendar.
262 calendar/libmonolithcalendar.so: $(CALENDAR_LOBJS)
263 $(MP_LINK_DYNAMIC) $@ $^ -Lwidgets -lmonolithwidgets \
264 -Lsrc -lmonolithcore $(LIBS)
266 # Build the chat server.
268 chat/libmonolithchat.so: $(CHAT_LOBJS)
269 $(MP_LINK_DYNAMIC) $@ $^ -Lwidgets -lmonolithwidgets \
270 -Lsrc -lmonolithcore $(LIBS)
272 chat/chatbot.so: chat/chatbot.lo
273 ifneq ($(shell uname), SunOS)
274 $(CC) $(CFLAGS) -shared -Wl,-soname,$@ $^ $(LIBS) -o $@
276 # XXX make+ should provide a way to do this
277 $(CC) $(CFLAGS) -shared -Wl,-h,$@ $^ $(LIBS) -o $@
281 # Build the discussion system.
283 discussion/libmonolithdiscussion.so: $(DISCUSSION_LOBJS)
284 $(MP_LINK_DYNAMIC) $@ $^ -Lwidgets -lmonolithwidgets \
285 -Lsrc -lmonolithcore $(LIBS)
287 # Build all the manpages.
289 manpages: $(HEADERS) $(WIDGETS_HEADERS) $(CALENDAR_HEADERS) \
290 $(CHAT_HEADERS) $(DISCUSSION_HEADERS)
294 --author '$(AUTHOR)' \
295 --license '$(COPYRIGHT)' \
296 --version '$(PACKAGE)-$(VERSION)' \
300 # Build all the symbol tables.
302 syms: src/libmonolithcore.syms widgets/libmonolithwidgets.syms \
303 apps_syms examples_syms
305 src/libmonolithcore.syms: src/libmonolithcore.so
306 nm $< | sort | grep -i '^[0-9a-f]' | awk '{print $$1 " " $$3}' > $@
308 widgets/libmonolithwidgets.syms: widgets/libmonolithwidgets.so
309 nm $< | sort | grep -i '^[0-9a-f]' | awk '{print $$1 " " $$3}' > $@
311 apps_syms: $(patsubst %.so,%.syms,$(APPS))
313 apps/%.syms: apps/%.so
314 nm $< | sort | grep -i '^[0-9a-f]' | awk '{print $$1 " " $$3}' > $@
316 examples_syms: $(patsubst %.so,%.syms,$(EXAMPLES))
318 examples/%.syms: examples/%.so
319 nm $< | sort | grep -i '^[0-9a-f]' | awk '{print $$1 " " $$3}' > $@
324 install -d $(DESTDIR)$(libdir)
325 install -d $(DESTDIR)$(includedir)
326 install -d $(DESTDIR)$(iconsdir)
327 install -d $(DESTDIR)$(man3dir)
328 install -d $(DESTDIR)$(solibdir)
329 install -d $(DESTDIR)$(sqldir)
330 install -d $(DESTDIR)$(styledir)
331 install -d $(DESTDIR)$(symtabsdir)
332 install -d $(DESTDIR)$(botsdir)
334 $(MP_INSTALL_DYNAMIC_LIB) src/libmonolithcore.so
335 $(MP_INSTALL_DYNAMIC_LIB) widgets/libmonolithwidgets.so
336 $(MP_INSTALL_DYNAMIC_LIB) calendar/libmonolithcalendar.so
337 $(MP_INSTALL_DYNAMIC_LIB) chat/libmonolithchat.so
338 $(MP_INSTALL_DYNAMIC_LIB) discussion/libmonolithdiscussion.so
339 install -m 0644 $(HEADERS) \
341 $(CALENDAR_HEADERS) \
343 $(DISCUSSION_HEADERS) \
344 $(DESTDIR)$(includedir)
345 install -m 0644 $(srcdir)/icons/*.png $(DESTDIR)$(iconsdir)
346 install -m 0644 *.3 $(DESTDIR)$(man3dir)
347 install -m 0755 $(APPS) $(EXAMPLES) $(DESTDIR)$(solibdir)
348 # install -m 0755 chatbot.so $(DESTDIR)$(solibdir)
349 install -m 0644 $(srcdir)/sql/*.sql $(DESTDIR)$(sqldir)
350 install -m 0644 $(srcdir)/default.css $(DESTDIR)$(styledir)
351 install -m 0644 */*.syms $(DESTDIR)$(symtabsdir)
352 install -m 0755 $(CHAT_BOTS) $(DESTDIR)$(botsdir)
355 <% include page_header.msp %>
356 <h1>$(PACKAGE) - $(SUMMARY)</h1>
359 Monolith is a framework for web applications. Instead of
360 thinking of your web application as a series of pages and forms,
361 Monolith gives you basic widgets like buttons, images, form
362 fields, tables and so on, which you can use to build up your web
363 application or construct reusable <q>super-widgets</q>. In this
364 way, building a web application is rather like constructing a
365 traditional GUI application using Gtk, Motif, Windows/MFC,
370 Monolith applications are written in C or C++ (we may
371 support other languages in future, particularly Perl and Java).
375 Monolith applications compile down to standalone shared
376 object scripts which can be run directly from the
377 <a href="../rws/">rws micro web server</a>.
381 Monolith comes with a full-featured discussion system, chat
386 <a href="doc/">There is extensive documentation and
393 You will need to install the complete tool-chain before
398 <li> <a href="../c2lib/">c2lib</a> - a Perl/STL-like
399 library of basics for C
400 <li> <a href="../pthrlib/">pthrlib</a> - a library for
401 writing small, fast and efficient servers in C
402 <li> <a href="../rws/">rws</a> - a small, fast webserver
406 Always make sure you have the latest versions installed!
416 <td> <a href="$(PACKAGE)-$(VERSION).tar.gz">$(PACKAGE)-$(VERSION).tar.gz</a> </td>
418 <td> Latest source distribution </td>
421 <td> <a href="$(PACKAGE)-$(VERSION)-1.i686.rpm">$(PACKAGE)-$(VERSION)-1.i686.rpm</a> </td>
422 <td> i686 binary RPM </td>
423 <td> Binary libraries, header files, man pages
424 for Red Hat Linux </td>
427 <td> <a href="$(PACKAGE)-$(VERSION)-1.src.rpm">$(PACKAGE)-$(VERSION)-1.src.rpm</a> </td>
428 <td> source RPM </td>
429 <td> Source files for Red Hat Linux </td>
434 Note: To rebuild the manual pages which come with the
435 package, you will also need to download
436 <a href="../c2lib/">cdoc >= 0.9.2</a> (this is
443 <b>Sat Feb 8 17:00:47 GMT 2003:</b>
444 Ported to Solaris, OpenBSD and FreeBSD (thanks to
445 <a href="http://www.azazel.net/">Jeremy Sowden</a>
446 and <a href="http://www.mondaymorning.org/">Richard Baker</a>
447 for help and equipment).
448 Removed all non-shared libraries. Allow uses to
449 set <code>class</code> on <code>div</code> elements.
450 Fixed many string escaping bugs. Fixed spelling mistakes
451 in the documentation. Updated CSS for the bugtracker.
455 <b>Sun Dec 8 17:23:47 GMT 2002:</b>
456 Builds using <a href="../makeplus/">make+</a>.
457 Fixes to compile on RH 7.3. Changed to support
458 <code>current_pth</code> API change in
459 <code>pthrlib</code>.
460 <code>ml_login_nopw</code> acts more conservatively
461 with email addresses, possibly closing a security
462 hole. Added <code>ml_select_layout</code>. Made
463 the button widget more memory efficient.
464 Allow widgets to widget properties. Changes to
465 the stylesheet for discussion. Enabled debugging
466 and optimisations. <code>ml_window</code> supports
467 browser refresh (primarily for chat). Added two
468 forgotten <code>fclose</code> calls in the stats
469 code. Added <code>ml_menu</code> - initial support
470 for pull-down menus. Integrated smart text into the
471 core library. User agent now stored in the session,
476 <b>Mon Nov 25 09:31:37 GMT 2002:</b>
477 Added support for smart text, and updated widgets to
479 Better handling of session timeouts.
480 Fixed <code>kill_session</code> to be race-free.
481 Stats application now suports hit counts for sessions.
482 Stats application can do full symbol resolution.
483 Forms have names. Form text input fields can capture
488 <b>Sun Nov 17 23:31:32 GMT 2002:</b>
489 Debian packages. Added MSP files. Simplified the look of
490 the <code>ml_login_nopw</code> widget. Added the <code>icons</code>
491 directory. Added <code>begin work ... commit work</code>
492 around SQL scripts. Install SQL in <code>/usr/share/rws/sql/</code>
493 directory. Install so scripts in <code>/usr/share/rws/so-bin/</code>.
494 Added widget properties. Connection pooling completely
495 rewritten and simplified. Added <code>ml_die</code> function.
496 Added the ability to get the peername. Added <code>ml_heading</code>
497 widget. Added CSS for commercial widgets. <code>ml_msp</code>
498 now supports up to 5 arguments to the widget function (for chat).
499 Close button allows opener window to be reloaded.
500 Added tabbed layout widget (not working yet).
501 Added <code>ml_form_layout</code> layout widget.
502 Added <code>ml_user_directory</code> widget for bug tracker
503 (not working yet). Added iframe widget. Support
504 scroll_to for windows. Colours, tooltips, link types
505 for buttons. Added more styles. Added styling for link
506 buttons. Added <code>class</code> property for many of
507 the widgets. Added close buttons, bulletins board widget.
508 Multi-column, horizontal and vertical layout widgets.
509 Added <code>color</code> property for text label widgets.
510 Session structures are now properly locked to avoid
511 potential data corruption.
515 <b>Thu Nov 14 15:33:29 GMT 2002:</b> Major checkpoint release
520 <b>Sun Oct 20 15:04:07 BST 2002:</b> Correct flags for
521 PCRE. Many bug fixes to MSPs. User authentication.
522 MSPs can now access the
523 database. <code>ml_bulletins</code> allows you to post
524 message, supports user authentication. Added a
525 <code>ml_close_button</code> widget to core. Dialogs
526 now support close buttons. Added <code>ml_ok_window</code>
527 and <code>ml_error_window</code>. Allow forms to change
528 their posting method. <code>ml_text_label</code> doesn't
529 crash if there is no text. <code>ml_login_nopw</code> widget.
530 Get the window ID of a window (required by the login widget).
531 Nominate a "default" main window (required by MSPs).
532 Provided a way to get at the original Host: header in
533 the request. Fixed multiple bugs in persistent database
535 This version now requires a version of pthrlib which was
536 compiled with DBI support.
540 <b>Tue Oct 15 23:40:42 BST 2002:</b> Multiple bug fixes.
544 <b>Sat Sep 7 16:01:14 BST 2002:</b> Packages are now
545 available as i686 binary RPMs and source RPMs.
548 <h2>Old news and old versions</h2>
551 <b>Sat Sep 7 14:48:24 BST 2002</b>
555 <a href="monolith-1.0.1.tar.gz">monolith-1.0.1.tar.gz</a> released.
556 Documentation and tutorial. Fixed missing includes of
557 <string.h> (thanks to jjr-at-japo-dot-fi)
561 <b>Fri Aug 30 15:28:57 BST 2002</b>
565 <a href="monolith-1.0.0.tar.gz">monolith-1.0.0.tar.gz</a> released.
566 Full complement of form input widgets created.
570 <b>Wed Aug 28 20:30:33 BST 2002</b>
574 <a href="monolith-0.8.6.tar.gz">monolith-0.8.6.tar.gz</a> released.
575 This is a candidate for release as version 1.0.
576 Added framesets, removed private data in session, removed
577 explicit name parameters on form input fields.
581 <b>Wed Aug 28 16:11:09 BST 2002</b>
585 <a href="monolith-0.8.5.tar.gz">monolith-0.8.5.tar.gz</a> released.
586 More details in the README file on how to install monolith.
590 <b>Wed Aug 28 15:41:50 BST 2002</b>
594 <a href="monolith-0.8.4.tar.gz">monolith-0.8.4.tar.gz</a> released.
595 Support for multiple windows, improved CSS, improved support for
600 <b>Tue Aug 27 11:17:00 BST 2002</b>
604 <a href="monolith-0.8.3.tar.gz">monolith-0.8.3.tar.gz</a> released.
605 This version has support for forms, and more example programs.
609 <b>Sat Aug 24 16:55:21 BST 2002</b>
613 <a href="monolith-0.8.2.tar.gz">monolith-0.8.2.tar.gz</a> released.
614 This fixes some bugs in the button widget, finishes off the
615 <q>toy calculator</q> example, and improves the box widget.
619 <b>Sat Aug 24 15:13:58 BST 2002</b>
623 <a href="monolith-0.8.1.tar.gz">monolith-0.8.1.tar.gz</a> released.
624 This release is slightly more substantial than the previous one.
625 It includes a few more widgets, and CSS changes to make the
626 example programs much nicer-looking.
630 <b>Fri Aug 23 15:00:51 BST 2002</b>
634 <a href="monolith-0.8.0.tar.gz">monolith-0.8.0.tar.gz</a> released.
635 This is the first basic release of the new C/C++-based monolith
636 library. It contains a single simple example program and just a
640 <% include page_footer.msp %>
644 scp $(PACKAGE)-$(VERSION).tar.gz $(PACKAGE)-$(VERSION)-1.*.rpm \
645 $(PACKAGE)-$(VERSION).bin.tar.gz \
646 10.0.0.248:annexia.org/freeware/$(PACKAGE)/
648 10.0.0.248:annexia.org/freeware/$(PACKAGE)/index.msp
650 .PHONY: build configure test upload_website