HomeSoftware Development Tools and Techniques

HIVE Source Code Processor and Manager

Hive reads a description of a project and generates an appropriate makefile. Such a makefile may be processed by make and contains a number of targets which may useful for software development and distribution.


Installation

Binary/snapshot
Just put Hive binary somewhere in your PATH. Under UNIX, snapshot for your Scheme interpreter may be used in the same way, just chmod +x it and fix the path of interpreter in the beginning of a snapshot file, if necessary. Otherwise use your interpreter on the snapshot file.

Source
Use make to create a binary or snapshot for your scheme, for example:
make bin-gambit
or
make snapshot-guile.

The Scheme used has to be case-sensitive, PLT Schemes may require -g command line switch.


Usage

hive -h

For example:
hive hive.sxml >makefile
make [bigloo | gambit | plt | guile | chicken]


Project Description

Project description may be provided as XML or SXML. SXML is default format, XML requires -t xml command option for Hive. Project description consists of project attributes, targets description, and implementation-specific customisation elements and included file descriptions.

Project attributes are:
name- Project name.
root- Project root directory (trailing "/" not included).
scmsfx- Suffix for Scheme source file name. Optional, default is .scm.
dir- Project directory in root. Optional, default is the subdirectory name, where name and root are project name and project root directory.
copyright- Copyright information. Optional.
version- Version information. Optional.
libsdir- Library directory in root. Optional, default is subdirectory named libs in the project root directory.
doc- Documentation text. Optional.

Targets description
Targets description is (S)XML element.

It has some nested elements named after make targets. Currently supported names are:
bin static jvm snap win.
If such an element is present and it has "exclude" attribute, when corresponding target will be excluded for all Schemes.

NOTE: the target itself will not be removed from makefile generated, but primary target for every Scheme will not depend on it.

For example, with

(targets
  (bin (@ (exclude))))
target
make bin-bigloo
is still available, but neither
make
nor
make bigloo
will generate it.

Implementation-specific customisation element
Implementation-specific customisation element is (S)XML element named after target Scheme implementation.

If an element like (<scheme-name> (@ (exclude))) exists then instruction for named Scheme will not be included in source file.

Some (S)XML elements named after make targets may be nested in implementation-specific customisation element. If such an element is present and it has "exclude" attribute, when corresponding target will be excluded for this Scheme. See also: targets description.

Current version of Hive supports additional customization for (gambit ...) and (bigloo ...) elements. (Unrecognized elements are ignored.)

For gambit and bigloo: (options "value") contains command line options for compiler.
For bigloo (jvm (options "value")) is used only for compilation to JVM and (bin (options "value")) for compilation to native code.

For example:

  (bigloo
    (jvm
      (options "-jvm-purify"))
    (static (@ (exclude)))
    (bin 
      (options "-O2"))
    (options "-call/cc"))
will use -O2 -call/cc for native code and -call/cc -jvm-purify for JVM, and exclude "static-distro-bigloo" target.

Included file description
Included file description is a XML/SXML element.

It's attributes are:
name- File name. The only mandatory attribute.
sparse- Singular attribute (just a fact of its presence is significant, not its value). If this attribute is present, then existence of a nested element for particular Scheme implementation with attribute "include" is condition for inclusion of a file in a project.

Following attributes are optional, see Pathnames for more information.
dir- Directory name. The subdirectory of the project root directory where a file is located.
absdir- Absolute path.
lib- Singular attribute (just a fact of its presence is significant, not its value). If this attribute is present, then the file is located in implementation-specific directory.

File description element
File description element may have some nested element named after Scheme implementations (bigloo, gambit, etc.). Such an element is used for implementation-specific project configuration. If a nested element has a (singular) attribute exclude, then this file is not included in a project for particular Scheme implementation. If it has a (singular) attribute include, then this file is included in a project despite a presence of sparse attribute in file description element.


Pathnames

Pathname of a file is calculated using following rules:

If the file has an attribute dir or if nested element for specified Scheme has an attribute dir
-> root/dir

If the file has an attribute absdir or if nested element for specified Scheme has an attribute absdir
-> absdir

If the file has an attribute lib or if nested element for specified Scheme has an attribute lib
-> root/lib/scm

Otherwise:
-> root/prjdir

where root, libsdir and prjdir are values of root, libsdir and dir attributes of project description, and scm is a subdirectory of libsdir named after corresponding Scheme implementation (bigloo, gambit, etc.)

Please note, that if the nested element for particular scheme exists, then it's attributes have a priority over the attributes of the parent element.


EXAMPLE

Project description

(prj
  (@ (root  "/opt/scheme/")
     (libsdir "libs"))
  (file (@ (name "foo") (dir "bar"))
      (guile (@ (lib)))
      (gambit (@ (absdir "/usr/local/share/gambc")))
      )
will locate the file foo.scm in
/usr/local/share/gambc/ for gambit
/opt/scheme/libs/guile/ for guile
/opt/scheme/bar/ for others.


Download

HomeSoftware Development Tools and Techniques