diff --git a/pkgs/development/libraries/libvpx/default.nix b/pkgs/development/libraries/libvpx/default.nix index d78a08852521..d82bf42bef61 100644 --- a/pkgs/development/libraries/libvpx/default.nix +++ b/pkgs/development/libraries/libvpx/default.nix @@ -41,6 +41,25 @@ let inherit (stdenv) is64bit isMips isDarwin isCygwin; inherit (lib) enableFeature optional optionals; + + # libvpx darwin targets include darwin version (ie. ARCH-darwinXX-gcc, XX being the darwin version) + # See all_platforms: https://github.com/webmproject/libvpx/blob/master/configure + # Darwin versions: 10.4=8, 10.5=9, 10.6=10, 10.7=11, 10.8=12, 10.9=13, 10.10=14 + darwinVersion = + /**/ if stdenv.hostPlatform.osxMinVersion == "10.10" then "14" + else if stdenv.hostPlatform.osxMinVersion == "10.9" then "13" + else if stdenv.hostPlatform.osxMinVersion == "10.8" then "12" + else if stdenv.hostPlatform.osxMinVersion == "10.7" then "11" + else if stdenv.hostPlatform.osxMinVersion == "10.6" then "10" + else if stdenv.hostPlatform.osxMinVersion == "10.5" then "9" + else "8"; + + kernel = + # Build system doesn't understand BSD, so pretend to be Linux. + /**/ if stdenv.isBSD then "linux" + else if stdenv.isDarwin then "darwin${darwinVersion}" + else stdenv.hostPlatform.parsed.kernel.name; + in assert vp8DecoderSupport || vp8EncoderSupport || vp9DecoderSupport || vp9EncoderSupport; @@ -144,20 +163,8 @@ stdenv.mkDerivation rec { (enableFeature (experimentalSpatialSvcSupport || experimentalFpMbStatsSupport || experimentalEmulateHardwareSupport) "experimental") - ] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ - # libvpx darwin targets include darwin version (ie. ARCH-darwinXX-gcc, XX being the darwin version) - # See all_platforms: https://github.com/webmproject/libvpx/blob/master/configure - # Darwin versions: 10.4=8, 10.5=9, 10.6=10, 10.7=11, 10.8=12, 10.9=13, 10.10=14 - "--force-target=${stdenv.hostPlatform.parsed.cpu.name}-${stdenv.hostPlatform.parsed.kernel.name}${ - if stdenv.hostPlatform.isDarwin then - if stdenv.hostPlatform.osxMinVersion == "10.10" then "14" - else if stdenv.hostPlatform.osxMinVersion == "10.9" then "13" - else if stdenv.hostPlatform.osxMinVersion == "10.8" then "12" - else if stdenv.hostPlatform.osxMinVersion == "10.7" then "11" - else if stdenv.hostPlatform.osxMinVersion == "10.6" then "10" - else if stdenv.hostPlatform.osxMinVersion == "10.5" then "9" - else "8" - else ""}-gcc" + ] ++ optionals (stdenv.isBSD || stdenv.hostPlatform != stdenv.buildPlatform) [ + "--force-target=${stdenv.hostPlatform.parsed.cpu.name}-${kernel}-gcc" (if stdenv.hostPlatform.isCygwin then "--enable-static-msvcrt" else "") ] # Experimental features ++ optional experimentalSpatialSvcSupport "--enable-spatial-svc"