void-packages/srcpkgs/qt6-webengine/template

178 lines
5.0 KiB
Bash

# Template file for 'qt6-webengine'
pkgname=qt6-webengine
version=6.4.2
revision=2
build_style=cmake
configure_args="
-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_pdf_v8=ON
-DNinja_EXECUTABLE=$XBPS_WRAPPERDIR/ninja
-DQT_BUILD_EXAMPLES=ON"
hostmakedepends="qt6-base-devel perl pkg-config nodejs python3-html5lib
qt6-declarative-host-tools protobuf gperf flex nss-devel libwebp-devel
qt6-tools icu-devel libevent-devel"
makedepends="qt6-base-devel qt6-declarative-devel pulseaudio-devel
qt6-tools-devel qt6-websockets-devel libflac-devel qt6-svg-devel
alsa-lib-devel libvpx-devel pciutils-devel opus-devel libxslt-devel
libxml2-devel freetype-devel lcms2-devel libwebp-devel icu-devel
re2-devel zlib-devel libpng-devel minizip-devel harfbuzz-devel cups-devel
nss-devel libXcursor-devel libXcomposite-devel libXScrnSaver-devel
protobuf-devel ffmpeg-devel snappy-devel libevent-devel pipewire-devel
libxkbfile-devel qt6-location-devel qt6-webchannel-devel libxshmfence-devel"
# Not working properly with HTTPS without those packages
# Not strict dependencies, though
depends="qt6-plugin-tls-openssl qt6-plugin-tls-qcertonly"
short_desc="Cross-platform application and UI framework - Webengine"
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=ffa945518d1cc8d9ee73523e8d9c2090844f5a2d9c7eac05c4ad079472a119c9
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
broken="webengine can be built only if word size matches"
fi
if [ "$XBPS_WORDSIZE" = 32 ]; then
CFLAGS=-g1
CXXFLAGS=-g1
LDFLAGS="-Wl,--no-keep-memory"
broken="nodejs compress js files failure"
fi
case "$XBPS_TARGET_MACHINE" in
ppc*) broken="not ported" ;;
esac
#build_options="examples"
#build_options_default="examples"
#desc_option_examples="Build examples"
subpackages="qt6-webengine-devel"
#if [ "$build_option_examples" ]; then
subpackages+=" qt6-webengine-examples"
#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() {
_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
}
qt6-webengine-devel_package() {
depends="${sourcepkg}>=${version}_${revision} qt6-webchannel-devel>=${version}_1
qt6-declarative-devel>=${version}_1 qt6-location-devel>=${version}_1"
short_desc+=" - development files"
pkg_install() {
vmove usr/include
vmove usr/lib/cmake
vmove usr/lib/pkgconfig
vmove usr/lib/qt6/mkspecs
vmove "usr/lib/*.so"
vmove "usr/lib/*.prl"
vmove usr/share/qt6/modules
}
}
qt6-webengine-examples_package() {
short_desc+=" - sample browsers"
depends="qt6-svg"
pkg_install() {
vmove usr/lib/qt6/examples
}
}