From: Adam Chlipala Date: Wed, 22 Sep 2004 02:27:21 +0000 (+0000) Subject: Un-hard code some things X-Git-Url: http://git.hcoop.net/bpt/mlt.git/commitdiff_plain/dc3b1a7f9c941c2a323e57861871090465fa31f7 Un-hard code some things --- diff --git a/BUILDING b/BUILDING index 41164d4..38265e5 100644 --- a/BUILDING +++ b/BUILDING @@ -13,6 +13,8 @@ internals, and they may change often. Configuration ============= +Modify the parameters in settings.sml as appropriate for your system. + If it is possible for you to modify a file /etc/mlt.conf, then you can edit this file to set various options related to locations of important files on your file system. In particular, you may want to diff --git a/build b/build index 49811e7..98b1f5c 100755 --- a/build +++ b/build @@ -1,11 +1,12 @@ #!/bin/sh SMLBIN=/usr/local/sml/bin +PLATFORM=x86-linux cd src -if [ -f mlt.x86-linux ] ; then - rm mlt.x86-linux +if [ -f mlt.$PLATFORM ] ; then + rm mlt.$PLATFORM fi if [ -d CM ] ; then rm -rf CM diff --git a/install b/install index 853a70d..8a5b10c 100755 --- a/install +++ b/install @@ -1,2 +1,5 @@ -cp src/mlt /usr/local/bin/ -cp src/mlt.x86-linux /usr/local/bin/ \ No newline at end of file +BIN=/usr/local/bin +PLATFORM=x86-linux + +cp src/mlt $BIN/ +cp src/mlt.$PLATFORM $BIN/ \ No newline at end of file diff --git a/src/compiler.sml b/src/compiler.sml index b335cd9..16d66f8 100644 --- a/src/compiler.sml +++ b/src/compiler.sml @@ -21,6 +21,8 @@ structure Compiler :> COMPILER = struct + open Settings + exception Error val cgiMode = Posix.FileSys.S.flags [Posix.FileSys.S.irwxu, @@ -169,7 +171,6 @@ struct val outPath = Config.outPath config val pubPath = Config.pubPath config val sml = Config.sml config - val arch = "x86-linux" val loc = Environment.staticPart (#get (EnvRef.loc ()) ()) val base = Environment.staticPart (#get (EnvRef.base ()) ()) diff --git a/src/config.sml b/src/config.sml index 45253ac..3ddc0d7 100644 --- a/src/config.sml +++ b/src/config.sml @@ -1,6 +1,6 @@ (* * Dynamic web page generation with Standard ML - * Copyright (C) 2003 Adam Chlipala + * Copyright (C) 2003-2004 Adam Chlipala * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -21,7 +21,7 @@ structure Config :> CONFIG = struct - val defaultFile = "/etc/mlt.conf" + open Settings datatype config = CONFIG of {inPath : string, (* Directory for input sources *) diff --git a/src/main.sml b/src/main.sml index 80b8eaf..d9950fa 100644 --- a/src/main.sml +++ b/src/main.sml @@ -34,4 +34,6 @@ struct print msg; print "\n"; OS.Process.failure) + | Io => (print "FATAL ERROR: Io\n"; + OS.Process.failure) end \ No newline at end of file diff --git a/src/settings.sml b/src/settings.sml new file mode 100644 index 0000000..39a96a4 --- /dev/null +++ b/src/settings.sml @@ -0,0 +1,26 @@ +(* + * Dynamic web page generation with Standard ML + * Copyright (C) 2003-2004 Adam Chlipala + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + *) + +(* Configuration parameters *) + +structure Settings = +struct + val arch = "x86-linux" + val defaultFile = "/etc/mlt.conf" +end \ No newline at end of file diff --git a/src/sources.cm b/src/sources.cm index f59dcb2..0631a65 100644 --- a/src/sources.cm +++ b/src/sources.cm @@ -28,6 +28,8 @@ is $smlnj/compiler/current.cm + settings.sml + string_map.sml common.sml