tl;dr: drop our own port which only exists for Mumble and use the
bundeld CELT version like FreeBSD and (some) Linux distributions do.
To do so, little OpenBSD specific code is required in the CELT codec's
abstraction layers, see the patches for adding a sandboxing stub as well
as routines around futex(2) - it is simple.
The only small downside in this is that I had to disable RNNoise support
since CELT and and RNNoise code use the same symbols which conflict at
link-time.
"Configure > Settings > Audio Input > Audio Processing" has a checkbox
for RNNoise which is off by default; with this diff the checkbox no
longer exists, but then again I have never experienced noise problems
when recording with my notebook's microphone - it just worked and others
hear me clearly without disturbance.
Mumble builds and runs just fine without audio/celt07 installed.
After this diff, audio/celt07 can be removed completely.
Feedback? OK?
Index: Makefile
===================================================================
RCS file: /cvs/ports/audio/mumble/Makefile,v
retrieving revision 1.43
diff -u -p -r1.43 Makefile
--- Makefile 5 Apr 2020 02:46:58 -0000 1.43
+++ Makefile 5 Apr 2020 02:58:10 -0000
@@ -3,7 +3,7 @@
COMMENT = low-latency voice chat client
DISTNAME = mumble-1.3.0
-REVISION = 3
+REVISION = 4
CATEGORIES = audio
@@ -22,8 +22,7 @@ DEBUG_PACKAGES = ${BUILD_PACKAGES}
MODULES = devel/qmake x11/qt5
-BUILD_DEPENDS = audio/celt07 \
- devel/boost
+BUILD_DEPENDS = devel/boost
LIB_DEPENDS = audio/libsndfile>=1.0.25p0 \
audio/opus \
@@ -32,8 +31,7 @@ LIB_DEPENDS = audio/libsndfile>=1.0.25p
devel/protobuf \
x11/qt5/qtsvg
-RUN_DEPENDS = audio/celt07 \
- devel/desktop-file-utils \
+RUN_DEPENDS = devel/desktop-file-utils \
x11/gtk+3,-guic
# CONFIG+=c++11 because of protobuf
@@ -43,7 +41,6 @@ MODQMAKE_ARGS = MUMBLE_PREFIX=${PREFIX}
CONFIG+=no-11x \
CONFIG+=no-alsa \
CONFIG+=no-bonjour \
- CONFIG+=no-bundled-celt \
CONFIG+=no-bundled-opus \
CONFIG+=no-bundled-speex \
CONFIG+=no-crash-report \
@@ -61,6 +58,11 @@ MODQMAKE_ARGS = MUMBLE_PREFIX=${PREFIX}
CONFIG+=release \
DEFINES+="LOCALE_PATH=${PREFIX}/share/mumble/locale" \
DEFINES+="PLUGIN_PATH=${PREFIX}/lib/mumble"
+
+# use bundled CELT version, but disable RNNoise compression filter due to
+# duplicate symbols.
+MODQMAKE_ARGS += CONFIG+=no-rnnoise \
+ CONFIG+=sbcelt \
ALL_TARGET = release
Index: patches/patch-3rdparty_sbcelt-helper-build_sbcelt-helper-build_pro
===================================================================
RCS file: patches/patch-3rdparty_sbcelt-helper-build_sbcelt-helper-build_pro
diff -N patches/patch-3rdparty_sbcelt-helper-build_sbcelt-helper-build_pro
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-3rdparty_sbcelt-helper-build_sbcelt-helper-build_pro 5 Apr
2020 02:58:10 -0000
@@ -0,0 +1,17 @@
+$OpenBSD$
+
+Support OpenBSD in SBCELT.
+
+Index: 3rdparty/sbcelt-helper-build/sbcelt-helper-build.pro
+--- 3rdparty/sbcelt-helper-build/sbcelt-helper-build.pro.orig
++++ 3rdparty/sbcelt-helper-build/sbcelt-helper-build.pro
+@@ -61,6 +61,9 @@ unix:!macx {
+ contains(UNAME, FreeBSD) {
+ SOURCES *= ../lib/futex-freebsd.c sbcelt-sandbox-freebsd.c pdeath-kqueue.c
+ }
++ contains(UNAME, OpenBSD) {
++ SOURCES *= ../lib/futex-openbsd.c sbcelt-sandbox-openbsd.c pdeath-kqueue.c
++ }
+ }
+
+ macx {
Index: patches/patch-3rdparty_sbcelt-helper-build_sbcelt-helper-build_pro.orig
===================================================================
RCS file:
patches/patch-3rdparty_sbcelt-helper-build_sbcelt-helper-build_pro.orig
diff -N patches/patch-3rdparty_sbcelt-helper-build_sbcelt-helper-build_pro.orig
Index: patches/patch-3rdparty_sbcelt-lib-build_sbcelt-lib-build_pro
===================================================================
RCS file: patches/patch-3rdparty_sbcelt-lib-build_sbcelt-lib-build_pro
diff -N patches/patch-3rdparty_sbcelt-lib-build_sbcelt-lib-build_pro
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-3rdparty_sbcelt-lib-build_sbcelt-lib-build_pro 5 Apr
2020 02:58:10 -0000
@@ -0,0 +1,17 @@
+$OpenBSD$
+
+Support OpenBSD in SBCELT.
+
+Index: 3rdparty/sbcelt-lib-build/sbcelt-lib-build.pro
+--- 3rdparty/sbcelt-lib-build/sbcelt-lib-build.pro.orig
++++ 3rdparty/sbcelt-lib-build/sbcelt-lib-build.pro
+@@ -46,6 +46,9 @@ unix:!macx {
+ contains(UNAME, FreeBSD) {
+ SOURCES *= futex-freebsd.c closefrom-sys.c
+ }
++ contains(UNAME, OpenBSD) {
++ SOURCES *= futex-openbsd.c closefrom-sys.c
++ }
+ }
+
+ macx {
Index: patches/patch-3rdparty_sbcelt-lib-build_sbcelt-lib-build_pro.orig
===================================================================
RCS file: patches/patch-3rdparty_sbcelt-lib-build_sbcelt-lib-build_pro.orig
diff -N patches/patch-3rdparty_sbcelt-lib-build_sbcelt-lib-build_pro.orig
Index: patches/patch-3rdparty_sbcelt-src_helper_sbcelt-sandbox-openbsd_c
===================================================================
RCS file: patches/patch-3rdparty_sbcelt-src_helper_sbcelt-sandbox-openbsd_c
diff -N patches/patch-3rdparty_sbcelt-src_helper_sbcelt-sandbox-openbsd_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-3rdparty_sbcelt-src_helper_sbcelt-sandbox-openbsd_c 5 Apr
2020 02:58:10 -0000
@@ -0,0 +1,11 @@
+$OpenBSD$
+
+Provide SBCELT_EnterSandbox() stub.
+
+Index: 3rdparty/sbcelt-src/helper/sbcelt-sandbox-openbsd.c
+--- 3rdparty/sbcelt-src/helper/sbcelt-sandbox-openbsd.c.orig
++++ 3rdparty/sbcelt-src/helper/sbcelt-sandbox-openbsd.c
+@@ -0,0 +1,3 @@
++int SBCELT_EnterSandbox(int mode) {
++ return 0;
++}
Index: patches/patch-3rdparty_sbcelt-src_helper_sbcelt-sandbox-openbsd_c.orig
===================================================================
RCS file: patches/patch-3rdparty_sbcelt-src_helper_sbcelt-sandbox-openbsd_c.orig
diff -N patches/patch-3rdparty_sbcelt-src_helper_sbcelt-sandbox-openbsd_c.orig
Index: patches/patch-3rdparty_sbcelt-src_lib_futex-openbsd_c
===================================================================
RCS file: patches/patch-3rdparty_sbcelt-src_lib_futex-openbsd_c
diff -N patches/patch-3rdparty_sbcelt-src_lib_futex-openbsd_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-3rdparty_sbcelt-src_lib_futex-openbsd_c 5 Apr 2020
02:58:10 -0000
@@ -0,0 +1,28 @@
+$OpenBSD$
+
+Provide futex_*() implementations for SBCELT.
+
+Index: 3rdparty/sbcelt-src/lib/futex-openbsd.c
+--- 3rdparty/sbcelt-src/lib/futex-openbsd.c.orig
++++ 3rdparty/sbcelt-src/lib/futex-openbsd.c
+@@ -0,0 +1,20 @@
++#include <sys/time.h>
++#include <sys/futex.h>
++#include <errno.h>
++#include "futex.h"
++int futex_available() {
++ return 1;
++}
++int futex_wake(int *uaddr) {
++ return futex(uaddr, FUTEX_WAKE, 1, 0, 0);
++}
++int futex_wait(int *uaddr, int val, struct timespec *ts) {
++ int err = futex(uaddr, FUTEX_WAIT, val, ts, 0);
++ if (err != 0) {
++ if (errno == ETIMEDOUT)
++ return FUTEX_TIMEDOUT;
++ else if (errno == EINTR)
++ return FUTEX_INTERRUPTED;
++ }
++ return err;
++}
Index: patches/patch-3rdparty_sbcelt-src_lib_futex-openbsd_c.orig
===================================================================
RCS file: patches/patch-3rdparty_sbcelt-src_lib_futex-openbsd_c.orig
diff -N patches/patch-3rdparty_sbcelt-src_lib_futex-openbsd_c.orig
Index: patches/patch-main_pro
===================================================================
RCS file: patches/patch-main_pro
diff -N patches/patch-main_pro
--- patches/patch-main_pro 25 Feb 2020 05:14:52 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,16 +0,0 @@
-$OpenBSD: patch-main_pro,v 1.2 2020/02/25 05:14:52 rsadowski Exp $
-
-Use celt from our ports tree
-
-Index: main.pro
---- main.pro.orig
-+++ main.pro
-@@ -21,7 +21,7 @@ SUBDIRS *= src/mumble_proto
- CONFIG(sbcelt) {
- SUBDIRS *= 3rdparty/celt-0.7.0-build 3rdparty/sbcelt-lib-build
3rdparty/sbcelt-helper-build
- } else {
-- unix:!CONFIG(bundled-celt):system($$PKG_CONFIG --atleast-version=0.7.0
celt) {
-+ unix:!CONFIG(bundled-celt):system($$PKG_CONFIG --atleast-version=0.7.0
celt07) {
- CONFIG *= no-bundled-celt
- }
- !CONFIG(no-bundled-celt) {
Index: patches/patch-plugins_link_link_pro
===================================================================
RCS file: /cvs/ports/audio/mumble/patches/patch-plugins_link_link_pro,v
retrieving revision 1.4
diff -u -p -r1.4 patch-plugins_link_link_pro
--- patches/patch-plugins_link_link_pro 25 Feb 2020 05:14:52 -0000 1.4
+++ patches/patch-plugins_link_link_pro 5 Apr 2020 02:58:10 -0000
@@ -1,4 +1,7 @@
$OpenBSD: patch-plugins_link_link_pro,v 1.4 2020/02/25 05:14:52 rsadowski Exp $
+
+Do not link against nonexistent librt (part of libc).
+
Index: plugins/link/link.pro
--- plugins/link/link.pro.orig
+++ plugins/link/link.pro
Index: patches/patch-src_mumble_AudioOutputSpeech_h
===================================================================
RCS file: patches/patch-src_mumble_AudioOutputSpeech_h
diff -N patches/patch-src_mumble_AudioOutputSpeech_h
--- patches/patch-src_mumble_AudioOutputSpeech_h 25 Feb 2020 05:14:52
-0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,16 +0,0 @@
-$OpenBSD: patch-src_mumble_AudioOutputSpeech_h,v 1.2 2020/02/25 05:14:52
rsadowski Exp $
-
-Use celt from our ports tree
-
-Index: src/mumble/AudioOutputSpeech.h
---- src/mumble/AudioOutputSpeech.h.orig
-+++ src/mumble/AudioOutputSpeech.h
-@@ -10,7 +10,7 @@
- #include <speex/speex.h>
- #include <speex/speex_resampler.h>
- #include <speex/speex_jitter.h>
--#include <celt.h>
-+#include <celt07/celt.h>
-
- #include <QtCore/QMutex>
-
Index: patches/patch-src_mumble_Audio_cpp
===================================================================
RCS file: /cvs/ports/audio/mumble/patches/patch-src_mumble_Audio_cpp,v
retrieving revision 1.2
diff -u -p -r1.2 patch-src_mumble_Audio_cpp
--- patches/patch-src_mumble_Audio_cpp 25 Feb 2020 05:14:52 -0000 1.2
+++ patches/patch-src_mumble_Audio_cpp 5 Apr 2020 02:58:10 -0000
@@ -1,6 +1,6 @@
$OpenBSD: patch-src_mumble_Audio_cpp,v 1.2 2020/02/25 05:14:52 rsadowski Exp $
-Fix loading of CELT plugins; use celt from our tree
+Fix loading of CELT plugins
Index: src/mumble/Audio.cpp
--- src/mumble/Audio.cpp.orig
Index: patches/patch-src_mumble_CELTCodec_h
===================================================================
RCS file: patches/patch-src_mumble_CELTCodec_h
diff -N patches/patch-src_mumble_CELTCodec_h
--- patches/patch-src_mumble_CELTCodec_h 25 Feb 2020 05:14:52 -0000
1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,16 +0,0 @@
-$OpenBSD: patch-src_mumble_CELTCodec_h,v 1.2 2020/02/25 05:14:52 rsadowski Exp
$
-
-Use celt from our ports tree
-
-Index: src/mumble/CELTCodec.h
---- src/mumble/CELTCodec.h.orig
-+++ src/mumble/CELTCodec.h
-@@ -7,7 +7,7 @@
- #define MUMBLE_MUMBLE_CELTCODEC_H_
-
- #include <stdint.h>
--#include <celt.h>
-+#include <celt07/celt.h>
-
- #include <QtCore/QLibrary>
- #include <QtCore/QString>
Index: patches/patch-src_mumble_main_cpp
===================================================================
RCS file: /cvs/ports/audio/mumble/patches/patch-src_mumble_main_cpp,v
retrieving revision 1.3
diff -u -p -r1.3 patch-src_mumble_main_cpp
--- patches/patch-src_mumble_main_cpp 25 Feb 2020 05:14:52 -0000 1.3
+++ patches/patch-src_mumble_main_cpp 5 Apr 2020 02:58:10 -0000
@@ -2,9 +2,24 @@ $OpenBSD: patch-src_mumble_main_cpp,v 1.
Fix loading of translation files
+Fix QString handling in SBCELT code:
+../../../src/mumble/main.cpp:122:59: error: calling a private constructor of
class 'QString'
+
+
Index: src/mumble/main.cpp
--- src/mumble/main.cpp.orig
+++ src/mumble/main.cpp
+@@ -118,8 +118,8 @@ int main(int argc, char **argv) {
+ #ifdef USE_SBCELT
+ {
+ QDir d(a.applicationVersionRootPath());
+- QString helper =
d.absoluteFilePath(QString::fromLatin1("sbcelt-helper"));
+- EnvUtils::setenv(QLatin1String("SBCELT_HELPER_BINARY"),
helper.toUtf8().constData());
++ EnvUtils::setenv(QLatin1String("SBCELT_HELPER_BINARY"),
++ d.absoluteFilePath(QString::fromLatin1("sbcelt-helper")));
+ }
+ #endif
+
@@ -386,7 +386,8 @@ int main(int argc, char **argv) {
a.installTranslator(&translator);
Index: patches/patch-src_mumble_mumble_pch_hpp
===================================================================
RCS file: patches/patch-src_mumble_mumble_pch_hpp
diff -N patches/patch-src_mumble_mumble_pch_hpp
--- patches/patch-src_mumble_mumble_pch_hpp 25 Feb 2020 05:14:52 -0000
1.3
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,16 +0,0 @@
-$OpenBSD: patch-src_mumble_mumble_pch_hpp,v 1.3 2020/02/25 05:14:52 rsadowski
Exp $
-
-Use celt from our ports tree
-
-Index: src/mumble/mumble_pch.hpp
---- src/mumble/mumble_pch.hpp.orig
-+++ src/mumble/mumble_pch.hpp
-@@ -55,7 +55,7 @@
- #define ENABLE_SNDFILE_WINDOWS_PROTOTYPES 1
- #endif
- #include <sndfile.h>
--#include <celt.h>
-+#include <celt07/celt.h>
- #ifdef USE_SBCELT
- #include <sbcelt.h>
- #endif
Index: patches/patch-src_mumble_mumble_pro
===================================================================
RCS file: /cvs/ports/audio/mumble/patches/patch-src_mumble_mumble_pro,v
retrieving revision 1.6
diff -u -p -r1.6 patch-src_mumble_mumble_pro
--- patches/patch-src_mumble_mumble_pro 5 Apr 2020 02:46:58 -0000 1.6
+++ patches/patch-src_mumble_mumble_pro 5 Apr 2020 02:58:10 -0000
@@ -4,28 +4,12 @@ use celt from our tree
Do not include nonexistent librt (part of libc).
+Do not link against nonexistent librt (part of libc).
+
Index: src/mumble/mumble.pro
--- src/mumble/mumble.pro.orig
+++ src/mumble/mumble.pro
-@@ -320,16 +320,9 @@ CONFIG(sbcelt) {
- LIBS *= -lcelt -lsbcelt
- DEFINES *= SBCELT_PREFIX_API SBCELT_COMPAT_API USE_SBCELT
- } else {
-- unix:!CONFIG(bundled-celt):system($$PKG_CONFIG --atleast-version=0.7.0
celt) {
-+ unix:!CONFIG(bundled-celt):system($$PKG_CONFIG --atleast-version=0.7.0
celt07) {
- CONFIG *= no-bundled-celt
- }
-- CONFIG(no-bundled-celt) {
-- INCLUDEPATH *= /usr/include/celt
-- unix {
-- QMAKE_CFLAGS *= "-I/usr/include/celt" "-isystem /usr/include/celt"
-- QMAKE_CXXFLAGS *= "-I/usr/include/celt" "-isystem /usr/include/celt"
-- }
-- }
- !CONFIG(no-bundled-celt) {
- INCLUDEPATH *= ../../3rdparty/celt-0.7.0-src/libcelt
- unix {
-@@ -539,9 +532,6 @@ unix {
+@@ -539,9 +539,6 @@ unix {
}
must_pkgconfig(x11)