Skip to content

Commit b3277d1

Browse files
committed
mumble: enable building on darwin
1 parent 353f43c commit b3277d1

File tree

3 files changed

+92
-17
lines changed

3 files changed

+92
-17
lines changed

pkgs/applications/networking/mumble/default.nix

Lines changed: 58 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
lib,
33
stdenv,
44
fetchFromGitHub,
5-
fetchpatch,
65
pkg-config,
76
qt5,
87
cmake,
@@ -22,18 +21,21 @@
2221
libogg,
2322
libvorbis,
2423
stdenv_32bit,
24+
alsaSupport ? stdenv.hostPlatform.isLinux,
2525
iceSupport ? true,
2626
zeroc-ice,
2727
jackSupport ? false,
2828
libjack2,
29-
pipewireSupport ? true,
29+
pipewireSupport ? stdenv.hostPlatform.isLinux,
3030
pipewire,
3131
pulseSupport ? true,
3232
libpulseaudio,
3333
speechdSupport ? false,
3434
speechd-minimal,
3535
microsoft-gsl,
3636
nlohmann_json,
37+
xar,
38+
makeWrapper,
3739
}:
3840

3941
let
@@ -54,14 +56,16 @@ let
5456
qt5.qttools
5557
] ++ (overrides.nativeBuildInputs or [ ]);
5658

57-
buildInputs = [
58-
avahi
59-
boost
60-
poco
61-
protobuf
62-
microsoft-gsl
63-
nlohmann_json
64-
] ++ (overrides.buildInputs or [ ]);
59+
buildInputs =
60+
[
61+
boost
62+
poco
63+
protobuf
64+
microsoft-gsl
65+
nlohmann_json
66+
]
67+
++ lib.optionals stdenv.hostPlatform.isLinux [ avahi ]
68+
++ (overrides.buildInputs or [ ]);
6569

6670
cmakeFlags = [
6771
"-D g15=OFF"
@@ -85,7 +89,7 @@ let
8589
felixsinger
8690
lilacious
8791
];
88-
platforms = platforms.linux;
92+
platforms = platforms.linux ++ (overrides.platforms or [ ]);
8993
};
9094
}
9195
);
@@ -95,7 +99,13 @@ let
9599
generic {
96100
type = "mumble";
97101

98-
nativeBuildInputs = [ qt5.qttools ];
102+
platforms = lib.platforms.darwin;
103+
nativeBuildInputs =
104+
[ qt5.qttools ]
105+
++ lib.optionals stdenv.hostPlatform.isDarwin [
106+
makeWrapper
107+
];
108+
99109
buildInputs =
100110
[
101111
flac
@@ -107,12 +117,14 @@ let
107117
qt5.qtsvg
108118
rnnoise
109119
]
110-
++ lib.optional (!jackSupport) alsa-lib
120+
++ lib.optional (!jackSupport && alsaSupport) alsa-lib
111121
++ lib.optional jackSupport libjack2
112122
++ lib.optional speechdSupport speechd-minimal
113123
++ lib.optional pulseSupport libpulseaudio
114-
++ lib.optional pipewireSupport pipewire;
115-
124+
++ lib.optional pipewireSupport pipewire
125+
++ lib.optionals stdenv.hostPlatform.isDarwin [
126+
xar
127+
];
116128

117129
cmakeFlags = [
118130
"-D server=OFF"
@@ -122,23 +134,52 @@ let
122134
"-D overlay-xcompile=OFF"
123135
"-D oss=OFF"
124136
"-D warnings-as-errors=OFF" # conversion error workaround
137+
# building the overlay on darwin does not work in nipxkgs (yet)
138+
# also see the patch below to disable scripts the build option misses
139+
# see https://github.com/mumble-voip/mumble/issues/6816
140+
(lib.cmakeBool "overlay" (!stdenv.hostPlatform.isDarwin))
125141
(lib.cmakeBool "speechd" speechdSupport)
126142
(lib.cmakeBool "pulseaudio" pulseSupport)
127143
(lib.cmakeBool "pipewire" pipewireSupport)
128144
(lib.cmakeBool "jackaudio" jackSupport)
129-
(lib.cmakeBool "alsa" (!jackSupport))
145+
(lib.cmakeBool "alsa" (!jackSupport && alsaSupport))
130146
];
131147

132148
env.NIX_CFLAGS_COMPILE = lib.optionalString speechdSupport "-I${speechd-minimal}/include/speech-dispatcher";
133149

134-
postFixup = ''
150+
patches = [
151+
./disable-overlay-build.patch
152+
./fix-plugin-copy.patch
153+
];
154+
155+
postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''
156+
# The build erraneously marks the *.dylib as executable
157+
# which causes the qt-hook to wrap it, which then prevents the app from loading it
158+
chmod -x $out/lib/mumble/plugins/*.dylib
159+
160+
# Post-processing for the app bundle
161+
$NIX_BUILD_TOP/source/macx/scripts/osxdist.py \
162+
--source-dir=$NIX_BUILD_TOP/source/ \
163+
--binary-dir=$out \
164+
--only-appbundle \
165+
--version "${source.version}"
166+
167+
mkdir -p $out/Applications $out/bin
168+
mv $out/Mumble.app $out/Applications/Mumble.app
169+
170+
# ensure that the app can be started from the shell
171+
makeWrapper $out/Applications/Mumble.app/Contents/MacOS/mumble $out/bin/mumble
172+
'';
173+
174+
postFixup = lib.optionalString stdenv.hostPlatform.isLinux ''
135175
wrapProgram $out/bin/mumble \
136176
--prefix LD_LIBRARY_PATH : "${
137177
lib.makeLibraryPath (
138178
lib.optional pulseSupport libpulseaudio ++ lib.optional pipewireSupport pipewire
139179
)
140180
}"
141181
'';
182+
142183
} source;
143184

144185
server =
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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):

0 commit comments

Comments
 (0)