From nobody Mon Apr 6 17:55:55 2026 X-Original-To: dev-commits-ports-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4fqH7H6TQ1z6YS0q for ; Mon, 06 Apr 2026 17:55:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R12" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4fqH7H1FlCz3Jc5 for ; Mon, 06 Apr 2026 17:55:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1775498155; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=UsY4QKbBXtdLozNwXH+zNs3zbvD6fsd95OR/tcNPMVU=; b=dFr8BWievRUg0dTwWZEG4zRQq8ewxVuBWI/DKAu4DMULy5fNtnBWIb4klElaQun4MpLf68 vpkkXsL8bFRx2btzWiTX3wOKNaMfzGYtU6i7lBJ11U3Om3vVdfkF0kN37yzoJQqd9b9G8D jEx1RGLYGXskDXMdFDHV3uAAmN2DyPzXWEHkVqHJ2Yb+O1FFWR4sjxz34vqzQ5Tz9wwaJ+ uovlZowlH3wAqMuNUtlPVWno/jj4Et5Zd5mU80yjxiFg1d/GOh1t6HdRibvrh5GM9/XeO1 LblaiUQnfCqdSiKd3Um8l2V55GK1BJstlZuFwxpMojr/BoovvULn9Tt4xz99vQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1775498155; a=rsa-sha256; cv=none; b=i0Cb7i8JdcgHlhxgTgrXd4g99l472xBeLJqWyJUQDMt1BQKEM0v7ZeW0er0erd9KQJuKOQ 5UID+MOpRjObIQPyRjb9crruJjMZ+nrJqxw39rfD+5QpMRKi/32JLK11Tbo/OCgdktKKru 5Ee3Vo2w0jkLFbR1DbouoTuQqxLRY7hQi+HmklHx9K62oZyD2ez1Lbqt5sF6h8uOWQR1mK BjX79xkM3gwidY/hfcJ1xDAqE8whxWhyRfnFZKyHW8/lsoNrzXYwMP64cTbv/jlFxBFnUe gz7gi8UJ5s5TfFoRdsCVRJQeia0fQF/wnohhnElYppfixeuVoYh+sz7LssjAaA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1775498155; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=UsY4QKbBXtdLozNwXH+zNs3zbvD6fsd95OR/tcNPMVU=; b=XjErj5gsXglysiZUaHyb7zb37n70W0N3G5YnIEknOwcvBQvtjooEIBFGaVXo4x3VKqr0SZ hX09YSjg9/yDze5RniYLNw67/FDWXLJfQcBnT+tYfPG98eViqgcrUJHhDc7XgLFparYIsi qL7Amky4Pj4DbIMVIjyp7N+0wQlnejfc7XFXqhJnQzGECZH32sl/psFMFSqcP95eRH6rD3 xtKd/rGw+LXuosV8WLlW4BuW8JLe9/gYYRUUjf13n3nwqJWrE+zf312CfuBJV59YQUuNwq y27UGkYMdGy5W3VWHYLqNCqz5br+bZUisSJYC8b4bbTqj3cApqXissy1+QVo6w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4fqH7H0XyYz13p6 for ; Mon, 06 Apr 2026 17:55:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 22bd0 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 06 Apr 2026 17:55:55 +0000 To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Yuri Victorovich Subject: git: 13d7288f3a7b - main - graphics/py-pypdfium2: New port: Python bindings to the PDFium PDF rendering library List-Id: Commits to the main branch of the FreeBSD ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-ports-main@freebsd.org Sender: owner-dev-commits-ports-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: yuri X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 13d7288f3a7b267748210c1142bf344d21252e4a Auto-Submitted: auto-generated Date: Mon, 06 Apr 2026 17:55:55 +0000 Message-Id: <69d3f3ab.22bd0.912ebdd@gitrepo.freebsd.org> The branch main has been updated by yuri: URL: https://cgit.FreeBSD.org/ports/commit/?id=13d7288f3a7b267748210c1142bf344d21252e4a commit 13d7288f3a7b267748210c1142bf344d21252e4a Author: Yuri Victorovich AuthorDate: 2026-04-06 16:35:46 +0000 Commit: Yuri Victorovich CommitDate: 2026-04-06 17:55:47 +0000 graphics/py-pypdfium2: New port: Python bindings to the PDFium PDF rendering library --- graphics/Makefile | 1 + graphics/py-pypdfium2/Makefile | 38 ++++++++++++++++++ graphics/py-pypdfium2/distinfo | 3 ++ graphics/py-pypdfium2/files/patch-pyproject.toml | 11 ++++++ graphics/py-pypdfium2/files/patch-setupsrc_base.py | 46 ++++++++++++++++++++++ graphics/py-pypdfium2/pkg-descr | 14 +++++++ 6 files changed, 113 insertions(+) diff --git a/graphics/Makefile b/graphics/Makefile index beaadb827af3..599500c6c344 100644 --- a/graphics/Makefile +++ b/graphics/Makefile @@ -1022,6 +1022,7 @@ SUBDIR += py-pymaging-png SUBDIR += py-pyocr SUBDIR += py-pyogrio + SUBDIR += py-pypdfium2 SUBDIR += py-pypillowfight SUBDIR += py-pyproj SUBDIR += py-pyqrcode diff --git a/graphics/py-pypdfium2/Makefile b/graphics/py-pypdfium2/Makefile new file mode 100644 index 000000000000..cc95aff596b8 --- /dev/null +++ b/graphics/py-pypdfium2/Makefile @@ -0,0 +1,38 @@ +PORTNAME= pypdfium2 +PORTVERSION= 5.6.0 +CATEGORIES= graphics python +MASTER_SITES= PYPI +PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} + +MAINTAINER= yuri@FreeBSD.org +COMMENT= Python bindings to the PDFium PDF rendering library +WWW= https://github.com/pypdfium2-team/pypdfium2 + +LICENSE= APACHE20 BSD3CLAUSE MIT +LICENSE_COMB= multi +LICENSE_FILE_APACHE20= ${WRKSRC}/LICENSES/Apache-2.0.txt +LICENSE_FILE_BSD3CLAUSE= ${WRKSRC}/LICENSES/BSD-3-Clause.txt +LICENSE_FILE_MIT= ${WRKSRC}/LICENSES/MIT.txt + +BUILD_DEPENDS= ${LO_PDFIUM}:editors/libreoffice \ + ${PYTHON_PKGNAMEPREFIX}packaging>0:devel/py-packaging@${PY_FLAVOR} \ + ${PYTHON_PKGNAMEPREFIX}setuptools>0:devel/py-setuptools@${PY_FLAVOR} \ + ${PYTHON_PKGNAMEPREFIX}wheel>0:devel/py-wheel@${PY_FLAVOR} +RUN_DEPENDS= ${LO_PDFIUM}:editors/libreoffice + +USES= python +USE_PYTHON= autoplist concurrent pep517 + +# pdfium version bundled with LibreOffice (editors/libreoffice) +PDFIUM_VER= 7471 +PDFIUM_FULL_VER= 143.0.7471.0 +LO_PDFIUM= ${LOCALBASE}/lib/libreoffice/program/libpdfiumlo.so + +# Use pre-generated reference bindings (bundled in the source tree) to avoid +# network access during the build phase. Provide the full pdfium version so +# PdfiumVer.to_full() does not do a git ls-remote to chromium.googlesource.com. +MAKE_ENV= PDFIUM_BINDINGS=reference \ + PDFIUM_PLATFORM=system-search:${PDFIUM_VER} \ + GIVEN_FULLVER=${PDFIUM_FULL_VER} + +.include diff --git a/graphics/py-pypdfium2/distinfo b/graphics/py-pypdfium2/distinfo new file mode 100644 index 000000000000..a152a3adcd69 --- /dev/null +++ b/graphics/py-pypdfium2/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1775414292 +SHA256 (pypdfium2-5.6.0.tar.gz) = bcb9368acfe3547054698abbdae68ba0cbd2d3bda8e8ee437e061deef061976d +SIZE (pypdfium2-5.6.0.tar.gz) = 270714 diff --git a/graphics/py-pypdfium2/files/patch-pyproject.toml b/graphics/py-pypdfium2/files/patch-pyproject.toml new file mode 100644 index 000000000000..aa3b7adadbaf --- /dev/null +++ b/graphics/py-pypdfium2/files/patch-pyproject.toml @@ -0,0 +1,11 @@ +--- pyproject.toml.orig 2026-04-05 21:42:40 UTC ++++ pyproject.toml +@@ -9,7 +9,7 @@ requires = [ + "packaging", + # XXX dependence on wheel is historical, with setuptools >= v70.1.0 this is not needed anymore + "wheel !=0.38.0, !=0.38.1", +- "ctypesgen @ git+https://github.com/pypdfium2-team/ctypesgen@8ab382671a113cb7b9123e1d5ae5a554d4cb52e6", ++ # ctypesgen (pypdfium2 fork) is not required when PDFIUM_BINDINGS=reference + ] + + [tool.cibuildwheel] diff --git a/graphics/py-pypdfium2/files/patch-setupsrc_base.py b/graphics/py-pypdfium2/files/patch-setupsrc_base.py new file mode 100644 index 000000000000..47c4f6d65d68 --- /dev/null +++ b/graphics/py-pypdfium2/files/patch-setupsrc_base.py @@ -0,0 +1,46 @@ +--- setupsrc/base.py.orig 2026-04-05 20:07:20 UTC ++++ setupsrc/base.py +@@ -681,6 +681,7 @@ def run_ctypesgen( + record_ver = PdfiumVer.pinned + if version != record_ver: + log(f"Warning: binary/bindings version mismatch ({version} != {record_ver}). This is ABI-unsafe!") ++ mkdir(target_path.parent) + shutil.copyfile(RefBindingsFile, target_path) + return target_path + +@@ -767,20 +768,21 @@ def build_pdfium_bindings(version, headers_dir=None, * + else: + log(f"Bindings cache state differs:", prev_info, curr_info, sep="\n") + +- # try to reuse headers if only bindings params differ, not version +- if prev_ver == version and headers_dir.exists() and list(headers_dir.glob("fpdf*.h")): +- log("Using cached headers") +- else: +- log("Downloading headers...") +- mkdir(headers_dir) +- archive_url = f"{PdfiumURL}/+archive/refs/heads/chromium/{version}/public.tar.gz" +- archive_path = DataDir_Bindings / "pdfium_public.tar.gz" +- url_request.urlretrieve(archive_url, archive_path) +- with tarfile.open(archive_path) as tar: +- for m in tar.getmembers(): +- if m.isfile() and re.fullmatch(r"fpdf(\w+)\.h", m.name, flags=re.ASCII): +- tar_extract_file(tar, m, headers_dir/m.name) +- archive_path.unlink() ++ if not USE_REFBINDINGS: ++ # try to reuse headers if only bindings params differ, not version ++ if prev_ver == version and headers_dir.exists() and list(headers_dir.glob("fpdf*.h")): ++ log("Using cached headers") ++ else: ++ log("Downloading headers...") ++ mkdir(headers_dir) ++ archive_url = f"{PdfiumURL}/+archive/refs/heads/chromium/{version}/public.tar.gz" ++ archive_path = DataDir_Bindings / "pdfium_public.tar.gz" ++ url_request.urlretrieve(archive_url, archive_path) ++ with tarfile.open(archive_path) as tar: ++ for m in tar.getmembers(): ++ if m.isfile() and re.fullmatch(r"fpdf(\w+)\.h", m.name, flags=re.ASCII): ++ tar_extract_file(tar, m, headers_dir/m.name) ++ archive_path.unlink() + + log(f"Building bindings ...") + bindings_path = DataDir_Bindings/BindingsFN diff --git a/graphics/py-pypdfium2/pkg-descr b/graphics/py-pypdfium2/pkg-descr new file mode 100644 index 000000000000..ad870cc86117 --- /dev/null +++ b/graphics/py-pypdfium2/pkg-descr @@ -0,0 +1,14 @@ +pypdfium2 is a set of Python bindings to PDFium, the open-source PDF +rendering engine developed by Google and used in Chromium. + +It provides a comprehensive API for working with PDF files including: +- Rendering PDF pages to images (Pillow, NumPy arrays, or raw bytes) +- Text extraction with character-level metadata +- Table of contents access +- Form field handling +- PDF attachment access +- Page object model (paths, images, text) + +NOTE: This port uses the PDFium shared library bundled with LibreOffice +(editors/libreoffice). A dedicated graphics/pdfium port is not yet +available in the FreeBSD ports tree.