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