diff --git a/pkgs/development/libraries/ffmpeg/generic.nix b/pkgs/development/libraries/ffmpeg/generic.nix index bc51ce177bc5..d1c657eabf4e 100644 --- a/pkgs/development/libraries/ffmpeg/generic.nix +++ b/pkgs/development/libraries/ffmpeg/generic.nix @@ -795,6 +795,25 @@ stdenv.mkDerivation ( (enableFeature withExtraWarnings "extra-warnings") (enableFeature withStripping "stripping") ] + ++ optionals (stdenv.hostPlatform.isPower) [ + # FFmpeg expects us to pass `--cpu=` to pick a specific feature set to compile for. If unset, it defaults to `generic`. + # For POWER, the default doesn't produce baseline-compliant settings. Passing a baseline-like CPU as a target doesn't + # produce entirely correct settings either - POWER4 leaves AltiVec enabled, but that's only guaranteed with POWER6. + # Just configure together everything on our own. + + # Easy: Only ppc64le's baseline is recent enough to guarantee all of these. + (enableFeature (stdenv.hostPlatform.isPower64 && stdenv.hostPlatform.isLittleEndian) "altivec") + (enableFeature (stdenv.hostPlatform.isPower64 && stdenv.hostPlatform.isLittleEndian) "vsx") + (enableFeature (stdenv.hostPlatform.isPower64 && stdenv.hostPlatform.isLittleEndian) "power8") + (enableFeature (stdenv.hostPlatform.isPower64 && stdenv.hostPlatform.isLittleEndian) "ldbrx") + + # Instructions that are highly specific to that series of 32-bit embedded CPUs. Never try to enable them. + (enableFeature false "ppc4xx") + + # I *think* enabling this on 64-bit POWER is correct? Struggling to find much info on when/where this was introduced. + # Definitely present on the Apple G5, and likely Freescale e5500/e6500 as well. + (enableFeature (stdenv.hostPlatform.isPower64) "dcbzl") + ] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ "--cross-prefix=${stdenv.cc.targetPrefix}" "--enable-cross-compile"