Skip to content

Commit

Permalink
refbindings: define feature flags
Browse files Browse the repository at this point in the history
  • Loading branch information
mara004 committed Nov 21, 2023
1 parent 136a655 commit ddc8abc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 3 additions & 1 deletion setupsrc/pypdfium2_setup/autorelease.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
4 changes: 1 addition & 3 deletions setupsrc/pypdfium2_setup/packaging_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down

0 comments on commit ddc8abc

Please sign in to comment.