[nurpawiki commit] r460 - trunk

1 view
Skip to first unread message

codesite...@google.com

unread,
Jan 14, 2009, 12:14:38 PM1/14/09
to nurpawiki-n...@googlegroups.com
Author: jjhellst
Date: Wed Jan 14 09:04:48 2009
New Revision: 460

Added:
trunk/_tags
trunk/main.ml
- copied, changed from r458, /trunk/nurpawiki.ml
trunk/nurpawiki.mlpack
Removed:
trunk/nurpawiki.ml
Modified:
trunk/Makefile
trunk/scheduler.ml

Log:
Many improvements to the build system

* Switch to ocamlbuild.
* Rename nurpawiki.ml to main.ml, to avoid silent failures of
ocamlbuild when nurpawiki.cma cannot be built from several modules
(in this case, it falls back to building it from the .ml file,
which is not what we want).
* Make a pack of all Nurpawiki modules, to prevent global module
namespace pollution.
* Build native archive/plugin if possible.

Modified: trunk/Makefile
==============================================================================
--- trunk/Makefile (original)
+++ trunk/Makefile Wed Jan 14 09:04:48 2009
@@ -1,53 +1,49 @@
+LIB := -package threads,netstring,calendar,extlib,postgresql,ocsigen
+CAMLC := ocamlfind ocamlc -thread -g $(LIB)
+CAMLOPT := ocamlfind ocamlopt -thread $(LIB)
+CAMLDOC := ocamlfind ocamldoc $(LIB)
+CAMLDEP := ocamlfind ocamldep
+CAMLBUILDOPTS := -ocamlc '$(CAMLC)' -ocamlopt '$(CAMLOPT)'
+CAMLBUILD := ocamlbuild $(CAMLBUILDOPTS)
+
+CMA := nurpawiki.cma
+CMXA := nurpawiki.cmxa
+CMXS := nurpawiki.cmxs
+
+TARGETS := $(CMA)
+ifneq ($(shell which ocamlopt),)
+ TARGETS += $(CMXA)
+ ifneq ($(wildcard $(shell ocamlc -where)/dynlink.cmxa),)
+ TARGETS += $(CMXS)
+ endif
+endif
+
+all: $(TARGETS) META
+
+$(CMA): version.ml
+ $(CAMLBUILD) -classic-display -ocamlc '$(CAMLC)' $@

-FILES=version.ml config.ml types.ml util.ml database.ml
database_upgrade.ml database_schema.ml services.ml privileges.ml
html_util.ml session.ml user_editor.ml page_revisions.ml nurpawiki.ml
scheduler.ml history.ml about.ml
+$(CMXA): version.ml
+ $(CAMLBUILD) -classic-display -ocamlopt '$(CAMLOPT)' $@

-CAMLC = ocamlfind ocamlc -thread -g $(LIB)
-CAMLOPT = ocamlfind ocamlopt -thread $(LIB)
-CAMLDOC = ocamlfind ocamldoc $(LIB)
-CAMLDEP = ocamlfind ocamldep
-LIB = -package threads,netstring,calendar,extlib,postgresql,ocsigen
+%.cmxs: %.cmxa
+ $(CAMLOPT) -shared -linkall -o _build/$@ _build/$<

-OBJS = $(FILES:.ml=.cmo)
-
-CMA = nurpawiki.cma
-
-all: $(CMA) META
-
-$(CMA): $(OBJS)
- $(CAMLC) -a -o $(CMA) $(OBJS)
-
-.SUFFIXES:
-.SUFFIXES: .ml .mli .cmo .cmi .cmx
-
-.PHONY: doc install
+.PHONY: $(CMA) doc install

NWIKI_VER=$(shell cat VERSION)
version.ml:version.ml.in VERSION
echo $(NWIKI_VER)
- cat version.ml.in | \
- sed -e "s|%_NURPAWIKI_VERSION_%|$(NWIKI_VER)|g" > version.ml
+ sed -e "s|%_NURPAWIKI_VERSION_%|$(NWIKI_VER)|g" version.ml.in > version.ml

META:META.in VERSION
- cat META.in | \
- sed -e "s|%_NURPAWIKI_VERSION_%|$(NWIKI_VER)|g" > META
-
-.ml.cmo:
- $(CAMLC) -c $<
-
-.mli.cmi:
- $(CAMLC) -c $<
-.ml.cmx:
- $(CAMLOPT) $(PP) -c $<
+ sed -e "s|%_NURPAWIKI_VERSION_%|$(NWIKI_VER)|g" META.in > META

doc:
# $(CAMLDOC) -d doc -html db.mli

clean:
- -rm -f *.cm[ioxa] *~ $(NAME)
+ -rm -Rf _build META version.ml

install:
- ocamlfind install nurpawiki META $(CMA)
-
-depend:
- $(CAMLDEP) $(PP) $(LIB) $(FILES:.ml=.mli) $(FILES) > .depend
-
+ ocamlfind install nurpawiki META $(foreach T,$(TARGETS),_build/$(T))

Added: trunk/_tags
==============================================================================
--- (empty file)
+++ trunk/_tags Wed Jan 14 09:04:48 2009
@@ -0,0 +1,2 @@
+<*.cmx>: for-pack(Nurpawiki)
+<nurpawiki.cmx>: -for-pack(Nurpawiki)

Copied: trunk/main.ml (from r458, /trunk/nurpawiki.ml)
==============================================================================

Added: trunk/nurpawiki.mlpack
==============================================================================
--- (empty file)
+++ trunk/nurpawiki.mlpack Wed Jan 14 09:04:48 2009
@@ -0,0 +1,17 @@
+Version
+Config
+Types
+Util
+Database
+Database_upgrade
+Database_schema
+Services
+Privileges
+Html_util
+Session
+User_editor
+Page_revisions
+Main
+Scheduler
+History
+About

Modified: trunk/scheduler.ml
==============================================================================
--- trunk/scheduler.ml (original)
+++ trunk/scheduler.ml Wed Jan 14 09:04:48 2009
@@ -152,7 +152,7 @@
ET_scheduler ->
view_scheduler_page sp ~conn ~cur_user
| ET_view wiki_page ->
- Nurpawiki.view_wiki_page sp ~conn ~cur_user
(wiki_page,(None,(None,None)))
+ Main.view_wiki_page sp ~conn ~cur_user (wiki_page,(None,(None,None)))

(* /scheduler *)
let _ =

Reply all
Reply to author
Forward
0 new messages