[vlc-devel] [PATCH] contrib: x264: Fix building for windows on arm

Martin Storsjö martin at martin.st
Wed Feb 21 21:20:57 CET 2018


This includes a backport of one patch (from original git commit
7b13b31be60, included since Dec 24 2017), and passing the necessary
configure parameters for setting up gas-preprocessor for this
configuration.
---
This does check for __ELF__ instead of !__APPLE__ && !_WIN32 as
decided upon in vlc - but this is a backport of an upstream patch.
---
 contrib/src/x264/arm-asm-win.patch | 34 ++++++++++++++++++++++++++++++++++
 contrib/src/x264/rules.mak         |  6 +++++-
 2 files changed, 39 insertions(+), 1 deletion(-)
 create mode 100644 contrib/src/x264/arm-asm-win.patch

diff --git a/contrib/src/x264/arm-asm-win.patch b/contrib/src/x264/arm-asm-win.patch
new file mode 100644
index 0000000..32d2f14
--- /dev/null
+++ b/contrib/src/x264/arm-asm-win.patch
@@ -0,0 +1,34 @@
+From 064d3bbd30e3dc8d7096ee267de66b6d0a56cd02 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin at martin.st>
+Date: Mon, 16 Oct 2017 22:50:26 +0300
+Subject: [PATCH] arm: Check for __ELF__ instead of !__APPLE__, for using
+ .arch/.fpu
+
+For windows, when building with armasm, we already filtered these out
+with gas-preprocessor.
+
+By filtering them out already in the source, we can also build directly
+with clang for windows (which also require wrapping the assembler in
+gas-preprocessor for converting instructions to thumb form, but
+gas-preprocessor doesn't and shouldn't filter out them in the clang
+configuration).
+---
+ common/arm/asm.S | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/common/arm/asm.S b/common/arm/asm.S
+index 619a509..37a4229 100644
+--- a/common/arm/asm.S
++++ b/common/arm/asm.S
+@@ -28,7 +28,7 @@
+ 
+ .syntax unified
+ 
+-#ifndef __APPLE__
++#ifdef __ELF__
+ .arch armv7-a
+ .fpu neon
+ #endif
+-- 
+2.7.4
+
diff --git a/contrib/src/x264/rules.mak b/contrib/src/x264/rules.mak
index 9d7e7a6..a1ff5c1 100644
--- a/contrib/src/x264/rules.mak
+++ b/contrib/src/x264/rules.mak
@@ -35,6 +35,9 @@ ifndef HAVE_WIN32
 X264CONF += --enable-pic
 else
 X264CONF += --enable-win32thread
+ifeq ($(ARCH), arm)
+X264_AS = AS="./tools/gas-preprocessor.pl -arch arm -as-type clang -force-thumb -- $(CC) -mimplicit-it=always"
+endif
 endif
 ifdef HAVE_CROSS_COMPILE
 X264CONF += --cross-prefix="$(HOST)-"
@@ -77,6 +80,7 @@ x264 x26410b: %: x264-git.tar.bz2 .sum-%
 	mkdir -p $*-git
 	tar xvjf "$<" --strip-components=1 -C $*-git
 	$(UPDATE_AUTOCONFIG)
+	$(APPLY) $(SRC)/x264/arm-asm-win.patch
 	mv $*-git $*
 
 x262: x262-git.tar.gz .sum-x262
@@ -89,7 +93,7 @@ x262: x262-git.tar.gz .sum-x262
 
 .x264: x264
 	$(REQUIRE_GPL)
-	cd $< && $(HOSTVARS) ./configure $(X264CONF)
+	cd $< && $(HOSTVARS) $(X264_AS) ./configure $(X264CONF)
 	cd $< && $(MAKE) install
 	touch $@
 
-- 
2.7.4



More information about the vlc-devel mailing list