From 8ae7fe9fd3fdc54afb9c91c7bfb246707c4c1af6 Mon Sep 17 00:00:00 2001 From: Stefan Frijters Date: Mon, 2 Jun 2025 20:22:32 +0200 Subject: [PATCH] libtheora: fix ARM build We need to change to the GitHub source because the release tarball is missing relevant files, c.f. https://github.com/xiph/theora/commit/b167cb4a3e3e2d3239d71f0ca2cbc25af4f2183c Without this fix, building ffmpeg for e.g. armv7l-hf-multiplatform fails, because the configure script hits a linker error while trying to find libtheora . --- pkgs/by-name/li/libtheora/package.nix | 32 +++++++++++++++++++-------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/pkgs/by-name/li/libtheora/package.nix b/pkgs/by-name/li/libtheora/package.nix index 63a7096e8c8d..74c5b0691a9a 100644 --- a/pkgs/by-name/li/libtheora/package.nix +++ b/pkgs/by-name/li/libtheora/package.nix @@ -1,11 +1,12 @@ { lib, stdenv, - fetchurl, + fetchFromGitHub, autoreconfHook, libogg, libvorbis, pkg-config, + perl, testers, validatePkgConfig, }: @@ -14,13 +15,19 @@ stdenv.mkDerivation (finalAttrs: { pname = "libtheora"; version = "1.2.0"; - src = fetchurl { - url = "https://downloads.xiph.org/releases/theora/libtheora-${finalAttrs.version}.tar.gz"; - hash = "sha256-J5MnM5kDtUTCipKurafQ3P0Dl7WcLzaMxpisVvUVkG4="; + src = fetchFromGitHub { + owner = "xiph"; + repo = "theora"; + tag = "v${finalAttrs.version}"; + hash = "sha256-kzZh4V6wZX9MetDutuqjRenmdpy4PHaRU9MgtIwPpiU="; }; patches = lib.optionals stdenv.hostPlatform.isMinGW [ ./mingw-remove-export.patch ]; + postPatch = lib.optionalString stdenv.hostPlatform.isArmv7 '' + patchShebangs lib/arm/arm2gnu.pl + ''; + configureFlags = [ "--disable-examples" ]; outputs = [ @@ -30,17 +37,24 @@ stdenv.mkDerivation (finalAttrs: { ]; outputDoc = "devdoc"; - nativeBuildInputs = [ - autoreconfHook - pkg-config - validatePkgConfig - ]; + nativeBuildInputs = + [ + autoreconfHook + pkg-config + validatePkgConfig + ] + ++ lib.optionals stdenv.hostPlatform.isArmv7 [ + # Needed to run lib/arm/arm2gnu.pl for ARM assembly optimizations + perl + ]; propagatedBuildInputs = [ libogg libvorbis ]; + strictDeps = true; + passthru = { tests.pkg-config = testers.hasPkgConfigModules { package = finalAttrs.finalPackage;