void-packages/srcpkgs/qt5-webengine/template

205 lines
7.5 KiB
Bash

# Template file for 'qt5-webengine'
pkgname=qt5-webengine
version=5.15.4
revision=1
_commit=0d4ca9cfb0d6e538172005e1c4b0b3a021b1c18c
_chromium_commit=3f594ea1afb8b18c864715a796ef21099d432a13
archs="x86_64* i686* armv[67]* ppc64* aarch64*"
wrksrc="qtwebengine-${_commit}"
build_style=qmake
configure_args="--
-webengine-icu -webengine-ffmpeg -webengine-opus -webengine-webp
-webengine-pepper-plugins -webengine-printing-and-pdf -webengine-proprietary-codecs
-webengine-pulseaudio -webengine-spellchecker -webengine-webrtc -webengine-geolocation
-webengine-kerberos -no-webengine-embedded-build $(vopt_if sndio '' '-no')-webengine-sndio
$(vopt_if pipewire '' '-no')-webengine-webrtc-pipewire"
# Rely on auto detection (fails if forced for cross builds) -webengine-alsa
hostmakedepends="qt5-qmake gperf ninja qt5-host-tools flex pkg-config nodejs
which perl python protobuf nss-devel libevent-devel zlib-devel icu-devel
libjpeg-turbo-devel libpng-devel libwebp-devel freetype-devel
harfbuzz-devel"
makedepends="qt5-webchannel-devel qt5-location-devel qt5-tools-devel qt5-devel
qt5-declarative-devel libevent-devel snappy-devel icu-devel ffmpeg-devel
libwebp-devel opus-devel cups-devel nss-devel minizip-devel libxslt-devel
libvpx-devel re2-devel libXtst-devel libXcursor-devel libXcomposite-devel
jsoncpp-devel harfbuzz-devel lcms2-devel protobuf-devel pulseaudio-devel
libXrandr-devel MesaLib-devel mit-krb5-devel alsa-lib-devel libxkbcommon-devel
$(vopt_if sndio sndio-devel) $(vopt_if pipewire libpipewire0.2-devel)"
short_desc="Cross-platform application and UI framework (QT5) - WebEngine component"
maintainer="John <me@johnnynator.dev>"
license="GPL-3.0-or-later, LGPL-3.0-or-later"
homepage="https://qt.io/"
distfiles="https://github.com/qt/qtwebengine/archive/${_commit}.tar.gz
https://github.com/qt/qtwebengine-chromium/archive/${_chromium_commit}.tar.gz"
checksum="cea995e14c599c0c46b53b9938fd16f2360b639bf77e88a28ea26f518bb7b578
fa0cab27cc32284f5af227a3dabde05ed6755f06641db6a6ca1c66848b10f715"
patch_args="-Np1"
no_generic_pkgconfig_link=yes
build_options="sndio pipewire"
build_options_default="pipewire"
desc_option_pipewire="Enable support for screen sharing for WebRTC via PipeWire"
if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
makedepends+=" musl-legacy-compat"
fi
if [ "$XBPS_LIBC" = "musl" ]; then
hostmakedepends+=" musl-legacy-compat"
fi
if [ "$XBPS_WORDSIZE" -eq 32 ]; then
nodebug=yes # prevent OOM
fi
if [ ! "$XBPS_WORDSIZE" = "$XBPS_TARGET_WORDSIZE" ]; then
broken="webengine can be built only if word size matches"
fi
if [ "$XBPS_TARGET_ENDIAN" != "le" ]; then
broken="webengine only supports little endian"
fi
if [ "$XBPS_NO_ATOMIC8" ]; then
hostmakedepends+=" libatomic-devel"
fi
# ppc64 still needs libatomic here, as does s390x but we don't have that
case "$XBPS_MACHINE" in
ppc64*) hostmakedepends+=" libatomic-devel"
esac
if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
makedepends+=" libatomic-devel"
LDFLAGS+=" -latomic"
fi
case "$XBPS_TARGET_MACHINE" in
ppc64*) makedepends+=" libatomic-devel" ;;
esac
case "$XBPS_TARGET_MACHINE" in
ppc64*-musl) makedepends+=" libucontext-devel" ;;
esac
_bootstrap_gn() {
local opts
# 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" \
python2 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}" $opts
ninja -C out/Release gn
cd ${wrksrc}
}
_cleanup_wrksrc_leak() {
if [ -d "${PKGDESTDIR}/usr/lib/cmake" ]; then
# Replace references to ${wrksrc} in cmake files
vsed -i ${PKGDESTDIR}/usr/lib/cmake/*/*.cmake \
-e "s;${wrksrc}/host;/usr/lib/qt5;g" \
-e "s;devices/void-${XBPS_CROSS_TRIPLET}-g++;linux-g++;g"
fi
if [ -d "${PKGDESTDIR}/usr/lib/pkgconfig" ]; then
# Replace references to ${wrksrc} in pkgconfig files
vsed -i ${PKGDESTDIR}/usr/lib/pkgconfig/*.pc \
-e "s;${wrksrc}/host;/usr/lib/qt5;g" \
-e "s;devices/void-${XBPS_CROSS_TRIPLET}-g++;linux-g++;g"
fi
# Remove QMAKE_PRL_BUILD_DIR from hint files for static libraries
# and replace references to ${wrksrc}
find ${PKGDESTDIR} -iname "*.prl" -exec sed -i "{}" \
-e "/^QMAKE_PRL_BUILD_DIR/d" \
-e "s;-L${wrksrc}/qtbase/lib;-L/usr/lib;g" \;
# Replace ${wrksrc} in project include files
find ${PKGDESTDIR} -iname "*.pri" -exec sed -i "{}" \
-e "s;${wrksrc}/qtbase;/usr/lib/qt5;g" \;
}
post_extract() {
rmdir ${wrksrc}/src/3rdparty
mv -v ${wrksrc}/../qtwebengine-chromium-${_chromium_commit} ${wrksrc}/src/3rdparty
# ¯\_(ツ)_/¯
mkdir -p ${wrksrc}/.git ${wrksrc}/src/3rdparty/chromium/.git
}
post_patch() {
mkdir -p ${wrksrc}/src/3rdparty/chromium/media/audio/{sndio,openbsd}
cp ${FILESDIR}/sndio-files/sndio_*put.* \
${wrksrc}/src/3rdparty/chromium/media/audio/sndio
cp ${FILESDIR}/sndio-files/audio_manager_openbsd.* \
${wrksrc}/src/3rdparty/chromium/media/audio/openbsd
# Eternal 5.15.2, this can't ever be increased since other components are 5.15.2
sed -e "/^MODULE_VERSION/s/5.*/5.15.2/" -i .qmake.conf
# enable libucontext on ppc with musl for breakpad
case "$XBPS_TARGET_MACHINE" in
ppc64*-musl)
vsed -i 's,#libs +=,libs +=,' \
${wrksrc}/src/3rdparty/chromium/third_party/breakpad/BUILD.gn
;;
esac
}
pre_configure() {
cp ${FILESDIR}/resolv_compat.h ${wrksrc}/src/3rdparty/chromium/net/dns
case "$XBPS_TARGET_MACHINE" in
armv5*|armv6*) # Disable "yield" assembler instruction
vsed -i src/3rdparty/chromium/base/allocator/partition_allocator/spin_lock.cc \
src/3rdparty/chromium/third_party/pdfium/third_party/base/allocator/partition_allocator/spin_lock.cc \
-e 's;"yield";"nop";'
;;
esac
case "$XBPS_TARGET_MACHINE" in
*-musl) export CXXFLAGS+=" -D_POSIX_THREAD_ATTR_STACKSIZE=2097152";;
esac
case "$XBPS_TARGET_MACHINE" in
mips*) # sgidefs.h is in /usr/include/asm
for f in \
qtwebengine/src/3rdparty/chromium/third_party/lss/linux_syscall_support.h \
qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/common/android/include/asm-mips/fpregdef.h \
qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/common/android/include/asm-mips/regdef.h \
qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/common/android/include/asm-mips/asm.h \
qtwebengine/src/3rdparty/chromium/third_party/tcmalloc/vendor/src/base/linux_syscall_support.h \
qtwebengine/src/3rdparty/chromium/third_party/tcmalloc/chromium/src/base/linux_syscall_support.h \
qtscript/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h; do
vsed -i $f -e "s;<sgidefs.h>;<asm/sgidefs.h>;"
done
# Assume that RGBA order is correct for big endian CPUs
vsed -i qtwebengine/src/3rdparty/chromium/skia/config/SkUserConfig.h \
-e '/#error Read the comment at this location/d'
;;
esac
_bootstrap_gn
}
pre_build() {
export NINJAJOBS=${makejobs}
# Qt used to preped ulimit in front of $$QMAKE_LINK
# but they do not do this anymore if ccache is in use
ulimit -n 4096
}
qt5-webengine-devel_package() {
depends="qt5-devel>=5.15.2_1 ${sourcepkg}>=${version}_${revision}"
short_desc+=" - development files"
pkg_install() {
vmove usr/include
vmove usr/lib/cmake
vmove usr/lib/pkgconfig
vmove usr/lib/qt5/mkspecs
#TODO: FIX!!!
if [ -z "$CROSS_BUILD" ]; then
vmove usr/lib/qt5/plugins/designer
fi
vmove "usr/lib/*.so"
vmove "usr/lib/*.prl"
vmove "usr/lib/*.la"
_cleanup_wrksrc_leak
}
}