Portable package installation on Haskell Platform with Cabal on windows
Asked Answered
M

1

2

I have Windows XP and Haskell Platform 2013 installed on it. When I want to compile my code on some computer, which has not Haskell Platform installed on it, and I'm not allowed to install anything, I can copy my Haskell Platform on USB flashcard, and run on this computer, and it's work just fine.

But sometimes I need additional packages, that are not part of the standard Haskell Platform build.

I can simply install it on my personal computer with Cabal, but I don't know, how to install them in such a way that they could work portable, i. e. from my USB flashcard on not my computer.

I tried this:

cabal install gnuplot --prefix "C:\Program Files\Haskell Platform\2013.2.0.0"

This installed package into Haskell platform directory, but when I run Haskell Platform on another computer, it don't see it.

I think, I should make configuration file to be installed in Haskell Platform directory, but I don't how to do it.

Please, help me to solve this problem. Thank you in advance!



Thank you very much, Mikhail Glushenkov! All work fine now.

For convenience of newbies like me, that looking for answers, I merely describe the instruction, what to do, to have same result:

0) Read the instruction before doing anything/

1) Uninstall all additional packages, that is needed to be installed portable (with dependencies): unregister this packages with

ghc-pkg unregister gnuplot

, and then delete package-files from where it stores. Also delete all related files from "package.conf.d" folders. To search them, use

ghc-pkg list

.

2) Run (maybe it's unnecessary)

ghc-pkg recache

.

3) Install package in desired directory in haskell platform. I did it in "C:\Program Files\Haskell Platform\2013.2.0.0\addlib":

cabal install gnuplot --prefix "C:\Program Files\Haskell Platform\2013.2.0.0\addlib" --global

.

4) Change every new file, related to installed packages in "package.conf.d": replace "C:\Program Files\Haskell Platform\2013.2.0.0\addlib\utility-ht-0.0.9\ghc-7.6.3" in them like that: "$topdir\..\addlib\utility-ht-0.0.9\ghc-7.6.3", i. e. "C:\Program Files\Haskell Platform\2013.2.0.0\addlib\" -> "$topdir\..\addlib\".

5) Run

ghc-pkg recache

.

3a) Maybe, this would work better, then 3 (I did not tested it). If so, don't do 3, 4, and 5.

cabal install gnuplot --prefix "$topdir\..\addlib" --global

.

End.

*UPD*

I found some stupid mistakes in this instructions (in 3a and 4). Fixed now.

3a is not working!

Mcclintock answered 25/9, 2013 at 14:2 Comment(2)
I have never installed Haskell on windows so maybe this is just something I don't understand but I don't get the prefix bit. The prefix you're supplying is not on your USB drive, why would you expect to see it on a different computer then?Saccharose
@AndrewMyers, I installed the library in Haskell platform folder, and move Haskell platform folder into my USB flashcard, so, physically, the library was on another computer. The problem was to make Haskell platform see it on another computer. And I didn't knew how to do so, and that's why I have asked the question.Mcclintock
M
3

You need to replace the absolute paths in $GHCDIR\lib\package.conf.d\*.conf files with relative paths referencing $topdir and then run ghc-pkg recache.

Take a look at how the Haskell Platform's Windows installer does it.

Mezzorelievo answered 25/9, 2013 at 15:31 Comment(8)
Thank you, @MikhailGlushenkov, but it looks like that I have not any file, related to gnuplot library (that I, in particular, installed). How could I make this file?Mcclintock
Well, I can't edit previous comment yet, so I just write: I mean, I haven't such file in directory mentioned by you.Mcclintock
@AnonImous Run ghc-pkg list. It will show you the locations of package.conf.d directories. Also, you need to run cabal install with --global so that it installs to the global package DB.Mezzorelievo
I'm sorry for interrupting you, but how to install it portable at once?Mcclintock
Look like SO didn;t call you here. So I do it now. @MikhailMcclintock
@AnonImous I don't think cabal-install supports this out of the box. You need to create a custom script.Mezzorelievo
Thank you, @Mikhail, for information! Now, I think, that I'll do it.Mcclintock
The link is dead.Barthold

© 2022 - 2024 — McMap. All rights reserved.