mumble: Enable build on Darwin (#384691)

authored by

Arne Keller and committed by
GitHub
b94166b8 33a11780

+121 -35
+87 -35
pkgs/applications/networking/mumble/default.nix
··· 10 boost, 11 libopus, 12 libsndfile, 13 protobuf, 14 - speex, 15 libcap, 16 alsa-lib, 17 python3, ··· 22 libogg, 23 libvorbis, 24 stdenv_32bit, 25 iceSupport ? true, 26 zeroc-ice, 27 jackSupport ? false, 28 libjack2, 29 - pipewireSupport ? true, 30 pipewire, 31 pulseSupport ? true, 32 libpulseaudio, 33 speechdSupport ? false, 34 speechd-minimal, 35 }: 36 37 let ··· 52 qt5.qttools 53 ] ++ (overrides.nativeBuildInputs or [ ]); 54 55 - buildInputs = [ 56 - avahi 57 - boost 58 - poco 59 - protobuf 60 - ] ++ (overrides.buildInputs or [ ]); 61 62 cmakeFlags = [ 63 "-D g15=OFF" 64 "-D CMAKE_CXX_STANDARD=17" # protobuf >22 requires C++ 17 65 "-D BUILD_NUMBER=${lib.versions.patch source.version}" 66 - ] ++ (overrides.configureFlags or [ ]); 67 68 preConfigure = '' 69 patchShebangs scripts ··· 79 felixsinger 80 lilacious 81 ]; 82 - platforms = platforms.linux; 83 }; 84 } 85 ); ··· 89 generic { 90 type = "mumble"; 91 92 - nativeBuildInputs = [ qt5.qttools ]; 93 buildInputs = 94 [ 95 flac ··· 97 libopus 98 libsndfile 99 libvorbis 100 qt5.qtsvg 101 rnnoise 102 - speex 103 ] 104 - ++ lib.optional (!jackSupport) alsa-lib 105 ++ lib.optional jackSupport libjack2 106 ++ lib.optional speechdSupport speechd-minimal 107 ++ lib.optional pulseSupport libpulseaudio 108 - ++ lib.optional pipewireSupport pipewire; 109 110 - configureFlags = 111 - [ 112 - "-D server=OFF" 113 - "-D bundled-celt=ON" 114 - "-D bundled-opus=OFF" 115 - "-D bundled-speex=OFF" 116 - "-D bundle-qt-translations=OFF" 117 - "-D update=OFF" 118 - "-D overlay-xcompile=OFF" 119 - "-D oss=OFF" 120 - "-D warnings-as-errors=OFF" # conversion error workaround 121 - ] 122 - ++ lib.optional (!speechdSupport) "-D speechd=OFF" 123 - ++ lib.optional (!pulseSupport) "-D pulseaudio=OFF" 124 - ++ lib.optional (!pipewireSupport) "-D pipewire=OFF" 125 - ++ lib.optional jackSupport "-D alsa=OFF -D jackaudio=ON"; 126 127 env.NIX_CFLAGS_COMPILE = lib.optionalString speechdSupport "-I${speechd-minimal}/include/speech-dispatcher"; 128 129 - postFixup = '' 130 wrapProgram $out/bin/mumble \ 131 --prefix LD_LIBRARY_PATH : "${ 132 lib.makeLibraryPath ( ··· 134 ) 135 }" 136 ''; 137 } source; 138 139 server = ··· 141 generic { 142 type = "murmur"; 143 144 - configureFlags = 145 [ 146 "-D client=OFF" 147 ] 148 - ++ lib.optional (!iceSupport) "-D ice=OFF" 149 ++ lib.optionals iceSupport [ 150 "-D Ice_HOME=${lib.getDev zeroc-ice};${lib.getLib zeroc-ice}" 151 - "-D CMAKE_PREFIX_PATH=${lib.getDev zeroc-ice};${lib.getLib zeroc-ice}" 152 "-D Ice_SLICE_DIR=${lib.getDev zeroc-ice}/share/ice/slice" 153 ]; 154 ··· 161 stdenv = stdenv_32bit; 162 type = "mumble-overlay"; 163 164 - configureFlags = [ 165 "-D server=OFF" 166 "-D client=OFF" 167 "-D overlay=ON"
··· 10 boost, 11 libopus, 12 libsndfile, 13 + speexdsp, 14 protobuf, 15 libcap, 16 alsa-lib, 17 python3, ··· 22 libogg, 23 libvorbis, 24 stdenv_32bit, 25 + alsaSupport ? stdenv.hostPlatform.isLinux, 26 iceSupport ? true, 27 zeroc-ice, 28 jackSupport ? false, 29 libjack2, 30 + pipewireSupport ? stdenv.hostPlatform.isLinux, 31 pipewire, 32 pulseSupport ? true, 33 libpulseaudio, 34 speechdSupport ? false, 35 speechd-minimal, 36 + microsoft-gsl, 37 + nlohmann_json, 38 + xar, 39 + makeWrapper, 40 }: 41 42 let ··· 57 qt5.qttools 58 ] ++ (overrides.nativeBuildInputs or [ ]); 59 60 + buildInputs = 61 + [ 62 + boost 63 + poco 64 + protobuf 65 + microsoft-gsl 66 + nlohmann_json 67 + ] 68 + ++ lib.optionals stdenv.hostPlatform.isLinux [ avahi ] 69 + ++ (overrides.buildInputs or [ ]); 70 71 cmakeFlags = [ 72 "-D g15=OFF" 73 "-D CMAKE_CXX_STANDARD=17" # protobuf >22 requires C++ 17 74 "-D BUILD_NUMBER=${lib.versions.patch source.version}" 75 + "-D bundled-gsl=OFF" 76 + "-D bundled-json=OFF" 77 + ] ++ (overrides.cmakeFlags or [ ]); 78 79 preConfigure = '' 80 patchShebangs scripts ··· 90 felixsinger 91 lilacious 92 ]; 93 + platforms = platforms.linux ++ (overrides.platforms or [ ]); 94 }; 95 } 96 ); ··· 100 generic { 101 type = "mumble"; 102 103 + platforms = lib.platforms.darwin; 104 + nativeBuildInputs = 105 + [ qt5.qttools ] 106 + ++ lib.optionals stdenv.hostPlatform.isDarwin [ 107 + makeWrapper 108 + ]; 109 + 110 buildInputs = 111 [ 112 flac ··· 114 libopus 115 libsndfile 116 libvorbis 117 + speexdsp 118 qt5.qtsvg 119 rnnoise 120 ] 121 + ++ lib.optional (!jackSupport && alsaSupport) alsa-lib 122 ++ lib.optional jackSupport libjack2 123 ++ lib.optional speechdSupport speechd-minimal 124 ++ lib.optional pulseSupport libpulseaudio 125 + ++ lib.optional pipewireSupport pipewire 126 + ++ lib.optionals stdenv.hostPlatform.isDarwin [ 127 + xar 128 + ]; 129 130 + cmakeFlags = [ 131 + "-D server=OFF" 132 + "-D bundled-speex=OFF" 133 + "-D bundle-qt-translations=OFF" 134 + "-D update=OFF" 135 + "-D overlay-xcompile=OFF" 136 + "-D oss=OFF" 137 + "-D warnings-as-errors=OFF" # conversion error workaround 138 + # building the overlay on darwin does not work in nipxkgs (yet) 139 + # also see the patch below to disable scripts the build option misses 140 + # see https://github.com/mumble-voip/mumble/issues/6816 141 + (lib.cmakeBool "overlay" (!stdenv.hostPlatform.isDarwin)) 142 + (lib.cmakeBool "speechd" speechdSupport) 143 + (lib.cmakeBool "pulseaudio" pulseSupport) 144 + (lib.cmakeBool "pipewire" pipewireSupport) 145 + (lib.cmakeBool "jackaudio" jackSupport) 146 + (lib.cmakeBool "alsa" (!jackSupport && alsaSupport)) 147 + ]; 148 149 env.NIX_CFLAGS_COMPILE = lib.optionalString speechdSupport "-I${speechd-minimal}/include/speech-dispatcher"; 150 151 + patches = [ 152 + ./disable-overlay-build.patch 153 + ./fix-plugin-copy.patch 154 + # Can be removed before the next update of Mumble, as that fix was upstreamed 155 + # fix version display in MacOS Finder 156 + (fetchpatch { 157 + url = "https://github.com/mumble-voip/mumble/commit/fbd21bd422367bed19f801bf278562f567cbb8b7.patch"; 158 + sha256 = "sha256-qFhC2j/cOWzAhs+KTccDIdcgFqfr4y4VLjHiK458Ucs="; 159 + }) 160 + ]; 161 + 162 + postInstall = lib.optionalString stdenv.hostPlatform.isDarwin '' 163 + # The build erraneously marks the *.dylib as executable 164 + # which causes the qt-hook to wrap it, which then prevents the app from loading it 165 + chmod -x $out/lib/mumble/plugins/*.dylib 166 + 167 + # Post-processing for the app bundle 168 + $NIX_BUILD_TOP/source/macx/scripts/osxdist.py \ 169 + --source-dir=$NIX_BUILD_TOP/source/ \ 170 + --binary-dir=$out \ 171 + --only-appbundle \ 172 + --version "${source.version}" 173 + 174 + mkdir -p $out/Applications $out/bin 175 + mv $out/Mumble.app $out/Applications/Mumble.app 176 + 177 + # ensure that the app can be started from the shell 178 + makeWrapper $out/Applications/Mumble.app/Contents/MacOS/mumble $out/bin/mumble 179 + ''; 180 + 181 + postFixup = lib.optionalString stdenv.hostPlatform.isLinux '' 182 wrapProgram $out/bin/mumble \ 183 --prefix LD_LIBRARY_PATH : "${ 184 lib.makeLibraryPath ( ··· 186 ) 187 }" 188 ''; 189 + 190 } source; 191 192 server = ··· 194 generic { 195 type = "murmur"; 196 197 + cmakeFlags = 198 [ 199 "-D client=OFF" 200 + (lib.cmakeBool "ice" iceSupport) 201 ] 202 ++ lib.optionals iceSupport [ 203 "-D Ice_HOME=${lib.getDev zeroc-ice};${lib.getLib zeroc-ice}" 204 "-D Ice_SLICE_DIR=${lib.getDev zeroc-ice}/share/ice/slice" 205 ]; 206 ··· 213 stdenv = stdenv_32bit; 214 type = "mumble-overlay"; 215 216 + cmakeFlags = [ 217 "-D server=OFF" 218 "-D client=OFF" 219 "-D overlay=ON"
+21
pkgs/applications/networking/mumble/disable-overlay-build.patch
···
··· 1 + diff --git a/macx/scripts/osxdist.py b/macx/scripts/osxdist.py 2 + index bdc7fcbd2..2114caf37 100755 3 + --- a/macx/scripts/osxdist.py 4 + +++ b/macx/scripts/osxdist.py 5 + @@ -128,7 +128,7 @@ class AppBundle(object): 6 + shutil.copy(rsrc, os.path.join(rsrcpath, b)) 7 + 8 + # Extras 9 + - shutil.copy(os.path.join(options.binary_dir, 'MumbleOverlay.pkg'), os.path.join(rsrcpath, 'MumbleOverlay.pkg')) 10 + + # shutil.copy(os.path.join(options.binary_dir, 'MumbleOverlay.pkg'), os.path.join(rsrcpath, 'MumbleOverlay.pkg')) 11 + 12 + def copy_codecs(self): 13 + ''' 14 + @@ -275,7 +276,7 @@ def package_client(): 15 + title = 'Mumble %s' % ver 16 + 17 + # Fix overlay installer package 18 + - create_overlay_package() 19 + + # create_overlay_package() 20 + if options.only_overlay: 21 + sys.exit(0)
+13
pkgs/applications/networking/mumble/fix-plugin-copy.patch
···
··· 1 + diff --git a/macx/scripts/osxdist.py b/macx/scripts/osxdist.py 2 + index bdc7fcbd2..2114caf37 100755 3 + --- a/macx/scripts/osxdist.py 4 + +++ b/macx/scripts/osxdist.py 5 + @@ -151,7 +151,7 @@ class AppBundle(object): 6 + dst = os.path.join(self.bundle, 'Contents', 'Plugins') 7 + if not os.path.exists(dst): 8 + os.makedirs(dst) 9 + - for plugin in glob.glob(os.path.join(options.binary_dir, 'plugins') + '/*.dylib'): 10 + + for plugin in glob.glob(os.path.join(options.binary_dir, 'lib/mumble/plugins') + '/*.dylib'): 11 + shutil.copy(plugin, dst) 12 + 13 + def update_plist(self):