[vlc-devel] [PATCH] contrib: remove STDC hack for android

Rafaël Carré funman at videolan.org
Thu Mar 29 22:30:07 CEST 2012


Remove -ansi flag for packages which don't build.

-ansi (and __STRICT_ANSI__) prevent the bionic headers to define (u)int64_t

Freetype exhibits a bug in gcc headers which typedef uint64_t u_int64_t

It seems like gcc, libebml, libmatroska, and taglib rely on standard headers
to define (u)int64_t which is the case for glibc even with -ansi.
---
 contrib/src/ebml/no-ansi.patch     |   12 ++++++++++++
 contrib/src/ebml/rules.mak         |    1 +
 contrib/src/freetype2/rules.mak    |    1 +
 contrib/src/main.mak               |    2 +-
 contrib/src/matroska/no-ansi.patch |   12 ++++++++++++
 contrib/src/matroska/rules.mak     |    1 +
 contrib/src/taglib/no-ansi.patch   |   14 ++++++++++++++
 contrib/src/taglib/rules.mak       |    1 +
 8 files changed, 43 insertions(+), 1 deletions(-)
 create mode 100644 contrib/src/ebml/no-ansi.patch
 create mode 100644 contrib/src/matroska/no-ansi.patch
 create mode 100644 contrib/src/taglib/no-ansi.patch

diff --git a/contrib/src/ebml/no-ansi.patch b/contrib/src/ebml/no-ansi.patch
new file mode 100644
index 0000000..ba3a866
--- /dev/null
+++ b/contrib/src/ebml/no-ansi.patch
@@ -0,0 +1,12 @@
+diff -ur libebml.orig/make/linux/Makefile libebml/make/linux/Makefile
+--- libebml.orig/make/linux/Makefile	2012-03-29 16:03:42.965538360 -0400
++++ libebml/make/linux/Makefile	2012-03-29 16:04:03.673538362 -0400
+@@ -61,7 +61,7 @@
+ objects:=$(patsubst %$(EXTENSION),%.o,$(sources))
+ objects_so:=$(objects)
+ 
+-WARNINGFLAGS=-Wall -Wno-unknown-pragmas -ansi -fno-gnu-keywords -Wshadow
++WARNINGFLAGS=-Wall -Wno-unknown-pragmas -fno-gnu-keywords -Wshadow
+ COMPILEFLAGS=$(WARNINGFLAGS) $(CXXFLAGS) $(CPPFLAGS) $(DEBUGFLAGS) $(INCLUDE)
+ DEPENDFLAGS  = $(CXXFLAGS) $(INCLUDE)
+ 
diff --git a/contrib/src/ebml/rules.mak b/contrib/src/ebml/rules.mak
index bd3b07c..4df752d 100644
--- a/contrib/src/ebml/rules.mak
+++ b/contrib/src/ebml/rules.mak
@@ -12,6 +12,7 @@ $(TARBALLS)/libebml-$(EBML_VERSION).tar.bz2:
 libebml: libebml-$(EBML_VERSION).tar.bz2 .sum-ebml
 	$(UNPACK)
 	$(APPLY) $(SRC)/ebml/ebml-pic.patch
+	$(APPLY) $(SRC)/ebml/no-ansi.patch
 	$(MOVE)
 
 .ebml: libebml
diff --git a/contrib/src/freetype2/rules.mak b/contrib/src/freetype2/rules.mak
index 65c8acf..dda8a52 100644
--- a/contrib/src/freetype2/rules.mak
+++ b/contrib/src/freetype2/rules.mak
@@ -18,6 +18,7 @@ freetype: freetype-$(FREETYPE2_VERSION).tar.gz .sum-freetype2
 	$(MOVE)
 
 .freetype2: freetype
+	sed -i.orig s/-ansi// $</builds/unix/configure
 	cd $< && GNUMAKE=$(MAKE) $(HOSTVARS) ./configure $(HOSTCONF)
 	cd $< && $(MAKE) install
 	touch $@
diff --git a/contrib/src/main.mak b/contrib/src/main.mak
index 4de50a2..9625500 100644
--- a/contrib/src/main.mak
+++ b/contrib/src/main.mak
@@ -114,7 +114,7 @@ else
     ANDROID_CPU_FLAGS = -mcpu=arm1136jf-s -mfpu=vfp
 endif
 endif
-EXTRA_CFLAGS += -D__STDC_VERSION__=199901L -I$(ANDROID_NDK)/sources/cxx-stl/gnu-libstdc++/include
+EXTRA_CFLAGS += -I$(ANDROID_NDK)/sources/cxx-stl/gnu-libstdc++/include
 EXTRA_CFLAGS += -I$(ANDROID_NDK)/sources/cxx-stl/gnu-libstdc++/libs/$(ANDROID_ABI)/include
 EXTRA_CFLAGS += -mfloat-abi=softfp $(ANDROID_CPU_FLAGS)
 endif
diff --git a/contrib/src/matroska/no-ansi.patch b/contrib/src/matroska/no-ansi.patch
new file mode 100644
index 0000000..744962d
--- /dev/null
+++ b/contrib/src/matroska/no-ansi.patch
@@ -0,0 +1,12 @@
+diff -ru libmatroska.orig/make/linux/Makefile libmatroska/make/linux/Makefile
+--- libmatroska.orig/make/linux/Makefile	2012-03-29 16:04:40.525538362 -0400
++++ libmatroska/make/linux/Makefile	2012-03-29 16:04:58.105538361 -0400
+@@ -67,7 +67,7 @@
+ 
+ objects_so:=$(objects)
+ 
+-WARNINGFLAGS=-Wall -Wno-unknown-pragmas -ansi -fno-gnu-keywords -D_GNU_SOURCE \
++WARNINGFLAGS=-Wall -Wno-unknown-pragmas -fno-gnu-keywords -D_GNU_SOURCE \
+ 		-Wshadow
+ COMPILEFLAGS=$(DEBUGFLAGS) $(CXXFLAGS) $(CPPFLAGS) $(WARNINGFLAGS) $(INCLUDE)
+ LINKFLAGS=-L. -L$(LIBEBML_LIB_DIR) $(LDFLAGS)
diff --git a/contrib/src/matroska/rules.mak b/contrib/src/matroska/rules.mak
index 6845e1d..62ecf0d 100644
--- a/contrib/src/matroska/rules.mak
+++ b/contrib/src/matroska/rules.mak
@@ -15,6 +15,7 @@ $(TARBALLS)/libmatroska-$(MATROSKA_VERSION).tar.bz2:
 libmatroska: libmatroska-$(MATROSKA_VERSION).tar.bz2 .sum-matroska
 	$(UNPACK)
 	$(APPLY) $(SRC)/matroska/matroska-pic.patch
+	$(APPLY) $(SRC)/matroska/no-ansi.patch
 	$(MOVE)
 
 .matroska: libmatroska
diff --git a/contrib/src/taglib/no-ansi.patch b/contrib/src/taglib/no-ansi.patch
new file mode 100644
index 0000000..76b961a
--- /dev/null
+++ b/contrib/src/taglib/no-ansi.patch
@@ -0,0 +1,14 @@
+diff -ru taglib.orig/CMakeLists.txt taglib/CMakeLists.txt
+--- taglib.orig/CMakeLists.txt	2012-03-29 16:07:01.933538361 -0400
++++ taglib/CMakeLists.txt	2012-03-29 16:07:09.545538361 -0400
+@@ -24,8 +24,8 @@
+ 
+ if (CMAKE_COMPILER_IS_GNUCXX)
+    if (CMAKE_SYSTEM_NAME MATCHES Linux)
+-     set ( CMAKE_C_FLAGS     "${CMAKE_C_FLAGS} -Wno-long-long -ansi -Wundef -Wcast-align -Werror-implicit-function-declaration -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -fno-common")
+-     set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Wno-long-long -ansi -Wundef -Wcast-align -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -fno-check-new -fno-common")
++     set ( CMAKE_C_FLAGS     "${CMAKE_C_FLAGS} -Wno-long-long -Wundef -Wcast-align -Werror-implicit-function-declaration -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -fno-common")
++     set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Wno-long-long -Wundef -Wcast-align -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -fno-check-new -fno-common")
+    endif (CMAKE_SYSTEM_NAME MATCHES Linux)
+ endif (CMAKE_COMPILER_IS_GNUCXX)
+ if(MSVC)
diff --git a/contrib/src/taglib/rules.mak b/contrib/src/taglib/rules.mak
index 2ec0931..c19f3ba 100644
--- a/contrib/src/taglib/rules.mak
+++ b/contrib/src/taglib/rules.mak
@@ -13,6 +13,7 @@ $(TARBALLS)/taglib-$(TAGLIB_VERSION).tar.gz:
 taglib: taglib-$(TAGLIB_VERSION).tar.gz .sum-taglib
 	$(UNPACK)
 	$(APPLY) $(SRC)/taglib/taglib-static.patch
+	$(APPLY) $(SRC)/taglib/no-ansi.patch
 ifdef HAVE_WIN32
 	$(APPLY) $(SRC)/taglib/taglib-win32.patch
 endif
-- 
1.7.9.1



More information about the vlc-devel mailing list