From 7cc3051dd596e662d26cfa66e0a20b4b189d3cb2 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Sun, 12 Jan 2020 22:46:24 +0000 Subject: [PATCH] build: Implement install rule. --- Goalfile.in | 19 +++++++++++++++++++ src/cmdline.ml | 3 ++- 2 files changed, 21 insertions(+), 1 deletion(-) 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" -- 1.8.3.1