---
name: "hugs-package"
section: "1"
platform: "linux"
package: "hugs"
version: "98.200311-4"
release: "Debian 3.1 (Sarge)"
platforms: ["linux"]
url: "https://new.carta.tech/hugs-package"
---

# hugs-package(1)

converting a source package for use with Hugs 98

## NAME

hugs-package - converting a source package for use with Hugs 98

## SYNOPSIS

**hugs-package** *pkg-dir* \[ *target-dir* \]

## DESCRIPTION

Though Hugs does not uses packages directly, source packages that work with the compilers may be converted for use with Hugs using the *hugs-package* script. The *pkg-dir* directory should contain a collection of Haskell modules and related files (see below). The converted files are placed in a hierarchy under the directory *target-dir*. You then need to ensure that this directory is in the path used by [*hugs*(1)](/hugs/1.md). If *target-dir*, the converted package is placed in the **libraries** directory used by [*hugs*(1)](/hugs/1.md), if possible.

### Package directory structure

A package directory is assumed to contain a directory hierarchy reflecting the module hierarchy, e.g. with module *A***.***B***.***C* in the source file *pkg-dir***/***A***/***B***/***C***.hs** and so on.  The following filename suffixes are recognized:

- **.hs** or **.lhs**

  Haskell source, to be sent through the C preprocessor with **\_\_HUGS\_\_** defined.  The file may also **#include** **HsFFi.h**, **config.h**, **MachDeps.h** and any header files in *pkg-dir***/include**.

- **.y** or **.ly**

  Happy source, to be processed with [*happy*(1)](/happy/1.md) with the result sent through the C preprocessor as above.

- **.hsc**

  input for *hsc2hs*(1) and then the C preprocessor. If *name***\_hsc\_make.c** (the platform-independent output of **hsc2hs --no-compile**) is present, it will be used instead.

- **.gc**

  input for *greencard*(1).

In addition to Haskell source modules, the package directory may optionally contain the following:

- **cbits/**

  a directory containing C source files to be linked with Haskell files by ffihugs.

- **include/**

  a directory of C header files used by foreign declarations and files in cbits.

- **hugs/exclude**

  a list of names of modules to be skipped by the conversion script. (Only the first word in each line is used, and blank lines and lines starting with **#** are ignored, leaving room for explanations.)

- **package.conf.in**

  a package configuration file, to be preprocessed with cpp. The script uses the **extra\_libraries** and **extra\_ld\_opts fields**.

- **package.conf**

  a package configuration file (not to be preprocessed).

The conversion script runs [*ffihugs*(1)](/ffihugs/1.md) where required. It sets the include path, and also adds auxiliary files generated by *hsc2hs*(1) and *greencard*(1). C files from the **cbits** directory required by a module may be specified with a **CBITS** *\`pragma' in the source file, for example:*

**{-# CBITS file.c another.c #-}**

## ENVIRONMENT

- **HUGSDIR**

  *The* [*hugs*(1)](/hugs/1.md) *library directory*

*Other environment variables that may be set are* **CC**, **cpp**, **hsc2hs**, **greencard**, **ffihugs** *and* **runhugs**, *all naming programs.*

## SEE ALSO

[*hugs*(1)](/hugs/1.md), [*happy*(1)](/happy/1.md), *hsc2hs*(1), *greencard*(1)

## BUGS

*The conversion process is somewhat brittle.*

*The program fails to follow dependencies in package configuration files.*
