summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libdvbpsi-1-fix-include.patch32
-rw-r--r--src/libdvbpsi-1.patch69
-rw-r--r--src/libdvbpsi-2-fix-no-asprintf.patch156
-rw-r--r--src/libdvbpsi.mk1
4 files changed, 189 insertions, 69 deletions
diff --git a/src/libdvbpsi-1-fix-include.patch b/src/libdvbpsi-1-fix-include.patch
new file mode 100644
index 0000000..4e0c540
--- /dev/null
+++ b/src/libdvbpsi-1-fix-include.patch
@@ -0,0 +1,32 @@
+This file is part of MXE.
+See index.html for further information.
+
+Submitted to upstream at
+https://mailman.videolan.org/pipermail/libdvbpsi-devel/2014-June/000737.html
+
+From 278634b51875f3b85817315bed05c448f852a70f Mon Sep 17 00:00:00 2001
+From: Guilherme Lima Bernal <lb-guilherme@live.com>
+Date: Tue, 24 Jun 2014 14:51:11 -0700
+Subject: [PATCH 1/3] src/descriptor: fix include on MinGW
+
+Signed-off-by: Timothy Gu <timothygu99@gmail.com>
+---
+ src/descriptor.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/descriptor.h b/src/descriptor.h
+index f344a73..1d1364a 100644
+--- a/src/descriptor.h
++++ b/src/descriptor.h
+@@ -39,6 +39,8 @@
+ extern "C" {
+ #endif
+
++#include <sys/types.h>
++
+ /*****************************************************************************
+ * common definitions
+ *****************************************************************************/
+--
+1.9.1
+
diff --git a/src/libdvbpsi-1.patch b/src/libdvbpsi-1.patch
deleted file mode 100644
index 80159f8..0000000
--- a/src/libdvbpsi-1.patch
+++ /dev/null
@@ -1,69 +0,0 @@
-This file is part of MXE.
-See index.html for further information.
-
-diff --git a/src/descriptor.h b/src/descriptor.h
---- a/src/descriptor.h
-+++ b/src/descriptor.h
-@@ -41,6 +41,7 @@
- #ifdef __cplusplus
- extern "C" {
- #endif
-+#include <sys/types.h>
-
- /*****************************************************************************
- * common definitions
-
-diff --git a/configure b/configure
---- a/configure
-+++ b/configure
-@@ -11864,7 +11864,7 @@
-
- CFLAGS_save="${CFLAGS}"
-
--CFLAGS_dist="-Wall -Werror --std=gnu99 -D_GNU_SOURCE"
-+CFLAGS_dist="-Wall -Werror --std=gnu99"
- CFLAGS_dist="${CFLAGS_dist} -Wpointer-arith -Wcast-align -Wcast-qual -Wstrict-prototypes -Wshadow -Waggregate-return -Wmissing-prototypes -Wnested-externs -Wsign-compare"
-
- case "${target_os}" in
-
-diff --git a/src/dvbpsi.c b/src/dvbpsi.c
---- a/src/dvbpsi.c
-+++ b/src/dvbpsi.c
-@@ -531,12 +531,12 @@
- va_end(ap);
- return;
- }
-- if (snprintf(&msg, DVBPSI_MSG_SIZE, DVBPSI_MSG_FORMAT, ap) < 0) {
-+ if (snprintf(msg, DVBPSI_MSG_SIZE, DVBPSI_MSG_FORMAT, ap) < 0) {
- va_end(ap);
- free(msg);
- return;
- }
-- int err = vsnprintf(&msg, DVBPSI_MSG_SIZE, fmt, ap);
-+ int err = vsnprintf(msg, DVBPSI_MSG_SIZE, fmt, ap);
- #endif
- va_end(ap);
- if (err > DVBPSI_MSG_NONE) {
-@@ -575,7 +575,7 @@
- free(msg); \
- } while(0);
- # else
--# define DVBPSI_MSG_COMMON \
-+# define DVBPSI_MSG_COMMON(level) \
- do { \
- va_list ap; \
- va_start(ap, fmt); \
-@@ -584,11 +584,11 @@
- va_end(ap); \
- return; \
- } \
-- if (snprintf(&msg, DVBPSI_MSG_SIZE, DVBPSI_MSG_FORMAT, src) < 0) { \
-+ if (snprintf(msg, DVBPSI_MSG_SIZE, DVBPSI_MSG_FORMAT, "?", src) < 0) { \
- va_end(ap); \
- return; \
- } \
-- int err = vsnprintf(&msg, DVBPSI_MSG_SIZE, fmt, ap); \
-+ int err = vsnprintf(msg, DVBPSI_MSG_SIZE, fmt, ap); \
- va_end(ap); \
- if (err > 0) { \
- if (dvbpsi->pf_message) \
diff --git a/src/libdvbpsi-2-fix-no-asprintf.patch b/src/libdvbpsi-2-fix-no-asprintf.patch
new file mode 100644
index 0000000..8e71a47
--- /dev/null
+++ b/src/libdvbpsi-2-fix-no-asprintf.patch
@@ -0,0 +1,156 @@
+This file is part of MXE.
+See index.html for further information.
+
+Submitted to upstream at
+https://mailman.videolan.org/pipermail/libdvbpsi-devel/2014-June/000738.html
+https://mailman.videolan.org/pipermail/libdvbpsi-devel/2014-June/000739.html
+
+From ada90a3c9a5e8b1c8d214f9e9e82499b54060419 Mon Sep 17 00:00:00 2001
+From: Timothy Gu <timothygu99@gmail.com>
+Date: Tue, 24 Jun 2014 14:57:31 -0700
+Subject: [PATCH 2/3] dvbpsi: fix when _GNU_SOURCE is not defined
+
+Based on a patch by Guilherme Lima Bernal <lb-guilherme@live.com>.
+
+Signed-off-by: Timothy Gu <timothygu99@gmail.com>
+---
+ src/dvbpsi.c | 22 +++++++++++++---------
+ 1 file changed, 13 insertions(+), 9 deletions(-)
+
+diff --git a/src/dvbpsi.c b/src/dvbpsi.c
+index 89d4932..141e3df 100644
+--- a/src/dvbpsi.c
++++ b/src/dvbpsi.c
+@@ -529,14 +529,10 @@ void dvbpsi_message(dvbpsi_t *dvbpsi, const dvbpsi_msg_level_t level, const char
+ msg = malloc(DVBPSI_MSG_SIZE);
+ if (msg == NULL) {
+ va_end(ap);
+- return;
+- }
+- if (snprintf(&msg, DVBPSI_MSG_SIZE, DVBPSI_MSG_FORMAT, ap) < 0) {
+- va_end(ap);
+ free(msg);
+ return;
+ }
+- int err = vsnprintf(&msg, DVBPSI_MSG_SIZE, fmt, ap);
++ int err = vsnprintf(msg, DVBPSI_MSG_SIZE, fmt, ap);
+ #endif
+ va_end(ap);
+ if (err > DVBPSI_MSG_NONE) {
+@@ -575,20 +571,28 @@ void dvbpsi_message(dvbpsi_t *dvbpsi, const dvbpsi_msg_level_t level, const char
+ free(msg); \
+ } while(0);
+ # else
+-# define DVBPSI_MSG_COMMON \
++# define DVBPSI_MSG_COMMON(level) \
+ do { \
+ va_list ap; \
+ va_start(ap, fmt); \
+ char *msg = malloc(DVBPSI_MSG_SIZE); \
+- if (msg == NULL) { \
++ char *tmp = malloc(DVBPSI_MSG_SIZE); \
++ if (msg == NULL || tmp == NULL) { \
+ va_end(ap); \
++ if (msg) \
++ free(msg); \
++ if (tmp) \
++ free(tmp); \
+ return; \
+ } \
+- if (snprintf(&msg, DVBPSI_MSG_SIZE, DVBPSI_MSG_FORMAT, src) < 0) { \
++ if (vsnprintf(tmp, DVBPSI_MSG_SIZE, fmt, ap) < 0) { \
+ va_end(ap); \
++ free(tmp); \
++ free(msg); \
+ return; \
+ } \
+- int err = vsnprintf(&msg, DVBPSI_MSG_SIZE, fmt, ap); \
++ int err = snprintf(msg, DVBPSI_MSG_SIZE, DVBPSI_MSG_FORMAT, src, tmp); \
++ free(tmp); \
+ va_end(ap); \
+ if (err > 0) { \
+ if (dvbpsi->pf_message) \
+--
+1.9.1
+
+From a2117900002bc8f9e0f821d872f8cd70ece67634 Mon Sep 17 00:00:00 2001
+From: Timothy Gu <timothygu99@gmail.com>
+Date: Thu, 26 Jun 2014 13:41:02 -0700
+Subject: [PATCH 3/3] Add a separate check for [v]asprintf() instead of
+ checking for _GNU_SOURCE
+
+Platforms like i686-pc-mingw32 defines _GNU_SOURCE but does not contain
+the functions.
+
+Signed-off-by: Timothy Gu <timothygu99@gmail.com>
+---
+ configure.ac | 21 +++++++++++++++++++++
+ src/dvbpsi.c | 6 +++---
+ 2 files changed, 24 insertions(+), 3 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 2a97e5b..f95c186 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -100,6 +100,27 @@ if test "${ac_cv_cpp_variadic_macros}" != "no"; then
+ AC_DEFINE(HAVE_VARIADIC_MACROS, 1, Support for variadic macros)
+ fi
+
++dnl Check for asprintf(). Systems with asprintf() must also have vasprintf(),
++dnl so it is not checked separately.
++AC_CACHE_CHECK([for asprintf()],
++ [ac_cv_asprintf],
++ [AC_COMPILE_IFELSE([
++ AC_LANG_SOURCE([[
++ #include <stdio.h>
++ #include <stdlib.h>
++ int main(void) {
++ char *text = NULL;
++ int ret = asprintf(&text, "test");
++ if (ret >= 0) free(text);
++ return 0;
++ }
++ ]])],
++ ac_cv_asprintf=yes,
++ ac_cv_asprintf=no)])
++if test "${ac_cv_asprintf}" != "no"; then
++ AC_DEFINE(HAVE_ASPRINTF, 1, [Support for asprintf() and vasprintf()])
++fi
++
+ dnl
+ dnl Generate Makefiles and other output files
+ dnl
+diff --git a/src/dvbpsi.c b/src/dvbpsi.c
+index 141e3df..29ae2b0 100644
+--- a/src/dvbpsi.c
++++ b/src/dvbpsi.c
+@@ -508,7 +508,7 @@ bool dvbpsi_packet_push(dvbpsi_t *p_dvbpsi, uint8_t* p_data)
+ * 1 is warning and errors
+ * 2 is debug, warning and errors
+ *****************************************************************************/
+-#if !defined(_GNU_SOURCE)
++#if !defined(HAVE_ASPRINTF)
+ # define DVBPSI_MSG_SIZE 1024
+ #endif
+
+@@ -523,7 +523,7 @@ void dvbpsi_message(dvbpsi_t *dvbpsi, const dvbpsi_msg_level_t level, const char
+ va_list ap;
+ va_start(ap, fmt);
+ char *msg = NULL;
+-#if defined(_GNU_SOURCE)
++#if defined(HAVE_ASPRINTF)
+ int err = vasprintf(&msg, fmt, ap);
+ #else
+ msg = malloc(DVBPSI_MSG_SIZE);
+@@ -545,7 +545,7 @@ void dvbpsi_message(dvbpsi_t *dvbpsi, const dvbpsi_msg_level_t level, const char
+ #else
+
+ /* Common code for printing messages */
+-# if defined(_GNU_SOURCE)
++# if defined(HAVE_ASPRINTF)
+ # define DVBPSI_MSG_COMMON(level) \
+ do { \
+ va_list ap; \
+--
+1.9.1
+
diff --git a/src/libdvbpsi.mk b/src/libdvbpsi.mk
index 5f360c6..640306c 100644
--- a/src/libdvbpsi.mk
+++ b/src/libdvbpsi.mk
@@ -18,6 +18,7 @@ define $(PKG)_UPDATE
endef
define $(PKG)_BUILD
+ cd '$(1)' && autoreconf -fi
cd '$(1)' && ./configure \
$(MXE_CONFIGURE_OPTS) \
--enable-release