Skip to content

Commit 54b1b12

Browse files
committed
Make libffi build also key on mpdec
1 parent b40fbf9 commit 54b1b12

2 files changed

Lines changed: 23 additions & 1 deletion

File tree

.github/workflows/reusable-emscripten.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ jobs:
4141
with:
4242
node-version: ${{ steps.emscripten-config.outputs.node-version }}
4343
- name: "Cache Emscripten SDK"
44+
id: emsdk-cache
4445
uses: actions/cache@v5
4546
with:
4647
path: ${{ env.EMSDK_CACHE }}
@@ -59,7 +60,9 @@ jobs:
5960
- name: "Make build Python"
6061
run: python3 Platforms/emscripten make-build-python
6162
- name: "Make dependencies"
62-
run: python3 Platforms/emscripten make-dependencies
63+
run: >-
64+
python3 Platforms/emscripten make-dependencies
65+
${{ steps.emsdk-cache.outputs.cache-hit == 'true' && '--check-up-to-date' || '' }}
6366
- name: "Configure host Python"
6467
run: python3 Platforms/emscripten configure-host --host-runner node -- --config-cache
6568
- name: "Make host Python"

Platforms/emscripten/__main__.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,10 +351,17 @@ def make_emscripten_libffi(context, working_dir):
351351
validate_emsdk_version(context.emsdk_cache)
352352
prefix = context.build_paths["prefix_dir"]
353353
libffi_config = load_config_toml()["dependencies"]["libffi"]
354+
with open(EMSCRIPTEN_DIR / "make_libffi.sh", "rb") as f:
355+
libffi_config["make_libffi_shasum"] = hashlib.file_digest(f, "sha256").hexdigest()
354356
if not should_build_library(
355357
prefix, "libffi", libffi_config, context.quiet
356358
):
357359
return
360+
361+
if context.check_up_to_date:
362+
print("libffi out of date, expected to be up to date", file=sys.stderr)
363+
sys.exit(1)
364+
358365
url = libffi_config["url"]
359366
version = libffi_config["version"]
360367
shasum = libffi_config["shasum"]
@@ -382,6 +389,10 @@ def make_mpdec(context, working_dir):
382389
if not should_build_library(prefix, "mpdec", mpdec_config, context.quiet):
383390
return
384391

392+
if context.check_up_to_date:
393+
print("libmpdec out of date, expected to be up to date", file=sys.stderr)
394+
sys.exit(1)
395+
385396
url = mpdec_config["url"]
386397
version = mpdec_config["version"]
387398
shasum = mpdec_config["shasum"]
@@ -678,6 +689,14 @@ def main():
678689
help="Build all static library dependencies",
679690
)
680691

692+
for cmd in [make_mpdec_cmd, make_libffi_cmd, make_dependencies_cmd]:
693+
cmd.add_argument(
694+
"--check-up-to-date",
695+
action="store_true",
696+
default=False,
697+
help=("If passed, will fail if dependency is out of date"),
698+
)
699+
681700
make_build = subcommands.add_parser(
682701
"make-build-python", help="Run `make` for the build Python"
683702
)

0 commit comments

Comments
 (0)