diff options
Diffstat (limited to 'src')
-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 |
17 files changed, 88 insertions, 60 deletions
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) " |