1{
2 lib,
3 stdenv,
4 multiStdenv,
5 fetchFromGitHub,
6 requireFile,
7 unzip,
8 wine,
9 cmake,
10 makeWrapper,
11 wrapQtAppsHook,
12 file,
13 libX11,
14 qt5,
15 vst2-sdk,
16}:
17
18let
19 version = "1.3.3";
20
21 airwave-src = fetchFromGitHub {
22 owner = "phantom-code";
23 repo = "airwave";
24 rev = version;
25 sha256 = "1ban59skw422mak3cp57lj27hgq5d3a4f6y79ysjnamf8rpz9x4s";
26 };
27
28 wine-wow64 = wine.override {
29 wineRelease = "stable";
30 wineBuild = "wineWow";
31 };
32
33 wine-xembed = wine-wow64.overrideDerivation (oldAttrs: {
34 patchFlags = [ "-p2" ];
35 patches = [ "${airwave-src}/fix-xembed-wine-windows.patch" ];
36 });
37
38in
39
40multiStdenv.mkDerivation {
41 pname = "airwave";
42 inherit version;
43
44 src = airwave-src;
45
46 nativeBuildInputs = [
47 cmake
48 makeWrapper
49 wrapQtAppsHook
50 ];
51
52 buildInputs = [
53 file
54 libX11
55 qt5.qtbase
56 wine-xembed
57 ];
58
59 postPatch = ''
60 # Binaries not used directly should land in libexec/.
61 substituteInPlace src/common/storage.cpp --replace '"/bin"' '"/libexec"'
62
63 # For airwave-host-32.exe.so, point wineg++ to 32-bit versions of
64 # these libraries, as $NIX_LDFLAGS contains only 64-bit ones.
65 substituteInPlace src/host/CMakeLists.txt --replace '-m32' \
66 '-m32 -L${wine-xembed}/lib -L${wine-xembed}/lib/wine -L${multiStdenv.cc.libc.out}/lib/32'
67 '';
68
69 # libstdc++.so link gets lost in 64-bit executables during
70 # shrinking.
71 dontPatchELF = true;
72
73 # Cf. https://github.com/phantom-code/airwave/issues/57
74 hardeningDisable = [ "format" ];
75
76 cmakeFlags = [ "-DVSTSDK_PATH=${vst2-sdk}" ];
77
78 postInstall = ''
79 mv $out/bin $out/libexec
80 mkdir $out/bin
81 mv $out/libexec/airwave-manager $out/bin
82 wrapProgram $out/libexec/airwave-host-32.exe --set WINELOADER ${wine-xembed}/bin/wine
83 wrapProgram $out/libexec/airwave-host-64.exe --set WINELOADER ${wine-xembed}/bin/wine64
84 '';
85
86 meta = {
87 description = "WINE-based VST bridge for Linux VST hosts";
88 longDescription = ''
89 Airwave is a wine based VST bridge, that allows for the use of
90 Windows 32- and 64-bit VST 2.4 audio plugins with Linux VST
91 hosts. Due to the use of shared memory, only one extra copying
92 is made for each data transfer. Airwave also uses the XEMBED
93 protocol to correctly embed the plugin editor into the host
94 window.
95 '';
96 homepage = "https://github.com/phantom-code/airwave";
97 license = lib.licenses.mit;
98 platforms = [ "x86_64-linux" ];
99 maintainers = with lib.maintainers; [ michalrus ];
100 hydraPlatforms = [ ];
101 };
102}