Skip to content

Open-source download manager & offline media toolbox for YouTube, music, social media, learning platforms & 1,800+ sites. Built with Tauri 2.0, Rust & Svelte.

fix(deps,linux): support apple silicon ffmpeg and prevent appimage egl crashes

IGECT50422d16f261
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 6a367364..526b4fd5 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -82,6 +82,13 @@ jobs:
with:
workspaces: './src-tauri -> target'
+ - name: Seed patched linuxdeploy-plugin-gtk (Ubuntu only)
+ if: contains(matrix.platform, 'ubuntu')
+ run: |
+ mkdir -p ~/.cache/tauri
+ cp scripts/linux/linuxdeploy-plugin-gtk.sh ~/.cache/tauri/linuxdeploy-plugin-gtk.sh
+ chmod +x ~/.cache/tauri/linuxdeploy-plugin-gtk.sh
+
- uses: tauri-apps/tauri-action@v0
id: tauri-build
env:
diff --git a/scripts/linux/linuxdeploy-plugin-gtk.sh b/scripts/linux/linuxdeploy-plugin-gtk.sh
index 4050f262..fd00f562 100755
--- a/scripts/linux/linuxdeploy-plugin-gtk.sh
+++ b/scripts/linux/linuxdeploy-plugin-gtk.sh
@@ -228,6 +228,13 @@ export GTK_THEME="$APPIMAGE_GTK_THEME" # Custom themes are broken
export GDK_BACKEND=x11 # Crash with Wayland backend on Wayland - We tested it without it and ended up with this: https://github.com/tauri-apps/tauri/issues/8541
export XDG_DATA_DIRS="$APPDIR/usr/share:/usr/share:$XDG_DATA_DIRS" # g_get_system_data_dirs() from GLib
+if [ -z "${WEBKIT_DISABLE_DMABUF_RENDERER:-}" ]; then
+ export WEBKIT_DISABLE_DMABUF_RENDERER=1
+fi
+if [ -z "${WEBKIT_DISABLE_COMPOSITING_MODE:-}" ]; then
+ export WEBKIT_DISABLE_COMPOSITING_MODE=1
+fi
+
# WebKitGTK plays media through GStreamer, and the bundled core libraries come
# without plugins or the plugin-scanner helper — so the default scan finds no
# appsink/autoaudiosink/decodebin and the first media pipeline dies (blank page
diff --git a/src-tauri/omniget-core/src/core/dependencies.rs b/src-tauri/omniget-core/src/core/dependencies.rs
index a3c79306..6fdfafda 100644
--- a/src-tauri/omniget-core/src/core/dependencies.rs
+++ b/src-tauri/omniget-core/src/core/dependencies.rs
@@ -533,18 +533,37 @@ async fn download_ffmpeg() -> anyhow::Result<PathBuf> {
Ok(ffmpeg_target)
}
+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
enum ArchiveType {
Zip,
TarXz,
}
fn ffmpeg_download_urls() -> Vec<(&'static str, ArchiveType)> {
- if cfg!(target_os = "windows") {
+ ffmpeg_download_urls_for(std::env::consts::OS, std::env::consts::ARCH)
+}
+
+pub(crate) fn ffmpeg_download_urls_for(
+ target_os: &str,
+ target_arch: &str,
+) -> Vec<(&'static str, ArchiveType)> {
+ if target_os == "windows" {
vec![(
"https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-win64-gpl.zip",
ArchiveType::Zip,
)]
- } else if cfg!(target_os = "macos") {
+ } else if target_os == "macos" && target_arch == "aarch64" {
+ vec![
+ (
+ "https://ffmpeg.martin-riedl.de/redirect/latest/macos/arm64/release/ffmpeg.zip",
+ ArchiveType::Zip,
+ ),
+ (
+ "https://ffmpeg.martin-riedl.de/redirect/latest/macos/arm64/release/ffprobe.zip",
+ ArchiveType::Zip,
+ ),
+ ]
+ } else if target_os == "macos" {
vec![
(
"https://evermeet.cx/ffmpeg/getrelease/zip",
@@ -555,7 +574,7 @@ fn ffmpeg_download_urls() -> Vec<(&'static str, ArchiveType)> {
ArchiveType::Zip,
),
]
- } else if cfg!(target_arch = "aarch64") {
+ } else if target_arch == "aarch64" {
vec![(
"https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-linuxarm64-gpl.tar.xz",
ArchiveType::TarXz,
@@ -997,4 +1016,34 @@ mod integrity_tests {
assert_eq!(parse_github_digest(VAZIO), None);
assert_eq!(parse_github_digest("sha512:abc"), None);
}
+
+ #[test]
+ fn ffmpeg_download_urls_per_target_architecture() {
+ use super::*;
+
+ let mac_arm = ffmpeg_download_urls_for("macos", "aarch64");
+ assert_eq!(mac_arm.len(), 2);
+ assert!(mac_arm[0].0.contains("arm64") && mac_arm[0].0.ends_with("ffmpeg.zip"));
+ assert!(mac_arm[1].0.contains("arm64") && mac_arm[1].0.ends_with("ffprobe.zip"));
+ assert_eq!(mac_arm[0].1, ArchiveType::Zip);
+
+ let mac_intel = ffmpeg_download_urls_for("macos", "x86_64");
+ assert_eq!(mac_intel.len(), 2);
+ assert!(mac_intel[0].0.contains("evermeet.cx"));
+
+ let win = ffmpeg_download_urls_for("windows", "x86_64");
+ assert_eq!(win.len(), 1);
+ assert!(win[0].0.contains("win64"));
+ assert_eq!(win[0].1, ArchiveType::Zip);
+
+ let linux_arm = ffmpeg_download_urls_for("linux", "aarch64");
+ assert_eq!(linux_arm.len(), 1);
+ assert!(linux_arm[0].0.contains("linuxarm64"));
+ assert_eq!(linux_arm[0].1, ArchiveType::TarXz);
+
+ let linux_x64 = ffmpeg_download_urls_for("linux", "x86_64");
+ assert_eq!(linux_x64.len(), 1);
+ assert!(linux_x64[0].0.contains("linux64"));
+ assert_eq!(linux_x64[0].1, ArchiveType::TarXz);
+ }
}
diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs
index 567dc43f..e352999c 100644
--- a/src-tauri/src/main.rs
+++ b/src-tauri/src/main.rs
@@ -60,22 +60,23 @@ fn setup_environment() {
std::env::set_var("PYTHONLEGACYWINDOWSSTDIO", "0");
#[cfg(target_os = "linux")]
- if std::env::var("WEBKIT_DISABLE_DMABUF_RENDERER").is_err() {
- std::env::set_var("WEBKIT_DISABLE_DMABUF_RENDERER", "1");
- }
-
- // Issue #199. AppImages bundle their own libwayland, which conflicts with
- // the system EGL on some Wayland setups (Fedora/KDE, Intel+Mesa) and kills
- // the WebKit process with EGL_BAD_PARAMETER before any window appears
- // (tauri-apps/tauri#11988). Running through XWayland sidesteps the bundled
- // library entirely. Only applies inside an AppImage on a Wayland session,
- // and never overrides an explicit user choice.
- #[cfg(target_os = "linux")]
- if std::env::var_os("APPIMAGE").is_some()
- && std::env::var_os("GDK_BACKEND").is_none()
- && std::env::var("XDG_SESSION_TYPE").as_deref() == Ok("wayland")
{
- std::env::set_var("GDK_BACKEND", "x11");
+ if std::env::var("WEBKIT_DISABLE_DMABUF_RENDERER").is_err() {
+ std::env::set_var("WEBKIT_DISABLE_DMABUF_RENDERER", "1");
+ }
+ if std::env::var("WEBKIT_DISABLE_COMPOSITING_MODE").is_err() {
+ std::env::set_var("WEBKIT_DISABLE_COMPOSITING_MODE", "1");
+ }
+
+ let is_wayland = std::env::var("XDG_SESSION_TYPE").as_deref() == Ok("wayland")
+ || std::env::var_os("WAYLAND_DISPLAY").is_some();
+
+ if std::env::var_os("APPIMAGE").is_some()
+ && std::env::var_os("GDK_BACKEND").is_none()
+ && is_wayland
+ {
+ std::env::set_var("GDK_BACKEND", "x11");
+ }
}
// WebKit plays media through GStreamer, and the AppImage bundles