diff --git a/pkgs/applications/networking/mumble/default.nix b/pkgs/applications/networking/mumble/default.nix index cab3e4774bee..2b85dcdf17d1 100644 --- a/pkgs/applications/networking/mumble/default.nix +++ b/pkgs/applications/networking/mumble/default.nix @@ -10,8 +10,8 @@ boost, libopus, libsndfile, + speexdsp, protobuf, - speex, libcap, alsa-lib, python3, @@ -22,16 +22,21 @@ libogg, libvorbis, stdenv_32bit, + alsaSupport ? stdenv.hostPlatform.isLinux, iceSupport ? true, zeroc-ice, jackSupport ? false, libjack2, - pipewireSupport ? true, + pipewireSupport ? stdenv.hostPlatform.isLinux, pipewire, pulseSupport ? true, libpulseaudio, speechdSupport ? false, speechd-minimal, + microsoft-gsl, + nlohmann_json, + xar, + makeWrapper, }: let @@ -52,18 +57,24 @@ let qt5.qttools ] ++ (overrides.nativeBuildInputs or [ ]); - buildInputs = [ - avahi - boost - poco - protobuf - ] ++ (overrides.buildInputs or [ ]); + buildInputs = + [ + boost + poco + protobuf + microsoft-gsl + nlohmann_json + ] + ++ lib.optionals stdenv.hostPlatform.isLinux [ avahi ] + ++ (overrides.buildInputs or [ ]); cmakeFlags = [ "-D g15=OFF" "-D CMAKE_CXX_STANDARD=17" # protobuf >22 requires C++ 17 "-D BUILD_NUMBER=${lib.versions.patch source.version}" - ] ++ (overrides.configureFlags or [ ]); + "-D bundled-gsl=OFF" + "-D bundled-json=OFF" + ] ++ (overrides.cmakeFlags or [ ]); preConfigure = '' patchShebangs scripts @@ -79,7 +90,7 @@ let felixsinger lilacious ]; - platforms = platforms.linux; + platforms = platforms.linux ++ (overrides.platforms or [ ]); }; } ); @@ -89,7 +100,13 @@ let generic { type = "mumble"; - nativeBuildInputs = [ qt5.qttools ]; + platforms = lib.platforms.darwin; + nativeBuildInputs = + [ qt5.qttools ] + ++ lib.optionals stdenv.hostPlatform.isDarwin [ + makeWrapper + ]; + buildInputs = [ flac @@ -97,36 +114,71 @@ let libopus libsndfile libvorbis + speexdsp qt5.qtsvg rnnoise - speex ] - ++ lib.optional (!jackSupport) alsa-lib + ++ lib.optional (!jackSupport && alsaSupport) alsa-lib ++ lib.optional jackSupport libjack2 ++ lib.optional speechdSupport speechd-minimal ++ lib.optional pulseSupport libpulseaudio - ++ lib.optional pipewireSupport pipewire; + ++ lib.optional pipewireSupport pipewire + ++ lib.optionals stdenv.hostPlatform.isDarwin [ + xar + ]; - configureFlags = - [ - "-D server=OFF" - "-D bundled-celt=ON" - "-D bundled-opus=OFF" - "-D bundled-speex=OFF" - "-D bundle-qt-translations=OFF" - "-D update=OFF" - "-D overlay-xcompile=OFF" - "-D oss=OFF" - "-D warnings-as-errors=OFF" # conversion error workaround - ] - ++ lib.optional (!speechdSupport) "-D speechd=OFF" - ++ lib.optional (!pulseSupport) "-D pulseaudio=OFF" - ++ lib.optional (!pipewireSupport) "-D pipewire=OFF" - ++ lib.optional jackSupport "-D alsa=OFF -D jackaudio=ON"; + cmakeFlags = [ + "-D server=OFF" + "-D bundled-speex=OFF" + "-D bundle-qt-translations=OFF" + "-D update=OFF" + "-D overlay-xcompile=OFF" + "-D oss=OFF" + "-D warnings-as-errors=OFF" # conversion error workaround + # building the overlay on darwin does not work in nipxkgs (yet) + # also see the patch below to disable scripts the build option misses + # see https://github.com/mumble-voip/mumble/issues/6816 + (lib.cmakeBool "overlay" (!stdenv.hostPlatform.isDarwin)) + (lib.cmakeBool "speechd" speechdSupport) + (lib.cmakeBool "pulseaudio" pulseSupport) + (lib.cmakeBool "pipewire" pipewireSupport) + (lib.cmakeBool "jackaudio" jackSupport) + (lib.cmakeBool "alsa" (!jackSupport && alsaSupport)) + ]; 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 \ --prefix LD_LIBRARY_PATH : "${ lib.makeLibraryPath ( @@ -134,6 +186,7 @@ let ) }" ''; + } source; server = @@ -141,14 +194,13 @@ let generic { type = "murmur"; - configureFlags = + cmakeFlags = [ "-D client=OFF" + (lib.cmakeBool "ice" iceSupport) ] - ++ lib.optional (!iceSupport) "-D ice=OFF" ++ lib.optionals iceSupport [ "-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" ]; @@ -161,7 +213,7 @@ let stdenv = stdenv_32bit; type = "mumble-overlay"; - configureFlags = [ + cmakeFlags = [ "-D server=OFF" "-D client=OFF" "-D overlay=ON" diff --git a/pkgs/applications/networking/mumble/disable-overlay-build.patch b/pkgs/applications/networking/mumble/disable-overlay-build.patch new file mode 100644 index 000000000000..9d2aff0d8da0 --- /dev/null +++ b/pkgs/applications/networking/mumble/disable-overlay-build.patch @@ -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) diff --git a/pkgs/applications/networking/mumble/fix-plugin-copy.patch b/pkgs/applications/networking/mumble/fix-plugin-copy.patch new file mode 100644 index 000000000000..e8c503944b42 --- /dev/null +++ b/pkgs/applications/networking/mumble/fix-plugin-copy.patch @@ -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):