1{
2 stdenv,
3 lib,
4 fetchurl,
5 fetchpatch,
6 fetchFromGitHub,
7 cmake,
8 git,
9 pkg-config,
10 python3,
11 cairo,
12 libsndfile,
13 libxcb,
14 libxkbcommon,
15 xcbutil,
16 xcbutilcursor,
17 xcbutilkeysyms,
18 zenity,
19 curl,
20 rsync,
21}:
22
23stdenv.mkDerivation rec {
24 pname = "surge";
25 version = "1.9.0";
26
27 src = fetchurl {
28 url = "https://github.com/surge-synthesizer/releases/releases/download/${version}/SurgeSrc_${version}.tgz";
29 sha256 = "00af4lfcipl0rn0dn4gfipx7nbk8ym1mrmji8v0ar98frsrpxg4k";
30 };
31
32 extraContent = fetchFromGitHub {
33 owner = "surge-synthesizer";
34 repo = "surge-extra-content";
35 # rev from: https://github.com/surge-synthesizer/surge/blob/release_1.8.1/cmake/stage-extra-content.cmake#L6
36 # or: https://github.com/surge-synthesizer/surge/blob/main/cmake/stage-extra-content.cmake
37 # SURGE_EXTRA_CONTENT_HASH
38 rev = "afc591cc06d9adc3dc8dc515a55c66873fa10296";
39 sha256 = "1wqv86l70nwlrb10n47rib80f47a96j9qqg8w5dv46ys1sq2nz7z";
40 };
41
42 patches = [
43 # Fix build error due to newer glibc version by upgrading lib "catch 2"
44 # Issue: https://github.com/surge-synthesizer/surge/pull/4843
45 # Patch: https://github.com/surge-synthesizer/surge/pull/4845
46 (fetchpatch {
47 url = "https://github.com/surge-synthesizer/surge/commit/7a552038bab4b000d188ae425aa97963dc91db17.patch";
48 sha256 = "sha256-5Flf0uJqEK6e+sadB+vr6phdvvdZYXcFFfm4ywhAeW0=";
49 name = "glibc_build_fix.patch";
50 })
51 ];
52
53 nativeBuildInputs = [
54 cmake
55 git
56 pkg-config
57 python3
58 ];
59
60 buildInputs = [
61 cairo
62 libsndfile
63 libxcb
64 libxkbcommon
65 xcbutil
66 xcbutilcursor
67 xcbutilkeysyms
68 zenity
69 curl
70 rsync
71 ];
72
73 postPatch = ''
74 substituteInPlace src/common/SurgeStorage.cpp \
75 --replace "/usr/share/Surge" "$out/share/surge"
76 substituteInPlace src/linux/UserInteractionsLinux.cpp \
77 --replace '"zenity' '"${zenity}/bin/zenity'
78 patchShebangs scripts/linux/
79 cp -r $extraContent/Skins/ resources/data/skins
80 '';
81
82 installPhase = ''
83 cd ..
84 cmake --build build --config Release --target install-everything-global
85 '';
86
87 doInstallCheck = true;
88
89 installCheckPhase = ''
90 export HOME=$(mktemp -d)
91 export SURGE_DISABLE_NETWORK_TESTS=TRUE
92 build/surge-headless
93 '';
94
95 meta = with lib; {
96 description = ''
97 LV2 & VST3 synthesizer plug-in (previously released as Vember Audio
98 Surge)
99 '';
100 homepage = "https://surge-synthesizer.github.io";
101 license = licenses.gpl3;
102 platforms = [ "x86_64-linux" ];
103 maintainers = with maintainers; [
104 magnetophon
105 orivej
106 ];
107 };
108}