setup-helper

  1. setup-helper
  2. Documentation
    1. Extension Information
      1. extension-name-and-version
      2. extension-name
      3. extension-version
      4. verify-extension-name
    2. Filename Support
      1. CHICKEN-SOURCE-EXTENSION
      2. CHICKEN-IMPORT-EXTENSION
      3. CHICKEN-INLINE-EXTENSION
      4. CHICKEN-TYPES-EXTENSION
      5. HTML-EXTENSION
      6. STATIC-ARCHIVE-EXTENSION
      7. OBJECT-BINARY-EXTENSION
      8. EXECUTABLE-EXTENSION
      9. DIRECTORY-SEPARATOR
      10. installation-chicken-home
      11. installation-repository-path
      12. directory-separator?
      13. filename
      14. make-directory-name
      15. document-filename
      16. source-filename
      17. shared-library-filename
      18. shared-filename
      19. static-library-filename
      20. static-filename
      21. import-filename
      22. source-import-filename
      23. shared-import-filename
      24. inline-filename
      25. types-filename
      26. program-filename
      27. make-home-pathname
      28. make-repository-pathname
      29. srfi-29-bundles-home
      30. make-srfi-29-bundle-directory-name
    3. File Copy Support
      1. copy-file-relative
      2. copy-file-absolute
      3. copy-to-repository
      4. copy-to-home
    4. Compile Support
      1. compile-static
      2. compile-shared
      3. compile-static-module
      4. compile-shared-module
    5. Install Support
      1. install-in-repository
      2. install-in-home
      3. install-srfi-29-bundle
      4. install-static-extension
      5. install-shared-extension
      6. install-static-extension-module
      7. install-shared-extension-module
      8. install-shared+static-extension-module
      9. install-extension-tag
    6. Setup Support
      1. setup-static-extension
      2. setup-shared-extension
      3. setup-static-extension-module
      4. setup-shared-extension-module
      5. setup-shared+static-extension-module
  3. Parameters
    1. Compile Support
      1. default-static-compile-options
      2. default-shared-compile-options
      3. default-import-compile-options
    2. Install Support
      1. default-static-install-options
      2. default-shared-install-options
      3. default-static-module-install-options
      4. default-shared-module-install-options
      5. default-shared+static-module-install-options
  4. Usage
  5. Examples
  6. Bugs and Limitations
  7. Author
  8. Version history
  9. License

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]).

INSTALL-REPOSITORY is the installation Chicken repository directory.

INSTALL-HOME is the installation Chicken home directory.

CHICKEN-SOURCE-EXTENSION

CHICKEN-IMPORT-EXTENSION

CHICKEN-INLINE-EXTENSION

CHICKEN-TYPES-EXTENSION

HTML-EXTENSION

STATIC-ARCHIVE-EXTENSION

OBJECT-BINARY-EXTENSION

EXECUTABLE-EXTENSION

Values suitable for use as the EXT argument to make-pathname.

DIRECTORY-SEPARATOR

The platform specific directory separator string.

installation-chicken-home

[procedure] (installation-chicken-home) => string

Returns the INSTALL-HOME.

installation-repository-path

[procedure] (installation-repository-path) => string

Returns the INSTALL-REPOSITORY.

directory-separator?

[procedure] (directory-separator? X) => boolean

Is X a directory separator?

X is a string, character, or symbol.

filename

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

Returns a filename for FILE and EXTENSION.

make-directory-name

[procedure] (make-directory-name DIRECTORY) => string

Returns a dirname, ensuring no trailing directory separator.

DIRECTORY is a string, symbol, or a list.

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.

types-filename

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

Returns an "types" filename for FILE.

program-filename

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

Returns a platform-specific executable filename for FILE.

make-home-pathname

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

Returns a pathname for FILE in the INSTALL-HOME.

make-repository-pathname

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

Returns a pathname for FILE in the INSTALL-REPOSITORY.

srfi-29-bundles-home

[procedure] (srfi-29-bundles-home) => string

Returns the root dirname for SRFI 29 bundles.

Please see the srfi-29 extension documentation.

make-srfi-29-bundle-directory-name

[procedure] (make-srfi-29-bundle-directory-name SPEC) => string

Returns the SRFI 29 bundle installation dirname for the supplied SPEC.

SPEC is a list BUNDLE-SPECIFICATION-COMPONENT....

Please see the srfi-29 extension documentation.

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-relative

[procedure] (copy-file-relative FILENAME DIRECTORY)

Copies the file FILENAME to the DIRECTORY. The DIRECTORY be relative.

copy-file-absolute

[procedure] (copy-file-absolute FILENAME DIRECTORY)

Copies the file FILENAME to the DIRECTORY. Should the DIRECTORY be relative it will be coerced to absolute (by copy-file).

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).

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 compile command from the last position.

INLINE? is a boolean indicating whether a global inline file is created. The inline file is named (make-pathname #f NAME "inline"). Chicken 4.0.0+ only.

TYPES? is a boolean indicating whether a types database file is created. The types database file is named (make-pathname #f NAME "types"). Chicken 4.7.3+ only.

compile-static

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

Compiles to object file with unit-name NAME.

No linking is performed!

compile-shared

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

Compiles to shared file.

compile-static-module

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

Compiles to object file with unit-name NAME and import to shared file.

compile-shared-module

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

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-in-repository

[procedure] (install-in-repository FILENAME)

Like copy-to-repository but observes the no-install status.

install-in-home

[procedure] (install-in-home FILENAME)

Like copy-to-home but observes the no-install status.

install-srfi-29-bundle

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

Copies the local SRFI 29 bundle to the (srfi-29-bundle-directory).

The bundle is a single file with NAME that may be at the bottom of a BUNDLE-SPECIFICATION-COMPONENT hierarchy.

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-static-extension-module

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

Installs a compiled-static-extension-module.

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?] [#:types? TYPES?] [#: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?] [#:types? TYPES?] [#:install-options INSTALL-OPTIONS] [#:files FILENAMES])

Compiles & installs a shared-extension.

setup-static-extension-module

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

Compiles & installs a static-extension-module.

setup-shared-extension-module

[procedure] (setup-shared-extension-module NAME VERSION [#:compile-options COMPILE-OPTIONS] [#:inline? INLINE?] [#:types? TYPES?] [#: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 [#:compile-options COMPILE-OPTIONS] [#:shared-compile-options COMPILE-OPTIONS] [#:static-compile-options COMPILE-OPTIONS] [#:inline? INLINE?] [#:types? TYPES?] [#:install-options INSTALL-OPTIONS] [#:files FILENAMES])

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

The COMPILE-OPTIONS, INLINE?, AND TYPES? are applied to both the shared and static builds. As such the -o|-output-file' option cannot be supported.

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 -local -inline -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-static-module-install-options

[parameter] (default-static-module-install-options) => list
[parameter] (default-static-module-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

(use setup-helper-mod)

Examples

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

(use setup-helper-mod)

; 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

Support for the include form is Deprecated and will be removed as soon as possible.

Author

Kon Lovett

Version history

1.5.3
Fix for deployment mode installation prefix. [Bug #904]
1.5.2
Fix for types filename generation.
1.5.1
Conditional expansion of types & inline. Fix consultation of inline & types info.
1.5.0
Added types generation support.
1.4.1
Fixed missing file.
1.4.0
Compiled version setup-helper-mod. Include form deprecated.
1.3.3
Remove -unboxing as default option.
1.3.2
Use 'repository-path' function (Ticket #722). Install in (repository-path) & (chicken-home) (Ticket #722 & Ticket #773).
1.3.1
Added "static module". Fix for setup-shared+static-extension-module not installing the static object file.
1.3.0
Deprecated copy-file-to-directory. Documented more of the exposed API.
1.2.0
Addd install-in-home & install-in-repository. install-srfi-29-bundle observes no-install status.
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-2012 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.