x264: fix cross compilation

This commit is contained in:
Daniel Fullmer 2020-01-03 20:06:13 -05:00 committed by Frederik Rietdijk
parent 996e11d92b
commit 2e5051e223
2 changed files with 22 additions and 4 deletions

View file

@ -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";

View file

@ -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