Bug 240585

Summary: audio/pulseaudio: Update to 13.0
Product: Ports & Packages Reporter: lightside <lightside>
Component: Individual Port(s)Assignee: freebsd-gnome (Nobody) <gnome>
Status: Closed FIXED    
Severity: Affects Some People CC: gnome, jbeich, kwm
Priority: --- Keywords: patch
Version: LatestFlags: bugzilla: maintainer-feedback? (gnome)
Hardware: Any   
OS: Any   
Attachments:
Description Flags
Proposed patch (since 507372 revision) lightside: maintainer-approval? (gnome)

Description lightside 2019-09-14 23:25:37 UTC
Created attachment 207491 [details]
Proposed patch (since 507372 revision)

Patch to update audio/pulseaudio port from 12.2 to 13.0 version.

Look following links for changes:
https://www.freedesktop.org/wiki/Software/PulseAudio/Notes/13.0/
https://gitlab.freedesktop.org/pulseaudio/pulseaudio/compare/v12.2...v13.0
ABI:
https://abi-laboratory.pro/tracker/timeline/pulseaudio/

- Remove intltool from USE_GNOME variable [1]
- Add src/utils/pa-info to SHEBANG_FILES variable
- Add fix for src/pulsecore/atomic.h [2]
- Add fix for src/tests/atomic-test.c [3]
- Update pkg-plist

For reference:
1. Use upstream gettext instead intltool
https://gitlab.freedesktop.org/pulseaudio/pulseaudio/commit/57e3ccaf51f714eec8ca29005c3cc4fde456e84e

2. Fixes following error, when using WEBRTC_AEC port's option and Clang compiler:
-8<--
In file included from modules/echo-cancel/webrtc.cc:31:
In file included from ./pulsecore/modargs.h:29:
In file included from ./pulsecore/resampler.h:25:
In file included from ./pulsecore/memblock.h:31:
./pulsecore/atomic.h:120:33: error: cannot initialize a parameter of type 'volatile unsigned long' with an lvalue of
      type 'void *'
    __atomic_store_n(&a->value, p, __ATOMIC_SEQ_CST);
                                ^
-->8-

The GCC compiler doesn't report about this (and probably not affected).

This is because of following commit:
atomic: fix load and store for armv7 and higher
https://gitlab.freedesktop.org/pulseaudio/pulseaudio/commit/d4ff4adce2808c31898b4b7d2f60825effb61484

Alternative approach is to define "pulseaudio_cv_atomic_store_n" variable:
CONFIGURE_ENV+=	pulseaudio_cv_atomic_store_n=""

The "uintptr_t" type was used because of:
https://github.com/freebsd/freebsd/blob/e100f32e6e1cd39a01dea1c5e99ba63fe0a2b2e8/contrib/compiler-rt/lib/builtins/emutls.c#L250
https://github.com/freebsd/freebsd/blob/e100f32e6e1cd39a01dea1c5e99ba63fe0a2b2e8/contrib/compiler-rt/lib/builtins/emutls.c#L320-L327
"Integer type capable of holding a value converted from a void pointer and then be converted back to that type with a value that compares equal to the original pointer."
http://www.cplusplus.com/reference/cstdint/

3. Fixes following error (or similar errors):
-8<--
tests/atomic-test.c:58:4: error: unknown type name 'cpu_set_t'; did you mean 'cpusetid_t'?
   cpu_set_t cpuset;
   ^~~~~~~~~
   cpusetid_t
-->8-

Related to [2], but possible to use "--disable-default-build-tests" configure option instead:
CONFIGURE_ARGS+=	--disable-default-build-tests
-8<--
% ./configure --help | grep -h1 disable-default-build-tests | tail -2
  --disable-default-build-tests
                          Build test programs only during make check
-->8-
Comment 1 lightside 2019-09-14 23:27:49 UTC
The "PulseAudio 13.0 release notes":
https://www.freedesktop.org/wiki/Software/PulseAudio/Notes/13.0/
mentions about following bug report:
With latest update on pulseaudio from 12.2-7 --> 12.99.1 makes qt compile impossible
https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/707

With references to following bug reports:
pulseaudio-12.99.1 breaks qtwebengine build
https://bugreports.qt.io/browse/QTBUG-77037
https://bugzilla.redhat.com/show_bug.cgi?id=1729806

Some suggestion in following comment is to use CONFIG+=link_pulseaudio (e.g., for www/qt5-webengine port, when using PULSEAUDIO port's option):
https://bugreports.qt.io/browse/QTBUG-77037?focusedCommentId=468605#comment-468605
Comment 2 Jan Beich freebsd_committer freebsd_triage 2019-09-15 16:15:29 UTC
Thanks for providing rationale for each change. I've added a few of mine:

- Add missing dependency to build tests and confirm files/patch-src_tests_atomic-test.c
- Move tests into a separate option as it has extra dependency
- Allow running tests via "make test"
- Auto-run "make test" if TEST=on to simplify testing on every release/architecture via poudriere;
  To be revisited after https://github.com/freebsd/poudriere/pull/355 lands
- Add missing dependency for building manpages:

  perl ./xmltoman pulseaudio.1.xml > pulseaudio.1 || rm -f pulseaudio.1
  /bin/sh: perl: not found
  Can't locate XML/Parser.pm in @INC (you may need to install the XML::Parser module) (@INC contains: /usr/local/lib/perl5/site_perl/mach/5.30 /usr/local/lib/perl5/site_perl /usr/local/lib/perl5/5.30/mach /usr/local/lib/perl5/5.30 .) at ./xmltoman line 20.
  [...]
   /bin/mkdir -p '/wrkdirs/usr/ports/audio/pulseaudio/work/stage/usr/local/man/man1'
   install  -m 0644 ./pulseaudio.1 ./pax11publish.1 ./pacat.1 ./pacmd.1 ./pactl.1 ./pasuspender.1 ./padsp.1 ./start-pulseaudio-x11.1 '/wrkdirs/usr/ports/audio/pulseaudio/work/stage/usr/local/man/man1'
  install: ./pulseaudio.1: No such file or directory

- Fix some errors in pa-info script:

  > cat /etc/pulse/daemon.conf
  cat: /etc/pulse/daemon.conf: No such file or directory
  ________________
  > cat /etc/pulse/client.conf
  cat: /etc/pulse/client.conf: No such file or directory
  ________________
  > cat /etc/pulse/default.pa
  cat: /etc/pulse/default.pa: No such file or directory
  ________________
  > cat /etc/pulse/system.pa
  cat: /etc/pulse/system.pa: No such file or directory
  ________________
  > jacks_do
  ls: illegal option -- -
  usage: ls [-ABCFGHILPRSTUWZabcdfghiklmnopqrstuwxy1,] [-D format] [file ...]

- Adjust RUN_DEPENDS in net/xrdp:
  ===>   xrdp-0.9.11,1 depends on file: /usr/local/lib/pulse-12.2/modules/module-xrdp-sink.so - not found
  *** Error code 1

- Fix Blink-based consumers by adding "const" to lazy bindings:

  [992/17036] python ../../tools/generate_stubs/generate_stubs.py -i gen/media/audio/pulse -o gen/media/audio/pulse -t posix_stubs -e ../../media/audio/pulse/pulse_stub_header.fragment -s pulse_stubs -p media/audio/pulse ../../media/audio/pulse/pulse.sigs
  [...]
  gen/media/audio/pulse/pulse_stubs.cc:155:27: error: conflicting types for 'pa_context_get_state'
  extern pa_context_state_t pa_context_get_state(pa_context* c) __attribute__((weak));
			    ^
  ../../../../../../../../../../usr/local/include/pulse/context.h:199:20: note: previous declaration is here
  pa_context_state_t pa_context_get_state(const pa_context *c);
		     ^
Comment 3 commit-hook freebsd_committer freebsd_triage 2019-09-15 16:16:04 UTC
A commit references this bug:

Author: jbeich
Date: Sun Sep 15 16:15:05 UTC 2019
New revision: 512113
URL: https://svnweb.freebsd.org/changeset/ports/512113

Log:
  audio/pulseaudio: update to 13.0

  - Connect tests to the framework

  Changes:	https://www.freedesktop.org/wiki/Software/PulseAudio/Notes/13.0/
  ABI:		https://abi-laboratory.pro/tracker/timeline/pulseaudio/
  PR:		240585
  Submitted by:	lightside@gmx.com

Changes:
  head/audio/pulseaudio/Makefile
  head/audio/pulseaudio/distinfo
  head/audio/pulseaudio/files/patch-src_pulsecore_atomic.h
  head/audio/pulseaudio/files/patch-src_tests_atomic-test.c
  head/audio/pulseaudio/pkg-plist
  head/devel/electron4/files/patch-media_audio_pulse_pulse.sigs
  head/net/xrdp/Makefile
  head/www/chromium/files/patch-media_audio_pulse_pulse.sigs
  head/www/iridium/files/patch-media_audio_pulse_pulse.sigs
  head/www/qt5-webengine/files/patch-src_3rdparty_chromium_media_audio_pulse_pulse.sigs
Comment 4 lightside 2019-09-15 19:55:17 UTC
(In reply to Jan Beich from comment #2)
Thanks for your attention and work on this PR.