Skip to content

Commit

Permalink
added blog
Browse files Browse the repository at this point in the history
  • Loading branch information
DerThorsten committed May 10, 2024
1 parent ebc5e6e commit 44cdcec
Show file tree
Hide file tree
Showing 8 changed files with 109 additions and 11 deletions.
16 changes: 7 additions & 9 deletions docs/adding_packages.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Adding packages

To add a new package to emscripten-forge, just create a Pull Request in this repository.
The recipe format is described in the [rattler-build recipe format](https://github.com/prefix-dev/rattler-build?tab=readme-ov-file#the-recipe-format)



# C/C++ Packages
## CMake
## C/C++ Packages
### CMake

Adding cmake based packages is easy. Usually it is enough to replace the `cmake` command with the `emcmake` command and
`make` with `emmake` (see the [emscripten documentation](https://emscripten.org/docs/compiling/Building-Projects.html#integrating-with-a-build-system) for more details)
Expand All @@ -18,14 +18,14 @@ Adding cmake based packages is easy. Usually it is enough to replace the `cmake`
* [xeus-javascript](https://github.com/emscripten-forge/recipes/tree/main/recipes/recipes_emscripten/xeus-javascript)
* [sqlitecpp](https://github.com/emscripten-forge/recipes/tree/main/recipes/recipes_emscripten/sqlitecpp)

## Configure / Make
### Configure / Make

Usually it is enough to replace the `./configure` command with the `emconfigure ./configure` (see the [emscripten documentation](https://emscripten.org/docs/compiling/Building-Projects.html#integrating-with-a-build-system) for more details)


# Python Packages
## Python Packages

## pip / setuptools
### pip / setuptools
For simple package only these requirements are usually necessary:
```yaml

Expand All @@ -46,9 +46,7 @@ requirements:
* [regex](https://github.com/emscripten-forge/recipes/tree/main/recipes/recipes_emscripten/regex)
### Example recipes
## rust
### rust
Building rust package with PyO3 / maturin works usually out of the box.
For a maturin / cffi / pyo3 package, the following requirements are usually necessary:
Expand Down
7 changes: 7 additions & 0 deletions docs/blog/.authors.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
authors:
derthorsten:
name: Dr. Thorsten Beier
description: main author of emscripten-forge
avatar: https://avatars.githubusercontent.com/u/904752?v=4 # Author avatar
slug: DerThorsten # Author profile slug
url: https://github.com/DerThorsten # Author website URL
Empty file added docs/blog/index.md
Empty file.
21 changes: 21 additions & 0 deletions docs/blog/posts/pixi.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
date: 2024-05-10
category:
- rust

authors:
- derthorsten
---

# Local builds with `pixi`

Setting up a local build environment for emscripten-forge used to be a very complicated process with many dependencies and many steps.
But with the usage of [pixi](https://pixi.sh/latest/) this has become trivial!

```bash
# this only needs to be done once
pixi run setup

# thats it! packages can now be built
pixi run build-emscripten-wasm32-pkg recipes/recipes_emscripten/regex
```
44 changes: 44 additions & 0 deletions docs/blog/posts/rattler_build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
date: 2024-05-10
category:
- rust

authors:
- derthorsten
---

# Goodby boa, welcome rattler-build

When emscripten-forge was started, we relied on `https://github.com/mamba-org/boa` which is a [conda-build](https://github.com/conda/conda-build) like tool but
using more of [mamba](https://github.com/mamba-org/mamba) then [conda](https://github.com/conda/conda).
This was always a bit brittle and we had to maintain a fork of `boa` to make it work with `emscripten-wasm32`.
Testing did not work at all, because test dependencies could only be specified for the `target_platform` and not for the `host_platform`, ie
only for emscripten-wasm32 and not for linux-64 (or any other host platform).
This means there was no sane way to install the "emulators" to run the wasm code on the host platform.
Also the error messages were not very helpful and the code was hard to understand.

But then there came [rattler-build](https://github.com/prefix-dev/rattler-build)
which is a complete rewrite of `boa` / `conda-build` in rust which is faster, hast barley any dependencies and has easy to understand error messages.
And to make it even better, test dependencies can be specified for the host platform and the target platform!
This means we can now install the [pyjs-code-runner](https://github.com/emscripten-forge/pyjs-code-runner) which can be used
to run wasm in a headless browser.

This allows to have a proper test section in the recipe.yaml file like in the [regex](https://github.com/emscripten-forge/recipes/tree/main/recipes/recipes_emscripten/regex) recipe:

```yaml

tests:
- script: pytester
requirements:
build:
- pytester
run:
- pytester-run
files:
recipe:
- test_regex.py

```


Today we have removed `boa` support from this repository and are now using only `rattler-build`.
18 changes: 18 additions & 0 deletions docs/blog/posts/rust.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
date: 2024-05-10
category:
- rust
- python

authors:
- derthorsten
---

# Rust/PyO3 Support

Finally, we have added support for Rust/PyO3/maturin packages.
This allows to build packages like * [cryptography](https://github.com/emscripten-forge/recipes/tree/main/recipes/recipes_emscripten/cryptography),
[pydantic-core](https://github.com/emscripten-forge/recipes/tree/main/recipes/recipes_emscripten/cryptography) and
[pycrdt](https://github.com/emscripten-forge/recipes/tree/main/recipes/recipes_emscripten/pycrdt).


13 changes: 11 additions & 2 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
site_name: Emscripten-forge
theme:
name: material

features:
- navigation.instant
palette:

# Palette toggle for automatic mode
Expand All @@ -13,13 +14,15 @@ theme:
# Palette toggle for light mode
- media: "(prefers-color-scheme: light)"
scheme: default
primary: deep orange
toggle:
icon: material/brightness-7
name: Switch to dark mode

# Palette toggle for dark mode
- media: "(prefers-color-scheme: dark)"
scheme: slate
primary: deep orange
toggle:
icon: material/brightness-4
name: Switch to system preference
Expand All @@ -39,4 +42,10 @@ markdown_extensions:


plugins:
- search
- search

- git-committers:
repository: emscripten-forge/recipes
branch: main

- blog
1 change: 1 addition & 0 deletions pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ python = "3.11.*"
mkdocs = ">=1.6.0"
mkdocs-material = ">=9.5.2"
pip = "*"
mkdocs-git-committers-plugin-2 = "*"


[feature.feature_documentation.tasks.docs-serve]
Expand Down

0 comments on commit 44cdcec

Please sign in to comment.