Skip to content

Commit

Permalink
chromium: enable ffmpeg and link more system libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
licy183 committed Dec 11, 2022
1 parent d25b997 commit 26e7e02
Show file tree
Hide file tree
Showing 15 changed files with 408 additions and 77 deletions.
2 changes: 1 addition & 1 deletion tur-continuous/chromium/0011-chromium-impl-sysinfo.patch
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
+
+#include "base/logging.h"
+
+#if (__ANDROID_API__ >= 21 /* 5.0 - Lollipop */)
+#if 0 // (__ANDROID_API__ >= 21 /* 5.0 - Lollipop */)
+
+namespace {
+
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
--- a/ui/base/x/x11_cursor_loader.cc
+++ b/ui/base/x/x11_cursor_loader.cc
@@ -139,7 +139,11 @@
void operator()(void* ptr) const { dlclose(ptr); }
};

+#ifdef __TERMUX__
+ std::unique_ptr<void, DlCloser> lib(dlopen("libXcursor.so", RTLD_LAZY));
+#else
std::unique_ptr<void, DlCloser> lib(dlopen("libXcursor.so.1", RTLD_LAZY));
+#endif
if (!lib)
return "";

--- a/ui/gfx/x/xlib_support.cc
+++ b/ui/gfx/x/xlib_support.cc
@@ -41,7 +41,11 @@
CHECK(xlib_loader->Load("libX11.so.6"));

auto* xlib_xcb_loader = GetXlibXcbLoader();
+#ifndef __TERMUX__
CHECK(xlib_xcb_loader->Load("libX11-xcb.so.1"));
+#else
+ CHECK(xlib_xcb_loader->Load("libX11-xcb.so"));
+#endif

CHECK(xlib_loader->XInitThreads());

Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
--- a/ui/gfx/x/xlib_support.cc
+++ b/ui/gfx/x/xlib_support.cc
@@ -41,7 +41,11 @@
CHECK(xlib_loader->Load("libX11.so.6"));

auto* xlib_xcb_loader = GetXlibXcbLoader();
+#ifndef __TERMUX__
CHECK(xlib_xcb_loader->Load("libX11-xcb.so.1"));
+#else
+ CHECK(xlib_xcb_loader->Load("libX11-xcb.so"));
+#endif

CHECK(xlib_loader->XInitThreads());

--- a/ui/ozone/platform/wayland/host/wayland_connection.cc
+++ b/ui/ozone/platform/wayland/host/wayland_connection.cc
@@ -139,14 +139,22 @@
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
--- a/ui/gtk/gtk_compat.cc
+++ b/ui/gtk/gtk_compat.cc
@@ -62,27 +62,47 @@
}

void* GetLibGio() {
+#ifdef __TERMUX__
+ static void* libgio = DlOpen("libgio-2.0.so");
+#else
static void* libgio = DlOpen("libgio-2.0.so.0");
+#endif
return libgio;
}

void* GetLibGdkPixbuf() {
+#ifdef __TERMUX__
+ static void* libgdk_pixbuf = DlOpen("libgdk_pixbuf-2.0.so");
+#else
static void* libgdk_pixbuf = DlOpen("libgdk_pixbuf-2.0.so.0");
+#endif
return libgdk_pixbuf;
}

void* GetLibGdk3() {
+#ifdef __TERMUX__
+ static void* libgdk3 = DlOpen("libgdk-3.so");
+#else
static void* libgdk3 = DlOpen("libgdk-3.so.0");
+#endif
return libgdk3;
}

void* GetLibGtk3(bool check = true) {
+#ifdef __TERMUX__
+ static void* libgtk3 = DlOpen("libgtk-3.so", check);
+#else
static void* libgtk3 = DlOpen("libgtk-3.so.0", check);
+#endif
return libgtk3;
}

void* GetLibGtk4(bool check = true) {
+#ifdef __TERMUX__
+ static void* libgtk4 = DlOpen("libgtk-4.so", check);
+#else
static void* libgtk4 = DlOpen("libgtk-4.so.1", check);
+#endif
return libgtk4;
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
--- a/media/audio/pulse/pulse_util.cc
+++ b/media/audio/pulse/pulse_util.cc
@@ -44,8 +44,12 @@

#if defined(DLOPEN_PULSEAUDIO)
static const base::FilePath::CharType kPulseLib[] =
+#ifdef __TERMUX__
+ FILE_PATH_LITERAL("libpulse.so");
+#else
FILE_PATH_LITERAL("libpulse.so.0");
#endif
+#endif

void DestroyMainloop(pa_threaded_mainloop* mainloop) {
pa_threaded_mainloop_stop(mainloop);
--- a/third_party/webrtc/modules/audio_device/linux/pulseaudiosymboltable_linux.cc
+++ b/third_party/webrtc/modules/audio_device/linux/pulseaudiosymboltable_linux.cc
@@ -30,7 +30,11 @@
namespace webrtc {
namespace adm_linux_pulse {

+#ifdef __TERMUX__
+LATE_BINDING_SYMBOL_TABLE_DEFINE_BEGIN(PulseAudioSymbolTable, "libpulse.so")
+#else
LATE_BINDING_SYMBOL_TABLE_DEFINE_BEGIN(PulseAudioSymbolTable, "libpulse.so.0")
+#endif
#define X(sym) \
LATE_BINDING_SYMBOL_TABLE_DEFINE_ENTRY(PulseAudioSymbolTable, sym)
PULSE_AUDIO_SYMBOLS_LIST
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
--- a/components/os_crypt/keyring_util_linux.cc
+++ b/components/os_crypt/keyring_util_linux.cc
@@ -68,7 +68,11 @@
if (keyring_loaded)
return true;

+#ifdef __TERMUX__
+ void* handle = dlopen("libgnome-keyring.so", RTLD_NOW | RTLD_GLOBAL);
+#else
void* handle = dlopen("libgnome-keyring.so.0", RTLD_NOW | RTLD_GLOBAL);
+#endif
if (!handle) {
// We wanted to use GNOME Keyring, but we couldn't load it. Warn, because
// either the user asked for this, or we autodetected it incorrectly. (Or
--- a/components/os_crypt/libsecret_util_linux.cc
+++ b/components/os_crypt/libsecret_util_linux.cc
@@ -102,7 +102,11 @@
if (libsecret_loaded_)
return true;

+#ifdef __TERMUX__
+ static void* handle = dlopen("libsecret-1.so", RTLD_NOW | RTLD_GLOBAL);
+#else
static void* handle = dlopen("libsecret-1.so.0", RTLD_NOW | RTLD_GLOBAL);
+#endif
if (!handle) {
// We wanted to use libsecret, but we couldn't load it. Warn, because
// either the user asked for this, or we autodetected it incorrectly. (Or
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
--- a/third_party/swiftshader/src/WSI/libWaylandClient.cpp
+++ b/third_party/swiftshader/src/WSI/libWaylandClient.cpp
@@ -56,7 +56,11 @@
}
else
{
+#ifdef __TERMUX__
+ libwl = loadLibrary("libwayland-client.so");
+#else
libwl = loadLibrary("libwayland-client.so.0");
+#endif
}

return LibWaylandClientExports(libwl);
--- a/third_party/swiftshader/src/WSI/libXCB.cpp
+++ b/third_party/swiftshader/src/WSI/libXCB.cpp
@@ -55,7 +55,11 @@
}
else
{
+#ifdef __TERMUX__
+ libxcb = loadLibrary("libxcb.so");
+#else
libxcb = loadLibrary("libxcb.so.1");
+#endif
}

if(getProcAddress(RTLD_DEFAULT, "xcb_shm_query_version")) // Search the global scope for pre-loaded XCB library.
@@ -64,7 +68,11 @@
}
else
{
+#ifdef __TERMUX__
+ libshm = loadLibrary("libxcb-shm.so");
+#else
libshm = loadLibrary("libxcb-shm.so.0");
+#endif
}

return LibXcbExports(libxcb, libshm);
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
--- a/third_party/dawn/src/dawn/native/XlibXcbFunctions.cpp
+++ b/third_party/dawn/src/dawn/native/XlibXcbFunctions.cpp
@@ -17,7 +17,11 @@
namespace dawn::native {

XlibXcbFunctions::XlibXcbFunctions() {
+#ifdef __TERMUX__
+ if (!mLib.Open("libX11-xcb.so") || !mLib.GetProc(&xGetXCBConnection, "XGetXCBConnection")) {
+#else
if (!mLib.Open("libX11-xcb.so.1") || !mLib.GetProc(&xGetXCBConnection, "XGetXCBConnection")) {
+#endif
mLib.Close();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
--- a/third_party/weston/src/libweston/backend-drm/drm-gbm.c
+++ b/third_party/weston/src/libweston/backend-drm/drm-gbm.c
@@ -61,7 +61,11 @@
* only the gl-renderer module links to it, the call above won't make
* these symbols globally available, and loading the DRI driver fails.
* Workaround this by dlopen()'ing libglapi with RTLD_GLOBAL. */
+#ifdef __TERMUX__
+ dlopen("libglapi.so", RTLD_LAZY | RTLD_GLOBAL);
+#else
dlopen("libglapi.so.0", RTLD_LAZY | RTLD_GLOBAL);
+#endif

gbm = gbm_create_device(fd);

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- a/chrome/browser/download/download_status_updater_linux.cc
+++ b/chrome/browser/download/download_status_updater_linux.cc
@@ -77,6 +77,8 @@
if (!unity_lib)
unity_lib = dlopen("libunity.so.9", RTLD_LAZY);
if (!unity_lib)
+ unity_lib = dlopen("libunity.so", RTLD_LAZY);
+ if (!unity_lib)
return;

unity_inspector_get_default_func inspector_get_default =
11 changes: 11 additions & 0 deletions tur-continuous/chromium/0052-v8-disable-trap-handler.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- a/v8/src/trap-handler/trap-handler.h
+++ b/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.
12 changes: 12 additions & 0 deletions tur-continuous/chromium/0053-breakpad-include-cstring.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
To solve error like
../../third_party/breakpad/breakpad/src/common/dwarf/elf_reader.cc:200:10: error: no member named 'strcmp' in namespace 'std'; did you mean simply 'strcmp'?
--- a/third_party/breakpad/breakpad/src/common/dwarf/elf_reader.cc
+++ b/third_party/breakpad/breakpad/src/common/dwarf/elf_reader.cc
@@ -39,6 +39,7 @@
#include <unistd.h>

#include <algorithm>
+#include <cstring>
#include <map>
#include <string>
#include <vector>
29 changes: 29 additions & 0 deletions tur-continuous/chromium/0054-ffmpeg-5.1.patch.disable
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
--- a/media/filters/audio_file_reader.cc
+++ b/media/filters/audio_file_reader.cc
@@ -243,10 +243,10 @@
// silence from being output. In the case where we are also discarding some
// portion of the packet (as indicated by a negative pts), we further want to
// adjust the duration downward by however much exists before zero.
- if (audio_codec_ == AudioCodec::kAAC && frame->duration) {
+ if (audio_codec_ == AudioCodec::kAAC && frame->pkt_duration) {
const base::TimeDelta pkt_duration = ConvertFromTimeBase(
glue_->format_context()->streams[stream_index_]->time_base,
- frame->duration + std::min(static_cast<int64_t>(0), frame->pts));
+ frame->pkt_duration + std::min(static_cast<int64_t>(0), frame->pts));
const base::TimeDelta frame_duration =
base::Seconds(frames_read / static_cast<double>(sample_rate_));

Remove this if termux/termux-packages#13743 is merged
--- a/media/filters/ffmpeg_demuxer.cc
+++ b/media/filters/ffmpeg_demuxer.cc
@@ -91,6 +91,10 @@
sample_rate);
}

+static inline int64_t av_stream_get_first_dts(const AVStream*) {
+ return kNoFFmpegTimestamp;
+}
+
static base::TimeDelta ExtractStartTime(AVStream* stream) {
// The default start time is zero.
base::TimeDelta start_time;
Loading

0 comments on commit 26e7e02

Please sign in to comment.