-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e1683e4
commit a0f0216
Showing
4 changed files
with
45 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,9 +37,23 @@ jobs: | |
if: runner.os == 'Windows' | ||
run: 'choco install wget -y' | ||
|
||
- name: Restore cached libbinaryen | ||
id: cache-libbinaryen-restore | ||
uses: actions/cache/restore@v4 | ||
with: | ||
path: ./binaryen/libbinaryen | ||
key: ${{ matrix.os }}-${{ runner.os }}-${{ runner.arch }}-v${{env.BINARYEN_VERSION}}-libbinaryen | ||
|
||
- name: Build wheels | ||
uses: pypa/[email protected] | ||
|
||
- name: Cache libbinaryen | ||
id: cache-libbinaryen-save | ||
uses: actions/cache/save@v4 | ||
with: | ||
path: ./binaryen/libbinaryen | ||
key: ${{steps.cache-libbinaryen-restore.outputs.cache-primary-key}} | ||
|
||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: binaryen-py-${{ matrix.os }}-${{ strategy.job-index }} | ||
|
@@ -59,5 +73,5 @@ jobs: | |
|
||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: cibw-sdist | ||
name: binaryen-py-sdist | ||
path: dist/*.tar.gz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,5 @@ | ||
# Building or updating Binaryen.py | ||
|
||
1. Put the new precompiled dynamic libraries in `binaryen/libbinaryen` for all architectures for all operating systems | ||
2. Update the `binaryen-c.h` and `wasm-delegations.def` | ||
3. Delete the existing `binaryen-c.c` and run `python binaryen/libbinaryen/create_cdef.py` | ||
4. Replace any unions in the ouputed `binaryen-c.c` to the largest of their contents | ||
5. Copy the contents of `binaryen-c.c` to the `cdef` variable in `binaryen_build.py` | ||
6. *Optional* run `python binaryen_build.py` | ||
|
||
## Replacing unions | ||
|
||
Replace all unions so that the largest type of the union is used instead. CFFI can't do this automatically without the full C source. | ||
|
||
```c | ||
// Change | ||
struct BinaryenLiteral { | ||
uintptr_t type; | ||
union { | ||
int32_t i32; | ||
int64_t i64; | ||
float f32; | ||
double f64; | ||
uint8_t v128[16]; | ||
const char* func; | ||
}; | ||
}; | ||
// to | ||
struct BinaryenLiteral { | ||
uintptr_t type; | ||
uint8_t v128[16]; | ||
}; | ||
``` | ||
1. (Optional) Update `BINARYEN_VERSION` in `pyproject.toml` and `.github/workflows/build.yaml` | ||
2. Run `bash scripts/build_libbinaryen.sh` | ||
3. Run `cibuildwheel`, `python -m pip wheel .`, `python -m pip install -e .` or whichever supported build command you would prefer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters