Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add qhull and update matplotlib #1205

Merged
merged 7 commits into from
Jul 16, 2024
Merged
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
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