diff --git a/common/shlibs b/common/shlibs index 32d7b9301cfd59..d4a6f5edb6d425 100644 --- a/common/shlibs +++ b/common/shlibs @@ -4537,6 +4537,7 @@ libomemo-c.so.0 libomemo-c-0.5.1_1 libclapper-gtk-0.0.so.0 clapper-libs-0.8.0_1 libclapper-0.0.so.0 clapper-libs-0.8.0_1 libopenxr_loader.so.1 openxr-1.1.47_1 +libpdfium.so.1 libpdfium-7659_1 libppsdocument-4.0.so.5 libpapers-48.3_1 libppsshell-4.0.so.4 libpapers-48.3_1 libppsview-4.0.so.4 libpapers-48.3_1 diff --git a/srcpkgs/libpdfium-devel b/srcpkgs/libpdfium-devel new file mode 120000 index 00000000000000..793badd0d9e2d3 --- /dev/null +++ b/srcpkgs/libpdfium-devel @@ -0,0 +1 @@ +libpdfium \ No newline at end of file diff --git a/srcpkgs/libpdfium/template b/srcpkgs/libpdfium/template new file mode 100644 index 00000000000000..325f8b97726009 --- /dev/null +++ b/srcpkgs/libpdfium/template @@ -0,0 +1,164 @@ +# Template file for 'libpdfium' +pkgname=libpdfium +version=7659 +revision=1 +_commit_pdfium="1c78362d2fd58803037befd37e5649fef3b3dcdc" +_commit_build="967506e40f93df1d46f0ded7c12c0cd7a58f01f7" +_commit_buildtools="6a18683f555b4ac8b05ac8395c29c84483ac9588" +_release_fast_float="8.2.2" +hostmakedepends="python3 ninja gn pkg-config tar" +makedepends="libjpeg-turbo-devel icu-devel libopenjpeg2-devel freetype-devel + glib-devel abseil-cpp-devel lcms2-devel libpng-devel zlib-devel" +short_desc="Google PDF rendering library" +maintainer="Mateusz Sylwestrzak " +license="Apache-2.0" +homepage="https://pdfium.googlesource.com/pdfium" +distfiles=" + https://pdfium.googlesource.com/pdfium/+archive/${_commit_pdfium}.tar.gz>pdfium-${version}.tar.gz + https://chromium.googlesource.com/chromium/src/build/+archive/${_commit_build}.tar.gz>build-${version}.tar.gz + https://chromium.googlesource.com/chromium/src/buildtools/+archive/${_commit_buildtools}.tar.gz>buildtools-${version}.tar.gz + https://github.com/fastfloat/fast_float/archive/refs/tags/v${_release_fast_float}.tar.gz>fast_float.tar.gz" +checksum="@a95045e880ba851d1601030c5d3ea7bab440984dbd0532b26e66216c8d573ef2 + @c0b0c894d912ec777e87b7e3184bc34d5c9125965daf662a6eaba1ca65ea0b94 + @93dc381113745090ab300e90acbbc6cc6b3d055b80f6020791f78ae3042f6dbb + e64b5fff88e04959154adbd5fb83331d91f2e04ac06454671cdfcbdff172b158" +skip_extraction="build-${version}.tar.gz buildtools-${version}.tar.gz fast_float.tar.gz" + +post_extract() { + mkdir -p build buildtools third_party/fast_float/src \ + third_party/icu third_party/abseil-cpp + + local _dist="${XBPS_SRCDISTDIR}/${pkgname}-${version}" + tar -xf "${_dist}/build-${version}.tar.gz" -C build + tar -xf "${_dist}/buildtools-${version}.tar.gz" -C buildtools + tar -xf "${_dist}/fast_float.tar.gz" -C third_party/fast_float/src --strip-components=1 + + # Mock testing targets to satisfy internal dependencies + rm -f testing/BUILD.gn + for g in pdfium_test path_service embedder_test_support unit_test_support test_support pixel_diff_utils; do + echo "group(\"$g\") {}" >> testing/BUILD.gn + done + + cat > build/config/gclient_args.gni <<-EOF + checkout_google_benchmark = false + checkout_nacl = false + EOF + + cat > build_overrides/build.gni <<-EOF + build_with_chromium = false + use_system_libcxx = true + EOF + + # System shim for ICU + cat > third_party/icu/BUILD.gn <<-EOF + import("//build/config/linux/pkg_config.gni") + pkg_config("icu_config") { packages = [ "icu-uc", "icu-i18n" ] } + group("icuuc") { public_configs = [ ":icu_config" ] } + group("icui18n") { public_configs = [ ":icu_config" ] } +EOF + + # System shim for Abseil + cat > third_party/abseil-cpp/BUILD.gn <<-EOF + import("//build/config/linux/pkg_config.gni") + pkg_config("absl_config") { + packages = [ + "absl_base", "absl_int128", "absl_strings", "absl_hash", + "absl_synchronization", "absl_raw_hash_set", + "absl_low_level_hash", "absl_raw_logging_internal" + ] + } + group("absl") { public_configs = [ ":absl_config" ] } +EOF +} + +post_patch() { + # Transform internal paths to system-wide include style + find core -type f \( -name "*.cpp" -o -name "*.h" \) -exec sed -i \ + -e 's|#include "third_party/abseil-cpp/\(.*\)"|#include <\1>|g' \ + -e 's|#include "third_party/icu/source/common/\(.*\)"|#include <\1>|g' \ + -e 's|#include "third_party/icu/source/i18n/\(.*\)"|#include <\1>|g' {} + + + # Strip ARM64-specific strictness that breaks build for this arch + vsed -i build/config/compiler/BUILD.gn \ + -e 's/-Wl,--fatal-warnings/-Wl,--no-fatal-warnings/g' + + # Map build-system toolchain to XBPS environment + vsed -i build/toolchain/linux/BUILD.gn \ + -e '/toolprefix =/d' \ + -e "s|cc = \".*gcc\"|cc = \"${CC}\"|g" \ + -e "s|cxx = \".*g++\"|cxx = \"${CXX}\"|g" \ + -e "s|ar = \".*ar\"|ar = \"${AR}\"|g" \ + -e "s|nm = \".*nm\"|nm = \"${NM}\"|g" \ + -e "s|readelf = \".*readelf\"|readelf = \"${READELF}\"|g" + + vsed -i build/config/compiler/BUILD.gn \ + -e '1i declare_args() { extra_cflags="" extra_cppflags="" extra_ldflags="" }' +} + +do_configure() { + case "$XBPS_TARGET_MACHINE" in + aarch64*) _cpu=arm64 ;; + arm*) _cpu=arm ;; + mips64*) _cpu=mips64 ;; + mips*) _cpu=mips ;; + ppc*) _cpu=ppc ;; + i686*) _cpu=x86 ;; + x86_64*) _cpu=x64 ;; + esac + + # Enforce global flags for all arches + local _extra_cflags="${CFLAGS} -Wno-free-nonheap-object" + local _extra_cppflags="${CXXFLAGS} -Wno-free-nonheap-object" + local _extra_ldflags="${LDFLAGS} -Wl,-soname,libpdfium.so.1 -Wl,--no-fatal-warnings" + + gn gen out/Release --args=" + target_cpu=\"${_cpu}\" is_debug=false is_component_build=true + pdf_is_standalone=true pdf_enable_v8=false pdf_enable_xfa=false pdf_use_skia=false + use_custom_libcxx=false use_sysroot=false + is_clang=false treat_warnings_as_errors=false symbol_level=0 + use_system_zlib=true + use_system_libpng=true + use_system_libjpeg=true + use_system_libopenjpeg2=true + use_system_lcms2=true + use_system_freetype=true + use_system_icu=true + pdf_bundle_freetype=false + extra_cflags=\"${_extra_cflags}\" + extra_cppflags=\"${_extra_cppflags}\" + extra_ldflags=\"${_extra_ldflags}\"" +} + +do_build() { + ninja -C out/Release pdfium +} + +do_install() { + vinstall out/Release/libpdfium.so 755 usr/lib libpdfium.so.1 + ln -sf libpdfium.so.1 ${DESTDIR}/usr/lib/libpdfium.so + vmkdir usr/include/pdfium + vcopy "public/*.h" usr/include/pdfium + + vmkdir usr/lib/pkgconfig + cat > "${DESTDIR}/usr/lib/pkgconfig/pdfium.pc" <<-EOF + prefix=/usr + exec_prefix=\${prefix} + libdir=\${exec_prefix}/lib + includedir=\${prefix}/include/pdfium + Name: pdfium + Description: Google PDFium rendering library + Version: ${version} + Libs: -L\${libdir} -lpdfium + Cflags: -I\${includedir} +EOF +} + +libpdfium-devel_package() { + short_desc+=" - development files" + depends="${sourcepkg}>=${version}_${revision}" + pkg_install() { + vmove "usr/lib/*.so" + vmove usr/include + vmove usr/lib/pkgconfig + } +} diff --git a/srcpkgs/python3-fpdf2/template b/srcpkgs/python3-fpdf2/template new file mode 100644 index 00000000000000..ad95013650be33 --- /dev/null +++ b/srcpkgs/python3-fpdf2/template @@ -0,0 +1,13 @@ +# Template file for 'python3-fpdf2' +pkgname=python3-fpdf2 +version=2.8.5 +revision=1 +build_style=python3-pep517 +hostmakedepends="python3-setuptools_scm python3-wheel fonttools" +depends="python3-defusedxml python3-Pillow fonttools" +short_desc="Simple PDF generation for Python" +maintainer="Mateusz Sylwestrzak " +license="LGPL-3.0-only" +homepage="https://github.com/py-pdf/fpdf2" +distfiles="${PYPI_SITE}/f/fpdf2/fpdf2-${version}.tar.gz" +checksum=af4491ef2e0a5fe476f9d61362925658949c995f7e804438c0e81008f1550247 diff --git a/srcpkgs/python3-ocrmypdf/template b/srcpkgs/python3-ocrmypdf/template index 0ebcadb0bdcb87..b66c7c04fd66a3 100644 --- a/srcpkgs/python3-ocrmypdf/template +++ b/srcpkgs/python3-ocrmypdf/template @@ -1,15 +1,22 @@ # Template file for 'python3-ocrmypdf' pkgname=python3-ocrmypdf -version=16.13.0 +version=17.1.0 revision=1 build_style=python3-pep517 hostmakedepends="hatchling hatch-vcs" depends="python3-deprecation img2pdf python3-packaging python3-pdfminer.six python3-pikepdf python3-Pillow python3-pluggy python3-reportlab python3-rich - python3-pillow_heif tesseract-ocr ghostscript unpaper pngquant jbig2enc qpdf" + python3-pillow_heif tesseract-ocr ghostscript unpaper pngquant jbig2enc qpdf + python3-fpdf2 python3-pydantic python3-pypdfium2 python3-uharfbuzz" short_desc="Add OCR text layer to scanned PDF files" maintainer="Mateusz Sylwestrzak " license="MPL-2.0" homepage="https://github.com/ocrmypdf/OCRmyPDF" +changelog="https://raw.githubusercontent.com/ocrmypdf/OCRmyPDF/main/docs/release_notes.md" distfiles="${PYPI_SITE}/o/ocrmypdf/ocrmypdf-${version}.tar.gz" -checksum=29d37e915234ce717374863a9cc5dd32d29e063dfe60c51380dda71254c88248 +checksum=de28346e5007366c4a4d3aa0d40224300e6c81d9d360f07dcae208ac980be79f + +post_install() { + vcompletion misc/completion/ocrmypdf.bash bash ocrmypdf + vcompletion misc/completion/ocrmypdf.fish fish ocrmypdf +} diff --git a/srcpkgs/python3-pypdfium2/template b/srcpkgs/python3-pypdfium2/template new file mode 100644 index 00000000000000..4ced99850334a0 --- /dev/null +++ b/srcpkgs/python3-pypdfium2/template @@ -0,0 +1,62 @@ +# Template file for 'python3-pypdfium2' +pkgname=python3-pypdfium2 +version=5.4.0 +revision=1 +build_style=python3-pep517 +build_wrksrc="pypdfium2-${version}" +hostmakedepends="python3-setuptools_scm python3-wheel python3-packaging tar pkg-config gcc" +makedepends="python3-devel libpdfium-devel" +depends="python3 libpdfium" +short_desc="Python bindings to PDFium" +maintainer="Mateusz Sylwestrzak " +license="Apache-2.0 OR BSD-3-Clause OR CC-BY-4.0 OR LGPL-3.0-or-later OR MIT OR MPL-2.0" +homepage="https://github.com/pypdfium2-team/pypdfium2" +_ctypesgen_commit="b561360fad763b4a64e2d8ef8f7ddf354670dbb7" # use pypdfium2's own fork of ctypesgen +distfiles="${PYPI_SITE}/p/pypdfium2/pypdfium2-${version}.tar.gz + https://github.com/pypdfium2-team/ctypesgen/archive/${_ctypesgen_commit}.tar.gz>ctypesgen-${_ctypesgen_commit}.tar.gz" +checksum="7219e55048fb3999fc8adcaea467088507207df4676ff9e521a3ae15a67d99c4 + 5ae14b36da396d3bea23e41f615c12349697be63144fc840f29336e50ab94406" +create_wrksrc=yes + +post_extract() { + mv "ctypesgen-${_ctypesgen_commit}" "ctypesgen_fork" +} + +pre_build() { + export SETUPTOOLS_SCM_PRETEND_VERSION="${version}" + export PDFIUM_PLATFORM="sourcebuild" + + _data_dir="data/sourcebuild" + mkdir -p "${_data_dir}" + + _prefix="${XBPS_CROSS_BASE}/usr" + _header_dir="${_prefix}/include/pdfium" + + _headers=$(find "${_header_dir}" -maxdepth 1 -name "*.h" | sort) + + _pdfium_ver=$(pkg-config --modversion pdfium) + + cat > "${_data_dir}/version.json" <<-EOF + {"major":0,"minor":0,"build":${_pdfium_ver},"patch":0,"origin":"sourcebuild","flags":[],"n_commits":0,"hash":"","is_reproducible":true} + EOF + + PYTHONPATH="../ctypesgen_fork/src" python3 -m ctypesgen \ + --library pdfium --no-srcinfo \ + --headers ${_headers} \ + --cpp "${CC} -E ${CFLAGS} ${CPPFLAGS}" \ + -I "${_header_dir}" \ + -I "${_prefix}/include" \ + -I "$(${CC} -print-file-name=include)" \ + -D "FPDF_EXPORT=" -D "FPDF_CALLCONV=" -D "__linux__" \ + -o "${_data_dir}/bindings.py" + + # Runtime fix: ensure it loads the specific SO version + sed -i "s|name = 'pdfium'|name = 'libpdfium.so.1'|g" "${_data_dir}/bindings.py" + + sed -i '/ctypesgen/d' pyproject.toml +} + +post_install() { + vlicense LICENSES/BSD-3-Clause.txt + vlicense LICENSES/MIT.txt +} diff --git a/srcpkgs/python3-uharfbuzz/template b/srcpkgs/python3-uharfbuzz/template new file mode 100644 index 00000000000000..42600875170692 --- /dev/null +++ b/srcpkgs/python3-uharfbuzz/template @@ -0,0 +1,14 @@ +# Template file for 'python3-uharfbuzz' +pkgname=python3-uharfbuzz +version=0.53.2 +revision=1 +build_style=python3-pep517 +hostmakedepends="python3-setuptools_scm python3-wheel python3-Cython python3-pkgconfig" +makedepends="python3-devel" +depends="python3" +short_desc="Streamlined Cython bindings for the harfbuzz shaping engine" +maintainer="Mateusz Sylwestrzak " +license="Apache-2.0" +homepage="https://github.com/harfbuzz/uharfbuzz" +distfiles="${PYPI_SITE}/u/uharfbuzz/uharfbuzz-${version}.tar.gz" +checksum=5151cbd986f080bbd2f4d531dbe9a03fb179cefb0fd864ba351aa522e58c9e23