Cabal configure install dependencies
Configuration and Installing Packages 4. Package Concepts and Development 5. Nix-style Local Builds 6. Package Description 8.
Package Description Format Specification History Field Syntax Reference Reporting Bugs and Stability of Cabal Interfaces Nix Integration Reference Index. Docs » 1. Note cabal-version refers to the version of the.
There is a separate installed package ID that uniquely identifies each installed package instance. Most of the time however, users need not be aware of this detail. It can be slightly confusing at first because there are various different notions of package floating around. Fortunately the details are not very complicated.
Cabal packages are really source packages. That is they contain Haskell and sometimes C source code. Cabal packages can be compiled to produce GHC packages. They can also be translated into operating system packages. GHC only cares about library packages, not executables. Library packages have to be registered with GHC for them to be available in GHCi or to be used when compiling other programs or packages. The low-level tool ghc-pkg is used to register GHC packages and to get information on what packages are currently registered.
You never need to make GHC packages manually. When you build and install a Cabal package containing a library then it gets registered with GHC automatically. Haskell implementations other than GHC have essentially the same concept of registered packages. For the most part, Cabal hides the slight differences. On operating systems like Linux and Mac OS X, the system has a specific notion of a package and there are tools for installing and managing packages.
The Cabal package format is designed to allow Cabal packages to be translated, mostly-automatically, into operating system packages. They are usually translated , that is a single Cabal package becomes a single system package. It is also possible to make Windows installers from Cabal packages, though this is typically done for a program together with all of its library dependencies, rather than packaging each library separately.
The Cabal package is the unit of distribution. What this means is that each Cabal package can be distributed on its own in source or binary form. Of course there may be dependencies between packages, but there is usually a degree of flexibility in which versions of packages can work together so distributing them independently makes sense. Many projects are made up of several interdependent packages and during development these might all be kept under one common directory tree and be built and tested together.
When it comes to distribution however, rather than distributing them all together in a single tarball, it is required that they each be distributed independently in their own tarballs.
Or to put it the other way round, if you want to distribute it as a single unit, then it should be a single package. Cabal takes the approach that all packages dependencies are specified explicitly and specified in a declarative way. The point is to enable automatic package management. This means tools like cabal can resolve dependencies and install a package plus all of its dependencies automatically.
Alternatively, it is possible to mechanically or mostly mechanically translate Cabal packages into system packages and let the system package manager install dependencies automatically. It is important to track dependencies accurately so that packages can reliably be moved from one system to another system and still be able to build it there.
Cabal is therefore relatively strict about specifying dependencies. Some manual work is required to transform a. This conversion work is usually done by people other than the package author s. The practical effect of this is that only the most popular packages will benefit from automatic package management. Instead, Cabal forces the original author to specify the dependencies but the advantage is that every package can benefit from automatic package management.
This approach makes sense in a world where installing additional dependencies is a tiresome manual process and so minimising dependencies is important. The automatic package management view is that packages should just declare what they need and the package manager will take responsibility for ensuring that all the dependencies are installed.
Sometimes of course optional features and optional dependencies do make sense. Cabal packages can have optional features and varying dependencies. These conditional dependencies are still specified in a declarative way however and remain compatible with automatic package management. GNU autoconf places restrictions on paths, including the path that the user builds a package from.
Package authors using build-type: configure should be aware of these restrictions; because users may be unexpectedly constrained and face mysterious errors, it is recommended that build-type: configure is only used where strictly necessary. One of the purposes of Cabal is to make it easier to build packages on different platforms operating systems and CPU architectures , with different compiler versions and indeed even with different Haskell implementations.
Yes, there are Haskell implementations other than GHC! Cabal provides abstractions of features present in different Haskell implementations and wherever possible it is best to take advantage of these to increase portability. Where necessary however it is possible to use specific features of specific implementations. This allows Cabal to figure out if the language extension is supported by the Haskell implementation that the user picks.
Additionally, certain language extensions such as Template Haskell require special handling from the build system and by listing the extension it provides the build system with enough information to do the right thing.
Another similar example is linking with foreign libraries. Rather than specifying GHC flags directly, the package author can list the libraries that are needed and the build system will take care of using the right flags for the compiler. Additionally this makes it easier for tools to discover what system C libraries a package needs, which is useful for tracking dependencies on system libraries e.
In fact both of these examples fall into the category of explicitly specifying dependencies. This command installs one or more named packages, and all their dependencies, from Hackage. By default, it installs the latest available version; however, you may specify exact versions or version ranges.
For example, cabal install alex This does a search of the installed and available packages. It does a case-insensitive substring match on the package name. Maintained by Cabal Development Team. This version can be pinned in stack with: cabal-install Module documentation for 2. Depends on 31 packages full list with versions : array , async , base , basebytestring , binary , bytestring , Cabal , containers , cryptohash-sha , deepseq , directory , echo , edit-distance , filepath , hackage-security , hashable , HTTP , mtl , network , network-uri , parsec , pretty , process , random , stm , tar , text , time , unix , zip-archive , zlib.
The cabal-install package See the Cabal web site for more information. Installing the cabal command-line tool The cabal-install package requires a number of other packages, most of which come with a standard GHC installation.
Quick start on Unix-like systems As a convenience for users on Unix-like systems, there is a bootstrap. Using cabal There are two sets of commands: commands for working with a local project build tree and those for working with packages distributed from Hackage.
0コメント