new package: qt6-qtwebengine

This commit is contained in:
termux-pacman-bot
2025-11-24 09:41:28 +00:00
parent d4690cfab5
commit bae50ce8cf
22 changed files with 596 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -133,6 +133,10 @@
-DGN_TARGET_CPU=${TEST_architecture_arch}
-DCMAKE_C_FLAGS=
-DCMAKE_CXX_FLAGS=
+ -DCMAKE_EXE_LINKER_FLAGS=
+ -DCMAKE_MODULE_LINKER_FLAGS=
+ -DCMAKE_SHARED_LINKER_FLAGS=
+ -DDUMMY_SYSROOT=
-DQT_FEATURE_qtwebengine_build=${QT_FEATURE_qtwebengine_build}
-DQT_FEATURE_qtpdf_build=${QT_FEATURE_qtpdf_build}
-DGCC_LEGACY_SUPPORT=${QT_FEATURE_webengine_gcc_legacy_support}
--- a/src/host/CMakeLists.txt
+++ b/src/host/CMakeLists.txt
@@ -62,6 +62,11 @@
"${CMAKE_CURRENT_BINARY_DIR}/config.tests/hostcompiler"
"${CMAKE_CURRENT_SOURCE_DIR}/config.tests/hostcompiler"
hostcompiler
+ CMAKE_FLAGS -DCMAKE_C_FLAGS=
+ -DCMAKE_CXX_FLAGS=
+ -DCMAKE_EXE_LINKER_FLAGS=
+ -DCMAKE_MODULE_LINKER_FLAGS=
+ -DCMAKE_SHARED_LINKER_FLAGS=
)
if(NOT has32HostCompiler)
MESSAGE(FATAL_ERROR "Compiler does not support 32bit compilation")

View File

@@ -0,0 +1,11 @@
--- a/cmake/QtToolchainHelpers.cmake
+++ b/cmake/QtToolchainHelpers.cmake
@@ -584,6 +584,8 @@
endif()
if(CMAKE_SYSROOT)
list(APPEND gnArgArg target_sysroot="${CMAKE_SYSROOT}")
+ elseif(DUMMY_SYSROOT)
+ list(APPEND gnArgArg target_sysroot="${DUMMY_SYSROOT}")
endif()
elseif(MACOS)
get_gn_arch(cpu ${arch})

View File

@@ -0,0 +1,24 @@
--- a/src/3rdparty/chromium/build/config/compiler/BUILD.gn
+++ b/src/3rdparty/chromium/build/config/compiler/BUILD.gn
@@ -1306,8 +1306,8 @@
}
} else if (current_cpu == "arm") {
if (is_clang && !is_android && !is_nacl && !is_chromeos_device) {
- cflags += [ "--target=arm-linux-gnueabihf" ]
- ldflags += [ "--target=arm-linux-gnueabihf" ]
+ cflags += [ "--target=armv7a-linux-androideabi24" ]
+ ldflags += [ "--target=armv7a-linux-androideabi24" ]
}
if (!is_nacl) {
cflags += ["-mfloat-abi=$arm_float_abi"]
@@ -1324,8 +1324,8 @@
} else if (current_cpu == "arm64") {
if (is_clang && !is_android && !is_nacl && !is_fuchsia &&
!is_chromeos_device) {
- cflags += [ "--target=aarch64-linux-gnu" ]
- ldflags += [ "--target=aarch64-linux-gnu" ]
+ cflags += [ "--target=aarch64-linux-android24" ]
+ ldflags += [ "--target=aarch64-linux-android24" ]
}
} else if (current_cpu == "mipsel" && !is_nacl) {
ldflags += [ "-Wl,--hash-style=sysv" ]

View File

@@ -0,0 +1,28 @@
--- a/src/3rdparty/chromium/base/allocator/partition_allocator/src/partition_alloc/partition_root.cc
+++ b/src/3rdparty/chromium/base/allocator/partition_allocator/src/partition_alloc/partition_root.cc
@@ -51,6 +51,11 @@
#endif // PA_CONFIG(ENABLE_SHADOW_METADATA)
#endif // PA_BUILDFLAG(IS_LINUX) || PA_BUILDFLAG(IS_CHROMEOS)
+#if defined(__ANDROID__) && __ANDROID_API__ < 30
+#include <sys/syscall.h>
+#define memfd_create(name,flags) syscall(SYS_memfd_create,name,flags)
+#endif
+
namespace partition_alloc::internal {
#if PA_BUILDFLAG(RECORD_ALLOC_INFO)
--- a/src/3rdparty/chromium/base/allocator/partition_allocator/src/partition_alloc/partition_address_space.cc
+++ b/src/3rdparty/chromium/base/allocator/partition_allocator/src/partition_alloc/partition_address_space.cc
@@ -37,6 +37,11 @@
#include <sys/mman.h>
#endif
+#if defined(__ANDROID__) && __ANDROID_API__ < 30
+#include <sys/syscall.h>
+#define memfd_create(name,flags) syscall(SYS_memfd_create,name,flags)
+#endif
+
namespace partition_alloc::internal {
#if PA_BUILDFLAG(HAS_64_BIT_POINTERS)

View File

@@ -0,0 +1,11 @@
--- a/src/3rdparty/chromium/base/files/file_posix.cc
+++ b/src/3rdparty/chromium/base/files/file_posix.cc
@@ -91,7 +91,7 @@
}
int CallFutimes(PlatformFile file, const struct timeval times[2]) {
-#ifdef __USE_XOPEN2K8
+#if defined(__USE_XOPEN2K8) || (defined(__ANDROID__) && __ANDROID_API__ < 26)
// futimens should be available, but futimes might not be
// http://pubs.opengroup.org/onlinepubs/9699919799/

View File

@@ -0,0 +1,11 @@
--- a/src/3rdparty/chromium/base/synchronization/lock_impl_posix.cc
+++ b/src/3rdparty/chromium/base/synchronization/lock_impl_posix.cc
@@ -58,7 +58,7 @@
// Lock::PriorityInheritanceAvailable still must be checked as the code may
// compile but the underlying platform still may not correctly support priority
// inheritance locks.
-#if BUILDFLAG(IS_NACL) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA)
+#if BUILDFLAG(IS_NACL) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA) || defined(__TERMUX__)
#define PRIORITY_INHERITANCE_LOCKS_POSSIBLE() 0
#else
#define PRIORITY_INHERITANCE_LOCKS_POSSIBLE() 1

View File

@@ -0,0 +1,92 @@
--- a/src/3rdparty/chromium/net/dns/dns_config_service_linux.cc
+++ b/src/3rdparty/chromium/net/dns/dns_config_service_linux.cc
@@ -7,6 +7,10 @@
#pragma allow_unsafe_buffers
#endif
+#include <sys/types.h>
+
+#ifndef __TERMUX__
+
#include "net/dns/dns_config_service_linux.h"
#include <netdb.h>
@@ -528,3 +532,8 @@
}
} // namespace net
+
+#else // __TERMUX__
+// XXX: Actually, Termux has no DNS config, fallback to use the stub of fushsia.
+#include "./dns_config_service_fuchsia.cc"
+#endif // __TERMUX__
--- a/src/3rdparty/chromium/net/dns/dns_reloader.cc
+++ b/src/3rdparty/chromium/net/dns/dns_reloader.cc
@@ -31,7 +31,7 @@
// an old musl bug that was fixed by musl c8fdcfe5, but Fuchsia's SDK doesn't
// have that change.
#if defined(__RES) && __RES >= 19991006 && !BUILDFLAG(IS_APPLE) && \
- !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_FUCHSIA)
+ !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_FUCHSIA) && !defined(__TERMUX__)
// We define this so we don't need to restate the complex condition here twice
// below - it would be easy for the copies below to get out of sync.
#define USE_RES_NINIT
--- a/src/3rdparty/chromium/net/dns/public/resolv_reader.cc
+++ b/src/3rdparty/chromium/net/dns/public/resolv_reader.cc
@@ -37,6 +37,8 @@
const struct __res_state& res) {
std::vector<IPEndPoint> nameservers;
+#ifndef __TERMUX__
+
if (!(res.options & RES_INIT))
return std::nullopt;
@@ -93,6 +95,12 @@
}
#endif
+#else // __TERMUX__
+ // From Android 8, getprop of net.dns%d has been invalid. So just
+ // assume the nameserver is 8.8.8.8.
+ nameservers.push_back(IPEndPoint(IPAddress(8, 8, 8, 8), 53));
+#endif // __TERMUX__
+
return nameservers;
}
--- a/src/3rdparty/chromium/net/dns/public/scoped_res_state.cc
+++ b/src/3rdparty/chromium/net/dns/public/scoped_res_state.cc
@@ -15,6 +15,15 @@
#include "base/check.h"
#include "build/build_config.h"
+#ifdef __TERMUX__
+static int res_ninit(struct __res_state*) {
+ return 0;
+}
+static void res_nclose(struct __res_state*) {
+ return;
+}
+#endif
+
namespace net {
ScopedResState::ScopedResState() {
--- a/src/3rdparty/chromium/net/dns/public/scoped_res_state.h
+++ b/src/3rdparty/chromium/net/dns/public/scoped_res_state.h
@@ -12,6 +12,14 @@
#include "build/build_config.h"
#include "net/base/net_export.h"
+#ifdef __TERMUX__
+// On Android NDK without JNI, there is no valid way to get nameservers.
+// So just provide a dummy struct and functions.
+struct __res_state {
+ int _dummy_state;
+};
+#endif
+
namespace net {
// Helper class to open, read and close a __res_state.

View File

@@ -0,0 +1,21 @@
--- a/src/3rdparty/chromium/third_party/crashpad/crashpad/util/file/file_io_posix.cc
+++ b/src/3rdparty/chromium/third_party/crashpad/crashpad/util/file/file_io_posix.cc
@@ -19,6 +19,7 @@
#include <sys/file.h>
#include <sys/mman.h>
#include <sys/stat.h>
+#include <sys/syscall.h>
#include <unistd.h>
#include <algorithm>
@@ -33,6 +34,10 @@
#include "build/build_config.h"
#include "util/misc/random_string.h"
+#if defined(__ANDROID__) && __ANDROID_API__ < 30
+#define memfd_create(name,flags) syscall(SYS_memfd_create,name,flags)
+#endif
+
namespace crashpad {
namespace {

View File

@@ -0,0 +1,11 @@
--- a/src/3rdparty/chromium/third_party/crashpad/crashpad/util/posix/close_multiple.cc
+++ b/src/3rdparty/chromium/third_party/crashpad/crashpad/util/posix/close_multiple.cc
@@ -135,7 +135,7 @@
// bionic/libc/bionic/ndk_cruft.cpp getdtablesize().
int max_fd = implicit_cast<int>(sysconf(_SC_OPEN_MAX));
-#if !BUILDFLAG(IS_ANDROID)
+#if !BUILDFLAG(IS_ANDROID) && !defined(__TERMUX__)
// getdtablesize() was removed effective Android 5.0.0 (API 21). Since it
// returns the same thing as the sysconf() above, just skip it. See
// https://android.googlesource.com/platform/bionic/+/462abab12b074c62c0999859e65d5a32ebb41951.

View File

@@ -0,0 +1,11 @@
--- a/src/3rdparty/chromium/base/files/file_util_posix.cc
+++ b/src/3rdparty/chromium/base/files/file_util_posix.cc
@@ -1314,7 +1314,7 @@
#if !BUILDFLAG(IS_ANDROID)
// This is implemented in file_util_android.cc for that platform.
bool GetShmemTempDir(bool executable, FilePath* path) {
-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_AIX)
+#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_AIX)) && !defined(__TERMUX__)
bool disable_dev_shm = false;
#if !BUILDFLAG(IS_CHROMEOS)
disable_dev_shm = CommandLine::ForCurrentProcess()->HasSwitch(

View File

@@ -0,0 +1,11 @@
--- a/src/3rdparty/chromium/base/process/set_process_title.cc
+++ b/src/3rdparty/chromium/base/process/set_process_title.cc
@@ -44,7 +44,7 @@
// TODO(jrg): Find out if setproctitle or equivalent is available on Android.
#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_APPLE) && !BUILDFLAG(IS_SOLARIS) && \
- !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_FUCHSIA) && !BUILDFLAG(IS_NACL)
+ !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_FUCHSIA) && !BUILDFLAG(IS_NACL) && !defined(__TERMUX__)
void SetProcessTitleFromCommandLine(const char** main_argv) {
// Build a single string which consists of all the arguments separated

View File

@@ -0,0 +1,23 @@
--- a/src/3rdparty/chromium/third_party/khronos/EGL/eglplatform.h
+++ b/src/3rdparty/chromium/third_party/khronos/EGL/eglplatform.h
@@ -88,7 +88,7 @@
typedef struct gbm_bo *EGLNativePixmapType;
typedef void *EGLNativeWindowType;
-#elif defined(__ANDROID__) || defined(ANDROID)
+#elif (defined(__ANDROID__) || defined(ANDROID)) && !defined(__TERMUX__)
struct ANativeWindow;
struct egl_native_pixmap_t;
--- a/src/3rdparty/chromium/third_party/angle/include/EGL/eglplatform.h
+++ b/src/3rdparty/chromium/third_party/angle/include/EGL/eglplatform.h
@@ -88,7 +88,7 @@
typedef struct gbm_bo *EGLNativePixmapType;
typedef void *EGLNativeWindowType;
-#elif defined(__ANDROID__) || defined(ANDROID)
+#elif (defined(__ANDROID__) || defined(ANDROID)) && !defined(__TERMUX__)
struct ANativeWindow;
struct egl_native_pixmap_t;

View File

@@ -0,0 +1,21 @@
--- a/src/core/web_engine_context.cpp
+++ b/src/core/web_engine_context.cpp
@@ -866,6 +866,10 @@
switches::kApplicationName,
QCoreApplication::applicationName().toUtf8().toPercentEncoding().toStdString());
+#ifdef __TERMUX__
+ parsedCommandLine.AppendSwitch(sandbox::policy::switches::kNoSandbox);
+ qInfo() << "Sandboxing disabled.";
+#else
// Enable sandboxing on OS X and Linux (Desktop / Embedded) by default.
bool disable_sandbox = qEnvironmentVariableIsSet(kDisableSandboxEnv);
if (!disable_sandbox) {
@@ -876,6 +880,7 @@
parsedCommandLine.AppendSwitch(sandbox::policy::switches::kNoSandbox);
qInfo("Sandboxing disabled by user.");
}
+#endif
// Do not advertise a feature we have removed at compile time
parsedCommandLine.AppendSwitch(switches::kDisableSpeechAPI);

View File

@@ -0,0 +1,26 @@
--- a/src/3rdparty/chromium/v8/src/trap-handler/trap-handler.h
+++ b/src/3rdparty/chromium/v8/src/trap-handler/trap-handler.h
@@ -19,7 +19,7 @@
// X64 on Linux, Windows, MacOS, FreeBSD.
#if V8_HOST_ARCH_X64 && V8_TARGET_ARCH_X64 && \
- ((V8_OS_LINUX && !V8_OS_ANDROID) || V8_OS_WIN || V8_OS_DARWIN || \
+ (V8_OS_LINUX || V8_OS_WIN || V8_OS_DARWIN || \
V8_OS_FREEBSD)
#define V8_TRAP_HANDLER_SUPPORTED true
// Arm64 (non-simulator) on Mac.
@@ -41,14 +41,6 @@
#define V8_TRAP_HANDLER_SUPPORTED false
#endif
-#if V8_OS_ANDROID && V8_TRAP_HANDLER_SUPPORTED
-// It would require some careful security review before the trap handler
-// can be enabled on Android. Android may do unexpected things with signal
-// handling and crash reporting that could open up security holes in V8's
-// trap handling.
-#error "The V8 trap handler should not be enabled on Android"
-#endif
-
// Setup for shared library export.
#if defined(BUILDING_V8_SHARED) && defined(V8_OS_WIN)
#define TH_EXPORT_PRIVATE __declspec(dllexport)

View File

@@ -0,0 +1,14 @@
--- a/src/3rdparty/chromium/v8/src/wasm/wasm-objects.cc
+++ b/src/3rdparty/chromium/v8/src/wasm/wasm-objects.cc
@@ -11,6 +11,11 @@
#undef MAP_TYPE
#endif // V8_TARGET_OS_LINUX
+#if defined __ANDROID__ && __ANDROID_API__ < 30
+#include <sys/syscall.h>
+#define memfd_create(name,flags) syscall(SYS_memfd_create,name,flags)
+#endif
+
#include "src/wasm/wasm-objects.h"
#include <optional>

View File

@@ -0,0 +1,11 @@
--- a/src/3rdparty/chromium/third_party/dav1d/libdav1d/src/cpu.c
+++ b/src/3rdparty/chromium/third_party/dav1d/libdav1d/src/cpu.c
@@ -91,7 +91,7 @@
GetNativeSystemInfo(&system_info);
return system_info.dwNumberOfProcessors;
#endif
-#elif HAVE_PTHREAD_GETAFFINITY_NP && defined(CPU_COUNT)
+#elif HAVE_PTHREAD_GETAFFINITY_NP && defined(CPU_COUNT) && !defined(__ANDROID__)
cpu_set_t affinity;
if (!pthread_getaffinity_np(pthread_self(), sizeof(affinity), &affinity))
return CPU_COUNT(&affinity);

View File

@@ -0,0 +1,28 @@
--- a/src/3rdparty/chromium/third_party/crashpad/crashpad/util/posix/spawn_subprocess.cc
+++ b/src/3rdparty/chromium/third_party/crashpad/crashpad/util/posix/spawn_subprocess.cc
@@ -15,12 +15,15 @@
#include "util/posix/spawn_subprocess.h"
#include <errno.h>
-#include <spawn.h>
#include <stdlib.h>
#include <string.h>
#include <sys/wait.h>
#include <unistd.h>
+#ifndef __TERMUX__
+#include <spawn.h>
+#endif
+
#include "base/check.h"
#include "base/check_op.h"
#include "base/logging.h"
@@ -171,7 +174,7 @@
char* const* envp_for_spawn =
envp ? const_cast<char* const*>(envp_c.data()) : environ;
-#if BUILDFLAG(IS_ANDROID) && __ANDROID_API__ < 28
+#if (BUILDFLAG(IS_ANDROID) || defined(__TERMUX__)) && __ANDROID_API__ < 28
pid = fork();
if (pid < 0) {
PLOG(FATAL) << "fork";

View File

@@ -0,0 +1,13 @@
--- a/src/3rdparty/chromium/third_party/cpuinfo/src/src/arm/linux/init.c
+++ b/src/3rdparty/chromium/third_party/cpuinfo/src/src/arm/linux/init.c
@@ -14,6 +14,10 @@
#include <cpuinfo/log.h>
#include <linux/api.h>
+#ifdef __TERMUX__
+#include <arm/android/properties.c>
+#endif
+
struct cpuinfo_arm_isa cpuinfo_isa = {0};
static struct cpuinfo_package package = {{0}};

View File

@@ -0,0 +1,50 @@
--- a/src/3rdparty/chromium/v8/src/codegen/external-reference-table.cc
+++ b/src/3rdparty/chromium/v8/src/codegen/external-reference-table.cc
@@ -12,7 +12,9 @@
#if defined(DEBUG) && defined(V8_OS_LINUX) && !defined(V8_OS_ANDROID)
#define SYMBOLIZE_FUNCTION
+#if defined(__GLIBC__)
#include <execinfo.h>
+#endif
#include <vector>
@@ -118,7 +120,7 @@
}
const char* ExternalReferenceTable::ResolveSymbol(void* address) {
-#ifdef SYMBOLIZE_FUNCTION
+#if defined(SYMBOLIZE_FUNCTION) && defined(__GLIBC__)
char** names = backtrace_symbols(&address, 1);
const char* name = names[0];
// The array of names is malloc'ed. However, each name string is static
--- a/src/3rdparty/chromium/base/debug/stack_trace.cc
+++ b/src/3rdparty/chromium/base/debug/stack_trace.cc
@@ -249,7 +249,7 @@
// Symbols are not expected to be reliable when gn args specifies
// symbol_level=0.
return false;
-#elif defined(__UCLIBC__) || defined(_AIX)
+#elif defined(__UCLIBC__) || defined(_AIX) || defined(__TERMUX__)
// StackTrace::OutputToStream() is not implemented under uclibc, nor AIX.
// See https://crbug.com/706728
return false;
@@ -311,7 +311,7 @@
std::string StackTrace::ToStringWithPrefix(cstring_view prefix_string) const {
std::stringstream stream;
-#if !defined(__UCLIBC__) && !defined(_AIX)
+#if !defined(__UCLIBC__) && !defined(_AIX) && !defined(__TERMUX__)
OutputToStreamWithPrefix(&stream, prefix_string);
#endif
return stream.str();
@@ -335,7 +335,7 @@
}
std::ostream& operator<<(std::ostream& os, const StackTrace& s) {
-#if !defined(__UCLIBC__) && !defined(_AIX)
+#if !defined(__UCLIBC__) && !defined(_AIX) && !defined(__TERMUX__)
s.OutputToStream(&os);
#else
os << "StackTrace::OutputToStream not implemented.";

View File

@@ -0,0 +1,40 @@
--- a/src/3rdparty/chromium/base/files/scoped_file_linux.cc
+++ b/src/3rdparty/chromium/base/files/scoped_file_linux.cc
@@ -14,6 +14,26 @@
#include "base/logging.h"
#include "base/strings/string_piece.h"
+#ifdef __TERMUX__
+#include <android/fdsan.h>
+#include <dlfcn.h>
+#include <sys/syscall.h>
+static inline void termux_disable_fdsan() {
+ typedef void (*android_fdsan_error_level_ptr_t)(enum android_fdsan_error_level);
+ // For Android 11+.
+ void *lib_handle = dlopen("libc.so", RTLD_LAZY);
+ if (lib_handle) {
+ android_fdsan_error_level_ptr_t set_fdsan_error_level =
+ reinterpret_cast<android_fdsan_error_level_ptr_t>(
+ dlsym(lib_handle, "android_fdsan_set_error_level"));
+ if (set_fdsan_error_level != nullptr) {
+ set_fdsan_error_level(ANDROID_FDSAN_ERROR_LEVEL_DISABLED);
+ }
+ dlclose(lib_handle);
+ }
+}
+#endif
+
namespace {
// We want to avoid any kind of allocations in our close() implementation, so we
@@ -65,6 +85,10 @@
void EnableFDOwnershipEnforcement(bool enabled) {
g_is_ownership_enforced = enabled;
+#ifdef __TERMUX__
+ // Disable the Android native fdsan.
+ termux_disable_fdsan();
+#endif
}
void ResetFDOwnership() {

View File

@@ -0,0 +1,11 @@
--- a/src/3rdparty/chromium/content/app/content_main_runner_impl.cc
+++ b/src/3rdparty/chromium/content/app/content_main_runner_impl.cc
@@ -1059,7 +1059,7 @@
}
#endif // BUILDFLAG(USE_ZYGOTE)
-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+#if (BUILDFLAG(IS_LINUX) && !defined(__TERMUX__)) || BUILDFLAG(IS_CHROMEOS)
if (process_type.empty()) {
// Check if Landlock is supported.
sandbox::policy::SandboxLinux::ReportLandlockStatus();

View File

@@ -0,0 +1,101 @@
TERMUX_PKG_HOMEPAGE=https://www.qt.io/
TERMUX_PKG_DESCRIPTION="Qt 6 WebEngine Library"
TERMUX_PKG_LICENSE="GPL-3.0"
TERMUX_PKG_MAINTAINER="@licy183"
TERMUX_PKG_VERSION="6.10.1"
TERMUX_PKG_SRCURL="https://download.qt.io/official_releases/qt/${TERMUX_PKG_VERSION%.*}/${TERMUX_PKG_VERSION}/submodules/qtwebengine-everywhere-src-${TERMUX_PKG_VERSION}.tar.xz"
TERMUX_PKG_SHA256=77b5ea6186a0429a6b8e656faedd5cd3e8019d33856ee59637698ab578ead1e3
TERMUX_PKG_DEPENDS="dbus, fontconfig, libc++, libexpat, libjpeg-turbo, libminizip, libnspr, libnss, libopus, libpng, libsnappy, libvpx, libwebp, libx11, libxkbfile, qt6-qtbase (>= ${TERMUX_PKG_VERSION}), qt6-qtdeclarative (>= ${TERMUX_PKG_VERSION}), qt6-qtwebchannel (>= ${TERMUX_PKG_VERSION}), zlib"
TERMUX_PKG_BUILD_DEPENDS="qt6-qtbase-cross-tools, qt6-qtdeclarative-cross-tools"
TERMUX_PKG_HOSTBUILD=true
TERMUX_PKG_NO_STATICSPLIT=true
TERMUX_PKG_AUTO_UPDATE=true
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
-DCMAKE_MESSAGE_LOG_LEVEL=STATUS
-DCMAKE_SYSTEM_NAME=Linux
-DTEST_glibc=ON
-DQT_GENERATE_SBOM=OFF
"
termux_step_host_build() {
termux_setup_cmake
termux_setup_ninja
mkdir -p host-gn-build
pushd host-gn-build
cmake \
-G Ninja \
-S ${TERMUX_PKG_SRCDIR}/src/gn \
-DCMAKE_BUILD_TYPE=MinSizeRel
ninja -j $TERMUX_PKG_MAKE_PROCESSES
popd # host-gn-build
}
termux_step_configure() {
termux_setup_cmake
termux_setup_ninja
termux_setup_nodejs
export PATH="$TERMUX_PKG_HOSTBUILD_DIR/host-gn-build/MinSizeRel:$PATH"
# Remove termux's dummy pkg-config
local _host_pkg_config="$(cat $(command -v pkg-config) | grep exec | awk '{print $2}')"
rm -rf $TERMUX_PKG_TMPDIR/host-pkg-config-bin
mkdir -p $TERMUX_PKG_TMPDIR/host-pkg-config-bin
ln -s $_host_pkg_config $TERMUX_PKG_TMPDIR/host-pkg-config-bin/pkg-config
ln -s $(command -v pkg-config) $TERMUX_PKG_TMPDIR/host-pkg-config-bin/$TERMUX_HOST_PLATFORM-pkg-config
export PATH="$TERMUX_PKG_TMPDIR/host-pkg-config-bin:$PATH"
# Create dummy sysroot
if [ ! -d "$TERMUX_PKG_CACHEDIR/sysroot-$TERMUX_ARCH" ]; then
rm -rf $TERMUX_PKG_TMPDIR/sysroot
mkdir -p $TERMUX_PKG_TMPDIR/sysroot
pushd $TERMUX_PKG_TMPDIR/sysroot
mkdir -p usr/include usr/lib usr/bin
cp -R $TERMUX_STANDALONE_TOOLCHAIN/sysroot/usr/include/* usr/include
cp -R $TERMUX_STANDALONE_TOOLCHAIN/sysroot/usr/include/$TERMUX_HOST_PLATFORM/* usr/include
cp -R $TERMUX_STANDALONE_TOOLCHAIN/sysroot/usr/lib/$TERMUX_HOST_PLATFORM/$TERMUX_PKG_API_LEVEL/* usr/lib/
cp "$TERMUX_STANDALONE_TOOLCHAIN/sysroot/usr/lib/$TERMUX_HOST_PLATFORM/libc++_shared.so" usr/lib/
cp "$TERMUX_STANDALONE_TOOLCHAIN/sysroot/usr/lib/$TERMUX_HOST_PLATFORM/libc++_static.a" usr/lib/
cp "$TERMUX_STANDALONE_TOOLCHAIN/sysroot/usr/lib/$TERMUX_HOST_PLATFORM/libc++abi.a" usr/lib/
cp -Rf $TERMUX_PREFIX/include/* usr/include
cp -Rf $TERMUX_PREFIX/lib/* usr/lib
ln -sf /data ./data
popd
mv $TERMUX_PKG_TMPDIR/sysroot $TERMUX_PKG_CACHEDIR/sysroot-$TERMUX_ARCH
fi
# Dummy pthread, rt and resolve
# TODO: Patch the building system and do not dummy `librt.so`.
echo "INPUT(-llog -liconv -landroid-shmem)" > "$TERMUX_PREFIX/lib/librt.so"
echo '!<arch>' > "$TERMUX_PREFIX/lib/libpthread.a"
echo '!<arch>' > "$TERMUX_PREFIX/lib/libresolv.a"
TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" -DDUMMY_SYSROOT=$TERMUX_PKG_CACHEDIR/sysroot-$TERMUX_ARCH"
: ${NINJAFLAGS:=""}
export NINJAFLAGS
termux_step_configure_cmake
}
termux_step_make_install() {
cmake \
--install "${TERMUX_PKG_BUILDDIR}" \
--prefix "${TERMUX_PREFIX}" \
--verbose
# Drop QMAKE_PRL_BUILD_DIR because reference the build dir
find "${TERMUX_PREFIX}/lib" -type f -name "libQt6Pdf*.prl" \
-exec sed -i -e '/^QMAKE_PRL_BUILD_DIR/d' "{}" \;
find "${TERMUX_PREFIX}/lib" -type f -name "libQt6WebEngine*.prl" \
-exec sed -i -e '/^QMAKE_PRL_BUILD_DIR/d' "{}" \;
# Remove *.la files
find "${TERMUX_PREFIX}/lib" -iname \*.la -delete
}
termux_step_post_make_install() {
# Remove the dummy files
rm $TERMUX_PREFIX/lib/lib{{pthread,resolv}.a,rt.so}
}