From 6d13c3b61eed006b5d0cceeab34894ac0338f0b1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Denis-Courmont?= <remi@remlab.net>
Date: Wed, 3 Aug 2011 13:37:13 +0300
Subject: [PATCH] contrib: matroska needs PIC on Linux even for staticlib

---
 contrib/src/matroska/matroska-pic.patch | 22 ++++++++++++++++++++++
 contrib/src/matroska/rules.mak          |  1 +
 2 files changed, 23 insertions(+)
 create mode 100644 contrib/src/matroska/matroska-pic.patch

diff --git a/contrib/src/matroska/matroska-pic.patch b/contrib/src/matroska/matroska-pic.patch
new file mode 100644
index 000000000000..a573d79bc4e8
--- /dev/null
+++ b/contrib/src/matroska/matroska-pic.patch
@@ -0,0 +1,22 @@
+diff -ru libmatroska.orig/make/linux/Makefile libmatroska/make/linux/Makefile
+--- libmatroska.orig/make/linux/Makefile	2011-06-15 15:00:37.000000000 +0300
++++ libmatroska/make/linux/Makefile	2011-08-03 13:33:25.000000000 +0300
+@@ -65,7 +65,7 @@
+ # object files; replace .cxx extension with .o
+ objects:=$(patsubst %$(EXTENSION),%.o,$(sources))
+ 
+-objects_so:=$(patsubst %$(EXTENSION),%.lo,$(sources))
++objects_so:=$(objects)
+ 
+ WARNINGFLAGS=-Wall -Wno-unknown-pragmas -ansi -fno-gnu-keywords -D_GNU_SOURCE \
+ 		-Wshadow
+@@ -89,9 +89,6 @@
+ 
+ # Build rules
+ %.o: %$(EXTENSION)
+-	$(CXX) -c $(COMPILEFLAGS) -o $@ $<
+-
+-%.lo: %$(EXTENSION)
+ 	$(CXX) -c $(COMPILEFLAGS) -fPIC -o $@ $<
+ 
+ $(LIBRARY): $(objects)
diff --git a/contrib/src/matroska/rules.mak b/contrib/src/matroska/rules.mak
index 8bbeab7f8181..9d1def175e7c 100644
--- a/contrib/src/matroska/rules.mak
+++ b/contrib/src/matroska/rules.mak
@@ -14,6 +14,7 @@ $(TARBALLS)/libmatroska-$(MATROSKA_VERSION).tar.bz2:
 
 libmatroska: libmatroska-$(MATROSKA_VERSION).tar.bz2 .sum-matroska
 	$(UNPACK)
+	$(APPLY) $(SRC)/matroska/matroska-pic.patch
 	$(MOVE)
 
 .matroska: libmatroska
-- 
GitLab