On this page:
build-catalog
repackage
build-docs
assemble-site

4 Repackaging a Distribution🔗ℹ

The distro-build/repackage library provides tools for deriving a distribution from an existing Racket distribution, where the existing distribution t includes minimal Racket builds that support cross compilation. The new distribution starts can have a different set of packages than a Racket distribution, and it can have an associated catalog that provides built versions of additional packages that are consistent with the starting Racket distribution (i.e., packages from either site can be installed without recompiling from each package’s source and without re-rendering documentation).

Repackaging uses raco cross, so it works on any Unix or Mac OS platform to build packages and installers for other platforms. Building installers for Windows and Mac OS requires cross-build tools like makensis.

Repackaging output and any needed needed raco cross workspaces are written to a "compiled/repackage" subdirectory of the current directory.

Added in version 1.25 of package distro-build-server.

procedure

(build-catalog #:version version    
  #:packages packages    
  #:catalogs source-catalogs    
  [#:installers-url installers-url    
  #:info-catalog info-catalog    
  #:original-template original-template    
  #:default-author default-author    
  #:dest dest    
  #:build-deps build-deps])  void?
  version : string?
  packages : (listof string?)
  source-catalogs : (listof path-string?)
  installers-url : (or/c #f string?) = #f
  info-catalog : string? = "https://pkgs.racket-lang.org"
  original-template : (or/c #f string?) = #f
  default-author : (or/c #f string?) = #f
  dest : path-string? = "build/built"
  build-deps : (listof string?) = '("draw-lib")
Creates a catalog of built packages for the Racket version specified by version. The packages argument specifies the packages to include, and dependencies of those packages will also be included when they are not in catalogs listed in the starting Racket’s configured catalogs (which are assumed to be catalogs of built packages). The catalogs provided as source-catalogs are consulted (in order) to find packages to build before using any catalogs that the starting Racket distribution would check.

If installers-url is not #f, then it is passed along to raco cross as the source for minimal Racket distributions.

As packages are built, metadata information such as the author must be recorded. The specified info-catalog provides metadata for packages not listed in packages (but which are dependencies of those packages). For packages in packages, the package author is extracted from a pkg-authors definition in "info.rkt" if available, otherwise default-author is used. If original-template is not #f, then the original source (typically a directory within a Github repository) is formed by combining the template and package name with format.

The resulting catalog and packages are written to (build-path "compiled/repackage" dest), where a "catalog" subdirectory contains the catalog and a "pkgs" subdirectory contains the built package (referenced by "catalog" entries through relative paths).

The build-deps argument lists packages that need to be installed in the host instance use by raco cross. The default includes "draw-lib", because that package’s native-library dependencies are often needed for rendering documentation on a non-Unix host.

procedure

(repackage #:config config-file    
  [#:config-mode config-mode]    
  #:version version    
  [#:installers-url installers-url]    
  #:catalogs catalogs    
  [#:dist-catalogs dist-catalogs    
  #:file-name-version file-name-version    
  #:version-note version-note]    
  #:skip-notarize? skip-notarize?)  void?
  config-file : path-string?
  config-mode : (or/c #f string?) = #f
  version : string?
  installers-url : (or/c #f string?) = #f
  catalogs : (listof path-string?)
  dist-catalogs : (listof path-string?) = catalogs
  file-name-version : string? = version
  version-note : string? = ""
  skip-notarize? : #f
Creates a set of installers based on the configuration in config-file, which is loaded with current-mode set to config-mode (where #f is equivalent to "default"). That configuration provides information on which installers to build, each installer’s name, and the packages to be included in each installer.

The version and installers-url arguments are used in the same way was by build-catalog to locate starting, built minimal Racket installers. The installer to use for each machine configuration specified by config-file is determined by matching the machine’s #:name (see Names and Download Pages) against names recorded for the minimal Racket installers, skipping the name’s first component before | and adding  | {3} Tarball to the end.

The catalogs argument provides catalogs to use before catalogs that are recorded in the starting minimal Racket installers. Typically, those catalogs are the output of build-catalog. The dist-catalogs argument (which defaults to catalogs) lists catalogs to be added to the start of the catalog configuration for each repackaged installer, which typically list sites where the catalogs are uploaded.

The file-name-version argument is used instead of version where a version number is used in an installer file name. The version-note string is used after the Racket version number explanation in a generated replacement "README" file within an installer.

The resulting installers are written to "compiled/repackage/build/installers" alongside other files within "compiled/repackage/build" that are useful to assemble-site.

procedure

(build-docs #:config config-file    
  [#:config-mode config-mode]    
  #:version version    
  [#:installers-url installers-url]    
  #:catalogs catalogs)  void?
  config-file : path-string?
  config-mode : (or/c #f string?) = #f
  version : string?
  installers-url : (or/c #f string?) = #f
  catalogs : (listof path-string?)
Similar to repackage, but for the additional step of rendering HTML documentation to "compiled/repackage/build/docs", which is where assemble-site expects to find (optional) rendered documentation to include at a web site.

procedure

(assemble-site #:config config-file    
  [#:config-mode config-mode    
  #:site-dest site-dest    
  #:default-dist-base default-dist-base    
  #:default-pkgs default-pkgs    
  #:pkgs-all-file pkgs-all-file    
  #:missing-pkg-ok? missing-pkg-ok?])  void?
  config-file : path-string?
  config-mode : (or/c #f string?) = #f
  site-dest : (or/c #f path-string?) = #f
  default-dist-base : string? = "racket"
  default-pkgs : (listof string?) = '()
  pkgs-all-file : (or/c #f path-string?)
   = "compiled/repackage/build/built/catalog/pkgs-all"
  missing-pkg-ok? : any/c = #f
Converts the output of a catalog build and installer repackaging to a directory that is suitable as a web site for downloading the installers. The config and config-mode arguments are used the same as by repackage. If site-dest is provided, is the output directory, otherwise config determines the output directory via #:site-dest.

The default-dist-base and default-pkgs arguments supply relevant defaults for a configuration that are normally take from a makefile for a non-repackaging distribution build.

The pkgs-all-file argument provides information on packages to include in catalog that is provided alongside installers, including dependency information for determining the full set of packages. The default path corresponds to the output of build-catalog. only packages listed in pkgs-all-file are included, but other packages can be dependencies as long as missing-pkg-ok? is not #f.