diff options
author | Edward Z. Yang <ezyang@mit.edu> | 2012-05-02 17:17:57 -0400 |
---|---|---|
committer | Edward Z. Yang <ezyang@mit.edu> | 2012-05-02 17:17:57 -0400 |
commit | 5e29700b15fad9e4ccbbea59b8312c53447df01b (patch) | |
tree | 91cc80e8e50847ab4c3b37714f133417df65f59a | |
parent | 1ca9408089542b282078cc1b7f3c8aa71659f00c (diff) |
Add support for -boot flag, which allows in-tree execution of Ur/Web
The boot flag rewrites most hardcoded paths to point to the build
directory, and also forces static compilation. This is convenient
for developing Ur/Web, or if you cannot 'sudo make install' Ur/Web.
The following changes were made:
* Header files were moved to include/urweb instead of include;
this lets FFI users point their C_INCLUDE_PATH at this directory
at write <urweb/urweb.h>. For internal Ur/Web executables,
we simply pass -I$PATH/include/urweb as normal.
* Differentiate between LIB and SRCLIB; SRCLIB is Ur and JavaScript
source files, while LIB is compiled products from libtool. For
in-tree compilation these live in different places.
* No longer reference Config for paths; instead use Settings; these
settings can be changed dynamically by Compiler.enableBoot ()
(TODO: add a disableBoot function.)
* config.h is now generated directly in include/urweb/config.h,
for consistency's sake (especially since it gets installed
along with the rest of the headers!)
* All of the autotools build products got updated.
* The linkStatic field in protocols now only contains the name of the
build product, and not the absolute path.
Future users have to be careful not to reference the Settings files
to early, lest they get an old version (this was the source of two
bugs during development of this patch.)
-rw-r--r-- | Makefile.am | 3 | ||||
-rw-r--r-- | Makefile.in | 108 | ||||
-rw-r--r-- | configure.ac | 10 | ||||
-rw-r--r-- | doc/manual.tex | 2 | ||||
-rw-r--r-- | include/urweb/config.h.in (renamed from config.h.in) | 0 | ||||
-rw-r--r-- | include/urweb/queue.h (renamed from include/queue.h) | 0 | ||||
-rw-r--r-- | include/urweb/request.h (renamed from include/request.h) | 0 | ||||
-rw-r--r-- | include/urweb/types.h (renamed from include/types.h) | 0 | ||||
-rw-r--r-- | include/urweb/urweb.h (renamed from include/urweb.h) | 0 | ||||
-rw-r--r-- | src/c/Makefile.am | 2 | ||||
-rw-r--r-- | src/c/Makefile.in | 42 | ||||
-rw-r--r-- | src/cgi.sml | 2 | ||||
-rw-r--r-- | src/cjr_print.sml | 4 | ||||
-rw-r--r-- | src/compiler.sig | 1 | ||||
-rw-r--r-- | src/compiler.sml | 34 | ||||
-rw-r--r-- | src/config.sig | 7 | ||||
-rw-r--r-- | src/config.sml.in | 10 | ||||
-rw-r--r-- | src/demo.sml | 2 | ||||
-rw-r--r-- | src/fastcgi.sml | 2 | ||||
-rw-r--r-- | src/http.sml | 2 | ||||
-rw-r--r-- | src/jscomp.sml | 2 | ||||
-rw-r--r-- | src/main.mlton.sml | 4 | ||||
-rw-r--r-- | src/settings.sig | 12 | ||||
-rw-r--r-- | src/settings.sml | 18 | ||||
-rw-r--r-- | src/static.sml | 2 | ||||
-rw-r--r-- | src/tutorial.sml | 2 |
26 files changed, 142 insertions, 129 deletions
diff --git a/Makefile.am b/Makefile.am index 98d1ca11..77f8f4e2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -82,8 +82,7 @@ install-exec-local-main: mkdir -p $(DESTDIR)$(LIB_JS) cp lib/js/*.js $(DESTDIR)$(LIB_JS)/ mkdir -p $(DESTDIR)$(INCLUDE) - cp config.h $(DESTDIR)$(INCLUDE)/ - cp include/*.h $(DESTDIR)$(INCLUDE)/ + cp include/urweb/*.h $(DESTDIR)$(INCLUDE)/ install-exec-local: install-exec-local-main install-exec-emacs -ldconfig diff --git a/Makefile.in b/Makefile.in index fe487127..68c53b62 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,9 +1,9 @@ -# Makefile.in generated by automake 1.11.3 from Makefile.am. +# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software -# Foundation, Inc. +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -35,9 +35,10 @@ build_triplet = @build@ host_triplet = @host@ subdir = . DIST_COMMON = $(am__configure_deps) $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in $(srcdir)/config.h.in \ - $(top_srcdir)/configure $(top_srcdir)/src/config.sml.in \ - config.guess config.sub depcomp install-sh ltmain.sh missing + $(srcdir)/Makefile.in $(top_srcdir)/configure \ + $(top_srcdir)/include/urweb/config.h.in \ + $(top_srcdir)/src/config.sml.in config.guess config.sub \ + depcomp install-sh ltmain.sh missing ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_openssl.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ @@ -49,7 +50,7 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = config.h +CONFIG_HEADER = $(top_builddir)/include/urweb/config.h CONFIG_CLEAN_FILES = src/config.sml CONFIG_CLEAN_VPATH_FILES = SOURCES = @@ -73,11 +74,9 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ - if test -d "$(distdir)"; then \ - find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ - && rm -rf "$(distdir)" \ - || { sleep 5 && rm -rf "$(distdir)"; }; \ - else :; fi + { test ! -d "$(distdir)" \ + || { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -fr "$(distdir)"; }; } am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ @@ -106,8 +105,6 @@ am__relativize = \ DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print -am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ - | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ @@ -186,6 +183,7 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SITELISP := @SITELISP@ SQHEADER = @SQHEADER@ +SRCLIB = @SRCLIB@ STRIP = @STRIP@ VERSION := @VERSION@ abs_builddir = @abs_builddir@ @@ -246,11 +244,10 @@ LIB_UR := $(LIB)/ur LIB_C := $(LIB)/c LIB_JS := $(LIB)/js SUBDIRS = src/c -all: config.h - $(MAKE) $(AM_MAKEFLAGS) all-recursive +all: all-recursive .SUFFIXES: -am--refresh: Makefile +am--refresh: @: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ @@ -285,20 +282,22 @@ $(ACLOCAL_M4): $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): -config.h: stamp-h1 - @if test ! -f $@; then rm -f stamp-h1; else :; fi - @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi +include/urweb/config.h: include/urweb/stamp-h1 + @if test ! -f $@; then \ + rm -f include/urweb/stamp-h1; \ + $(MAKE) $(AM_MAKEFLAGS) include/urweb/stamp-h1; \ + else :; fi -stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status - @rm -f stamp-h1 - cd $(top_builddir) && $(SHELL) ./config.status config.h -$(srcdir)/config.h.in: $(am__configure_deps) +include/urweb/stamp-h1: $(top_srcdir)/include/urweb/config.h.in $(top_builddir)/config.status + @rm -f include/urweb/stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status include/urweb/config.h +$(top_srcdir)/include/urweb/config.h.in: $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) - rm -f stamp-h1 + rm -f include/urweb/stamp-h1 touch $@ distclean-hdr: - -rm -f config.h stamp-h1 + -rm -f include/urweb/config.h include/urweb/stamp-h1 src/config.sml: $(top_builddir)/config.status $(top_srcdir)/src/config.sml.in cd $(top_builddir) && $(SHELL) ./config.status $@ @@ -391,7 +390,7 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) mkid -fID $$unique tags: TAGS -TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ @@ -408,7 +407,7 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ - list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ @@ -426,9 +425,9 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ fi; \ fi ctags: CTAGS -CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) - list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ @@ -518,11 +517,7 @@ dist-gzip: distdir $(am__remove_distdir) dist-bzip2: distdir - tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 - $(am__remove_distdir) - -dist-lzip: distdir - tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz + tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) dist-lzma: distdir @@ -530,7 +525,7 @@ dist-lzma: distdir $(am__remove_distdir) dist-xz: distdir - tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz + tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz $(am__remove_distdir) dist-tarZ: distdir @@ -561,8 +556,6 @@ distcheck: dist bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lzma*) \ lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\ - *.tar.lz*) \ - lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ @@ -582,7 +575,6 @@ distcheck: dist && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ - $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ @@ -611,16 +603,8 @@ distcheck: dist list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: - @test -n '$(distuninstallcheck_dir)' || { \ - echo 'ERROR: trying to run $@ with an empty' \ - '$$(distuninstallcheck_dir)' >&2; \ - exit 1; \ - }; \ - $(am__cd) '$(distuninstallcheck_dir)' || { \ - echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ - exit 1; \ - }; \ - test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ + @$(am__cd) '$(distuninstallcheck_dir)' \ + && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ @@ -638,7 +622,7 @@ distcleancheck: distclean exit 1; } >&2 check-am: all-am check: check-recursive -all-am: Makefile config.h all-local +all-am: Makefile all-local installdirs: installdirs-recursive installdirs-am: install: install-recursive @@ -651,15 +635,10 @@ install-am: all-am installcheck: installcheck-recursive install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: @@ -741,14 +720,14 @@ ps-am: uninstall-am: uninstall-local -.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \ - ctags-recursive install-am install-strip tags-recursive +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ + install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am all-local am--refresh check check-am clean \ clean-generic clean-libtool clean-local ctags ctags-recursive \ - dist dist-all dist-bzip2 dist-gzip dist-lzip dist-lzma \ - dist-shar dist-tarZ dist-xz dist-zip distcheck distclean \ + dist dist-all dist-bzip2 dist-gzip dist-lzma dist-shar \ + dist-tarZ dist-xz dist-zip distcheck distclean \ distclean-generic distclean-hdr distclean-libtool \ distclean-tags distcleancheck distdir distuninstallcheck dvi \ dvi-am html html-am info info-am install install-am \ @@ -829,8 +808,7 @@ install-exec-local-main: mkdir -p $(DESTDIR)$(LIB_JS) cp lib/js/*.js $(DESTDIR)$(LIB_JS)/ mkdir -p $(DESTDIR)$(INCLUDE) - cp config.h $(DESTDIR)$(INCLUDE)/ - cp include/*.h $(DESTDIR)$(INCLUDE)/ + cp include/urweb/*.h $(DESTDIR)$(INCLUDE)/ install-exec-local: install-exec-local-main install-exec-emacs -ldconfig diff --git a/configure.ac b/configure.ac index d19bad85..48bdb813 100644 --- a/configure.ac +++ b/configure.ac @@ -5,7 +5,7 @@ AM_INIT_AUTOMAKE([-Wall -Werror foreign no-define]) AC_PROG_CC() AC_PROG_LIBTOOL() AC_CONFIG_MACRO_DIR([m4]) -AC_CONFIG_HEADERS([config.h]) +AC_CONFIG_HEADERS([include/urweb/config.h]) AX_PTHREAD([echo >/dev/null], [echo "Your C compiler does not support POSIX threads."; exit 1]) @@ -41,7 +41,11 @@ if test [-z $BIN]; then fi if test [-z $LIB]; then - LIB=$prefix/lib/urweb + LIB=$prefix/lib +fi + +if test [-z $SRCLIB]; then + SRCLIB=$prefix/lib/urweb fi if test [-z $INCLUDE]; then @@ -89,6 +93,7 @@ fi AC_SUBST(CC) AC_SUBST(BIN) AC_SUBST(LIB) +AC_SUBST(SRCLIB) AC_SUBST(INCLUDE) AC_SUBST(SITELISP) AC_SUBST(CCARGS) @@ -112,6 +117,7 @@ cat <<EOF Ur/Web configuration: bin directory: BIN $BIN lib directory: LIB $LIB + src lib directory: SRCLIB $SRCLIB include directory: INCLUDE $INCLUDE site-lisp directory: SITELISP $SITELISP C compiler: CC $CC diff --git a/doc/manual.tex b/doc/manual.tex index 06731357..853febe7 100644 --- a/doc/manual.tex +++ b/doc/manual.tex @@ -225,6 +225,8 @@ Communication happens via a UNIX domain socket in file \cd{.urweb\_daemon} in th Some other command-line parameters are accepted: \begin{itemize} +\item \texttt{-boot}: Run Ur/Web from a build tree (and not from a system install). This is useful if you're testing the compiler and don't want to install it. It forces generation of statically linked executables. + \item \texttt{-db <DBSTRING>}: Set database connection information, using the format expected by Postgres's \texttt{PQconnectdb()}, which is \texttt{name1=value1 ... nameN=valueN}. The same format is also parsed and used to discover connection parameters for MySQL and SQLite. The only significant settings for MySQL are \texttt{host}, \texttt{hostaddr}, \texttt{port}, \texttt{dbname}, \texttt{user}, and \texttt{password}. The only significant setting for SQLite is \texttt{dbname}, which is interpreted as the filesystem path to the database. Additionally, when using SQLite, a database string may be just a file path. \item \texttt{-dbms [postgres|mysql|sqlite]}: Sets the database backend to use. diff --git a/config.h.in b/include/urweb/config.h.in index 68493505..68493505 100644 --- a/config.h.in +++ b/include/urweb/config.h.in diff --git a/include/queue.h b/include/urweb/queue.h index 8297dd00..8297dd00 100644 --- a/include/queue.h +++ b/include/urweb/queue.h diff --git a/include/request.h b/include/urweb/request.h index a1a7d78d..a1a7d78d 100644 --- a/include/request.h +++ b/include/urweb/request.h diff --git a/include/types.h b/include/urweb/types.h index c401b38f..c401b38f 100644 --- a/include/types.h +++ b/include/urweb/types.h diff --git a/include/urweb.h b/include/urweb/urweb.h index c506985d..c506985d 100644 --- a/include/urweb.h +++ b/include/urweb/urweb.h diff --git a/src/c/Makefile.am b/src/c/Makefile.am index c11596bd..250b0325 100644 --- a/src/c/Makefile.am +++ b/src/c/Makefile.am @@ -6,5 +6,5 @@ liburweb_cgi_la_SOURCES = cgi.c liburweb_fastcgi_la_SOURCES = fastcgi.c liburweb_static_la_SOURCES = static.c -AM_CPPFLAGS = -I../../include @OPENSSL_INCLUDES@ +AM_CPPFLAGS = -I../../include/urweb @OPENSSL_INCLUDES@ AM_CFLAGS = -Wimplicit -Wall -Werror -Wno-format-security -Wno-deprecated-declarations diff --git a/src/c/Makefile.in b/src/c/Makefile.in index ccf03749..a982441d 100644 --- a/src/c/Makefile.in +++ b/src/c/Makefile.in @@ -1,9 +1,9 @@ -# Makefile.in generated by automake 1.11.3 from Makefile.am. +# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software -# Foundation, Inc. +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -45,7 +45,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_openssl.m4 \ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_HEADER = $(top_builddir)/include/urweb/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; @@ -69,12 +69,6 @@ am__nobase_list = $(am__nobase_strip_setup); \ am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' -am__uninstall_files_from_dir = { \ - test -z "$$files" \ - || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ - || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ - $(am__cd) "$$dir" && rm -f $$files; }; \ - } am__installdirs = "$(DESTDIR)$(libdir)" LTLIBRARIES = $(lib_LTLIBRARIES) liburweb_la_LIBADD = @@ -93,7 +87,7 @@ liburweb_http_la_OBJECTS = $(am_liburweb_http_la_OBJECTS) liburweb_static_la_LIBADD = am_liburweb_static_la_OBJECTS = static.lo liburweb_static_la_OBJECTS = $(am_liburweb_static_la_OBJECTS) -DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include/urweb depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f @@ -192,6 +186,7 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SITELISP = @SITELISP@ SQHEADER = @SQHEADER@ +SRCLIB = @SRCLIB@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ @@ -253,7 +248,7 @@ liburweb_http_la_SOURCES = http.c liburweb_cgi_la_SOURCES = cgi.c liburweb_fastcgi_la_SOURCES = fastcgi.c liburweb_static_la_SOURCES = static.c -AM_CPPFLAGS = -I../../include @OPENSSL_INCLUDES@ +AM_CPPFLAGS = -I../../include/urweb @OPENSSL_INCLUDES@ AM_CFLAGS = -Wimplicit -Wall -Werror -Wno-format-security -Wno-deprecated-declarations all: all-am @@ -320,15 +315,15 @@ clean-libLTLIBRARIES: echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done -liburweb.la: $(liburweb_la_OBJECTS) $(liburweb_la_DEPENDENCIES) $(EXTRA_liburweb_la_DEPENDENCIES) +liburweb.la: $(liburweb_la_OBJECTS) $(liburweb_la_DEPENDENCIES) $(LINK) -rpath $(libdir) $(liburweb_la_OBJECTS) $(liburweb_la_LIBADD) $(LIBS) -liburweb_cgi.la: $(liburweb_cgi_la_OBJECTS) $(liburweb_cgi_la_DEPENDENCIES) $(EXTRA_liburweb_cgi_la_DEPENDENCIES) +liburweb_cgi.la: $(liburweb_cgi_la_OBJECTS) $(liburweb_cgi_la_DEPENDENCIES) $(LINK) -rpath $(libdir) $(liburweb_cgi_la_OBJECTS) $(liburweb_cgi_la_LIBADD) $(LIBS) -liburweb_fastcgi.la: $(liburweb_fastcgi_la_OBJECTS) $(liburweb_fastcgi_la_DEPENDENCIES) $(EXTRA_liburweb_fastcgi_la_DEPENDENCIES) +liburweb_fastcgi.la: $(liburweb_fastcgi_la_OBJECTS) $(liburweb_fastcgi_la_DEPENDENCIES) $(LINK) -rpath $(libdir) $(liburweb_fastcgi_la_OBJECTS) $(liburweb_fastcgi_la_LIBADD) $(LIBS) -liburweb_http.la: $(liburweb_http_la_OBJECTS) $(liburweb_http_la_DEPENDENCIES) $(EXTRA_liburweb_http_la_DEPENDENCIES) +liburweb_http.la: $(liburweb_http_la_OBJECTS) $(liburweb_http_la_DEPENDENCIES) $(LINK) -rpath $(libdir) $(liburweb_http_la_OBJECTS) $(liburweb_http_la_LIBADD) $(LIBS) -liburweb_static.la: $(liburweb_static_la_OBJECTS) $(liburweb_static_la_DEPENDENCIES) $(EXTRA_liburweb_static_la_DEPENDENCIES) +liburweb_static.la: $(liburweb_static_la_OBJECTS) $(liburweb_static_la_DEPENDENCIES) $(LINK) -rpath $(libdir) $(liburweb_static_la_OBJECTS) $(liburweb_static_la_LIBADD) $(LIBS) mostlyclean-compile: @@ -473,15 +468,10 @@ install-am: all-am installcheck: installcheck-am install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: diff --git a/src/cgi.sml b/src/cgi.sml index d8c7c3ec..7ee81425 100644 --- a/src/cgi.sml +++ b/src/cgi.sml @@ -32,7 +32,7 @@ open Print.PD Print val () = addProtocol {name = "cgi", compile = "", - linkStatic = Config.lib ^ "/../liburweb_cgi.a", + linkStatic = "liburweb_cgi.a", linkDynamic = "-lurweb_cgi", persistent = false, code = fn () => box [string "void uw_global_custom() {", diff --git a/src/cjr_print.sml b/src/cjr_print.sml index ba3e58f6..0f1e7135 100644 --- a/src/cjr_print.sml +++ b/src/cjr_print.sml @@ -3238,7 +3238,7 @@ fun p_file env (ds, ps) = val rfcFmt = "%a, %d %b %Y %H:%M:%S" in box [string "#include \"", - string (OS.Path.joinDirFile {dir = Config.includ, + string (OS.Path.joinDirFile {dir = !Settings.configInclude, file = "config.h"}), string "\"", newline, @@ -3262,7 +3262,7 @@ fun p_file env (ds, ps) = string "\"", newline]) (Settings.getHeaders ()), string "#include \"", - string (OS.Path.joinDirFile {dir = Config.includ, + string (OS.Path.joinDirFile {dir = !Settings.configInclude, file = "urweb.h"}), string "\"", newline, diff --git a/src/compiler.sig b/src/compiler.sig index 7c39f28d..2a900d41 100644 --- a/src/compiler.sig +++ b/src/compiler.sig @@ -187,6 +187,7 @@ signature COMPILER = sig val debug : bool ref val dumpSource : bool ref + val enableBoot : unit -> unit val doIflow : bool ref diff --git a/src/compiler.sml b/src/compiler.sml index 45d87b6a..c92cd832 100644 --- a/src/compiler.sml +++ b/src/compiler.sml @@ -326,10 +326,25 @@ structure M = BinaryMapFn(struct val compare = String.compare end) -val pathmap = ref (M.insert (M.empty, "", Config.libUr)) +(* XXX ezyang: pathmap gets initialized /really early/, before + * we do any options parsing. So libUr will always point to the + * default. We override it explicitly in enableBoot *) +val pathmap = ref (M.insert (M.empty, "", Settings.libUr ())) fun addPath (k, v) = pathmap := M.insert (!pathmap, k, v) +(* XXX ezyang: this is not right; it probably doesn't work in + * the case of separate build and src trees *) +fun enableBoot () = + (Settings.configBin := OS.Path.joinDirFile {dir = Config.builddir, file = "bin"}; + Settings.configSrcLib := OS.Path.joinDirFile {dir = Config.builddir, file = "lib"}; + (* joinDirFile is annoying... (ArcError; it doesn't like + * slashes in file) *) + Settings.configLib := Config.builddir ^ "/src/c/.libs"; + Settings.configInclude := OS.Path.joinDirFile {dir = Config.builddir ^ "/include", file = "urweb"}; + Settings.configSitelisp := Config.builddir ^ "/src/elisp"; + addPath ("", Settings.libUr ())) + fun capitalize "" = "" | capitalize s = str (Char.toUpper (String.sub (s, 0))) ^ String.extract (s, 1, NONE) @@ -1098,16 +1113,11 @@ val parse = { val toParse = transform parse "parse" o toParseJob -fun libFile s = OS.Path.joinDirFile {dir = Config.libUr, - file = s} -fun clibFile s = OS.Path.joinDirFile {dir = Config.libC, - file = s} - val elaborate = { func = fn file => let - val basisF = libFile "basis.urs" - val topF = libFile "top.urs" - val topF' = libFile "top.ur" + val basisF = Settings.libFile "basis.urs" + val topF = Settings.libFile "top.urs" + val topF' = Settings.libFile "top.ur" val basis = #func parseUrs basisF val topSgn = #func parseUrs topF @@ -1389,9 +1399,9 @@ fun compileC {cname, oname, ename, libs, profile, debug, linker, link = link'} = val proto = Settings.currentProtocol () val lib = if Settings.getStaticLinking () then - #linkStatic proto ^ " " ^ Config.lib ^ "/../liburweb.a" + " " ^ !Settings.configLib ^ "/" ^ #linkStatic proto ^ " " ^ !Settings.configLib ^ "/liburweb.a" else - "-L" ^ Config.lib ^ "/.. " ^ #linkDynamic proto ^ " -lurweb" + "-L" ^ !Settings.configLib ^ " " ^ #linkDynamic proto ^ " -lurweb" val opt = if debug then "" @@ -1399,7 +1409,7 @@ fun compileC {cname, oname, ename, libs, profile, debug, linker, link = link'} = " -O3" val compile = Config.ccompiler ^ " " ^ Config.ccArgs ^ " " ^ Config.pthreadCflags ^ " -Wimplicit -Werror -Wno-unused-value" - ^ opt ^ " -I " ^ Config.includ + ^ opt ^ " -I " ^ !Settings.configInclude ^ " " ^ #compile proto ^ " -c " ^ escapeFilename cname ^ " -o " ^ escapeFilename oname diff --git a/src/config.sig b/src/config.sig index 70548b12..a3ad7d76 100644 --- a/src/config.sig +++ b/src/config.sig @@ -1,13 +1,12 @@ signature CONFIG = sig + val builddir : string + val bin : string + val srclib : string val lib : string val includ : string val sitelisp : string - val libUr : string - val libC : string - val libJs : string - val ccompiler : string val ccArgs : string val openssl : string diff --git a/src/config.sml.in b/src/config.sml.in index 51d572eb..ebcdb7b6 100644 --- a/src/config.sml.in +++ b/src/config.sml.in @@ -1,17 +1,13 @@ structure Config :> CONFIG = struct +val builddir = "@abs_top_builddir@" + val bin = "@BIN@" +val srclib = "@SRCLIB@" val lib = "@LIB@" val includ = "@INCLUDE@" val sitelisp = "@SITELISP@" -val libUr = OS.Path.joinDirFile {dir = lib, - file = "ur"} -val libC = OS.Path.joinDirFile {dir = lib, - file = "c"} -val libJs = OS.Path.joinDirFile {dir = lib, - file = "js"} - val ccompiler = "@CC@" val ccArgs = "@CCARGS@" diff --git a/src/demo.sml b/src/demo.sml index 35332637..6897bfa2 100644 --- a/src/demo.sml +++ b/src/demo.sml @@ -320,7 +320,7 @@ fun make' {prefix, dirname, guided} = val cmd = "emacs --eval \"(progn " ^ "(global-font-lock-mode t) " ^ "(add-to-list 'load-path \\\"" - ^ Config.sitelisp + ^ !Settings.configSitelisp ^ "/\\\") " ^ "(load \\\"urweb-mode-startup\\\") " ^ "(urweb-mode) " diff --git a/src/fastcgi.sml b/src/fastcgi.sml index 5f849856..bf2a2a1a 100644 --- a/src/fastcgi.sml +++ b/src/fastcgi.sml @@ -32,7 +32,7 @@ open Print.PD Print val () = addProtocol {name = "fastcgi", compile = "", - linkStatic = Config.lib ^ "/../liburweb_fastcgi.a", + linkStatic = "liburweb_fastcgi.a", linkDynamic = "-lurweb_fastcgi", persistent = true, code = fn () => box [string "void uw_global_custom() {", diff --git a/src/http.sml b/src/http.sml index 5859f077..64dbb06d 100644 --- a/src/http.sml +++ b/src/http.sml @@ -32,7 +32,7 @@ open Print.PD Print val () = addProtocol {name = "http", compile = "", - linkStatic = Config.lib ^ "/../liburweb_http.a", + linkStatic = "liburweb_http.a", linkDynamic = "-lurweb_http", persistent = true, code = fn () => box [string "void uw_global_custom() {", diff --git a/src/jscomp.sml b/src/jscomp.sml index 901ea9fe..d7b9370f 100644 --- a/src/jscomp.sml +++ b/src/jscomp.sml @@ -1306,7 +1306,7 @@ fun process file = maxName = U.File.maxName file + 1} file - val inf = TextIO.openIn (OS.Path.joinDirFile {dir = Config.libJs, file = "urweb.js"}) + val inf = TextIO.openIn (OS.Path.joinDirFile {dir = Settings.libJs (), file = "urweb.js"}) fun lines acc = case TextIO.inputLine inf of NONE => String.concat (rev acc) diff --git a/src/main.mlton.sml b/src/main.mlton.sml index 9c18f727..9cc82da0 100644 --- a/src/main.mlton.sml +++ b/src/main.mlton.sml @@ -122,6 +122,10 @@ fun oneRun args = | "-root" :: name :: root :: rest => (Compiler.addModuleRoot (root, name); doArgs rest) + | "-boot" :: rest => + (Compiler.enableBoot (); + Settings.setStaticLinking true; + doArgs rest) | "-sigfile" :: name :: rest => (Settings.setSigFile (SOME name); doArgs rest) diff --git a/src/settings.sig b/src/settings.sig index 62b7a748..4b1ac8ac 100644 --- a/src/settings.sig +++ b/src/settings.sig @@ -27,9 +27,21 @@ signature SETTINGS = sig + (* XXX these should be unit -> string too *) + val configBin : string ref + val configLib : string ref + val configSrcLib : string ref + val configInclude : string ref + val configSitelisp : string ref + + val libUr : unit -> string + val libC : unit -> string + val libJs : unit -> string + val setDebug : bool -> unit val getDebug : unit -> bool + val libFile : string -> string val clibFile : string -> string (* How do all application URLs begin? *) diff --git a/src/settings.sml b/src/settings.sml index 3adf81c8..78b02126 100644 --- a/src/settings.sml +++ b/src/settings.sml @@ -27,6 +27,22 @@ structure Settings :> SETTINGS = struct +val configBin = ref Config.bin +val configLib = ref Config.lib +val configSrcLib = ref Config.srclib +val configInclude = ref Config.includ +val configSitelisp = ref Config.sitelisp + +fun libUr () = OS.Path.joinDirFile {dir = !configSrcLib, + file = "ur"} +fun libC () = OS.Path.joinDirFile {dir = !configSrcLib, + file = "c"} +fun libJs () = OS.Path.joinDirFile {dir = !configSrcLib, + file = "js"} + +fun libFile s = OS.Path.joinDirFile {dir = libUr (), + file = s} + val urlPrefixFull = ref "/" val urlPrefix = ref "/" val urlPrePrefix = ref "" @@ -408,7 +424,7 @@ val protocols = ref ([] : protocol list) fun addProtocol p = protocols := p :: !protocols fun getProtocol s = List.find (fn p => #name p = s) (!protocols) -fun clibFile s = OS.Path.joinDirFile {dir = Config.libC, +fun clibFile s = OS.Path.joinDirFile {dir = libC (), file = s} val curProto = ref {name = "", diff --git a/src/static.sml b/src/static.sml index fa3205c1..c74d4e34 100644 --- a/src/static.sml +++ b/src/static.sml @@ -32,7 +32,7 @@ open Print.PD Print val () = addProtocol {name = "static", compile = "", - linkStatic = Config.lib ^ "/../liburweb_static.a", + linkStatic = "liburweb_static.a", linkDynamic = "-lurweb_static", persistent = false, code = fn () => box [string "void uw_global_custom() { }", diff --git a/src/tutorial.sml b/src/tutorial.sml index 605b1f5e..1b8834f5 100644 --- a/src/tutorial.sml +++ b/src/tutorial.sml @@ -280,7 +280,7 @@ fun doUr fname = val cmd = "emacs --eval \"(progn " ^ "(global-font-lock-mode t) " ^ "(add-to-list 'load-path \\\"" - ^ Config.sitelisp + ^ !Settings.configSitelisp ^ "/\\\") " ^ "(load \\\"urweb-mode-startup\\\") " ^ "(urweb-mode) " |