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 10 boost, 11 11 libopus, 12 12 libsndfile, 13 + speexdsp, 13 14 protobuf, 14 - speex, 15 15 libcap, 16 16 alsa-lib, 17 17 python3, ··· 22 22 libogg, 23 23 libvorbis, 24 24 stdenv_32bit, 25 + alsaSupport ? stdenv.hostPlatform.isLinux, 25 26 iceSupport ? true, 26 27 zeroc-ice, 27 28 jackSupport ? false, 28 29 libjack2, 29 - pipewireSupport ? true, 30 + pipewireSupport ? stdenv.hostPlatform.isLinux, 30 31 pipewire, 31 32 pulseSupport ? true, 32 33 libpulseaudio, 33 34 speechdSupport ? false, 34 35 speechd-minimal, 36 + microsoft-gsl, 37 + nlohmann_json, 38 + xar, 39 + makeWrapper, 35 40 }: 36 41 37 42 let ··· 52 57 qt5.qttools 53 58 ] ++ (overrides.nativeBuildInputs or [ ]); 54 59 55 - buildInputs = [ 56 - avahi 57 - boost 58 - poco 59 - protobuf 60 - ] ++ (overrides.buildInputs or [ ]); 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 [ ]); 61 70 62 71 cmakeFlags = [ 63 72 "-D g15=OFF" 64 73 "-D CMAKE_CXX_STANDARD=17" # protobuf >22 requires C++ 17 65 74 "-D BUILD_NUMBER=${lib.versions.patch source.version}" 66 - ] ++ (overrides.configureFlags or [ ]); 75 + "-D bundled-gsl=OFF" 76 + "-D bundled-json=OFF" 77 + ] ++ (overrides.cmakeFlags or [ ]); 67 78 68 79 preConfigure = '' 69 80 patchShebangs scripts ··· 79 90 felixsinger 80 91 lilacious 81 92 ]; 82 - platforms = platforms.linux; 93 + platforms = platforms.linux ++ (overrides.platforms or [ ]); 83 94 }; 84 95 } 85 96 ); ··· 89 100 generic { 90 101 type = "mumble"; 91 102 92 - nativeBuildInputs = [ qt5.qttools ]; 103 + platforms = lib.platforms.darwin; 104 + nativeBuildInputs = 105 + [ qt5.qttools ] 106 + ++ lib.optionals stdenv.hostPlatform.isDarwin [ 107 + makeWrapper 108 + ]; 109 + 93 110 buildInputs = 94 111 [ 95 112 flac ··· 97 114 libopus 98 115 libsndfile 99 116 libvorbis 117 + speexdsp 100 118 qt5.qtsvg 101 119 rnnoise 102 - speex 103 120 ] 104 - ++ lib.optional (!jackSupport) alsa-lib 121 + ++ lib.optional (!jackSupport && alsaSupport) alsa-lib 105 122 ++ lib.optional jackSupport libjack2 106 123 ++ lib.optional speechdSupport speechd-minimal 107 124 ++ lib.optional pulseSupport libpulseaudio 108 - ++ lib.optional pipewireSupport pipewire; 125 + ++ lib.optional pipewireSupport pipewire 126 + ++ lib.optionals stdenv.hostPlatform.isDarwin [ 127 + xar 128 + ]; 109 129 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"; 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 + ]; 126 148 127 149 env.NIX_CFLAGS_COMPILE = lib.optionalString speechdSupport "-I${speechd-minimal}/include/speech-dispatcher"; 128 150 129 - postFixup = '' 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 '' 130 182 wrapProgram $out/bin/mumble \ 131 183 --prefix LD_LIBRARY_PATH : "${ 132 184 lib.makeLibraryPath ( ··· 134 186 ) 135 187 }" 136 188 ''; 189 + 137 190 } source; 138 191 139 192 server = ··· 141 194 generic { 142 195 type = "murmur"; 143 196 144 - configureFlags = 197 + cmakeFlags = 145 198 [ 146 199 "-D client=OFF" 200 + (lib.cmakeBool "ice" iceSupport) 147 201 ] 148 - ++ lib.optional (!iceSupport) "-D ice=OFF" 149 202 ++ lib.optionals iceSupport [ 150 203 "-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 204 "-D Ice_SLICE_DIR=${lib.getDev zeroc-ice}/share/ice/slice" 153 205 ]; 154 206 ··· 161 213 stdenv = stdenv_32bit; 162 214 type = "mumble-overlay"; 163 215 164 - configureFlags = [ 216 + cmakeFlags = [ 165 217 "-D server=OFF" 166 218 "-D client=OFF" 167 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):