Giter Club home page Giter Club logo

cabal-helper's Introduction

The cabal-helper library

build status

The purpose of the cabal-helper library is to give Haskell development tools access to the same environment which build tools such as cabal and stack provide to the compiler.

Introduction

In the Haskell ecosystem the most widely used build system is the Cabal library, not to be confused with the cabal build tool which is usually refered to by it's package-name: cabal-install to disambiguate.

All contemporary meta build tools such as cabal and stack as well as some custom Haskell build systems use the Cabal library as their foundation. For example the Glasgow Haskell Compiler's bespoke GNU Make based build system also utilises the Cabal library at its core.

We capitalize on this fact by using build information Cabal writes to disk as the common denominator between all Haskell build tools. This allows us to easily support a variety of build tools without incuring significant additional complexity.

Technical Background

Essentially all Haskell packages implement "The Haskell Cabal" (pdf) packaging specification. The Cabal library and cabal-install build tool are named after this specification. Yes we really love confusing naming in Haskell land.

The specification revolves around this Setup.hs script file you might have seen before. Basically the idea is a Haskell source package consists of, at the very least, a Setup.hs file, which is a Haskell program that provides a well defined command-line interface for configuring, building and installing it. Developers can use build tools, such as cabal, which interface with Setup.hs and provide functionality on top it.

Even though packages are in principle free to implement the Setup.hs interface however they like in practice everybody just imports the Cabal library in Setup.hs which provides a default implementation of this interface. The Cabal library then in turn uses the <pkg-name>.cabal file you've likely seen before to determine precisely what to do.

Since use of Cabal the library is pretty much a given we're just going to be talking about this case from here on out.

So the first step of building a package in "The Haskell Cabal" is to call:

$ ./Setup.hs configure

The Cabal library will then go off and probe a bunch of stuff about the system it's running on, such as the list of available Haskell packages, compiler type and version, paths to build tools among other things. Using this information Cabal then writes the concrete configuration of the package into a file called setup-config. Subsequent steps (./Setup.hs build...) will then read this file to avoid probing the system again.

It is this file that cabal-helper is primarily concerned with reading and presenting in a usable format.

IRC

If you have any problems, suggestions, comments swing by #ghc-mod (web client) on Freenode. If you're reporting a bug please also create an issue here so we have a way to contact you if you don't have time to stay.

Do hang around for a while if no one answers and repeat your question if you still haven't gotten any answer after a day or so. You're most likely to get an answer during the day in GMT+1.

cabal-helper's People

Contributors

alanz avatar anrock avatar danielg avatar hasufell avatar iquiw avatar lukel97 avatar mpickering avatar ulidtko avatar wildsebastian avatar wz1000 avatar yuga avatar

Watchers

 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.