Giter Club home page Giter Club logo

cabal-meta's Introduction

usage with cabal sandbox

Please use the cabal sandbox feature available in cabal >= 1.18 There is some overlap with the cabal sandbox add-source feature and using cabal-meta. You will probably want to try just using cabal sandbox with add-source and use cabal-meta when you have problems with that workflow.

cabal-meta

cabal-meta is a cabal wrapper that facilitates:

  • installing repos not on hackage (local or remote repos)
  • specifying build flags
  • ensuring that if possible, an install will succeed

Lets explain the last point: If you run this command, you can easily get a failure:

cabal install foo && cabal install bar

Whereas if you run this command it should almost always work:

cabal install foo bar

cabal-meta facilitates the second command: installing everything at once. This is very useful when you want cabal to install packages not on hackage. You need not worry about how cabal interprets your version, instead you let cabal easily interpret a location.

When invoked, cabal-meta looks for a file sources.txt. Each line of sources.txt is either a hackage package, a directory, or a github repo (which is cloned into a vendor/ directory). A directory is either a local cabal package or contains another sources.txt to recurse into.

cabal-meta automatically uses cabal-src-install (if you have it installed) unless you are using cabal-dev (--dev option). cabal-src-install is used to add local packages to your cabal package database: please see cabal-src documentation. Please note that this is done after the package install. If there is a failure anywhere along the way, cabal-src-install will not be used.

Usage

Run cabal-meta to see help output. Normal usage:

cabal-meta install

cabal-dev support:

cabal-meta --dev install

You can also supply arguments in an environment variable or a configuration file.

Examples

Controlling cabal-meta is done through sources.txt. sources.txt contains a repo location and optionally a branch name and build flags. Build flags start with a dash.

git://github.com/foo/bar ghc-7.6-compat -flag

Darcsden

darcs:http://darcs.net
darcs:http://hub.darcs.net/simon/darcsden

Yesod from github

To build a Yesod application using the latest code, create a sources.txt in the project directory with:

./
https://github.com/yesodweb/yesod
https://github.com/yesodweb/shakespeare
https://github.com/yesodweb/persistent
https://github.com/yesodweb/wai

Now just run: cabal-meta install

Yesod from local

To build a Yesod web application using my already downloaded source from github, I have a sources.txt in my project consisting of

./
sphinx -fone-one-beta
path/to/yesod/sources

./ refers to the current directory and thus your current project.

sphinx is a hackage package, and I have a build flag next to it that I don't have to worry about forgetting anymore. warning: a packge build flag will end up being applied to all packages

Recursion of sources.txt

In the example above, path/to/yesod/sources contains a sources.txt with:

./hamlet
./persistent
./wai
./yesod

Each of these directories has a sources.txt listing several dirctories containing cabal packages that will be installed. Confused? It is just recursion, although we are interleaving IO :)

cabal-meta's People

Contributors

andy-morris avatar bergey avatar cordawyn avatar gregwebs avatar hamishmack avatar jonnadal avatar kowey avatar lostbean avatar mwotton avatar sol avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.