Skip to content

Commit

Permalink
Emscripten 3.1.58 (#1256)
Browse files Browse the repository at this point in the history
* fixed syntax

* trigger python build

* strong run exports

* strong run exports

* fixed bzip2

* wip

* renamed

* naming
  • Loading branch information
DerThorsten authored Aug 2, 2024
1 parent 3d91fef commit 142c490
Show file tree
Hide file tree
Showing 9 changed files with 147 additions and 26 deletions.
110 changes: 110 additions & 0 deletions .github/workflows/bootstrap_python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: bootstrap python
on:
workflow_dispatch:
jobs:

build_simple_with_pixi:
strategy:
matrix:
os: [ubuntu-latest, macos-11, macos-12]
fail-fast: false
runs-on: ${{ matrix.os }}
env:
TARGET_PLATFORM: emscripten-wasm32
GITHUB_OWNER: "emscripten-forge"

steps:
################################################################
# SETUP
################################################################
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0

################################################################
# CONFIG
################################################################
- uses: prefix-dev/[email protected]
with:
pixi-version: v0.20.1

- run: |
# build compiler packages
pixi run setup
# build bzip2 sqlite zlib and libffi
pixi run build-emscripten-wasm32-pkg recipes/recipes_emscripten/bzip2
pixi run build-emscripten-wasm32-pkg recipes/recipes_emscripten/sqlite
pixi run build-emscripten-wasm32-pkg recipes/recipes_emscripten/zlib
pixi run build-emscripten-wasm32-pkg recipes/recipes_emscripten/libffi
# build python
pixi run build-emscripten-wasm32-pkg recipes/recipes_emscripten/python
# build pyjs
pixi run build-emscripten-wasm32-pkg recipes/recipes_emscripten/pyjs
# build regex
pixi run build-emscripten-wasm32-pkg recipes/recipes_emscripten/regex
- name: Upload packages to Quetz
if: github.repository == 'emscripten-forge/recipes'
env:
QUETZ_API_KEY: ${{ secrets.QUETZ_API_KEY }}
MATRIX_OS: ${{ matrix.os }}
run: |
overall_success=true
if [ "${MATRIX_OS}" = "ubuntu-latest" ]; then
platforms=(emscripten-wasm32 linux-64 noarch)
elif [ "${MATRIX_OS}" = "macos-11" ]; then
platforms=(osx-64)
elif [ "${MATRIX_OS}" = "macos-12" ]; then
platforms=(osx-arm64)
fi
# Loop over platforms
for platform in "${platforms[@]}"; do
if [ -d "${GITHUB_WORKSPACE}/output/${platform}" ]; then
cd "${GITHUB_WORKSPACE}/output/${platform}"
files=$(ls *.tar.bz2 2> /dev/null)
if [ -n "$files" ]; then
for package in $files; do
echo "Uploading ${package} for ${platform}"

FILE_SHA256=$(sha256sum "${package}" | awk '{ print $1 }')
CURL_CMD=(
pixi run curl -H "X-API-Key: ${QUETZ_API_KEY}" -X POST
"https://beta.mamba.pm/api/channels/emscripten-forge/upload/${package}?sha256=${FILE_SHA256}&force=false"
--data-binary "@${package}"
-o response_body.txt
-w "%{http_code}"
-s
)
HTTP_STATUS=$( "${CURL_CMD[@]}" )
RESPONSE=$(<response_body.txt)

# Check the HTTP status code and log appropriate message
if [[ "$HTTP_STATUS" -eq 201 ]]; then
echo "Upload succeeded for ${package} on ${platform}"
else
echo "Error: Upload failed with HTTP status $HTTP_STATUS"
echo "Response Body: $RESPONSE"
overall_success=false
fi
rm -f response_body.txt
done
fi
fi
done

# Check if all uploads were successful
if [ "$overall_success" = false ]; then
echo "One or more uploads failed"
exit 1
else
echo "All uploads completed successfully"
fi

19 changes: 13 additions & 6 deletions pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ platforms = ["osx-arm64", "osx-64", "linux-64"]
############################################
[feature.feature_rattler_build]
[feature.feature_rattler_build.dependencies]
rattler-build = ">= 0.18.1"
rattler-build = ">= 0.18.2"
python = "3.11.*"
typer = "*"
curl = "*"
Expand All @@ -26,7 +26,7 @@ cmd = [
"-c", "https://repo.mamba.pm/emscripten-forge",
"-c", "microsoft",
"-c", "conda-forge",
"--skip-existing", "local",
"--skip-existing", "all",
"-m", "conda_build_config.yaml",
"--recipe",
"recipes/recipes/emscripten_emscripten-wasm32"
Expand All @@ -41,7 +41,7 @@ cmd = [
"-c", "https://repo.mamba.pm/emscripten-forge",
"-c", "microsoft",
"-c", "conda-forge",
"--skip-existing", "local",
"--skip-existing", "all",
"-m", "conda_build_config.yaml",
"--recipe",
"recipes/recipes/cross-python_emscripten-wasm32"
Expand All @@ -56,13 +56,20 @@ cmd = [
"-c", "https://repo.mamba.pm/emscripten-forge",
"-c", "microsoft",
"-c", "conda-forge",
"--skip-existing", "local",
"--skip-existing", "all",
"-m", "conda_build_config.yaml",
"--recipe",
"recipes/recipes/pytester"
]



[feature.feature_rattler_build.tasks.curl]
cmd = ["curl"]




[feature.feature_rattler_build.tasks.setup]
depends_on = ["build-emscripten-compiler-pkg", "build-cross-python-pkg", "build-pytester-pkg"]

Expand Down Expand Up @@ -93,7 +100,7 @@ cmd = [
"-c", "microsoft",
"-c", "conda-forge",
"--target-platform", "emscripten-wasm32",
"--skip-existing", "local",
"--skip-existing", "all",
"-m", "conda_build_config.yaml","-v",
"--recipe-dir"
]
Expand All @@ -108,7 +115,7 @@ cmd = [
"-c", "https://repo.mamba.pm/emscripten-forge",
"-c", "microsoft",
"-c", "conda-forge",
"--skip-existing", "local",
"--skip-existing", "all",
"-m", "conda_build_config.yaml",
"--recipe"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,14 @@ for file in $PREFIX/opt/emsdk/upstream/emscripten/*; do
echo "Linking $file"
ln -sf $file $PREFIX/bin/
fi
# Check if the file ends with .py
if [[ $file == *.py ]]; then
# Create a symbolic link in the $PREFIX/bin directory
echo "Linking Python $file"
ln -sf $file $PREFIX/bin/
fi

done



3 changes: 2 additions & 1 deletion recipes/recipes/emscripten_emscripten-wasm32/recipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ context:
version: 3.1.58

build:
number: 1
number: 3


outputs:
- package:
Expand Down
5 changes: 3 additions & 2 deletions recipes/recipes_emscripten/bzip2/patches/0001-cross.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ index 9754ddf..b5512de 100644
@@ -15,16 +15,16 @@
SHELL=/bin/sh

# To assist in cross-compiling
# To assist in cross-compiling
-CC=gcc
-AR=ar
-RANLIB=ranlib
Expand All @@ -19,7 +19,7 @@ index 9754ddf..b5512de 100644
+CFLAGS?=-Wall -Winline -O2 -g
+CFLAGS=$(CFLAGS) $(BIGFILES)

# Where you want it installed when you do 'make install'
# Where you want it installed when you do 'make install'
-PREFIX=/usr/local
+PREFIX=$PREFIX

Expand Down Expand Up @@ -50,3 +50,4 @@ index e58791b..f4b9fa2 100644

OBJS= blocksort.o \
huffman.o \

7 changes: 4 additions & 3 deletions recipes/recipes_emscripten/bzip2/recipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ package:
source:
- url: https://sourceware.org/pub/bzip2/bzip2-${{ version }}.tar.gz
sha256: ab5a03176ee106d3f0fa90e381da478ddae405918153cca248e682cd0c4a2269
patches:
- patches/0001-cross.patch
- path: CMakeLists.txt
# patches:
# - patches/2.patch
# # - patches/0001-cross.patch
# - path: CMakeLists.txt

build:
number: 7
Expand Down
2 changes: 1 addition & 1 deletion recipes/recipes_emscripten/numpy/recipe_legacy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ requirements:
- '{{ compiler("c") }}'
- cross-python_emscripten-wasm32
- cython
- setuptools >=68.0
- setuptools =68.0
- pip
host:
- python
Expand Down
7 changes: 3 additions & 4 deletions recipes/recipes_emscripten/pyjs/recipe.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
context:
version: 2.1.0
version: 2.2.1
name: pyjs
package:
name: ${{name}}
version: ${{ version }}

source:
url: https://github.com/emscripten-forge/pyjs/archive/refs/tags/${{ version }}.tar.gz
sha256: 8633dfd8b5bf9403e6b9c02c582557dcc49226034689032939b547c7dc431000
sha256: d489ff69024ceae4dbd24d7536f150868720f1d70a63868a9cc4f0aca1c84cb9
build:
number: 7
number: 0


requirements:
Expand Down Expand Up @@ -64,7 +64,6 @@ tests:
- microsoft::playwright
run:
- pytest
- numpy
files:
source:
- tests/**/*
Expand Down
10 changes: 1 addition & 9 deletions recipes/recipes_emscripten/sqlite/recipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,7 @@ requirements:
tests:
- script:
- sqlite3 --version
- if not exist %PREFIX%\\Library\bin\sqlite3.dll exit 1
- if not exist %PREFIX%\\Library\lib\sqlite3.lib exit 1
- test -f $PREFIX/lib/libsqlite3${SHLIB_EXT}
- test ! -f $PREFIX/lib/libsqlite3.a
- test -f $PREFIX/lib/libsqlite3.a
- if not exist %PREFIX%\\Library\include\sqlite3.h exit 1
- if not exist %PREFIX%\\Library\include\sqlite3ext.h exit 1
- test -f $PREFIX/include/sqlite3.h
- test -f $PREFIX/include/sqlite3ext.h

about:
license: Unlicense
license_url: http://www.sqlite.org/copyright.html
Expand Down

0 comments on commit 142c490

Please sign in to comment.