Home

Awesome

Recipes

This is a system for building static, dependent libraries for R packages. It is mainly intended to automate the maintenance of CRAN dependencies for the macOS build system, but the system is intended to be usable on other platforms as well. Resulting binaries are available at https://mac.R-project.org/bin/.

The idea is for package authors to submit pull requests for dependencies their packages require such that they can be automatically installed on the build VMs.

The dependency descriptions are simple DCF files. The format should be self-explanatory, it follows the same conventions as DESCRIPTION files in R packages. The required fields are Package, Version and Source-URL. Most common optional fields include Depends and Configure.

There is a Perl script which will process the recipes and create a make file which can be used to build libraries and their dependencies.

More recently, we have added a user-friendly command line tool simply called build.sh (requires bash) which replicates the build as performed on the CRAN machines. For example, to build all libraries needed to build R use:

./build.sh r-base-dev

You can replace r-base-dev with any recipe or use all to build all recipes. See ./build.sh -h for a little help page. Each library is built, packaged and installed. The default locations used by the above script are /opt/R/$arch and /usr/local. The former will be used if present where $arch is typically x86_64 or arm64, otherwise /usr/local is the fall-back (not recommended).

For a more fine-grained control you can run scripts/mkmk.pl yourself and see the list of environment variables at the bottom of this page for possible configurations.

Reference

Most of the following entries are optional:

(*) - virtual packages are packages that are only used to trigger installation of other packages, they only create a target in the Makefile, but don't create any output themselves. Those don't have Version: nor Source.URL:.

NOTE: Originally, the DCF keys were using R notation such as Source.URL which was, unfortunately, later mixed with the Debian notation such as Build-System. To make the syntax consistent all keys are now defined using the Debian notation (so Source-URL). The R notation is still accepted (i.e., any . in the keys is treated as -), but deprecated.

Building

Currently the build steps are

Each dependency has to succeed in all the steps above before the next recipe is used. Makefile is used to determine the dependencies between the recipes.

Note: pkgconfig system stubs are expected to exist for system libraries such that they can be used as dependencies by pkgconfig. Some versions of macOS include them, but others may require manual installation. Most recent macOS versions don't allow stubs in system location since it is read-only, so adding an alternative path to PKG_CONFIG_PATH may be required. The build.sh script automatically adds the system stubs shipped with the recipes to PKG_CONFIG_PATH. To ensure compatibility the sys-stubs recipe provides a package which installs the system stubs (see pkgconfig-sys-stubs for the soruce).

Environment Variables

The mkmk.R script will respect the following environment variables: