Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qt6-pdf: split from webengine, build for 32 bit archs. #47679

Merged
merged 1 commit into from
Dec 12, 2023
Merged
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
6 changes: 3 additions & 3 deletions common/shlibs
Original file line number Diff line number Diff line change
Expand Up @@ -2054,10 +2054,10 @@ libQt6MultimediaQuick.so.6 qt6-multimedia-6.3.1_1
libQt6Multimedia.so.6 qt6-multimedia-6.3.1_1
libQt6SpatialAudio.so.6 qt6-multimedia-6.3.1_1
libQt6WebEngineQuick.so.6 qt6-webengine-6.3.1_1
libQt6PdfWidgets.so.6 qt6-webengine-6.3.1_1
libQt6PdfQuick.so.6 qt6-webengine-6.3.1_1
libQt6PdfWidgets.so.6 qt6-pdf-6.6.0_3
libQt6PdfQuick.so.6 qt6-pdf-6.6.0_3
libQt6Pdf.so.6 qt6-pdf-6.6.0_3
libQt6WebEngineCore.so.6 qt6-webengine-6.3.1_1
libQt6Pdf.so.6 qt6-webengine-6.3.1_1
libQt6WebEngineQuickDelegatesQml.so.6 qt6-webengine-6.3.1_1
libQt6WebEngineWidgets.so.6 qt6-webengine-6.3.1_1
libQt6TextToSpeech.so.6 qt6-speech-6.6.0_1
Expand Down
1 change: 1 addition & 0 deletions srcpkgs/qt6-pdf-devel
1 change: 1 addition & 0 deletions srcpkgs/qt6-pdf-examples
13 changes: 13 additions & 0 deletions srcpkgs/qt6-pdf/patches/0753-chromium-musl-32-bit-fstat.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
--- a/src/3rdparty/chromium/third_party/lss/linux_syscall_support.h
+++ b/src/3rdparty/chromium/third_party/lss/linux_syscall_support.h
@@ -293,6 +293,10 @@ struct kernel_rusage {
long ru_nivcsw;
};

+#ifdef fstatat64
+#undef fstatat64
+#endif
+
#if defined(__i386__) || defined(__ARM_EABI__) || defined(__ARM_ARCH_3__) \
|| defined(__PPC__) || (defined(__s390__) && !defined(__s390x__)) \
|| defined(__e2k__)
34 changes: 34 additions & 0 deletions srcpkgs/qt6-pdf/patches/1000-we-know-what-will-be-supported.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
--- a/src/3rdparty/chromium/BUILD.gn
+++ b/src/3rdparty/chromium/BUILD.gn
@@ -1647,9 +1647,7 @@ if (!is_ios && !is_qtwebengine) {
}

# TODO(cassew): Add more OS's that don't support x86.
-is_valid_x86_target =
- target_os != "ios" && target_os != "mac" &&
- (target_os != "linux" || use_libfuzzer || !build_with_chromium)
+is_valid_x86_target = true

# Note: v8_target_cpu == arm allows using the V8 arm simulator on x86 for fuzzing.
assert(
--- a/src/host/CMakeLists.txt
+++ b/src/host/CMakeLists.txt
@@ -48,18 +48,3 @@ if(QT_FEATURE_qtpdf_build)
DESTINATION ${WEBENGINE_ROOT_BUILD_DIR}/src/pdf/v8_toolchain
)
endif()
-
-# TODO: this could be run as part of main configure with execute_process
-
-if(CMAKE_CXX_COMPILER_ID STREQUAL GNU AND TEST_architecture_arch STREQUAL "x86_64"
-AND GN_TARGET_CPU STREQUAL "arm")
- try_compile(
- has32HostCompiler
- "${CMAKE_CURRENT_BINARY_DIR}/config.tests/hostcompiler"
- "${CMAKE_CURRENT_SOURCE_DIR}/config.tests/hostcompiler"
- hostcompiler
- )
- if(NOT has32HostCompiler)
- MESSAGE(FATAL_ERROR "Compiler does not support 32bit compilation")
- endif()
-endif()
254 changes: 254 additions & 0 deletions srcpkgs/qt6-pdf/template
Original file line number Diff line number Diff line change
@@ -0,0 +1,254 @@
# 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 <[email protected]>"
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*"
# Below items are kept in qt6-webengine
# 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/cmake/Qt6WebEngineCore"
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/qtwebengine*"
vmove "usr/share/qt6/resources/v8*"
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/Qt6WebEngineCore"
# Below item goes to qt6-webengine
# vmove "usr/lib/cmake/Qt6WebEngineCore"
vmove "usr/lib/cmake/Qt6WebEngineQuick*"
vmove "usr/lib/cmake/Qt6WebEngineWidgets*"
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*"
}
}
File renamed without changes.
1 change: 1 addition & 0 deletions srcpkgs/qt6-webengine
2 changes: 1 addition & 1 deletion srcpkgs/qt6-webengine-devel
2 changes: 1 addition & 1 deletion srcpkgs/qt6-webengine-examples
Loading
Loading