about summary refs log tree commit diff
path: root/pkgs/development/libraries/x264/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/libraries/x264/default.nix')
-rw-r--r--pkgs/development/libraries/x264/default.nix13
1 files changed, 9 insertions, 4 deletions
diff --git a/pkgs/development/libraries/x264/default.nix b/pkgs/development/libraries/x264/default.nix
index 9998add0d930..2757ca7704c4 100644
--- a/pkgs/development/libraries/x264/default.nix
+++ b/pkgs/development/libraries/x264/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, nasm }:
+{ stdenv, lib, fetchurl, nasm }:
 
 stdenv.mkDerivation rec {
   pname = "x264";
@@ -9,6 +9,10 @@ stdenv.mkDerivation rec {
     sha256 = "1xv41z04km3rf374xk3ny7v8ibr211ph0j5am0909ln63mphc48f";
   };
 
+  # Upstream ./configure greps for (-mcpu|-march|-mfpu) in CFLAGS, which in nix
+  # is put in the cc wrapper anyway.
+  patches = [ ./disable-arm-neon-default.patch ];
+
   postPatch = ''
     patchShebangs .
   '';
@@ -17,15 +21,16 @@ stdenv.mkDerivation rec {
 
   outputs = [ "out" "lib" "dev" ];
 
-  preConfigure = ''
+  preConfigure = lib.optionalString (stdenv.buildPlatform.isx86_64 || stdenv.hostPlatform.isi686) ''
     # `AS' is set to the binutils assembler, but we need nasm
     unset AS
   '';
 
   configureFlags = [ "--enable-shared" ]
-    ++ stdenv.lib.optional (!stdenv.isi686) "--enable-pic";
+    ++ stdenv.lib.optional (!stdenv.isi686) "--enable-pic"
+    ++ stdenv.lib.optional (stdenv.buildPlatform != stdenv.hostPlatform) "--cross-prefix=${stdenv.cc.targetPrefix}";
 
-  nativeBuildInputs = [ nasm ];
+  nativeBuildInputs = lib.optional (stdenv.hostPlatform.isx86_64 || stdenv.hostPlatform.isi686) nasm;
 
   meta = with stdenv.lib; {
     description = "Library for encoding H264/AVC video streams";