Skip to content

Commit efdc28d

Browse files
authoredFeb 12, 2025··
Add instructions to build R packages (#1886)
* Update deprecated field * Add pixi.lock to ignore list * Add README to docs * Add instructions for building R pkgs * Update actions * Update pixi version * Update setup-pixi action * Try excluding docs dir * Revert last commit
1 parent 83e318a commit efdc28d

File tree

5 files changed

+62
-6
lines changed

5 files changed

+62
-6
lines changed
 

‎.github/workflows/build_docs.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,17 @@ jobs:
3232
################################################################
3333
# CONFIG
3434
################################################################
35-
- uses: prefix-dev/setup-pixi@v0.6.0
35+
- uses: prefix-dev/setup-pixi@v0.8.2
3636
with:
37-
pixi-version: v0.20.1
37+
pixi-version: v0.41.1
3838
- run: |
3939
pixi run docs-build -d docs_build
4040
4141
################################################################
4242
# upload to github pages
4343
################################################################
4444
- name: Upload Pages artifact
45-
uses: actions/upload-pages-artifact@v2
45+
uses: actions/upload-pages-artifact@v3
4646
with:
4747
path: docs_build
4848

@@ -69,4 +69,4 @@ jobs:
6969
steps:
7070
- name: Deploy to GitHub Pages
7171
id: deployment
72-
uses: actions/deploy-pages@v3 # or specific "vX.X.X" version tag for this action
72+
uses: actions/deploy-pages@v4 # or specific "vX.X.X" version tag for this action

‎.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Untitled.ipynb
99

1010
# pixi folder
1111
.pixi/
12+
pixi.lock
1213
# rattler-build output folder
1314
output/
1415

‎docs/README.md

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Emscripten-Forge Documentation
2+
3+
Follow the instructions below to build the documentation locally.
4+
5+
1. Install `pixi` in your environment.
6+
7+
```bash
8+
micromamba install pixi -c conda-forge
9+
```
10+
11+
2. Build the documentation.
12+
13+
```bash
14+
pixi run docs-build -d _build
15+
16+
```
17+
18+
3. The generated documentation can be found in the `_build` directory. Use your favorite server.
19+
20+
```bash
21+
cd _build
22+
python -m http.server
23+
```

‎docs/development/adding_packages.md

+33-1
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`)

‎pixi.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ cmd = [
6464

6565

6666
[feature.feature_rattler_build.tasks.setup]
67-
depends_on = ["build-emscripten-compiler-pkg", "build-cross-python-pkg", "build-pytester-pkg"]
67+
depends-on = ["build-emscripten-compiler-pkg", "build-cross-python-pkg", "build-pytester-pkg"]
6868

6969

7070
[feature.feature_rattler_build.tasks.build-emscripten-wasm32-pkg]

0 commit comments

Comments
 (0)
Please sign in to comment.