简体   繁体   中英

How to clean leftover files from a cabal build?

I'm a complete noob at developer stuff. I've recently had to install Gitit https://github.com/jgm/gitit using cabal as they don't provide binaries for Windows. The build process seems to have left behind a lot of seemingly useless files. How do I clean it up? What if I want to move the binaries around on a USB stick (with haskell platform on it of course)? How do others manage this mess?

Directory structure:

 Directory of T:\haskell-platform\gitit\.cabal-sandbox

01/07/16  06:52                34 add-source-timestamps
01/07/16  06:52    <DIR>          bin
01/07/16  06:43    <DIR>          doc
01/07/16  06:52    <DIR>          logs
01/07/16  06:51    <DIR>          man
01/07/16  06:43    <DIR>          packages
01/07/16  06:52                11 world
01/07/16  06:52    <DIR>          x86_64-windows-ghc-7.10.3
01/07/16  06:52    <DIR>          x86_64-windows-ghc-7.10.3-packages.conf.d
               2 File(s)             45 bytes
               7 Dir(s)  57,124,208,640 bytes free

Images: Img1 Img2

That "mess" is all dependencies. That is, Cabal have downloaded all libraries your program needs to function. They are kept around so that future builds will be much faster, which is especially useful if you are rewriting some parts of the code yourself. You can just delete the entire .cabal-sandbox directory if you wish.

You can also run cabal clean to clean out most compilation working files, but that won't clean out the sandbox directory. Cleaning the sandbox directory is being discussed for a future version of Cabal.

GHC compiles your entire program into a single executable. You only need the compiled binary to run your program, not even the Haskell platform. Just remember that the binary will only work on the kind of system it was compiled for; operating system and CPU architecture.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM