Skip to content

Commit

Permalink
abolish 'SATYSFI_LIB_ROOT' and designate '~/.satysfi' as the library …
Browse files Browse the repository at this point in the history
…root
  • Loading branch information
gfngfn committed Feb 10, 2018
1 parent 4de277c commit aa03c82
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 24 deletions.
28 changes: 14 additions & 14 deletions Makefile
@@ -1,5 +1,5 @@
PREFIX=/usr/local
PREFIX_LIB=/usr/local
LIBDIR=~/.satysfi
SRCROOT=src
BACKEND=src/backend
FRONTEND=src/frontend
Expand All @@ -21,18 +21,18 @@ all:
install: $(TARGET)
mkdir -p $(BINDIR)
install $(TARGET) $(BINDIR)
install -d $(PREFIX_LIB)/lib-satysfi
install -d $(PREFIX_LIB)/lib-satysfi/dist
install -d $(PREFIX_LIB)/lib-satysfi/dist/unidata
install -m 644 lib-satysfi/dist/unidata/*.txt $(PREFIX_LIB)/lib-satysfi/dist/unidata
install -d $(PREFIX_LIB)/lib-satysfi/dist/fonts
install -m 644 lib-satysfi/dist/fonts/* $(PREFIX_LIB)/lib-satysfi/dist/fonts
install -d $(PREFIX_LIB)/lib-satysfi/dist/hash
install -m 644 lib-satysfi/dist/hash/* $(PREFIX_LIB)/lib-satysfi/dist/hash
install -d $(PREFIX_LIB)/lib-satysfi/dist/hyph
install -m 644 lib-satysfi/dist/hyph/* $(PREFIX_LIB)/lib-satysfi/dist/hyph
install -d $(PREFIX_LIB)/lib-satysfi/dist/packages
install -m 644 lib-satysfi/dist/packages/* $(PREFIX_LIB)/lib-satysfi/dist/packages
install -d $(LIBDIR)
install -d $(LIBDIR)/dist
install -d $(LIBDIR)/dist/unidata
install -m 644 lib-satysfi/dist/unidata/*.txt $(LIBDIR)/dist/unidata
install -d $(LIBDIR)/dist/fonts
install -m 644 lib-satysfi/dist/fonts/* $(LIBDIR)/dist/fonts
install -d $(LIBDIR)/dist/hash
install -m 644 lib-satysfi/dist/hash/* $(LIBDIR)/dist/hash
install -d $(LIBDIR)/dist/hyph
install -m 644 lib-satysfi/dist/hyph/* $(LIBDIR)/dist/hyph
install -d $(LIBDIR)/dist/packages
install -m 644 lib-satysfi/dist/packages/* $(LIBDIR)/dist/packages

#preliminary:
# [ -d .git ] && git submodule update -i || echo "Skip git submodule update -i"
Expand All @@ -57,7 +57,7 @@ lib:

uninstall:
rm -rf $(BINDIR)/$(TARGET)
rm -rf $(PREFIX_LIB)/lib-satysfi
rm -rf $(LIBDIR)

clean:
$(OCB) -clean
Expand Down
12 changes: 4 additions & 8 deletions opam
Expand Up @@ -8,18 +8,14 @@ dev-repo: "https://github.com/gfngfn/SATySFi.git"
bug-reports: "https://github.com/gfngfn/SATySFi/issues"
build: [
["echo" "\"begin to build SATySFi\""]
[make "-f" "Makefile" "PREFIX=%{prefix}%" "PREFIX_LIB=%{prefix}%"]
[make "-f" "Makefile" "lib" "PREFIX=%{prefix}%" "PREFIX_LIB=%{prefix}%"]
[make "-f" "Makefile" "PREFIX=%{prefix}%"]
[make "-f" "Makefile" "lib" "PREFIX=%{prefix}%"]
]
install: [
[make "-f" "Makefile" "install" "PREFIX=%{prefix}%" "PREFIX_LIB=%{prefix}%"]
]
post-messages: [
"Please set SATYSFI_LIB_ROOT. You may want to add the following line to ~/.bashrc"
"export SATYSFI_LIB_ROOT=\"$(PREFIX_LIB)/lib-satysfi\""
[make "-f" "Makefile" "install" "PREFIX=%{prefix}%"]
]
remove: [
[make "-f" "Makefile" "uninstall" "PREFIX=%{prefix}%" "PREFIX_LIB=%{prefix}%"]
[make "-f" "Makefile" "uninstall" "PREFIX=%{prefix}%"]
]
depends: [
"depext"
Expand Down
13 changes: 11 additions & 2 deletions src/frontend/main.ml
Expand Up @@ -255,23 +255,27 @@ let eval_document_file (libdir : file_path) (tyenv : Typeenv.t) (env : environme

| _ -> raise (NotADocumentFile(file_path_in, tyenv, ty))


(*
let env_var_lib_root = "SATYSFI_LIB_ROOT"

*)

let error_log_environment suspended =
try
suspended ()
with
| NoLibraryRootDesignation ->
report_error Interface [
NormalLine("cannot determine where the SATySFi library root is;");
NormalLine("the environment variable 'HOME' is NOT defined.");
(*
NormalLine("the environment variable '" ^ env_var_lib_root ^ "' is NOT defined;");
NormalLine("in order to work SATySFi correctly, for example,");
NormalLine("you can add to your '~/.bash_profile' a line of the form:");
DisplayLine("export " ^ env_var_lib_root^ "=/path/to/library/root/");
NormalLine("and execute:");
DisplayLine("$ source ~/.bash_profile");
NormalLine("The library root is typically '/usr/local/lib-satysfi/'.")
*)
]

| NoInputFileDesignation ->
Expand Down Expand Up @@ -722,9 +726,14 @@ let arg_spec_list curdir =
let () =
error_log_environment (fun () ->
let libdir =
(*
match Sys.getenv_opt env_var_lib_root with
| None -> raise NoLibraryRootDesignation
| Some(s) -> s
*)
match Sys.getenv_opt "HOME" with
| None -> raise NoLibraryRootDesignation
| Some(s) -> Filename.concat s ".satysfi"
in
let pkgdir = Filename.concat libdir "dist/packages" in
let curdir = Sys.getcwd () in
Expand Down

0 comments on commit aa03c82

Please sign in to comment.