Creating Packages - racket/racket GitHub Wiki

Create new libraries/Creating Packages

Don't forget to post your creations in the Racket package catalog.

Structure of a multi-collection package with a launcher

The todo-txt repository is an example of a multi-collection package. The package also defines a launcher (command line program).

The structure of the repository is

$ tree
├── file
│   ├── info.rkt [1]
│   ├── todoreport
│   │   ├── info.rkt [2]
│   │   └── private
│   │       └── cli.rkt
│   ├── todoreport.rkt
│   ├── todo-txt
│   │   ├── doc
│   │   │   ├── ...
│   │   │   └── todo-txt
│   │   │       └── ...
│   │   ├── info.rkt [3]
│   │   ├── private
│   │   │   ├── task-group.rkt
│   │   │   └── task.rkt
│   │   └── scribblings
│   │       └── todo-txt.scrbl
│   └── todo-txt.rkt
├── info.rkt [4]
├── LICENSE
└── ...

There are four info.rkt files:

  1. This info.rkt contains the launcher definition.
  2. This info.rkt only defines a collection todoreport
  3. This info.rkt is similar to 2, but also contains a definition for the documentation under scribblings.
  4. This info.rkt contains most of the package definition, in particular the line (define collection 'multi), the dependencies, the build dependencies, a package description and the package version. This file is adapted from the file that is generated by raco pkg new.

Continuous integration (CI) example for Sourcehut

Here's an example for a .build.yml file. It defines four tasks. A good part of the action happens in a Makefile.

These are the .build.yml tasks:

  • install-racket installs Racket as the preparation for all other tasks.
  • build creates a stand-alone binary for the native platform, which here is Ubuntu LTS (see the beginning of the .build.yml file).
  • test runs the available automated tests.
  • run tries to run the previously built program with different command line arguments and checks some results.
  • build-all uses the raco-exe-multitarget package (which itself relies on the raco-cross-lib package) to build standalone-binaries for different operating systems and saves these binaries as build artifacts.