void-packages/srcpkgs/qt5-webengine/template
2020-07-08 16:18:33 +02:00

189 lines
6.7 KiB
Bash

# Template file for 'qt5-webengine'
pkgname=qt5-webengine
version=5.15.0
revision=1
archs="x86_64* i686* armv[67]* ppc64* aarch64*"
wrksrc="qtwebengine-everywhere-src-${version}"
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
$(vopt_if sndio '-sndio') -webengine-kerberos"
# Rely on auto detection (fails if forced for cross builds) -webengine-alsa
hostmakedepends="qt5-qmake gperf ninja qt5-host-tools flex pkg-config
which perl python protobuf"
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 $(vopt_if sndio sndio-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="http://download.qt.io/official_releases/qt/${version%.*}/${version}/submodules/qtwebengine-everywhere-src-${version}.tar.xz"
checksum=c38e2fda7ed1b7d5a90f26abf231ec0715d78a5bc39a94673d8e39d75f04c5df
patch_args="-Np1"
build_options="sndio"
if [ "$CROSS_BUILD" ]; then
hostmakedepends+=" nss-devel libevent-devel qt5-location-devel
qt5-declarative-devel"
fi
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"
fi
case "$XBPS_TARGET_MACHINE" in
ppc64*) makedepends+=" libatomic-devel"
esac
case "$XBPS_TARGET_MACHINE" in
armv7l*) broken="ERROR at //skia/BUILD.gn:707:11: Undefined identifier.";;
# configs -= [ "//build/config/compiler:compiler_arm_fpu" ]
armv6l*) broken="ERROR at //build/toolchain/gcc_toolchain.gni:102:3: Duplicate definition.";;
esac
_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" \
python2 build/gen.py --no-last-commit-position --out-path \
${wrksrc}/src/3rdparty/gn/out/Release --cc "$CC_host" \
--cxx "$CXX_host" --ld "$CXX_host" --ar "$AR_host"
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_patch() {
if [ "$build_option_sndio" ]; then
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
for f in "${FILESDIR}"/sndio-patches/*.patch; do
cd src/3rdparty/chromium/
echo "Applying $f"
patch -Np0 -i "$f"
cd "$wrksrc"
done
fi
}
pre_configure() {
export PATH=${PATH/\/builddir\/.xbps-qt5-webengine\/wrappers:/}
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
if [ "$CROSS_BUILD" ]; then
_bootstrap_gn
fi
}
pre_build() {
export NINJAJOBS=${makejobs}
}
qt5-webengine-devel_package() {
depends="qt5-devel>=${version} ${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
}
}