From ddc8abc71494b4b3d683888557cb6a6cc436aa08 Mon Sep 17 00:00:00 2001 From: geisserml Date: Tue, 21 Nov 2023 01:10:33 +0100 Subject: [PATCH] refbindings: define feature flags --- setupsrc/pypdfium2_setup/autorelease.py | 4 +++- setupsrc/pypdfium2_setup/packaging_base.py | 4 +--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/setupsrc/pypdfium2_setup/autorelease.py b/setupsrc/pypdfium2_setup/autorelease.py index e820827cf..24073f5ab 100644 --- a/setupsrc/pypdfium2_setup/autorelease.py +++ b/setupsrc/pypdfium2_setup/autorelease.py @@ -22,8 +22,10 @@ def run_local(*args, **kws): def update_refbindings(version): + # We strive to make the reference bindings as universal and robust as possible + # We have symbol guards, so we can define all feature flags, except those that are platform specific, which can't be cross-compiled as they might depend on platform headers. RefBindingsFile.unlink() - build_pdfium_bindings(version, guard_symbols=True, allow_system_despite_libdirs=True) + build_pdfium_bindings(version, guard_symbols=True, flags=["V8", "XFA"], allow_system_despite_libdirs=True) shutil.copyfile(DataDir_Bindings/BindingsFN, RefBindingsFile) assert RefBindingsFile.exists() diff --git a/setupsrc/pypdfium2_setup/packaging_base.py b/setupsrc/pypdfium2_setup/packaging_base.py index 0f2aa05ba..178f3855f 100644 --- a/setupsrc/pypdfium2_setup/packaging_base.py +++ b/setupsrc/pypdfium2_setup/packaging_base.py @@ -422,9 +422,7 @@ def build_pdfium_bindings(version, headers_dir=None, **kwargs): # TODO move refbindings handling into run_ctypesgen on behalf of sourcebuild? # quick and dirty patch to allow using the pre-built bindings instead of calling ctypesgen if BindTarget == BindTarget_Ref: - print("Using refbindings as requested by env var.", file=sys.stderr) - if kwargs["flags"]: - print("Warning: default refbindings are not flags-compatible.") + print("Using refbindings as requested by env var. Note that this will bypass all bindings params (e.g. flags). The refbindings try to be as universal as possible, though.", file=sys.stderr) shutil.copyfile(RefBindingsFile, DataDir_Bindings/BindingsFN) ar_record = read_json(AR_RecordFile) write_json(ver_path, dict(version=ar_record["pdfium"], flags=[], run_lds=["."], source="reference"))