You are looking at historical revision 19594 of this page. It may differ significantly from its current revision.

setup-helper

Documentation

Shortcut routines providing common install process patterns of Chicken extensions.

Extension Information

NAME is a string or symbol. The name of the extension.

VERSION is a string or number.

(Note - extension-name-and-version, extension-name and extension-version are actually part of the setup-api.)

extension-name-and-version

[parameter] (extension-name-and-version) => list
[parameter] (extension-name-and-version NAME+VERSION)

NAME+VERSION is (list NAME VERSION).

extension-name

[procedure] (extension-name) => string

Returns the extension-name component of (extension-name-and-version).

extension-version

[procedure] (extension-version [DEFAULT]) => string

Returns the extension-version component of (extension-name-and-version).

Should the (second (extension-name-and-version)) be empty the DEFAULT is returned.

verify-extension-name

[procedure] (verify-extension-name NAME)

Raises an error should chicken-install know the extension by a different name.

Use when paranoid.

Filename Support

Makes stereotypical filenames & pathnames.

FILE is a string or symbol.

EXTENSION is a string or symbol.

DIRECTORY is as (make-pathname (pathname-directory DIRECTORY) (pathname-file DIRECTORY)).

FILENAME is as (make-pathname #f FILE [EXTENSION]).

PATHNAME is as (make-pathname DIRECTORY FILE [EXTENSION]).

filename

[procedure] (filename FILE [EXTENSION]) => string

Returns an filename for FILE and EXTENSION.

document-filename

[procedure] (document-filename FILE) => string

Returns a "html" filename for FILE.

source-filename

[procedure] (source-filename FILE) => string

Returns "scm" filename for FILE.

shared-library-filename

[procedure] (shared-library-filename FILE) => string

Returns a platform-specific dynamic-link-library filename for FILE.

shared-filename

[procedure] (shared-filename FILE) => string

Returns a platform-specific dynamic-load-file filename for FILE.

Note this superfluous now as all shared binaries have the "so" extension.

static-library-filename

[procedure] (static-library-filename FILE) => string

Returns a platform-specific static-link-library filename for FILE.

static-filename

[procedure] (static-filename FILE) => string

Returns a platform-specific object-file filename for FILE.

import-filename

[procedure] (import-filename FILE) => string

Returns an "import" filename for FILE.

source-import-filename

[procedure] (source-import-filename FILE) => string

Returns an "import.scm" filename for FILE.

shared-import-filename

[procedure] (shared-import-filename FILE) => string

Returns a platform-specific dynamic-load-file "import" filename for FILE.

inline-filename

[procedure] (inline-filename FILE) => string

Returns an "inline" filename for FILE.

program-filename

[procedure] (program-filename FILE) => string

Returns a platform-specific executable filename for FILE.

make-repository-pathname

[procedure] (make-repository-pathname FILE) => string

Returns a pathname for FILE in the (chicken-repository).

File Copy Support

Copy local file (local to the building egg directory) to some directory. These use the copy-file setup-api routine.

copy-file-to-directory

[procedure] (copy-file-to-directory FILENAME DIRECTORY)

Copies the local file FILENAME to the {{DIRECTORY}.

copy-to-repository

[procedure] (copy-to-repository FILENAME)

Copies the local file FILENAME to the (chicken-repository).

copy-to-home

[procedure] (copy-to-home FILENAME)

Copies the local file FILENAME to the directory (installation-prefix) share chicken. This is usually the same as (chicken-home).

SRFI-29 Bundle Support

Installation of SRFI-29 Bundles.

See srfi-29.

install-srfi-29-bundle

[procedure] (install-srfi-29-bundle NAME [BUNDLE-SPECIFICATION-COMPONENT ...])

Copies the local srfi-29-bundle file to the srfi-29-bundle-directory.

Compile Support

Compiles the source-file NAME. NAME is the basename of the source-file.

COMPILE-OPTIONS is a (list-of COMPILE-OPTION ...). COMPILE-OPTION is any object acceptable as a compile option. The COMPILE-OPTIONS are always expanded in the comple command in the last position.

INLINE? is a boolean indicating whether a global inline is created. The inline file is named (make-pathname #f NAME "inline"). Does not enable cross-module inlining.

compile-static

[procedure] (compile-static NAME [#:options COMPILE-OPTIONS] [#:inline? INLINE?])

Compiles to object file with unit-name NAME.

No linking is performed!

compile-shared

[procedure] (compile-shared NAME [#:options COMPILE-OPTIONS] [#:inline? INLINE?])

Compiles to shared file.

compile-shared-module

[procedure] (compile-shared-module NAME [#:options COMPILE-OPTIONS] [#:inline? INLINE?])

Compiles source and import to shared files.

Install Support

Installs the compiled-extension for NAME.

INSTALL-OPTION is any object acceptable as an install-extension command options list option.

INSTALL-OPTIONS is (list-of INSTALL-OPTION ...).

The INSTALL-OPTIONS is always expanded in the install-extension command options list in the last position.

FILENAMES is a (list-of FILENAME ...). These name local files (local to the building egg directory) that are to expanded in the install-extension command files list.

install-static-extension

[procedure] (install-static-extension NAME VERSION [#:options INSTALL-OPTIONS] [#:files FILENAMES])

Installs a compiled-static-extension.

install-shared-extension

[procedure] (install-shared-extension NAME VERSION [#:options INSTALL-OPTIONS] [#:files FILENAMES])

Installs a compiled-shared-extension.

install-shared-extension-module

[procedure] (install-shared-extension-module NAME VERSION [#:options INSTALL-OPTIONS] [#:files FILENAMES])

Installs a compiled-shared-extension-module.

install-shared+static-extension-module

[procedure] (install-shared+static-extension-module NAME VERSION [#:options INSTALL-OPTIONS] [#:files FILENAMES])

Installs a compiled-shared-extension-module and a compiled-static-extension.

install-extension-tag

[procedure] (install-extension-tag NAME VERSION)

Installs an empty extension with NAME and VERSION.

Setup Support

Compiles & installs the extension for NAME.

setup-static-extension

[procedure] (setup-static-extension NAME VERSION [#:compile-options COMPILE-OPTIONS] [#:inline? INLINE?] [#:install-options INSTALL-OPTIONS] [#:files FILENAMES])

Compiles & installs a static-extension.

setup-shared-extension

[procedure] (setup-shared-extension NAME VERSION [#:compile-options COMPILE-OPTIONS] [#:inline? INLINE?] [#:install-options INSTALL-OPTIONS] [#:files FILENAMES])

Compiles & installs a shared-extension.

setup-shared-extension-module

[procedure] (setup-shared-extension-module NAME VERSION [#:compile-options COMPILE-OPTIONS] [#:inline? INLINE?] [#:install-options INSTALL-OPTIONS] [#:files FILENAMES])

Compiles & installs a shared-extension-module.

setup-shared+static-extension-module

[procedure] (setup-shared+static-extension-module NAME VERSION [#:shared-compile-options COMPILE-OPTIONS] [#:shared-inline? INLINE?] [#:static-compile-options COMPILE-OPTIONS] [#:static-inline? INLINE?] [#:install-options INSTALL-OPTIONS] [#:files FILENAMES])

Compiles & installs a shared-extension-module and a static-extension.

Parameters

Compile Support

These are always expanded in the comple command in the first position.

default-static-compile-options

[parameter] (default-static-compile-options) => list
[parameter] (default-static-compile-options COMPILE-OPTIONS)

Built-in is (-c -optimize-leaf-routines -inline).

default-shared-compile-options

[parameter] (default-shared-compile-options) => list
[parameter] (default-shared-compile-options COMPILE-OPTIONS)

Built-in is (-shared -optimize-leaf-routines -inline).

default-import-compile-options

[parameter] (default-import-compile-options) => list
[parameter] (default-import-compile-options COMPILE-OPTIONS)

Built-in is (-shared -optimize-leaf-routines -inline -local -no-trace -no-lambda-info).

Install Support

These are always expanded in the install-extension command options list in the first position.

default-static-install-options

[parameter] (default-static-install-options) => list
[parameter] (default-static-install-options INSTALL-OPTIONS)

default-shared-install-options

[parameter] (default-static-install-options) => list
[parameter] (default-static-install-options INSTALL-OPTIONS)

default-shared-module-install-options

[parameter] (default-shared-module-install-options) => list
[parameter] (default-shared-module-install-options INSTALL-OPTIONS)

default-shared+static-module-install-options

[parameter] (default-shared+static-module-install-options) => list
[parameter] (default-shared+static-module-install-options INSTALL-OPTIONS)

Usage

(include "setup-helper")

Examples

;;;; example.setup -*- Hen -*-

(include "setup-helper")

; Paranoid
(verify-extension-name "example")

(setup-shared-extension-module 'example (extension-version "1.0.0")
  compile-options: '(-extend easyffi)
  install-options: '((syntax)))

Bugs and Limitations

Author

kon lovett

Version history

1.1.4
Fix for 'copy-to-home' when '(installation-prefix)' is #f. [Ivan Raikov]
1.1.3
Fix for 'copy-to-home' when '(chicken-home)' is not proper location of ".../share/chicken". [Ivan Raikov]
1.1.2
Need for explicit use of "setup-api". [Ivan Raikov]
1.1.1
Fix for SRFI 29 bundle directory support.
1.1.0
Added 'install-extension-tag'.
1.0.0
Initial release.

License

Copyright (C) 2009-2010 Kon Lovett. All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the Software), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ASIS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.