protz / ocaml-installer

The official windows installer (built using NSIS) for OCaml
http://protz.github.com/ocaml-installer/
GNU General Public License v3.0
66 stars 11 forks source link

Is a sandboxed, portable installation possible? #35

Closed jordwalke closed 8 years ago

jordwalke commented 8 years ago

Suppose I simply wanted the simplest possible OCaml setup on Windows, and I was willing to give up the ability to use all the existing tooling such as findlib, ocamlbuild, etc. Suppose, someone on windows just wants to learn how to use OCaml and execute raw ocamlopt/ocamldep commands. It would be best in this case, if all the compiler binaries, and standard lib existed in a sandboxed directory such as ./myDir/bin/, ./myDir/lib.

Is it possible or easy to generate a precompiled distribution such as I've described - without requiring that path variables be changed in a particular way? I don't necessarily care if the size is huge. How much of the ocaml-installer and the resulting compiler toolchain relies on being in some special directory in the windows special directories (or requires that compiled libraries are installed in some special location)? What can be done to create a fully self-contained, portable directory as I've described? Any help is greatly appreciated.

msprotz commented 8 years ago

A relocatable OCaml depends on the "OCAMLLIB" environment variable being set. If you don't want to set this environment variable, then you need to recompile OCaml on your machine with a "--prefix" flag passed to ./configure. Then, assuming OCaml is installed in the directory FOO you've passed to ./configure --prefix=FOO, OCaml will find the right cmx and cmi's. You still need, however, to have the other bits of the toolchain (x86_64-w64-mingw32-gcc, flexlink) in the PATH. I don't know how things would work otherwise. You'd probably have to patch OCaml to hardcode some directories then recompile.

jordwalke commented 8 years ago

Thanks for the detailed explanation, @msprotz!