► |  | raco: Racket Command-Line Tools

1 | raco make: Compiling Source to Bytecode
2 | raco exe: Creating Stand-Alone Executables
3 | raco distribute: Sharing Stand-Alone Executables
4 | raco planet: Automatic Package Distribution
5 | raco pkg: Package Management
6 | raco setup: Installation Management
7 | raco decompile: Decompiling Bytecode
8 | raco demod: Demodularizing Programs
9 | raco link: Library Collection Links
10 | raco pack: Packing Library Collections
11 | raco unpack: Unpacking Library Collections
12 | raco ctool: Working with C Code
13 | raco test: Run tests
14 | raco docs: Documentation Search
15 | raco expand: Macro Expansion
16 | raco read: Reading and Pretty-Printing
17 | raco scribble: Building Documentation
18 | Adding a raco Command
19 | Installation Configuration and Search Paths

▼ | 6 | raco setup: Installation Management

6.1 | Running raco setup
6.2 | Installing ".plt" Archives
6.3 | Controlling raco setup with "info.rkt" Files
6.4 | "info.rkt" File Format
6.5 | Package Dependency Checking
6.6 | API for Setup
6.7 | API for Installing ".plt" Archives
6.8 | API for Finding Installation Directories
6.9 | API for Reading "info.rkt" Files
6.10 | API for Relative Paths
6.11 | API for Collection Names
6.12 | API for Collection Searches
6.13 | API for Platform Specifications
6.14 | API for Cross-Platform Configuration
6.15 | API for Cross-References for Installed Manuals
6.16 | API for Materializing User-Specific Documentation
6.17 | Layered Installations
6.18 | Tethered Installations

On this page:

cross-system-type
cross-system-library-subpath
cross-installation?

top ← prev up next →

#### 6.14`` API for Cross-Platform Configuration

See the raco cross documentation for information about raco cross, a tool that is provided by the "raco-cross" package as a convenient interface to cross-compilation for Racket. The underlying API documented here supports raco cross and other tools.

(require setup/cross-system) | package: base

The setup/cross-system library provides functions for querying the system properties of a destination platform, which can be different than the current platform in cross-installation modes.

A Racket installation includes a "system.rktd" file in the directory reported by (find-lib-dir). When the information in that file does not match the running Racket’s information, then the setup/cross-system module infers that Racket is being run in cross-installation mode.

For example, if an in-place Racket BC installation for a different platform resides at ‹cross-dir›, then running Racket BC as

racket -C -G ‹cross-dir›/etc -X ‹cross-dir›/collects -l- raco pkg

runs raco pkg using the current platform’s racket executable, but using the collections and other configuration information of ‹cross-dir›, as well as modifying the packages of ‹cross-dir›. That can work as long as no platform-specific libraries need to run to perform the requested raco pkg action (e.g., when installing built packages), or as long as the current platform’s installation already includes those libraries.

For Racket CS, cross compilation is more complicated, because Racket CS ".zo" files are platform-specific:

- A target installation ‹cross-dir› is needed that includes cross-compilation support for the host platform as plug-in within the installation’s "‹cross-dir›/lib" directory. That installation might be created by compiling from source on the host platform. Only Racket CS can use a CS cross-compilation plug-in.

  When running racket in cross mode, use the --cross-compiler flag to specify the target machine and path to the "‹cross-dir›/lib" directory.

- A flag combination -MCR with argument "‹absolute-zo-dir›:" is needed to enable ".zo" file creation for both the host platform (which uses the directory before a :) and the target platform (which uses the normal compiled-file subdirectory when the path after the : is empty).

  The ‹absolute-zo-dir› can be any absolute path. It generally should be populated by running raco setup in cross mode before commands like raco pkg.

For example, the raco pkg example for Racket CS is

racket --cross-compiler ‹target-machine› ‹cross-dir›/lib \
-MCR ‹absolute-zo-dir›: \
-G ‹cross-dir›/etc -X ‹cross-dir›/collects -l- raco pkg

The ‹target-machine› provided to --cross-compiler should be the same as the target-machine entry in "‹cross-dir›/lib/systemd.rktd".

The -C flag is shorthand for --cross, -M is short for --compile-any, -R is short for --compiled, -G is short for --config, -X is short for --collects, and -MCR is short for -M -C -R.

Added in version 6.3 of package base.

> > procedure

> > (cross-system-type [mode])

> → (or/c symbol? string? bytes? exact-positive-integer? vector?)

> mode

> :

> (or/c 'os 'word 'gc 'vm 'link 'machine
> 'so-suffix 'so-mode 'fs-change)

> =

> 'os

Like system-type, but for the target platform instead of the current platform in cross-installation mode. When not in cross-installation mode, the results are the same as for system-type.

See also 'cross mode for system-type.

> > procedure

> > (cross-system-library-subpath [mode]) → path-for-some-system?

> mode : (or/c 'cgc '3m 'cs #f) = (system-type 'gc)

Like system-library-subpath, but for the target platform instead of the current platform in cross-installation mode. When not in cross-installation mode, the results are the same as for system-library-subpath.

In cross-installation mode, the target platform may have a different path convention than the current platform, so the result is path-for-some-system? instead of path?.

> > procedure

> > (cross-installation?) → boolean?

Returns #t if cross-installation mode has been detected, #f otherwise.
top ← prev up next →