4 Repackaging a Distribution
| (require distro-build/repackage) | |
| package: distro-build-server | |
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")
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
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?)
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
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.