summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2008-10-19 12:47:10 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2008-10-19 12:47:10 -0400
commit54d7cbad02005212c4171b7d652416c75a93aa37 (patch)
treea51f905aff94143b7019859ff0407d1935e177f9 /src
parent8476261d4f4a9a67119abc05cb40907ad979b4de (diff)
Proper configuration and installation
Diffstat (limited to 'src')
-rw-r--r--src/cjr_print.sml5
-rw-r--r--src/compiler.sml17
-rw-r--r--src/config.sig9
-rw-r--r--src/config.sml.in13
-rw-r--r--src/main.mlton.sml2
-rw-r--r--src/sources5
6 files changed, 44 insertions, 7 deletions
diff --git a/src/cjr_print.sml b/src/cjr_print.sml
index ef198e2a..aee23717 100644
--- a/src/cjr_print.sml
+++ b/src/cjr_print.sml
@@ -2037,7 +2037,10 @@ fun p_file env (ds, ps) =
string "#include <postgresql/libpq-fe.h>",
newline,
newline,
- string "#include \"urweb.h\"",
+ string "#include \"",
+ string (OS.Path.joinDirFile {dir = Config.includ,
+ file = "urweb.h"}),
+ string "\"",
newline,
newline,
p_list_sep newline (fn x => x) pds,
diff --git a/src/compiler.sml b/src/compiler.sml
index 26aede96..c413715a 100644
--- a/src/compiler.sml
+++ b/src/compiler.sml
@@ -355,11 +355,16 @@ 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 basis = #func parseUrs "lib/basis.urs"
- val topSgn = #func parseUrs "lib/top.urs"
- val topStr = #func parseUr "lib/top.ur"
+ val basis = #func parseUrs (libFile "basis.urs")
+ val topSgn = #func parseUrs (libFile "top.urs")
+ val topStr = #func parseUr (libFile "top.ur")
in
Elaborate.elabFile basis topStr topSgn ElabEnv.empty file
end,
@@ -493,8 +498,11 @@ val toSqlify = transform sqlify "sqlify" o toMono_opt2
fun compileC {cname, oname, ename} =
let
+ val urweb_o = clibFile "urweb.o"
+ val driver_o = clibFile "driver.o"
+
val compile = "gcc -Wstrict-prototypes -Werror -O3 -I include -c " ^ cname ^ " -o " ^ oname
- val link = "gcc -Werror -O3 -pthread -lpq clib/urweb.o " ^ oname ^ " clib/driver.o -o " ^ ename
+ val link = "gcc -Werror -O3 -pthread -lpq " ^ urweb_o ^ " " ^ oname ^ " " ^ driver_o ^ " -o " ^ ename
in
if not (OS.Process.isSuccess (OS.Process.system compile)) then
print "C compilation failed\n"
@@ -517,6 +525,7 @@ fun compile job =
else
let
val dir = OS.FileSys.tmpName ()
+ val () = OS.FileSys.remove dir
val cname = OS.Path.joinDirFile {dir = dir, file = "urweb.c"}
val oname = OS.Path.joinDirFile {dir = dir, file = "urweb.o"}
in
diff --git a/src/config.sig b/src/config.sig
new file mode 100644
index 00000000..890bd9ab
--- /dev/null
+++ b/src/config.sig
@@ -0,0 +1,9 @@
+signature CONFIG = sig
+ val bin : string
+ val lib : string
+ val includ : string
+ val sitelisp : string
+
+ val libUr : string
+ val libC : string
+end
diff --git a/src/config.sml.in b/src/config.sml.in
new file mode 100644
index 00000000..d1eb5025
--- /dev/null
+++ b/src/config.sml.in
@@ -0,0 +1,13 @@
+structure Config :> CONFIG = struct
+
+val bin = "@BIN@"
+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"}
+
+end
diff --git a/src/main.mlton.sml b/src/main.mlton.sml
index 142296e4..94d0f2ac 100644
--- a/src/main.mlton.sml
+++ b/src/main.mlton.sml
@@ -46,7 +46,7 @@ val (timing, sources) = doArgs (CommandLine.arguments (), (false, []))
val job =
case sources of
[file] => file
- | _ => raise Fail "Multiple job files specified"
+ | _ => raise Fail "Zero or multiple job files specified"
val () =
if timing then
diff --git a/src/sources b/src/sources
index 388e0996..897c0454 100644
--- a/src/sources
+++ b/src/sources
@@ -1,3 +1,6 @@
+config.sig
+config.sml
+
search.sig
search.sml
@@ -119,7 +122,7 @@ mono_reduce.sml
mono_shake.sig
mono_shake.sml
-pathcheck.sigx
+pathcheck.sig
pathcheck.sml
cjr.sml