libvpx: fix cross compiling

This commit is contained in:
Tristan Ross 2024-06-05 08:14:10 -07:00
parent ff80247307
commit 0af27a5615
No known key found for this signature in database
GPG Key ID: B09C422035669AF8

View File

@ -54,12 +54,26 @@ let
else if stdenv.hostPlatform.osxMinVersion == "10.5" then "9" else if stdenv.hostPlatform.osxMinVersion == "10.5" then "9"
else "8"; else "8";
cpu =
/**/ if stdenv.hostPlatform.isArmv7 then "armv7"
else if stdenv.hostPlatform.isAarch64 then "arm64"
else if stdenv.hostPlatform.isx86_32 then "x86"
else stdenv.hostPlatform.parsed.cpu.name;
kernel = kernel =
# Build system doesn't understand BSD, so pretend to be Linux. # Build system doesn't understand BSD, so pretend to be Linux.
/**/ if stdenv.isBSD then "linux" /**/ if stdenv.isBSD then "linux"
else if stdenv.isDarwin then "darwin${darwinVersion}" else if stdenv.isDarwin then "darwin${darwinVersion}"
else stdenv.hostPlatform.parsed.kernel.name; else stdenv.hostPlatform.parsed.kernel.name;
isGeneric =
/**/ (stdenv.hostPlatform.isPower && stdenv.hostPlatform.isLittleEndian)
|| stdenv.hostPlatform.parsed.cpu.name == "armv6l";
target =
/**/ if (stdenv.isBSD || stdenv.hostPlatform != stdenv.buildPlatform) then
(if isGeneric then "generic-gnu" else "${cpu}-${kernel}-gcc")
else null;
in in
assert vp8DecoderSupport || vp8EncoderSupport || vp9DecoderSupport || vp9EncoderSupport; assert vp8DecoderSupport || vp8EncoderSupport || vp9DecoderSupport || vp9EncoderSupport;
@ -163,8 +177,8 @@ stdenv.mkDerivation rec {
(enableFeature (experimentalSpatialSvcSupport || (enableFeature (experimentalSpatialSvcSupport ||
experimentalFpMbStatsSupport || experimentalFpMbStatsSupport ||
experimentalEmulateHardwareSupport) "experimental") experimentalEmulateHardwareSupport) "experimental")
] ++ optionals (stdenv.isBSD || stdenv.hostPlatform != stdenv.buildPlatform) [ ] ++ optionals (target != null) [
"--force-target=${stdenv.hostPlatform.parsed.cpu.name}-${kernel}-gcc" "--target=${target}"
(lib.optionalString stdenv.hostPlatform.isCygwin "--enable-static-msvcrt") (lib.optionalString stdenv.hostPlatform.isCygwin "--enable-static-msvcrt")
] # Experimental features ] # Experimental features
++ optional experimentalSpatialSvcSupport "--enable-spatial-svc" ++ optional experimentalSpatialSvcSupport "--enable-spatial-svc"