hsinstall

Install Haskell software

Version on this page:1.6
LTS Haskell 22.39:2.8
Stackage Nightly 2024-10-31:2.8
Latest on Hackage:2.8

See all snapshots hsinstall appears in

ISC licensed by Dino Morelli
Maintained by Dino Morelli
This version can be pinned in stack with:hsinstall-1.6@sha256:a149df23ce7dc12f1ea63691b9d2f4e0f1c9b76c8f05dd10b5be378c8fdb82c2,1719

Module documentation for 1.6

Used by 1 package in lts-9.21(full list with versions):

hsinstall

Synopsis

Install Haskell software

Description

This is a utility to install Haskell programs on a system using stack. Even though stack has an install command, I found it to be not enough for my needs. This software tries to install the binaries, the LICENSE file and also the resources directory if it finds one.

Installations can be performed in one of two directory structures. FHS, or the Filesystem Hierarchy Standard (most UNIX-like systems) and what I call “bundle” which is a portable directory for the app and all of its files. They look like this:

bundle is sort-of a self-contained structure like this:

 $PREFIX/
   $PROJECT-$VERSION/
     bin/...
     doc/LICENSE
     resources/...

fhs is the more traditional UNIX structure like this:

 $PREFIX/
   bin/...
   share/
     $PROJECT-$VERSION/
       doc/LICENSE
       resources/...

There are two parts to hsinstall that are intended to work together. The first part is a Haskell shell script, util/install.hs. Take a copy of this script and check it into a project you’re working on. This will be your installation script. Running the script with the --help switch will explain the options. Near the top of the script are default values for these options that should be tuned to what your project needs.

The other part of hsinstall is a library. The install script will try to install a resources directory if it finds one. the HSInstall library code is then used in your code to locate the resources at runtime.

Note that you only need this library if your software has data files it needs to locate at runtime in the installation directories. Many programs don’t have this requirement and can ignore the library altogether.

The application in this project, in the app dir, is a demo of using the library to locate resources. It has no use other than as a live example.

The install.hs script is deliberately not being compiled so that it’s flexible and hackable by developers to serve whatever additional installation needs they may have for a given project. It’s also deliberately self-contained, relying on nothing other than core libraries that ship with the GHC.

Development

For developers who need to build against a local copy of hsinstall I found this technique useful. Get a copy of the source code:

  $ darcs clone http://hub.darcs.net/dino/hsinstall

or

  $ stack unpack hsinstall

In another project (nearby on your system, say), modify stack.yaml:

  packages:
  - '.'
  - location: /path/to/hsinstall-x.y
    extra-dep: true
  extra-deps:
  - hsinstall-x.y

And then you should be able to build against this copy of hsinstall. Of course, these are just examples, the version numbers above will almost certainly be different.

Contact

Authors

Dino Morelli [email protected]

Changes

1.6 (2017-07-01)

  • Changed base lower bound from 4.9 to 4.8
  • Updated stack snapshot to lts-8.21
  • Added HCAR listing content
  • Removed defunct cabal stability field
  • Adjusted some documentation in the README
  • Moved copyright date up to 2017

1.5 (2016-10-16)

  • Now creating bin directory prior to stack install
  • Removed comments from auto-generated stack.yaml

1.4 (2016-10-11)

  • Added missing files to extra-source-files
  • Added switch for making a symlink to the app directory

1.3 (2016-10-07)

  • Fixed error in docs

1.2 (2016-10-07)

  • Added example additional script copying code
  • Updated developer instructions
  • Added a tested-with line to the cabal file

1.1 (2016-10-07)

  • Updated to stackage lts-7.2

1.0 (2016-10-02)

  • Cleaned up cabal file
  • Wrote API docs
  • Cleaned up README
  • Aborting the installation if stack install fails
  • Added instructions for compiling install.hs
  • Added library for locating resources at runtime
  • Initial release