Sophie

Sophie

distrib > * > 2008.0 > x86_64 > by-pkgid > fd784d835508651aa41b3a6d97f8cdb4 > files > 2

libdv-1.0.0-1mdv2008.0.src.rpm

#!/bin/sh -e
## 10_zap_config_h.dpatch by Daniel Kobras <kobras@debian.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: dv_types.h is part of the libdv API that has to be included
## DP: in application code. Therefore, it may not reference libdv's
## DP: private config.h.
## DP: Of course, config.h was included for a reason, and this patch
## DP: tries to cover it up, because at least in the scope of the
## DP: Debian package we can reliably guess at the contents of config.h.

if [ $# -lt 1 ]; then
    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    exit 1
fi

[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
patch_opts="${patch_opts:--f --no-backup-if-mismatch}"

case "$1" in
       -patch) patch $patch_opts -p1 < $0;;
       -unpatch) patch $patch_opts -p1 -R < $0;;
        *)
                echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
                exit 1;;
esac

exit 0

@DPATCH@
diff -urNad --exclude=CVS --exclude=.svn ./libdv/dv_types.h /tmp/dpep-work.X4gSie/libdv/libdv/dv_types.h
--- ./libdv/dv_types.h	2005-07-10 19:31:16.000000000 +0200
+++ /tmp/dpep-work.X4gSie/libdv/libdv/dv_types.h	2005-07-10 19:58:28.000000000 +0200
@@ -26,10 +26,11 @@
 #ifndef DV_TYPES_H
 #define DV_TYPES_H
 
-#if HAVE_CONFIG_H
-# include <config.h>
-#endif
-
+/* The Debian package is always compiled with popt support, but using it
+ * in an application is optional. Declare HAVE_LIBPOPT before including
+ * the libdv headers in order to access popt-specific entries in the
+ * libdv API.
+ */
 #if HAVE_LIBPOPT
 #include <popt.h>
 #endif // HAVE_LIBPOPT
@@ -38,11 +39,11 @@
 #include <inttypes.h>
 #include <stdio.h>
 #include <time.h>
-#if HAVE_ENDIAN_H
+/* FIXME Some systems use machine/endian.h instead. We probably ought to
+ * AC_SUBST the correct value in here. (Or use a namespace-clean dvconfig.h.)
+ * This quick fix should do for glibc-based systems.
+ */
 #include <endian.h>
-#elif HAVE_MACHINE_ENDIAN_H
-#include <machine/endian.h>
-#endif
 
 /* please tell me these are defined somewhere standard??? */
 #ifndef FALSE
@@ -61,16 +62,33 @@
 #define CLAMP(a,x,b) (MIN(b,MAX(a,x)))
 #endif
 
+/* FIXME These values indicate whether libdv was built with asm optimizations.
+ * It had better be AC_SUBSTed, but for the purpose of the Debian package, we
+ * can easily guess the correct value from standard compiler macros.
+ */
+#if !defined(ARCH_X86) && !defined(ARCH_X86_64)
+# if defined (__x86_64)
+#  define ARCH_X86 0
+#  define ARCH_X86_64 1
+# elif defined(i386)
+#  define ARCH_X86 1
+#  define ARCH_X86_64 0
+# else
+#  define ARCH_X86 0
+#  define ARCH_X86_64 0
+# endif
+#endif
+			       
 // For now assume ARCH_X86 means GCC with hints.
 #ifdef ARCH_X86
-#define HAVE_GCC 1
+#define LIBDV_HAVE_GCC 1
 #endif
 #ifdef ARCH_X86_64
-#define HAVE_GCC 1
+#define LIBDV_HAVE_GCC 1
 #endif
-//#define HAVE_GCC 0
+//#define LIBDV_HAVE_GCC 0
 
-#if HAVE_GCC
+#if LIBDV_HAVE_GCC
 #define ALIGN64 __attribute__ ((aligned (64)))
 #define ALIGN32 __attribute__ ((aligned (32)))
 #define ALIGN8 __attribute__ ((aligned (8)))