Skip to content

Container action for building webr binaries on r-universes

Notifications You must be signed in to change notification settings

r-universe-org/build-wasm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Minimal wasm build image

Docker image to build R packages for webassembly.

How to use

You don't need this repository, everything is in the docker image.

Simply run the container while mapping the host directory containing the R source package(s) to /sources. For example to build source packages in your current working directory (pwd):

# Download a source package on the host
# R -e 'download.packages("rlang", ".", repos = "https://cloud.r-project.org")'

# Build the wasm binaries
docker run --rm -it -v $(pwd):/sources ghcr.io/r-universe-org/build-wasm

Afterwards a new subdirectory repo is created under the sourced directory containing the wasm binaries.

How it works

The container actually installs the package twice:

  1. First it installs the package and its dependencies as usual in the default host version of R. This is mostly to trick R to think dependencies are installed. To speed this up, we use pak and ppm binaries.
  2. Then it cross-compiles the source package using emscripten compilers. It does not actually install build the dependencies for emscripten, and the package is installed with --no-test-load because it cannot actually be loaded outside of wasm.

About

Container action for building webr binaries on r-universes

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages