Unverified Commit c0adc7d6 authored by Guillaume Girol's avatar Guillaume Girol Committed by GitHub
Browse files

ffmpeg: Fix on big-endian POWER (#447126)

parents aeee9730 6a5b5095
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -79,6 +79,7 @@
      && !isAarch32
      && !hostPlatform.isLoongArch64
      && !hostPlatform.isRiscV
      && !(hostPlatform.isPower && hostPlatform.isBigEndian)
      && hostPlatform == buildPlatform
    ), # dynamically linked Nvidia code
  withFlite ? withFullDeps, # Voice Synthesis
@@ -799,6 +800,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"