Skip to content

Commit ea881fe

Browse files
committed
Add instructions for building R pkgs
1 parent 94640d2 commit ea881fe

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

docs/development/adding_packages.md

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ endian = 'little'
9494
9595
[binaries]
9696
exe_wrapper = 'node'
97-
pkgconfig = 'pkg-config'
97+
pkg-config = 'pkg-config'
9898
9999
```
100100

@@ -144,3 +144,35 @@ requirements:
144144
* [cryptography](https://github.com/emscripten-forge/recipes/tree/main/recipes/recipes_emscripten/cryptography)
145145
* [pydantic-core](https://github.com/emscripten-forge/recipes/tree/main/recipes/recipes_emscripten/pydantic-core)
146146
* [pycrdt](https://github.com/emscripten-forge/recipes/tree/main/recipes/recipes_emscripten/pycrdt)
147+
148+
149+
## R Packages
150+
151+
A typical R package requires at least one compiler and the `cross-r-base` package.
152+
153+
```yaml
154+
requirements:
155+
build:
156+
- ${{ compiler('cxx') }}
157+
- cross-r-base
158+
host:
159+
- r-base
160+
run:
161+
- r-base
162+
```
163+
164+
To build the package, a one-line script is sufficient:
165+
166+
```bash
167+
$R CMD INSTALL $R_ARGS --no-byte-compile .
168+
```
169+
170+
If the package requires a Fortran compiler, then `flang` must be installed in the build script.
171+
172+
Please note that the `cross-r-base` package adds files to the `$PREFIX` directory which do not belong to the package being built. This is because the build for `r-base` on conda-forge is different than the build for `r-base` on emscripten-forge. To avoid packaging irrelevant files, we filter files with an [outputs section](https://rattler.build/latest/reference/recipe_file/#outputs-section).
173+
174+
**Example recipes**:
175+
176+
- [r-bit](https://github.com/emscripten-forge/recipes/blob/main/recipes/recipes_emscripten/r-bit/recipe.yaml)
177+
- [r-colorspace](https://github.com/emscripten-forge/recipes/blob/main/recipes/recipes_emscripten/r-colorspace/recipe.yaml)
178+
- [r-nlme](https://github.com/emscripten-forge/recipes/blob/main/recipes/recipes_emscripten/r-nlme/recipe.yaml) (uses `flang`)

0 commit comments

Comments
 (0)