void-packages/srcpkgs/qt6-pdf/template

248 lines
7.5 KiB
Bash

# Template file for 'qt6-pdf'
pkgname=qt6-pdf
version=6.6.0
revision=3
build_style=cmake
configure_args="-DQT_FEATURE_qtpdf_build=ON
-DQT_FEATURE_qtpdf_widgets_build=ON
-DQT_FEATURE_qtpdf_quick_build=ON
-DNinja_EXECUTABLE=$XBPS_WRAPPERDIR/ninja
-DQT_BUILD_EXAMPLES=ON"
hostmakedepends="qt6-base-devel perl pkg-config nodejs python3-html5lib
qt6-declarative-host-tools gperf bison flex nss-devel"
makedepends="qt6-base-devel qt6-declarative-devel qt6-svg-devel zlib-devel
pciutils-devel opus-devel libxslt-devel libxml2-devel ffmpeg-devel
lcms2-devel libwebp-devel icu-devel re2-devel snappy-devel libevent-devel
libvpx-devel minizip-devel tiff-devel libpng-devel harfbuzz-devel
freetype-devel libjpeg-turbo-devel nss-devel libxshmfence-devel"
depends="qt6-svg"
short_desc="Cross-platform application and UI framework - Pdf"
maintainer="John <me@johnnynator.dev>"
license="GPL-3.0-only, GPL-2.0-only, LGPL-3.0-only, BSD-3-Clause"
homepage="https://www.qt.io"
distfiles="https://download.qt.io/official_releases/qt/${version%.*}/${version}/submodules/qtwebengine-everywhere-src-${version}.tar.xz"
checksum=d5dc9ff05a2c57adbf99cbf0c7cb6f19527f67216caf627b0cc160a1d253b780
if [ "$XBPS_LIBC" = "musl" ]; then
hostmakedepends+=" musl-legacy-compat"
fi
if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
makedepends+=" musl-legacy-compat"
fi
if [ "$XBPS_WORDSIZE" = "$XBPS_TARGET_WORDSIZE" ]; then
configure_args+=" -DQT_FEATURE_pdf_v8=ON"
_have_webengine=yes
else
configure_args+=" -DQT_FEATURE_pdf_v8=OFF"
_have_webengine=no
fi
if [ "$XBPS_WORDSIZE" = 32 ]; then
_have_webengine=no
fi
case "$XBPS_TARGET_MACHINE" in
riscv64*) broken="Patchset needs updating";;
ppc*) broken="not ported" ;;
armv5* | armv6*) broken="need yield" ;;
esac
subpackages="qt6-pdf-devel qt6-pdf-examples"
if [ "$_have_webengine" = yes ]; then
subpackages+=" qt6-webengine qt6-webengine-devel qt6-webengine-examples"
configure_args+="
-DQT_FEATURE_qtwebengine_build=ON
-DQT_FEATURE_qtwebengine_core_build=ON
-DQT_FEATURE_qtwebengine_widgets_build=ON
-DQT_FEATURE_qtwebengine_quick_build=ON
-DQT_FEATURE_webengine_system_ffmpeg=ON
-DQT_FEATURE_webengine_system_libevent=ON
-DQT_FEATURE_webengine_system_gn=ON
-DQT_FEATURE_webengine_system_icu=ON
-DQT_FEATURE_webengine_webrtc_pipewire=ON
-DQT_FEATURE_webengine_embedded_build=OFF
-DQT_FEATURE_webengine_proprietary_codecs=ON"
hostmakedepends+=" protobuf libwebp-devel icu-devel
libevent-devel qt6-tools"
makedepends+=" qt6-webchannel-devel qt6-websockets-devel qt6-tools-devel
qt6-location-devel qt6-webchannel-devel pulseaudio-devel libflac-devel
alsa-lib-devel cups-devel libXcursor-devel libXcomposite-devel
libXScrnSaver-devel protobuf-devel pipewire-devel libxkbfile-devel"
else
configure_args+="
-DQT_FEATURE_qtwebengine_build=OFF
-DQT_FEATURE_qtwebengine_core_build=OFF
-DQT_FEATURE_qtwebengine_widgets_build=OFF
-DQT_FEATURE_qtwebengine_quick_build=OFF"
fi
_bootstrap_gn() {
# Bootstrap gn (generate ninja)
echo "Bootstrapping 'gn'"
cd ${wrksrc}/src/3rdparty/gn
CFLAGS="$CFLAGS_host" CXXFLAGS="$CXXFLAGS_host" LDFLAGS="$LDFLAGS_host" \
PKGCONFIG=/usr/bin/pkgconfig PKG_CONFIG_PATH="/usr/lib/pkgconfig:/usr/share/pkgconfig" \
python3 build/gen.py --no-last-commit-position --out-path \
${wrksrc}/src/3rdparty/gn/out/Release --cc "${CC_host:-$CC}" \
--cxx "${CXX_host:-$CXX}" --ld "${CXX_host:-$CXX}" --ar "${AR_host:-$AR}" \
--qt-version "${version}.qtwebengine.qt.io"
ninja -C out/Release gn
cd ${wrksrc}
}
_unbundle_libs() {
cd ${wrksrc}/src/3rdparty/chromium
echo Dropping bundled libs from chromium
# Use system-provided libraries.
# TODO: use_system_hunspell (upstream changes needed).
# TODO: use_system_libsrtp.
# TODO: use_system_libusb (http://crbug.com/266149).
# TODO: use_system_ssl (http://crbug.com/58087).
# TODO: use_system_sqlite (http://crbug.com/22208).
# TODO: use_system_icu (segfaults)
# use_system_protobuf
# use_system_v8=1
# use_system_zlib=1
# bzip2 jsoncpp minizip xdg_utils speex
system="
ffmpeg
flac
fontconfig
freetype
harfbuzz-ng
icu
libdrm
libevent
libjpeg
libpng
libwebp
libxml
libxslt
opus
re2
snappy
"
build/linux/unbundle/replace_gn_files.py --system-libraries ${system}
}
# Provide a wrapper to run ./xbps-src -j 1 build later
_wrap_ninja() {
cat <<-'_EOF' >"$XBPS_WRAPPERDIR"/ninja
#!/bin/sh
exec /usr/bin/ninja $NINJAFLAGS "$@"
_EOF
chmod +x "$XBPS_WRAPPERDIR"/ninja
}
pre_configure() {
rm src/3rdparty/chromium/third_party/six/src/six.py
rm src/3rdparty/chromium/third_party/catapult/third_party/six/six.py
rm src/3rdparty/chromium/third_party/wpt_tools/wpt/tools/third_party/six/six.py
ln -s ${py3_sitelib}/six.py src/3rdparty/chromium/third_party/six/src/six.py
ln -s ${py3_sitelib}/six.py src/3rdparty/chromium/third_party/catapult/third_party/six/six.py
ln -s ${py3_sitelib}/six.py src/3rdparty/chromium/third_party/wpt_tools/wpt/tools/third_party/six/six.py
_bootstrap_gn
# _unbundle_libs
_wrap_ninja
export PATH="$PATH:${wrksrc}/src/3rdparty/gn/out/Release"
export PKG_CONFIG_HOST=${PKG_CONFIG_FOR_BUILD}
}
pre_build() {
export PATH="$PATH:${wrksrc}/src/3rdparty/gn/out/Release"
export NINJAFLAGS="$makejobs"
}
pre_install() {
export PATH="$PATH:${wrksrc}/src/3rdparty/gn/out/Release"
}
post_install() {
local _file
find "${DESTDIR}"/usr/lib/qt6/examples \
-path '*/lib/qt6/**/lib/qt6/*' -type f |
while read _file; do
mv "$_file" "${_file%/lib/qt6/*}"
done
vlicense src/3rdparty/chromium/third_party/pdfium/LICENSE
}
qt6-pdf-devel_package() {
depends="qt6-pdf>=${version}_${revision} qt6-base-devel
qt6-declarative-devel"
short_desc+=" - development files"
pkg_install() {
vmove "usr/include/qt6/QtPdf*"
# vmove "usr/lib/cmake/Qt6"
# vmove "usr/lib/cmake/Qt6BuildInternals"
vmove "usr/lib/cmake/Qt6Gui/Qt6QPdf*"
vmove "usr/lib/cmake/Qt6Pdf*"
vmove "usr/lib/cmake/Qt6Qml/QmlPlugins/Qt6Pdf*"
vmove "usr/lib/libQt6Pdf*.prl"
vmove "usr/lib/libQt6Pdf*.so"
vmove "usr/lib/pkgconfig/Qt6Pdf*"
vmove "usr/lib/qt6/mkspecs/modules/qt_lib_pdf*"
vmove "usr/lib/qt6/modules/Pdf*"
}
}
qt6-pdf-examples_package() {
short_desc+=" - examples"
pkg_install() {
vmove "usr/lib/qt6/examples/pdf*"
}
}
qt6-webengine_package() {
# Historically, qt6-webengine includes pdf supports
depends="qt6-pdf>=${version}_${revision}
qt6-plugin-tls-openssl qt6-plugin-tls-qcertonly"
short_desc="${short_desc/Pdf/WebEngine}"
pkg_install() {
vmove "usr/lib/libQt6WebEngine*.so.*"
vmove "usr/lib/qt6/libexec"
vmove "usr/lib/qt6/metatypes/qt6webengine*"
vmove "usr/lib/qt6/plugins/designer/libqwebengineview.so"
vmove "usr/lib/qt6/qml/QtWebEngine"
vmove "usr/share/qt6/resources"
vmove "usr/share/qt6/translations/qtwebengine*"
vlicense src/3rdparty/chromium/LICENSE
}
}
qt6-webengine-devel_package() {
depends="qt6-webengine>=${version}_${revision}
qt6-pdf-devel>=${version}_${revision}
qt6-webchannel-devel>=${version}_1
qt6-declarative-devel>=${version}_1
qt6-location-devel>=${version}_1"
short_desc="${short_desc/Pdf/WebEngine - development files}"
pkg_install() {
vmove "usr/include/qt6/QtWebEngine*"
vmove "usr/lib/cmake/Qt6Designer/Qt6QWebEngine*"
vmove "usr/lib/cmake/Qt6Qml/QmlPlugins/Qt6qtwebengine*"
vmove "usr/lib/cmake/Qt6WebEngine*"
vmove "usr/lib/libQt6WebEngine*.prl"
vmove "usr/lib/libQt6WebEngine*.so"
vmove "usr/lib/pkgconfig/Qt6Web*"
vmove "usr/lib/qt6/mkspecs/modules/qt_lib_webengine*"
vmove "usr/lib/qt6/modules/WebEngine*"
}
}
qt6-webengine-examples_package() {
short_desc+=" - sample browsers"
depends="qt6-pdf-examples"
pkg_install() {
vmove "usr/lib/qt6/examples/webengine*"
}
}