Skip to content

Commit

Permalink
add qhull and update matplotlib (#1205)
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfv authored Jul 16, 2024
1 parent a1763c2 commit 4ea2253
Show file tree
Hide file tree
Showing 9 changed files with 123 additions and 801 deletions.
33 changes: 33 additions & 0 deletions recipes/recipes_emscripten/matplotlib/build-base.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash

# Set up the cross file
# Note: the include folder is moved to `$BUILD_PREFIX` by the cross-python activation script
export NUMPY_INCLUDE_DIR="$BUILD_PREFIX/lib/python${PY_VER}/site-packages/numpy/core/include"

# write out the cross file
sed "s|@(NUMPY_INCLUDE_DIR)|${NUMPY_INCLUDE_DIR}|g" $RECIPE_DIR/emscripten.meson.cross > $SRC_DIR/emscripten.meson.cross.temp
sed "s|@(PYTHON)|${PYTHON}|g" $SRC_DIR/emscripten.meson.cross.temp > $SRC_DIR/emscripten.meson.cross
rm $SRC_DIR/emscripten.meson.cross.temp

cat $SRC_DIR/emscripten.meson.cross

export CFLAGS="$CFLAGS -sWASM_BIGINT"
export CXXFLAGS="$CXXFLAGS -sWASM_BIGINT"
export LDFLAGS="$LDFLAGS -sWASM_BIGINT"

${PYTHON} -m pip install . -vvv --no-deps --no-build-isolation \
-Csetup-args="--cross-file=$SRC_DIR/emscripten.meson.cross" \
-Csetup-args="-Dsystem-freetype=true" \
-Csetup-args="-Dsystem-qhull=true" \
-Csetup-args="-Dmacosx=false"

export MATPLOTLIB_LOCATION=$PREFIX/lib/python$PY_VER/site-packages/matplotlib

# Pre-built font cache
cp $RECIPE_DIR/src/fontlist.json $MATPLOTLIB_LOCATION/
cp $RECIPE_DIR/src/Humor-Sans-1.0.ttf $MATPLOTLIB_LOCATION/mpl-data/fonts/ttf/Humor-Sans.ttf

# Save space by removing unneeded code
rm -rf $MATPLOTLIB_LOCATION/backends/qt_editor
rm -rf $MATPLOTLIB_LOCATION/backends/web_backend
rm -rf $MATPLOTLIB_LOCATION/sphinxext
28 changes: 0 additions & 28 deletions recipes/recipes_emscripten/matplotlib/build.sh

This file was deleted.

16 changes: 16 additions & 0 deletions recipes/recipes_emscripten/matplotlib/emscripten.meson.cross
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[properties]
needs_exe_wrapper = true
skip_sanity_check = true
longdouble_format = 'IEEE_QUAD_LE' # for numpy
numpy-include-dir = '@(NUMPY_INCLUDE_DIR)'

[host_machine]
system = 'emscripten'
cpu_family = 'wasm32'
cpu = 'wasm'
endian = 'little'

[binaries]
exe_wrapper = 'node'
pkg-config = 'pkg-config'
python = '@(PYTHON)'
2 changes: 0 additions & 2 deletions recipes/recipes_emscripten/matplotlib/mplsetup.cfg

This file was deleted.

This file was deleted.

31 changes: 13 additions & 18 deletions recipes/recipes_emscripten/matplotlib/recipe.yaml
Original file line number Diff line number Diff line change
@@ -1,51 +1,45 @@
context:
name: matplotlib
version: 3.8.4

# package:
# name: ${{ name|lower }}
# version: ${{ version }}
version: "3.9.1"

source:
- url: https://github.com/matplotlib/matplotlib/archive/v${{ version }}.tar.gz
sha256: 7c4f370b7550eec8342c102f9dd80da3bec2895d7f514f5f6378764db4cb0e35
# sha256: 5ac5ca25e6ecd1e7711e1f859b4b6f74f290ef517387d1502bf8012bf2b1647e
sha256: 4fdf46dc325fdf4cbc61f7fa66de7b48287df0a71b3442b63ff0784041cae2e7
patches:
- patches/disable_macosx_backend.patch
- patches/fix-threading-and-font-cache.patch
- path: mplsetup.cfg
- path: setupext.py

build:
number: 0


outputs:
- package:
name: matplotlib-base
version: ${{ version }}
build:
script: build.sh
script: build-base.sh
requirements:
build:
- python
- numpy
- cross-python_emscripten-wasm32
- pybind11
- pip
- cross-python_${{ target_platform }}

- ${{ compiler('c') }}
- ${{ compiler('cxx') }}
- pkg-config
- meson-python

# TODO add certifi package to emscripten-wasm32 and depend in host on this
- certifi
- pip
- setuptools_scm_git_archive

# to template the emscripten.meson.cross file
- sed

host:
- python
- numpy
- pybind11
- freetype
- qhull

run:
- contourpy
- cycler
Expand All @@ -61,6 +55,7 @@ outputs:
- package:
name: matplotlib
version: ${{ version }}

requirements:
host:
- python
Expand Down
Loading

0 comments on commit 4ea2253

Please sign in to comment.