diff options
author | Daniel Fullmer <danielrf12@gmail.com> | 2020-01-03 20:06:13 -0500 |
---|---|---|
committer | Frederik Rietdijk <freddyrietdijk@fridh.nl> | 2020-01-15 09:46:30 +0100 |
commit | 2e5051e2235f93829f0d6531ace21e87f2a486a4 (patch) | |
tree | 8907c0d28cb6fd3038949e072f713f1636540dd4 | |
parent | 996e11d92b7df39896067a969f9d4269b6e18d14 (diff) | |
download | nixpkgs-2e5051e2235f93829f0d6531ace21e87f2a486a4.tar nixpkgs-2e5051e2235f93829f0d6531ace21e87f2a486a4.tar.gz nixpkgs-2e5051e2235f93829f0d6531ace21e87f2a486a4.tar.bz2 nixpkgs-2e5051e2235f93829f0d6531ace21e87f2a486a4.tar.lz nixpkgs-2e5051e2235f93829f0d6531ace21e87f2a486a4.tar.xz nixpkgs-2e5051e2235f93829f0d6531ace21e87f2a486a4.tar.zst nixpkgs-2e5051e2235f93829f0d6531ace21e87f2a486a4.zip |
x264: fix cross compilation
-rw-r--r-- | pkgs/development/libraries/x264/default.nix | 13 | ||||
-rw-r--r-- | pkgs/development/libraries/x264/disable-arm-neon-default.patch | 13 |
2 files changed, 22 insertions, 4 deletions
diff --git a/pkgs/development/libraries/x264/default.nix b/pkgs/development/libraries/x264/default.nix index 9998add0d93..2757ca7704c 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"; diff --git a/pkgs/development/libraries/x264/disable-arm-neon-default.patch b/pkgs/development/libraries/x264/disable-arm-neon-default.patch new file mode 100644 index 00000000000..6971944abb4 --- /dev/null +++ b/pkgs/development/libraries/x264/disable-arm-neon-default.patch @@ -0,0 +1,13 @@ +diff -Naur x264-snapshot-20190517-2245-stable-orig/configure x264-snapshot-20190517-2245-stable/configure +--- x264-snapshot-20190517-2245-stable-orig/configure 2020-01-03 19:51:03.041037657 -0500 ++++ x264-snapshot-20190517-2245-stable/configure 2020-01-03 19:52:15.075034609 -0500 +@@ -930,9 +930,6 @@ + fi + + if [ $asm = auto -a $ARCH = ARM ] ; then +- # set flags so neon is built by default +- [ $compiler == CL ] || echo $CFLAGS | grep -Eq '(-mcpu|-march|-mfpu)' || CFLAGS="$CFLAGS -mcpu=cortex-a8 -mfpu=neon" +- + cc_check '' '' '__asm__("add r0, r1, r2");' && define HAVE_ARM_INLINE_ASM + if [ $compiler = CL ] && cpp_check '' '' 'defined(_M_ARM) && _M_ARM >= 7' ; then + define HAVE_ARMV6 |