pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pulseaudio-git: Revamp patch for eliminating __WORDSIZE



Module Name:	pkgsrc-wip
Committed By:	Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By:	kamil
Date:		Sun Dec 20 00:38:24 2015 +0100
Changeset:	69cf48e566157060c583444e57fc0a38973adb48

Modified Files:
	pulseaudio-git/distinfo
	pulseaudio-git/patches/patch-configure.ac
	pulseaudio-git/patches/patch-src_pulsecore_sample-util.h
	pulseaudio-git/patches/patch-src_tests_mult-s16-test.c

Log Message:
pulseaudio-git: Revamp patch for eliminating __WORDSIZE

Proposed COMMIT_MSG for upstream:

NetBSD: Stop depending upon nonstandard __WORDSIZE

There is no way to check CPU type in a portable way across ABIs.

Assume if pointers are 64-bit that CPU is capable to perform fast
64-bit operations. Add an extra check to handle x32-ABI.

PulseAudio by default builds with -Wundef. If we add -Werror=undef this
missing define is fatal. By default build log is full of entries like:

In file included from ./pulsecore/core.h:47:0,
                 from ./pulsecore/module.h:31,
                 from ./pulsecore/sink-input.h:31,
                 from pulsecore/sound-file-stream.c:36:
./pulsecore/sample-util.h: In function 'pa_mult_s16_volume':
./pulsecore/sample-util.h:58:5: warning: "__WORDSIZE" is not defined [-Wundef]
 #if __WORDSIZE == 64 || ((ULONG_MAX) > (UINT_MAX))
     ^

(NetBSD-7.99.21 with default GCC 4.8.5)

This change fixes build issues on NetBSD.

This also address a bug reported by Shawn Walker from Oracle (possibly Solaris):
Bug 90880 - builds can fail due to non-portable glibc-specific internal macro usage

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=69cf48e566157060c583444e57fc0a38973adb48

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 pulseaudio-git/distinfo                            |  6 ++---
 pulseaudio-git/patches/patch-configure.ac          | 24 +++++++++++------
 .../patches/patch-src_pulsecore_sample-util.h      | 28 ++++++++------------
 .../patches/patch-src_tests_mult-s16-test.c        | 30 +++++++++-------------
 4 files changed, 41 insertions(+), 47 deletions(-)

diffs:
diff --git a/pulseaudio-git/distinfo b/pulseaudio-git/distinfo
index 37ee2df..9707032 100644
--- a/pulseaudio-git/distinfo
+++ b/pulseaudio-git/distinfo
@@ -5,15 +5,15 @@ RMD160 (pulseaudio-7.1.tar.gz) = f6138695f1cfddfcb72654e8b204b0731c8a2234
 SHA512 (pulseaudio-7.1.tar.gz) = c2b8946a4dfb4fa2a8c7a504d9375bd51086c0f2f40aa6ddbb56115815a01665f491507d367baa375bc9595e31bb0d88f15208a1c2ad507bfa40e1bde1213091
 Size (pulseaudio-7.1.tar.gz) = 2686090 bytes
 SHA1 (patch-aa) = b4143badf668a0887c903971bf26cd4d5b1604b4
-SHA1 (patch-configure.ac) = 18ae809e829573af27e148d0846d92c83f8436ce
+SHA1 (patch-configure.ac) = b9b33da41687090a305c364532b816eb23c7212d
 SHA1 (patch-src_Makefile.am) = 4533c3123d4beba08165e40137b73ae37ce62b31
 SHA1 (patch-src_daemon_main.c) = d00ea97a3fd6e14976a0cc8eb7f7db811a990fe5
 SHA1 (patch-src_modules_module-detect.c) = 4e1db6d3b3224c097ecd981d3f055880ecff780a
 SHA1 (patch-src_modules_module-solaris.c) = 814fefd672f9db75ef3209b50538e2a71aceaf01
 SHA1 (patch-src_modules_oss_module-oss.c) = 6199e48a842dc076b14d039c249295566bcb2c03
 SHA1 (patch-src_pulsecore_mix__neon.c) = a0810584e0271b0e6ac019e0716e99f6022872ef
-SHA1 (patch-src_pulsecore_sample-util.h) = 34600ac03317633700eb1295d28151a49144cb9e
+SHA1 (patch-src_pulsecore_sample-util.h) = 6407a03409422fa20adcfcb5966065b96ad9c23b
 SHA1 (patch-src_pulsecore_svolume__mmx.c) = d94c619ce46f56d55a4964c2626b29cab097418a
 SHA1 (patch-src_pulsecore_svolume__sse.c) = 393528e041fdc22e1d5a8b840ed26ecf83e3f981
-SHA1 (patch-src_tests_mult-s16-test.c) = 5a6195c9274783bbcfad728608b84e3dde87afa5
+SHA1 (patch-src_tests_mult-s16-test.c) = 2927296b74b8599bfb7091713f939b192f0bd9be
 SHA1 (patch-src_tests_rtpoll-test.c) = 2f9f1a523dd2375827ed9a96f32f531592cc423f
diff --git a/pulseaudio-git/patches/patch-configure.ac b/pulseaudio-git/patches/patch-configure.ac
index 0a5849a..69a7c25 100644
--- a/pulseaudio-git/patches/patch-configure.ac
+++ b/pulseaudio-git/patches/patch-configure.ac
@@ -6,7 +6,7 @@ $NetBSD$
   file framework will install them in the right place.
 * Avoid hardcoded SDK paths on Darwin.
 
---- configure.ac.orig	2015-12-08 11:29:36.000000000 +0000
+--- configure.ac.orig	2015-12-19 23:04:33.000000000 +0000
 +++ configure.ac
 @@ -21,7 +21,7 @@
  
@@ -25,17 +25,25 @@ $NetBSD$
          os_is_linux=1
      ;;
      freebsd*)
-@@ -463,6 +462,9 @@ AC_TYPE_OFF_T
+@@ -463,6 +462,17 @@ AC_TYPE_OFF_T
  AC_TYPE_UID_T
  AC_CHECK_DECLS(environ)
  
-+# Used to deduct CPU word size
 +AC_CHECK_SIZEOF(void*)
 +
++fast_64bit_operations="no"
++# This check covers x32-ABI
++AC_CHECK_DECL([__x86_64__], [fast_64bit_operations="yes"], [], [])
++if test "x$fast_64bit_operations" = "xno"; then
++    AS_IF([test $ac_cv_sizeof_void_p -eq 8], [fast_64bit_operations="yes"])
++fi
++
++AS_IF([test "x$fast_64bit_operations" = "xyes"], AC_DEFINE([HAVE_FAST_64BIT_OPERATIONS], 1, [Have CPU with fast 64-bit operations?]))
++
  # SIGXCPU
  AX_CHECK_DEFINE([signal.h], [SIGXCPU], [HAVE_SIGXCPU=1], [HAVE_SIGXCPU=0])
  AS_IF([test "x$HAVE_SIGXCPU" = "x1"], AC_DEFINE([HAVE_SIGXCPU], 1, [Have SIGXCPU?]))
-@@ -523,15 +525,9 @@ AC_SEARCH_LIBS([backtrace], [execinfo ub
+@@ -523,15 +533,9 @@ AC_SEARCH_LIBS([backtrace], [execinfo ub
  if test "x$os_is_darwin" = "x1" ; then
      AC_MSG_CHECKING([looking for Apple CoreService Framework])
      # How do I check a framework "library" - AC_CHECK_LIB prob. won't work??, just assign LIBS & hope
@@ -53,7 +61,7 @@ $NetBSD$
      AC_DEFINE([HAVE_CLOCK_GETTIME], 1, [Using clock_gettime() replacement])
      HAVE_BONJOUR=1
  fi
-@@ -1002,7 +998,7 @@ AS_IF([test "x$HAVE_DBUS" = "x1"], AC_DE
+@@ -1002,7 +1006,7 @@ AS_IF([test "x$HAVE_DBUS" = "x1"], AC_DE
  
  PA_MACHINE_ID="${sysconfdir}/machine-id"
  AX_DEFINE_DIR(PA_MACHINE_ID, PA_MACHINE_ID, [D-Bus machine-id file])
@@ -62,7 +70,7 @@ $NetBSD$
  AX_DEFINE_DIR(PA_MACHINE_ID_FALLBACK, PA_MACHINE_ID_FALLBACK,
  	      [Fallback machine-id file])
  
-@@ -1325,9 +1321,9 @@ fi
+@@ -1325,9 +1329,9 @@ fi
  
  PA_SYSTEM_RUNTIME_PATH="${localstatedir}/run/pulse"
  AX_DEFINE_DIR(PA_SYSTEM_RUNTIME_PATH, PA_SYSTEM_RUNTIME_PATH, [System runtime dir])
@@ -74,7 +82,7 @@ $NetBSD$
  AX_DEFINE_DIR(PA_SYSTEM_STATE_PATH, PA_SYSTEM_STATE_PATH, [System state dir])
  
  PA_BINARY=${bindir}/pulseaudio${EXEEXT}
-@@ -1339,8 +1335,9 @@ AX_DEFINE_DIR(PACTL_BINARY, PACTL_BINARY
+@@ -1339,8 +1343,9 @@ AX_DEFINE_DIR(PACTL_BINARY, PACTL_BINARY
  AC_SUBST(PA_SOEXT, [.so])
  AC_DEFINE(PA_SOEXT, [".so"], [Shared object extension])
  
@@ -86,7 +94,7 @@ $NetBSD$
  
  #### Mac OSX specific stuff #####
  
-@@ -1356,17 +1353,6 @@ AC_ARG_WITH(mac-sysroot,
+@@ -1356,17 +1361,6 @@ AC_ARG_WITH(mac-sysroot,
      AS_HELP_STRING([--with-mac-sysroot=<path>], [SDK basedir to use as the logical root directory for headers and libraries.]),
      mac_sysroot=$withval, mac_sysroot="/Developer/SDKs/MacOSX10.5.sdk")
  
diff --git a/pulseaudio-git/patches/patch-src_pulsecore_sample-util.h b/pulseaudio-git/patches/patch-src_pulsecore_sample-util.h
index 5de36b3..5a42b0a 100644
--- a/pulseaudio-git/patches/patch-src_pulsecore_sample-util.h
+++ b/pulseaudio-git/patches/patch-src_pulsecore_sample-util.h
@@ -1,21 +1,13 @@
-$NetBSD: patch-src_pulsecore_sample-util.h,v 1.1 2014/06/09 13:08:19 ryoon Exp $
+$NetBSD$
 
-Define glibc-specific (?) __WORDSIZE.
-
---- src/pulsecore/sample-util.h.orig	2015-11-28 09:05:41.000000000 +0000
+--- src/pulsecore/sample-util.h.orig	2015-12-05 22:03:14.000000000 +0000
 +++ src/pulsecore/sample-util.h
-@@ -32,6 +32,14 @@
- #include <pulsecore/memblock.h>
- #include <pulsecore/memchunk.h>
+@@ -55,7 +55,7 @@ void pa_deinterleave(const void *src, vo
+ void pa_sample_clamp(pa_sample_format_t format, void *dst, size_t dstr, const void *src, size_t sstr, unsigned n);
  
-+#if !defined __WORDSIZE
-+# if defined __LP64__
-+#  define __WORDSIZE     64
-+# else
-+#  define __WORDSIZE     32
-+# endif
-+#endif
-+
- typedef struct pa_silence_cache {
-     pa_memblock* blocks[PA_SAMPLE_MAX];
- } pa_silence_cache;
+ static inline int32_t pa_mult_s16_volume(int16_t v, int32_t cv) {
+-#if __WORDSIZE == 64 || ((ULONG_MAX) > (UINT_MAX))
++#if HAVE_FAST_64BIT_OPERATIONS
+     /* Multiply with 64 bit integers on 64 bit platforms */
+     return (v * (int64_t) cv) >> 16;
+ #else
diff --git a/pulseaudio-git/patches/patch-src_tests_mult-s16-test.c b/pulseaudio-git/patches/patch-src_tests_mult-s16-test.c
index 43cc291..bc1bb7e 100644
--- a/pulseaudio-git/patches/patch-src_tests_mult-s16-test.c
+++ b/pulseaudio-git/patches/patch-src_tests_mult-s16-test.c
@@ -1,26 +1,20 @@
-$NetBSD: patch-src_tests_mult-s16-test.c,v 1.1 2014/06/09 13:08:19 ryoon Exp $
+$NetBSD$
 
-Define glibc-specific (?) __WORDSIZE.
-
---- src/tests/mult-s16-test.c.orig	2015-12-07 11:45:13.000000000 +0000
+--- src/tests/mult-s16-test.c.orig	2015-12-05 22:03:14.000000000 +0000
 +++ src/tests/mult-s16-test.c
-@@ -23,6 +23,7 @@
- #include <unistd.h>
- #include <stdlib.h>
- #include <math.h>
-+#include <limits.h>
- 
- #include <pulse/rtclock.h>
- #include <pulsecore/random.h>
-@@ -93,9 +94,9 @@ int main(int argc, char *argv[]) {
+@@ -93,12 +93,10 @@ int main(int argc, char *argv[]) {
      if (!getenv("MAKE_CHECK"))
          pa_log_set_level(PA_LOG_DEBUG);
  
 -#if __WORDSIZE == 64 || ((ULONG_MAX) > (UINT_MAX))
-+#if (SIZEOF_VOIDP * CHAR_BIT) == 64
-     pa_log_debug("This seems to be 64-bit code.");
+-    pa_log_debug("This seems to be 64-bit code.");
 -#elif  __WORDSIZE == 32
-+#elif (SIZEOF_VOIDP * CHAR_BIT) == 32
-     pa_log_debug("This seems to be 32-bit code.");
+-    pa_log_debug("This seems to be 32-bit code.");
++#if HAVE_FAST_64BIT_OPERATIONS
++    pa_log_debug("Detected CPU with fast 64-bit operations.");
  #else
-     pa_log_debug("Don't know if this is 32- or 64-bit code.");
+-    pa_log_debug("Don't know if this is 32- or 64-bit code.");
++    pa_log_debug("Not detected CPU with fast 64-bit operations.");
+ #endif
+ 
+     s = suite_create("Mult-s16");


Home | Main Index | Thread Index | Old Index