Skip to content

Commit

Permalink
Try emcc monkey patch
Browse files Browse the repository at this point in the history
  • Loading branch information
talmo committed Sep 29, 2024
1 parent 4e5babe commit 83caaf3
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
9 changes: 9 additions & 0 deletions recipes/recipes_emscripten/h5py/build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
#!/bin/bash

# remove the emcc symlink in the $BUILD_PREFIX/bin
rm $BUILD_PREFIX/bin/emcc

# make callable
chmod +x $RECIPE_DIR/emcc_wrapper.sh

# create symlink to $RECIPE_DIR/emcc_wrapper.sh
ln -s $RECIPE_DIR/emcc_wrapper.sh $BUILD_PREFIX/bin/emcc

export HDF5_DIR=${PREFIX}

# tell setup.py to not 'pip install' exact package requirements
Expand Down
5 changes: 5 additions & 0 deletions recipes/recipes_emscripten/h5py/emcc_wrapper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
set -e

$BUILD_PREFIX/bin/python3 $RECIPE_DIR/py_emcc_wrapper.py $BUILD_PREFIX/opt/emsdk/upstream/emscripten/emcc "$@"
exit $?
16 changes: 16 additions & 0 deletions recipes/recipes_emscripten/h5py/py_emcc_wrapper.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import sys
import subprocess

if __name__ == "__main__":

args = sys.argv[2:]

filtered_args = []
for arg in args:
if ("-Wl,-R$PREFIX/lib" in arg) or ("-R" in arg):
print("removed arg:", arg)
else:
filtered_args.append(arg)

# run the actual command in argv[1]
subprocess.run([sys.argv[1]] + filtered_args, check=True)

0 comments on commit 83caaf3

Please sign in to comment.