opt/qtwebengine/Pkgfile

96 lines
3.9 KiB
Plaintext

# Description: Provides support for web applications using the Chromium browser project.
# URL: https://www.qt.io/
# Maintainer: Danny Rawlins, crux at romster dot me
# Depends on: ffmpeg libvpx libwebp nodejs nss qt5 xorg-libxscrnsaver xorg-libxtst
# Optional: jsoncpp krb5 libevent libsrtp pipewire pulseaudio snappy
name=qtwebengine
version=5.15.14
release=3
source=(https://anduin.linuxfromscratch.org/BLFS/qtwebengine/$name-$version.tar.xz
https://www.linuxfromscratch.org/patches/blfs/svn/qtwebengine-$version-build_fixes-1.patch
qtwebengine-5.15.2-disable-fatal-warnings.patch
qtwebengine-5.15.2_p20210224-chromium-87-v8-icu68.patch
qtwebengine-5.15.2_p20210521-clang-libc++.patch
qtwebengine-5.15.2_p20211015-pdfium-system-lcms2.patch
qtwebengine-5.15.3_p20220406-ffmpeg5.patch
qtwebengine-5.15.13-icu_73-1.patch
qt5-webengine-pipewire-0.3.patch
qtwebengine-5.15.15-c++17.patch
qtwebengine-system-absl-compat.patch
qtwebengine-re2-2023.07.01.patch)
build() {
cd qtwebengine-$version
# https://www.linuxfromscratch.org/blfs/view/svn/x/qtwebengine.html
patch -p1 -i $SRC/qtwebengine-$version-build_fixes-1.patch
patch -p1 -i $SRC/qtwebengine-5.15.2-disable-fatal-warnings.patch
patch -p1 -i $SRC/qtwebengine-5.15.2_p20210224-chromium-87-v8-icu68.patch
patch -p1 -i $SRC/qtwebengine-5.15.2_p20210521-clang-libc++.patch
patch -p1 -i $SRC/qtwebengine-5.15.2_p20211015-pdfium-system-lcms2.patch
patch -p1 -i $SRC/qtwebengine-5.15.3_p20220406-ffmpeg5.patch
patch -p1 -i $SRC/qtwebengine-5.15.13-icu_73-1.patch
patch -p1 -d src/3rdparty -i $SRC/qt5-webengine-pipewire-0.3.patch
if prt-get isinst re2; then
patch -p1 -i $SRC/qtwebengine-re2-2023.07.01.patch
patch -p1 -i $SRC/qtwebengine-system-absl-compat.patch
cp -f /usr/include/absl/base/options.h \
src/3rdparty/chromium/third_party/abseil-cpp/absl/base/options.h
sed -i -e 's,#define ABSL_OPTION_USE_STD_OPTIONAL 1,#define ABSL_OPTION_USE_STD_OPTIONAL 0,' src/3rdparty/chromium/third_party/abseil-cpp/absl/base/options.h
patch -p1 -i $SRC/qtwebengine-5.15.15-c++17.patch
export CXXFLAGS+=' -std=gnu++17'
find . -name "*.pro" -o -name "*.pri" |while read r; do
echo 'QMAKE_CXXFLAGS_GNUCXX14 = -std=gnu++17' >>$r
done
fi
mkdir -pv .git src/3rdparty/chromium/.git
sed -e '/^MODULE_VERSION/s/5.*/5.15.2/' -i .qmake.conf
find -type f -name "*.pr[io]" | \
xargs sed -i -e 's|INCLUDEPATH += |&$$QTWEBENGINE_ROOT/include |'
prt-get isinst pulseaudio && sed -e '/link_pulseaudio/s/false/true/' \
-i src/3rdparty/chromium/media/media_options.gni
# Ninja, by default, sets the number of jobs to the number of availalble threads
test -n "$JOBS" && export NINJAFLAGS+=" -j ${JOBS-1}"
prt-get isinst clang && export CC=clang CXX=clang++ QMAKE_XSPEC=linux-clang
prt-get isinst lld && export AR=llvm-ar NM=llvm-nm RANLIB=llvm-ranlib LDFLAGS+=' -fuse-ld=lld'
prt-get isinst ccache && export \
QMAKE_CC="ccache ${CC:-gcc}" \
QMAKE_LINK_C="ccache ${CC:-gcc}" \
QMAKE_LINK_C_SHLIB="ccache ${CC:-gcc}" \
QMAKE_CXX="ccache ${CXX:-g++}" \
QMAKE_LINK="ccache ${CXX:-g++}" \
QMAKE_LINK_SHLIB="ccache ${CXX:-g++}" \
QMAKESPEC=/usr/lib/qt5/mkspecs/${QMAKE_XSPEC:-linux-g++}
PATH="$(echo ${PATH} | awk -v RS=: -v ORS=: '/ccache/ {next} {print}' | sed 's/:*$//')"
sed -i -e 's|"-Wno-unknown-attributes",|"-Wno-enum-constexpr-conversion",\n &|' \
src/3rdparty/chromium/build/config/compiler/BUILD.gn
install -d build
cd build
prt-get isinst pulseaudio && PKGMK_QTWEBENGINE+=' -pulseaudio' || PKGMK_QTWEBENGINE+=' -no-pulseaudio'
prt-get isinst pipewire && PKGMK_QTWEBENGINE+=' -webengine-webrtc-pipewire'
prt-get isinst icu && PKGMK_QTWEBENGINE+=' -webengine-icu' || PKGMK_QTWEBENGINE+=' -no-webengine-icu'
qmake-qt5 .. -- \
$PKGMK_QTWEBENGINE \
-proprietary-codecs \
-system-ffmpeg \
-system-opus \
-system-webp \
-no-feature-webengine-embedded-build
make
make INSTALL_ROOT=$PKG install
find "$PKG/usr/lib" -type f -name '*.prl' \
-exec sed -i -e '/^QMAKE_PRL_BUILD_DIR/d' {} \;
}