fdopen / opam-repository-mingw

windows package repository for OPAM (mingw and msvc)
https://fdopen.github.io/opam-repository-mingw/
Creative Commons Zero v1.0 Universal
96 stars 34 forks source link

Cygwin packages directory Graphical installer #23

Closed maroneze closed 8 years ago

maroneze commented 8 years ago

I just tried the new graphical installer, and it is very useful! On the two machines I tested, it worked without issues.

One minor detail that I would suggest adding to the webpage is how to re-run Cygwin setup after installing OCaml (for instance, I needed to install autoconf, and I couldn't find at first cygwin-dl.exe in .opam\4.02.3+mingw32c\bin, so I thought I would have to re-download Cygwin setup by myself). That said, Cygwin's graphical setup is somewhat counter-intuitive when used to a Linux package manager, so that might be hard to explain without getting into too much detail.

I just noticed that the depext-cygwin page does mention cygwin-install gui, but it comes much later, so it could still be useful to mention it earlier.

In any case, it's becoming simpler to install OPAM on Windows than on Linux, which I wouldn't have expected a few years ago!

maroneze commented 8 years ago

By the way, if someone would like to customize the graphical installer (e.g. change the default installation path), is that possible at all? I don't believe it is open-source, is it?

fdopen commented 8 years ago

Yes, it should been documented better.

At the moment the following points occur to me that I should add to the documentation (I will leave this issue open until I've updated it):

1) cygwin-install gui should be used, if your cygwin installation was created with the gui installer. The gui installer creates a cygwin installation that is owned by the current user. That's convenient, because you can install external dependencies with a simple opam depext foo. By default, cygwin's setup starts in elevated mode and creates the cygwin environment accordingly. opam depext ocaml-top would then require a shell that is started in elevated mode, too. If cygwin-install gui is used, it will call cygwin's setup.exe in the same way as the installer. So opam depext ... should continue to work out of the box.

2) the gui switch accepts packages as parameters. If you want to install something:

$ cygcheck -p autoconf # search through the online database
$ cygwin-install gui autoconf2.5

But often you have to close all cygwin processes at this point (terminals, screen sessions, ssh daemons, etc.). You can't update cygwin, while cygwin processes are still active.

3) depext-cygwinports can be configured through a config file. The default config can be found under: ~/.opam/${SWITCH}/etc/depext-cygwinports/depext-cygwin.conf. At the moment, only mirror_cygwin should be changed (mirror_ports is unused). You can overwrite mirror_cygwin globally (for all opam switches):

$ mkdir -p ~/.config/depext-cygwinports
$ echo 'mirror_cygwin = "http://my_mirror.com/foo/"' > ~/.config/depext-cygwinports/urls

Possible urls can be found at: https://cygwin.com/mirrors.lst . It might become necessary, if the current default mirror goes offline.

4) If the setup complains, that a newer version is available, opam reinstall -y depext-cygwinports can be used to download the new version.


And no, the source code of the graphical installer (a simple nsis script and a few shell scripts) are currently not available online - but only because I was too lazy to write the build scripts in a way that are independent of my specific setup. If you have any use for it, I can upload it later.

maroneze commented 8 years ago

Thank you very much for this extra documentation.

I did use NSIS in the past once, so I think the script could be very useful for adapting Frama-C packages to some users who require extra hand-holding.

fdopen commented 8 years ago

Ok, here it is: https://github.com/fdopen/opam-cygwin-installer