mumble: Enable build on Darwin (#384691)

This commit is contained in:
Arne Keller 2025-05-31 19:41:35 +02:00 committed by GitHub
commit b94166b8b6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 121 additions and 35 deletions

View file

@ -10,8 +10,8 @@
boost, boost,
libopus, libopus,
libsndfile, libsndfile,
speexdsp,
protobuf, protobuf,
speex,
libcap, libcap,
alsa-lib, alsa-lib,
python3, python3,
@ -22,16 +22,21 @@
libogg, libogg,
libvorbis, libvorbis,
stdenv_32bit, stdenv_32bit,
alsaSupport ? stdenv.hostPlatform.isLinux,
iceSupport ? true, iceSupport ? true,
zeroc-ice, zeroc-ice,
jackSupport ? false, jackSupport ? false,
libjack2, libjack2,
pipewireSupport ? true, pipewireSupport ? stdenv.hostPlatform.isLinux,
pipewire, pipewire,
pulseSupport ? true, pulseSupport ? true,
libpulseaudio, libpulseaudio,
speechdSupport ? false, speechdSupport ? false,
speechd-minimal, speechd-minimal,
microsoft-gsl,
nlohmann_json,
xar,
makeWrapper,
}: }:
let let
@ -52,18 +57,24 @@ let
qt5.qttools qt5.qttools
] ++ (overrides.nativeBuildInputs or [ ]); ] ++ (overrides.nativeBuildInputs or [ ]);
buildInputs = [ buildInputs =
avahi [
boost boost
poco poco
protobuf protobuf
] ++ (overrides.buildInputs or [ ]); microsoft-gsl
nlohmann_json
]
++ lib.optionals stdenv.hostPlatform.isLinux [ avahi ]
++ (overrides.buildInputs or [ ]);
cmakeFlags = [ cmakeFlags = [
"-D g15=OFF" "-D g15=OFF"
"-D CMAKE_CXX_STANDARD=17" # protobuf >22 requires C++ 17 "-D CMAKE_CXX_STANDARD=17" # protobuf >22 requires C++ 17
"-D BUILD_NUMBER=${lib.versions.patch source.version}" "-D BUILD_NUMBER=${lib.versions.patch source.version}"
] ++ (overrides.configureFlags or [ ]); "-D bundled-gsl=OFF"
"-D bundled-json=OFF"
] ++ (overrides.cmakeFlags or [ ]);
preConfigure = '' preConfigure = ''
patchShebangs scripts patchShebangs scripts
@ -79,7 +90,7 @@ let
felixsinger felixsinger
lilacious lilacious
]; ];
platforms = platforms.linux; platforms = platforms.linux ++ (overrides.platforms or [ ]);
}; };
} }
); );
@ -89,7 +100,13 @@ let
generic { generic {
type = "mumble"; type = "mumble";
nativeBuildInputs = [ qt5.qttools ]; platforms = lib.platforms.darwin;
nativeBuildInputs =
[ qt5.qttools ]
++ lib.optionals stdenv.hostPlatform.isDarwin [
makeWrapper
];
buildInputs = buildInputs =
[ [
flac flac
@ -97,36 +114,71 @@ let
libopus libopus
libsndfile libsndfile
libvorbis libvorbis
speexdsp
qt5.qtsvg qt5.qtsvg
rnnoise rnnoise
speex
] ]
++ lib.optional (!jackSupport) alsa-lib ++ lib.optional (!jackSupport && alsaSupport) alsa-lib
++ lib.optional jackSupport libjack2 ++ lib.optional jackSupport libjack2
++ lib.optional speechdSupport speechd-minimal ++ lib.optional speechdSupport speechd-minimal
++ lib.optional pulseSupport libpulseaudio ++ lib.optional pulseSupport libpulseaudio
++ lib.optional pipewireSupport pipewire; ++ lib.optional pipewireSupport pipewire
++ lib.optionals stdenv.hostPlatform.isDarwin [
xar
];
configureFlags = cmakeFlags = [
[ "-D server=OFF"
"-D server=OFF" "-D bundled-speex=OFF"
"-D bundled-celt=ON" "-D bundle-qt-translations=OFF"
"-D bundled-opus=OFF" "-D update=OFF"
"-D bundled-speex=OFF" "-D overlay-xcompile=OFF"
"-D bundle-qt-translations=OFF" "-D oss=OFF"
"-D update=OFF" "-D warnings-as-errors=OFF" # conversion error workaround
"-D overlay-xcompile=OFF" # building the overlay on darwin does not work in nipxkgs (yet)
"-D oss=OFF" # also see the patch below to disable scripts the build option misses
"-D warnings-as-errors=OFF" # conversion error workaround # see https://github.com/mumble-voip/mumble/issues/6816
] (lib.cmakeBool "overlay" (!stdenv.hostPlatform.isDarwin))
++ lib.optional (!speechdSupport) "-D speechd=OFF" (lib.cmakeBool "speechd" speechdSupport)
++ lib.optional (!pulseSupport) "-D pulseaudio=OFF" (lib.cmakeBool "pulseaudio" pulseSupport)
++ lib.optional (!pipewireSupport) "-D pipewire=OFF" (lib.cmakeBool "pipewire" pipewireSupport)
++ lib.optional jackSupport "-D alsa=OFF -D jackaudio=ON"; (lib.cmakeBool "jackaudio" jackSupport)
(lib.cmakeBool "alsa" (!jackSupport && alsaSupport))
];
env.NIX_CFLAGS_COMPILE = lib.optionalString speechdSupport "-I${speechd-minimal}/include/speech-dispatcher"; env.NIX_CFLAGS_COMPILE = lib.optionalString speechdSupport "-I${speechd-minimal}/include/speech-dispatcher";
postFixup = '' patches = [
./disable-overlay-build.patch
./fix-plugin-copy.patch
# Can be removed before the next update of Mumble, as that fix was upstreamed
# fix version display in MacOS Finder
(fetchpatch {
url = "https://github.com/mumble-voip/mumble/commit/fbd21bd422367bed19f801bf278562f567cbb8b7.patch";
sha256 = "sha256-qFhC2j/cOWzAhs+KTccDIdcgFqfr4y4VLjHiK458Ucs=";
})
];
postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''
# The build erraneously marks the *.dylib as executable
# which causes the qt-hook to wrap it, which then prevents the app from loading it
chmod -x $out/lib/mumble/plugins/*.dylib
# Post-processing for the app bundle
$NIX_BUILD_TOP/source/macx/scripts/osxdist.py \
--source-dir=$NIX_BUILD_TOP/source/ \
--binary-dir=$out \
--only-appbundle \
--version "${source.version}"
mkdir -p $out/Applications $out/bin
mv $out/Mumble.app $out/Applications/Mumble.app
# ensure that the app can be started from the shell
makeWrapper $out/Applications/Mumble.app/Contents/MacOS/mumble $out/bin/mumble
'';
postFixup = lib.optionalString stdenv.hostPlatform.isLinux ''
wrapProgram $out/bin/mumble \ wrapProgram $out/bin/mumble \
--prefix LD_LIBRARY_PATH : "${ --prefix LD_LIBRARY_PATH : "${
lib.makeLibraryPath ( lib.makeLibraryPath (
@ -134,6 +186,7 @@ let
) )
}" }"
''; '';
} source; } source;
server = server =
@ -141,14 +194,13 @@ let
generic { generic {
type = "murmur"; type = "murmur";
configureFlags = cmakeFlags =
[ [
"-D client=OFF" "-D client=OFF"
(lib.cmakeBool "ice" iceSupport)
] ]
++ lib.optional (!iceSupport) "-D ice=OFF"
++ lib.optionals iceSupport [ ++ lib.optionals iceSupport [
"-D Ice_HOME=${lib.getDev zeroc-ice};${lib.getLib zeroc-ice}" "-D Ice_HOME=${lib.getDev zeroc-ice};${lib.getLib zeroc-ice}"
"-D CMAKE_PREFIX_PATH=${lib.getDev zeroc-ice};${lib.getLib zeroc-ice}"
"-D Ice_SLICE_DIR=${lib.getDev zeroc-ice}/share/ice/slice" "-D Ice_SLICE_DIR=${lib.getDev zeroc-ice}/share/ice/slice"
]; ];
@ -161,7 +213,7 @@ let
stdenv = stdenv_32bit; stdenv = stdenv_32bit;
type = "mumble-overlay"; type = "mumble-overlay";
configureFlags = [ cmakeFlags = [
"-D server=OFF" "-D server=OFF"
"-D client=OFF" "-D client=OFF"
"-D overlay=ON" "-D overlay=ON"

View file

@ -0,0 +1,21 @@
diff --git a/macx/scripts/osxdist.py b/macx/scripts/osxdist.py
index bdc7fcbd2..2114caf37 100755
--- a/macx/scripts/osxdist.py
+++ b/macx/scripts/osxdist.py
@@ -128,7 +128,7 @@ class AppBundle(object):
shutil.copy(rsrc, os.path.join(rsrcpath, b))
# Extras
- shutil.copy(os.path.join(options.binary_dir, 'MumbleOverlay.pkg'), os.path.join(rsrcpath, 'MumbleOverlay.pkg'))
+ # shutil.copy(os.path.join(options.binary_dir, 'MumbleOverlay.pkg'), os.path.join(rsrcpath, 'MumbleOverlay.pkg'))
def copy_codecs(self):
'''
@@ -275,7 +276,7 @@ def package_client():
title = 'Mumble %s' % ver
# Fix overlay installer package
- create_overlay_package()
+ # create_overlay_package()
if options.only_overlay:
sys.exit(0)

View file

@ -0,0 +1,13 @@
diff --git a/macx/scripts/osxdist.py b/macx/scripts/osxdist.py
index bdc7fcbd2..2114caf37 100755
--- a/macx/scripts/osxdist.py
+++ b/macx/scripts/osxdist.py
@@ -151,7 +151,7 @@ class AppBundle(object):
dst = os.path.join(self.bundle, 'Contents', 'Plugins')
if not os.path.exists(dst):
os.makedirs(dst)
- for plugin in glob.glob(os.path.join(options.binary_dir, 'plugins') + '/*.dylib'):
+ for plugin in glob.glob(os.path.join(options.binary_dir, 'lib/mumble/plugins') + '/*.dylib'):
shutil.copy(plugin, dst)
def update_plist(self):