From: Richard W.M. Jones Date: Sun, 12 Jan 2020 22:46:24 +0000 (+0000) Subject: build: Implement install rule. X-Git-Tag: v'0.2'~11 X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=7cc3051dd596e662d26cfa66e0a20b4b189d3cb2;p=goals.git build: Implement install rule. --- diff --git a/Goalfile.in b/Goalfile.in index 0fd2b5b..6601c58 100644 --- a/Goalfile.in +++ b/Goalfile.in @@ -153,3 +153,22 @@ goal test (name) = @{ exit 1 fi } + +#---------------------------------------------------------------------- +# Install. + +# DESTDIR can be overridden on the command line to install into +# a subdirectory. +let DESTDIR = "" + +let stdlibfiles = [wildcard ("stdlib/*.gl"), wildcard ("stdlib/*.sh")] + +goal install = { + # exec_prefix die die die + bindir="@prefix@/bin" + datadir="@prefix@/share" + mkdir -p %DESTDIR/"$bindir" + mkdir -p %DESTDIR/"$datadir/goals" + install src/goals %DESTDIR/"$bindir" -m 0755 + install %stdlibfiles %DESTDIR/"$datadir"/goals -m 644 +} diff --git a/src/cmdline.ml b/src/cmdline.ml index ff71c9c..927dfdf 100644 --- a/src/cmdline.ml +++ b/src/cmdline.ml @@ -41,7 +41,8 @@ let print_version () = (* Get stdlib directory. *) let datadir = - try Sys.getenv "GOALS_DATADIR" with Not_found -> Config.datadir + try Sys.getenv "GOALS_DATADIR" + with Not_found -> Config.datadir // "goals" let stdlibdir = datadir // "stdlib" let prelude_gl_file = stdlibdir // "prelude.gl" let prelude_sh_file = stdlibdir // "prelude.sh"