Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions recipes/recipes/rust-nightly/activate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

echo "[rust-nightly] Activating..."

set +u

[ -z "${BUILD_PREFIX}" ] && export BUILD_PREFIX="${PREFIX}"

export RUSTUP_HOME=$BUILD_PREFIX/.rustup_emscripten_forge
Expand Down
16 changes: 16 additions & 0 deletions recipes/recipes/rust-nightly/bootstrap.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
change-id = "ignore"
build.verbose = 0

rust.channel = "nightly"

build.target = ["wasm32-unknown-emscripten"]
build.docs = false

build.cargo = "$CARGO_BIN"
build.rustc = "$RUSTC_BIN"
build.rustfmt = "$RUSTFMT_BIN"
build.cargo-clippy = "$CLIPPY_BIN"

install.prefix = "$PREFIX"
install.sysconfdir = "$PREFIX/etc"

67 changes: 67 additions & 0 deletions recipes/recipes/rust-nightly/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ do
cp "${RECIPE_DIR}/${TASK}.sh" "${PREFIX}/etc/conda/${TASK}.d/${TASK}_${PKG_NAME}.sh"
done

set -eux

export RUSTUP_HOME=$PREFIX/.rustup_emscripten_forge
export CARGO_HOME=$PREFIX/.cargo_emscripten_forge

Expand All @@ -16,3 +18,68 @@ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- \
--profile minimal \
--target wasm32-unknown-emscripten \
-y


# RUSTC_DATE=$(rustc --version | cut -d' ' -f4 | tr -d '()')
# # RUSTC_DATE="2025-12-01"
# wget --quiet https://static.rust-lang.org/dist/${RUSTC_DATE}/channel-rust-nightly.toml

# Get the git_commit_hash for pkg.rustc [don't forget the C!]
# COMMIT_HASH=$(grep -A 2 "\[pkg.rustc\]" channel-rust-nightly.toml | grep git_commit_hash | cut -d'"' -f2)

rustc -vV
COMMIT_HASH=$(rustc -vV | grep commit-hash | cut -d' ' -f2)
echo "♥️♥️♥️ COMMIT_HASH: $COMMIT_HASH"

git clone https://github.com/rust-lang/rust.git --shallow-since=2025-01-01
cd rust
git reset --hard
git checkout $COMMIT_HASH

# https://github.com/pyodide/rust-emscripten-wasm-eh-sysroot/blob/main/turn-on-emscripten-wasm-eh.patch
sed -i 's/emscripten_wasm_eh: bool = (false, parse_bool, \[TRACKED\],/\
emscripten_wasm_eh: bool = (true, parse_bool, [TRACKED],/' \
compiler/rustc_session/src/options.rs

# Use nightly rustc and cargo
export PATH=$CARGO_HOME/bin:$PATH
rustup default nightly
rustup override set nightly
rustup component add rustfmt
rustup component add clippy
export RUSTC_BIN=$(which rustc)
export CARGO_BIN=$(which cargo)
export RUSTFMT_BIN=$(which rustfmt)
export CLIPPY_BIN=$(which cargo-clippy)

envsubst < $RECIPE_DIR/config.toml > ./config.toml
envsubst < $RECIPE_DIR/bootstrap.toml > ./bootstrap.toml

cat bootstrap.toml

./x build library --stage 1 --target wasm32-unknown-emscripten --config bootstrap.toml
# ./x build library --stage 2 --target wasm32-unknown-emscripten
# ./x build library --stage 2 --target x86_64-unknown-linux-gnu

# CUSTOM_TOOLCHAIN="${RUSTUP_HOME}/rust-toolchain-wasm-eh"
# mkdir -p $CUSTOM_TOOLCHAIN
# cp -r build/host/stage2/* $CUSTOM_TOOLCHAIN/
# rustup toolchain link rust-toolchain-wasm-eh $CUSTOM_TOOLCHAIN
# rustup default rust-toolchain-wasm-eh

# # Need to install and then remove the target so that it is recognized as active
RUST_TOOLCHAIN=$(rustup show active-toolchain | awk '{print $1}')
echo "🧿🧿🧿 LOOK"
ls -al $RUSTUP_HOME/toolchains/$RUST_TOOLCHAIN/lib/rustlib/wasm32-unknown-emscripten/lib
rm -r $RUSTUP_HOME/toolchains/$RUST_TOOLCHAIN/lib/rustlib/wasm32-unknown-emscripten
cp -r build/host/stage1/lib/rustlib/wasm32-unknown-emscripten \
$RUSTUP_HOME/toolchains/$RUST_TOOLCHAIN/lib/rustlib/

echo "👁️‍🗨️👁️‍🗨️👁️‍🗨️ LOOK AGAIN"
ls -al $RUSTUP_HOME/toolchains/$RUST_TOOLCHAIN/lib/rustlib/wasm32-unknown-emscripten/lib

rustup toolchain list
rustc --version
rustup --version


9 changes: 9 additions & 0 deletions recipes/recipes/rust-nightly/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
profile = "compiler"
change-id = "ignore"

[build]
target = ["wasm32-unknown-emscripten"]
docs = false

[rust]
channel = "nightly"
10 changes: 5 additions & 5 deletions recipes/recipes/rust-nightly/recipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ package:
version: ${{ version }}

build:
number: 2
number: 9

requirements:
build:
Expand All @@ -23,8 +23,8 @@ about:
homepage: https://www.rust-lang.org
license: MIT
license_file:
- LICENSE-APACHE
- LICENSE-MIT
- LICENSE-APACHE
- LICENSE-MIT
summary: |
Rust is a systems programming language that runs blazingly fast, prevents
segfaults, and guarantees thread safety. This package provides the compiler
Expand All @@ -34,5 +34,5 @@ about:

extra:
recipe-maintainers:
- DerThorsten
- IsabelParedes
- DerThorsten
- IsabelParedes
27 changes: 25 additions & 2 deletions recipes/recipes_emscripten/cramjam/build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,27 @@
#!/bin/bash

export MATURIN_PYTHON_SYSCONFIGDATA_DIR=${PREFIX}/etc/conda/_sysconfigdata__emscripten_wasm32-emscripten.py
${PYTHON} -m pip install . -vv
set -eux

# # emcc: error: DISABLE_EXCEPTION_CATCHING=0 is not compatible with -fwasm-exceptions
# unset EMCC_CFLAGS

# # rustup toolchain install nightly
# # rustup target add wasm32-unknown-emscripten --toolchain nightly
# # rustup override set nightly
# # rustup default nightly

# # export CARGO_BUILD_TARGET=wasm32-unknown-emscripten
# # export PYTHON_SYS_EXECUTABLE=$BUILD_PREFIX/bin/python3.13
# # export RUSTUP_TOOLCHAIN=nightly
# # export PYO3_CROSS_LIB_DIR=$BUILD_PREFIX/lib
# # export PYO3_CROSS_INCLUDE_DIR=$BUILD_PREFIX/include
# # export CARGO_FEATURE_NO_DEFAULT_FEATURES=1
# # export CARGO_NO_DEFAULT_FEATURES=1
# # export MATURIN_NO_DEFAULT_FEATURES=1

# # python -m pip install . --config-settings="maturin-args=--no-default-features" --no-build-isolation --prefix $PREFIX -vvv
# # # Use maturin with all cross-compilation variables
# RUSTUP_TOOLCHAIN=nightly maturin build --release --target wasm32-unknown-emscripten -i python3.13 --no-default-features --out dist
# python -m pip install dist/*.whl --prefix $PREFIX -vvv
export RUSTFLAGS="-Z emscripten-wasm-eh"
$PYTHON -m pip install . $PIP_ARGS
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
From 02c04db7feecbcc9d70baf3135a66045b5631073 Mon Sep 17 00:00:00 2001
From: Isabel Paredes <isabel.paredes@quantstack.net>
Date: Tue, 25 Nov 2025 11:02:28 +0100
Subject: [PATCH] Remove blosc2 from default features

blosc2 tries to build an internal zlib and fails.
---
Cargo.toml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Cargo.toml b/Cargo.toml
index 0c11a83..066ef00 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -14,7 +14,7 @@ name = "cramjam"
crate-type = ["cdylib"]

[features]
-default = ["extension-module", "snappy", "lz4", "bzip2", "brotli", "xz", "zstd", "gzip", "deflate", "blosc2", "igzip"]
+default = ["extension-module", "snappy", "lz4", "bzip2", "brotli", "xz", "zstd", "gzip", "deflate", "igzip"]
extension-module = ["pyo3/extension-module"]
generate-import-lib = ["pyo3/generate-import-lib"] # needed for Windows PyPy builds

29 changes: 16 additions & 13 deletions recipes/recipes_emscripten/cramjam/recipe.yaml
Original file line number Diff line number Diff line change
@@ -1,31 +1,34 @@
context:
name: cramjam
version: 2.8.3
version: 2.11.0

package:
name: ${{ name|lower }}
name: ${{ name }}
version: ${{ version }}

source:
url: https://pypi.io/packages/source/${{ name[0] }}/${{ name }}/${{ name }}-${{ version }}.tar.gz
sha256: 6b1fa0a6ea8183831d04572597c182bd6cece62d583a36cde1e6a86e72ce2389
sha256: 5c82500ed91605c2d9781380b378397012e25127e89d64f460fea6aeac4389b4
patches:
- patches/0001-Remove-blosc2-from-default-features.patch

build:
number: 0

requirements:
build:
- python
- cross-python_${{ target_platform }}
- maturin
- toml
- rust
- ${{ compiler('cxx') }}
- python
- cross-python_${{ target_platform }}
- maturin
- toml
- rust-nightly
- ${{ compiler('cxx') }}
host:
- python
- pip
- python
- pip
- zlib
run:
- python
- python

tests:
- script: pytester
Expand All @@ -45,7 +48,7 @@ about:
license_file: LICENSE
summary: python bindings to rust-implemented compression
description: |
Extremely thin Python bindings to de/compression algorithms in Rust.
Extremely thin Python bindings to de/compression algorithms in Rust.
documentation: https://docs.rs/cramjam

extra:
Expand Down
7 changes: 0 additions & 7 deletions recipes/recipes_emscripten/pycrdt/build.sh

This file was deleted.

12 changes: 7 additions & 5 deletions recipes/recipes_emscripten/pycrdt/recipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,26 @@ context:
version: 0.12.32

package:
name: ${{name}}
name: ${{ name }}
version: ${{ version }}

source:
- url: https://github.com/jupyter-server/pycrdt/archive/refs/tags/${{version}}.tar.gz
- url: https://github.com/jupyter-server/pycrdt/archive/refs/tags/${{ version }}.tar.gz
sha256: 39177cf5b515875f345a2a1460b44e1b11d30273263f6569d0bed5b8c953205f

build:
number: 0
script:
- export RUSTFLAGS="-Z emscripten-wasm-eh -Z link-native-libraries=yes -C link-args=-fwasm-exceptions"
- $PYTHON -m pip install . $PIP_ARGS

requirements:
build:
- cross-python_${{target_platform}}
- cross-python_${{ target_platform }}
- cffi
- setuptools-rust
- rust
- rust-nightly
- maturin

host:
- python
- openssl
Expand Down
4 changes: 3 additions & 1 deletion recipes/recipes_emscripten/tiktoken/build.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/bin/bash
cargo-bundle-licenses --format yaml --output THIRDPARTY.yml

export MATURIN_PYTHON_SYSCONFIGDATA_DIR=${PREFIX}/etc/conda/_sysconfigdata__emscripten_wasm32-emscripten.py
# export CFLAGS_wasm32-unknown-emscripten="-fwasm-exceptions"

# export RUSTFLAGS="-Z emscripten-wasm-eh -Cpanic=abort. -fwasm-exceptions"
${PYTHON} -m pip install . -vvv

7 changes: 3 additions & 4 deletions recipes/recipes_emscripten/tiktoken/recipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ context:
version: 0.11.0

package:
name: ${{name}}
name: ${{ name }}
version: ${{ version }}

source:
- url: https://pypi.io/packages/source/t/${{ name }}/tiktoken-${{ version }}.tar.gz
- url: https://pypi.io/packages/source/${{ name[0] }}/${{ name }}/${{ name }}-${{ version }}.tar.gz
sha256: 3c518641aee1c52247c2b97e74d8d07d780092af79d5911a6ab5e79359d9b06a

build:
Expand All @@ -17,14 +17,13 @@ requirements:
build:
- cross-python_${{target_platform}}
- setuptools-rust
- rust
- rust-nightly
- cargo-bundle-licenses
host:
- python
run:
- regex


tests:
- script: pytester
requirements:
Expand Down
Loading