Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions srcpkgs/libpdfium-devel
195 changes: 195 additions & 0 deletions srcpkgs/libpdfium/template
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
# Template file for 'libpdfium'
pkgname=libpdfium
version=7651
revision=1
_commit_pdfium="7cc0a4a9213a9d5c13695d0747f56ede53e5df39"
_commit_build="73bc49ded0de5ce2de9fb4e6aa8b1394368ec690"
_commit_buildtools="4dc32b3f510b330137385e2b3a631ca8e13a8e22"
_commit_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"
short_desc="Google PDF rendering library"
maintainer="Mateusz Sylwestrzak <slymattz@gmail.com>"
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${_commit_fast_float}.tar.gz>fast_float.tar.gz"
checksum="@a6f3fb34f5fcc728cc4a4aabbb66b409bf50f648ed529a7e646abddd8752943f
@f41ce5add198758c0a9550a57b59ad6cfeab4e7d291ffef27c3b9c5f1800477a
@f19f859a4da0b8fd98a10fe14f0166ed817071f6c1cb75ec4d4299b0121b51e2
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
tar -xf "${XBPS_SRCDISTDIR}/${pkgname}-${version}/build-${version}.tar.gz" -C build
tar -xf "${XBPS_SRCDISTDIR}/${pkgname}-${version}/buildtools-${version}.tar.gz" -C buildtools
tar -xf "${XBPS_SRCDISTDIR}/${pkgname}-${version}/fast_float.tar.gz" -C third_party/fast_float/src --strip-components=1

# Infrastructure stubs
mkdir -p build/config build_overrides pdf_overrides testing v8 third_party/test_fonts
rm -f testing/BUILD.gn

echo "checkout_google_benchmark = false" > build/config/gclient_args.gni
echo "checkout_nacl = false" >> build/config/gclient_args.gni
echo "build_with_chromium = false" > build_overrides/build.gni
echo "use_system_libcxx = true" >> build_overrides/build.gni

cat > pdf_overrides/build.gni <<-EOF
pdf_is_standalone = true
pdf_enable_v8_override = false
pdf_enable_xfa_override = false
pdf_use_skia_override = false
EOF

for g in pdfium_test path_service embedder_test_support unit_test_support test_support; do
echo "group(\"$g\") {}" >> testing/BUILD.gn
done

echo 'group("test_fonts") {}' > third_party/test_fonts/BUILD.gn
echo 'config("external_startup_data") {}' > v8/BUILD.gn
echo 'group("v8_libplatform") {}' >> v8/BUILD.gn
echo 'group("v8") {}' >> v8/BUILD.gn

# Path hijacking
_incdir="${XBPS_CROSS_BASE}/usr/include"
[ ! -d "${_incdir}" ] && _incdir="/usr/include"

# Create parents
mkdir -p third_party/icu/source/common \
third_party/abseil-cpp \
third_party/zlib \
third_party/libpng \
third_party/libjpeg_turbo \
third_party/lcms2/include \
third_party/libopenjpeg2

# Perform symlinks
# ICU
ln -sf "${_incdir}/unicode" third_party/icu/source/common/

# Abseil
ln -sf "${_incdir}/absl" third_party/abseil-cpp/absl

# Zlib, PNG, JPEG, LCMS2
ln -sf "${_incdir}/zlib.h" "${_incdir}/zconf.h" third_party/zlib/
ln -sf "${_incdir}/png.h" "${_incdir}/pngconf.h" "${_incdir}/pnglibconf.h" third_party/libpng/
ln -sf "${_incdir}/jpeglib.h" "${_incdir}/jerror.h" "${_incdir}/jconfig.h" "${_incdir}/jmorecfg.h" third_party/libjpeg_turbo/
ln -sf "${_incdir}/lcms2.h" "${_incdir}/lcms2_plugin.h" third_party/lcms2/include/

# OpenJPEG
_ojp_inc=$(ls -d ${_incdir}/openjpeg-2.* | head -n1)
ln -sf "${_ojp_inc}/openjpeg.h" third_party/libopenjpeg2/openjpeg.h

# GN Bridge Builders
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

cat > third_party/abseil-cpp/BUILD.gn <<-EOF
config("absl_config") {
include_dirs = [ "." ]
libs = [
"absl_base",
"absl_int128",
"absl_strings",
"absl_hash",
"absl_synchronization",
"absl_raw_hash_set", # THE KEY FIX
"absl_low_level_hash",
"absl_raw_logging_internal"
]
}
group("absl") { public_configs = [ ":absl_config" ] }
EOF

cat > third_party/BUILD.gn <<-EOF
import("//build/config/linux/pkg_config.gni")
pkg_config("s") { packages = [ "zlib", "libpng", "libjpeg", "lcms2", "libopenjp2", "freetype2" ] }
group("zlib") { public_configs = [ ":s" ] }
group("png") { public_configs = [ ":s" ] }
group("jpeg") { public_configs = [ ":s" ] }
group("lcms2") { public_configs = [ ":s" ] }
group("libopenjpeg2") { public_configs = [ ":s" ] }
group("fx_agg") { public_deps = [ "//third_party/agg23" ] }
group("fx_freetype") { public_configs = [ ":s" ] }
EOF

mkdir -p third_party/agg23
cat > third_party/agg23/BUILD.gn <<-EOF
config("c") { include_dirs = [ "." ] }
source_set("agg23") {
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
public_configs = [ ":c" ]
sources = [ "agg_curves.cpp", "agg_curves.h", "agg_path_storage.cpp", "agg_path_storage.h", "agg_rasterizer_scanline_aa.cpp", "agg_rasterizer_scanline_aa.h", "agg_vcgen_dash.cpp", "agg_vcgen_dash.h", "agg_vcgen_stroke.cpp", "agg_vcgen_stroke.h" ]
}
EOF

# Toolchain
sed -i 's|/usr/bin/python|/usr/bin/python3|g' build/toolchain/gcc_toolchain.gni
sed -i 's|toolprefix = ".*"|toolprefix = ""|g' build/toolchain/linux/BUILD.gn
sed -i -e "s|gcc\"|${CC}\"|g" -e "s|g++\"|${CXX}\"|g" -e "s|ar\"|${AR}\"|g" \
-e "s|readelf\"|${READELF}\"|g" -e "s|nm\"|${NM}\"|g" build/toolchain/linux/BUILD.gn
}

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

gn gen out/Release --args="
target_cpu=\"${_cpu}\" target_os=\"linux\" is_debug=false
pdf_enable_v8=false pdf_enable_xfa=false is_component_build=true
pdf_is_standalone=true use_system_libopenjpeg2=true use_custom_libcxx=false
use_sysroot=false is_clang=false clang_use_chrome_plugins=false
treat_warnings_as_errors=false symbol_level=0
extra_cflags=\"${CFLAGS}\" extra_cppflags=\"${CXXFLAGS}\" extra_ldflags=\"${LDFLAGS}\""
}

do_build() {
ninja -C out/Release pdfium
}

do_install() {
vinstall out/Release/libpdfium.so 755 usr/lib

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/include
vmove usr/lib/pkgconfig
}
}
13 changes: 13 additions & 0 deletions srcpkgs/python3-fpdf2/template
Original file line number Diff line number Diff line change
@@ -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 <slymattz@gmail.com>"
license="LGPL-3.0-only"
homepage="https://github.com/py-pdf/fpdf2"
distfiles="${PYPI_SITE}/f/fpdf2/fpdf2-${version}.tar.gz"
checksum=af4491ef2e0a5fe476f9d61362925658949c995f7e804438c0e81008f1550247
7 changes: 4 additions & 3 deletions srcpkgs/python3-ocrmypdf/template
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
# Template file for 'python3-ocrmypdf'
pkgname=python3-ocrmypdf
version=16.13.0
version=17.0.0b1
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 <slymattz@gmail.com>"
license="MPL-2.0"
homepage="https://github.com/ocrmypdf/OCRmyPDF"
distfiles="${PYPI_SITE}/o/ocrmypdf/ocrmypdf-${version}.tar.gz"
checksum=29d37e915234ce717374863a9cc5dd32d29e063dfe60c51380dda71254c88248
checksum=56050e27451b519ded50904e09c0e3b6583ed48c97ba7a4d13a4dbd1a13672f4
60 changes: 60 additions & 0 deletions srcpkgs/python3-pypdfium2/template
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Template file for 'python3-pypdfium2'
pkgname=python3-pypdfium2
version=5.3.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 <slymattz@gmail.com>"
license="Apache-2.0 OR BSD-3-Clause"
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="2873ffc95fcb01f329257ebc64a5fdce44b36447b6b171fe62f7db5dc3269885
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}"

_pdfium_ver=$(pkg-config --modversion pdfium)
_incdir="${XBPS_CROSS_BASE:-}/usr/include"
_header_dir="${_incdir}/pdfium"

[ ! -d "${_header_dir}" ] && _header_dir="/usr/include/pdfium"
[ ! -d "${_incdir}" ] && _incdir="/usr/include"

_headers=$(find "${_header_dir}" -maxdepth 1 -name "*.h" | sort)

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 "${_incdir}" -I "$(${CC} -print-file-name=include)" \
-D "FPDF_EXPORT=" -D "FPDF_CALLCONV=" -D "__linux__" \
-o "${_data_dir}/bindings.py"

ln -sf "${XBPS_CROSS_BASE}/usr/lib/libpdfium.so" "${_data_dir}/libpdfium.so"

sed -i '/ctypesgen/d' pyproject.toml
}

post_install() {
vlicense MANIFEST.in
}
14 changes: 14 additions & 0 deletions srcpkgs/python3-uharfbuzz/template
Original file line number Diff line number Diff line change
@@ -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 <slymattz@gmail.com>"
license="Apache-2.0"
homepage="https://github.com/harfbuzz/uharfbuzz"
distfiles="${PYPI_SITE}/u/uharfbuzz/uharfbuzz-${version}.tar.gz"
checksum=5151cbd986f080bbd2f4d531dbe9a03fb179cefb0fd864ba351aa522e58c9e23