1{
2 lib,
3 stdenv,
4 fetchgit,
5 fetchzip,
6 alsa-lib,
7 aubio,
8 boost,
9 cairomm,
10 cppunit,
11 curl,
12 dbus,
13 doxygen,
14 ffmpeg,
15 fftw,
16 fftwSinglePrec,
17 flac,
18 fluidsynth,
19 glibc,
20 glibmm,
21 graphviz,
22 gtkmm2,
23 harvid,
24 hidapi,
25 itstool,
26 kissfft,
27 libarchive,
28 libjack2,
29 liblo,
30 libltc,
31 libogg,
32 libpulseaudio,
33 librdf_rasqal,
34 libsamplerate,
35 libsigcxx,
36 libsndfile,
37 libusb1,
38 libuv,
39 libwebsockets,
40 libxml2,
41 libxslt,
42 lilv,
43 lrdf,
44 lv2,
45 makeWrapper,
46 pango,
47 perl,
48 pkg-config,
49 python3,
50 qm-dsp,
51 readline,
52 rubberband,
53 serd,
54 sord,
55 soundtouch,
56 sratom,
57 suil,
58 taglib,
59 vamp-plugin-sdk,
60 wafHook,
61 xjadeo,
62 optimize ? true, # disable to print Lua DSP script output to stdout
63 videoSupport ? true,
64}:
65stdenv.mkDerivation (
66 finalAttrs:
67 let
68 majorVersion = lib.versions.major finalAttrs.version;
69 in
70 {
71 pname = "ardour";
72 version = "8.12";
73
74 # We can't use `fetchFromGitea` here, as attempting to fetch release archives from git.ardour.org
75 # result in an empty archive. See https://tracker.ardour.org/view.php?id=7328 for more info.
76 src = fetchgit {
77 url = "git://git.ardour.org/ardour/ardour.git";
78 rev = finalAttrs.version;
79 hash = "sha256-4IgBQ53cwPA35YwNQyo+qBqsMGv+TLn6w1zaDX97erE=";
80 };
81
82 bundledContent = fetchzip {
83 url = "https://web.archive.org/web/20221026200824/http://stuff.ardour.org/loops/ArdourBundledMedia.zip";
84 hash = "sha256-IbPQWFeyMuvCoghFl1ZwZNNcSvLNsH84rGArXnw+t7A=";
85 # archive does not contain a single folder at the root
86 stripRoot = false;
87 };
88
89 patches = [
90 # AS=as in the environment causes build failure https://tracker.ardour.org/view.php?id=8096
91 ./as-flags.patch
92 ./default-plugin-search-paths.patch
93 ];
94
95 # Ardour's wscript requires git revision and date to be available.
96 # Since they are not, let's generate the file manually.
97 postPatch = ''
98 printf '#include "libs/ardour/ardour/revision.h"\nnamespace ARDOUR { const char* revision = "${finalAttrs.version}"; const char* date = ""; }\n' > libs/ardour/revision.cc
99 sed 's|/usr/include/libintl.h|${glibc.dev}/include/libintl.h|' -i wscript
100 patchShebangs ./tools/
101 substituteInPlace libs/ardour/video_tools_paths.cc \
102 --replace-fail 'ffmpeg_exe = X_("");' 'ffmpeg_exe = X_("${ffmpeg}/bin/ffmpeg");' \
103 --replace-fail 'ffprobe_exe = X_("");' 'ffprobe_exe = X_("${ffmpeg}/bin/ffprobe");'
104 '';
105
106 nativeBuildInputs = [
107 doxygen
108 graphviz # for dot
109 itstool
110 makeWrapper
111 perl
112 pkg-config
113 python3
114 wafHook
115 ];
116
117 buildInputs = [
118 alsa-lib
119 aubio
120 boost
121 cairomm
122 cppunit
123 curl
124 dbus
125 ffmpeg
126 fftw
127 fftwSinglePrec
128 flac
129 fluidsynth
130 glibmm
131 gtkmm2
132 hidapi
133 itstool
134 kissfft
135 libarchive
136 libjack2
137 liblo
138 libltc
139 libogg
140 libpulseaudio
141 librdf_rasqal
142 libsamplerate
143 libsigcxx
144 libsndfile
145 libusb1
146 libuv
147 libwebsockets
148 libxml2
149 libxslt
150 lilv
151 lrdf
152 lv2
153 pango
154 perl
155 python3
156 qm-dsp
157 readline
158 rubberband
159 serd
160 sord
161 soundtouch
162 sratom
163 suil
164 taglib
165 vamp-plugin-sdk
166 ]
167 ++ lib.optionals videoSupport [
168 harvid
169 xjadeo
170 ];
171
172 wafConfigureFlags = [
173 "--cxx17"
174 "--docs"
175 "--freedesktop"
176 "--no-phone-home"
177 "--ptformat"
178 "--run-tests"
179 "--test"
180 # since we don't have https://github.com/agfline/LibAAF yet,
181 # we need to use some of ardours internal libs, see:
182 # https://discourse.ardour.org/t/ardour-8-2-released/109615/6
183 # and
184 # https://discourse.ardour.org/t/ardour-8-2-released/109615/8
185 # "--use-external-libs"
186 ]
187 ++ lib.optional optimize "--optimize";
188
189 postInstall = ''
190 # wscript does not install these for some reason
191 install -vDm 644 "build/gtk2_ardour/ardour.xml" \
192 -t "$out/share/mime/packages"
193 install -vDm 644 "build/gtk2_ardour/ardour${majorVersion}.desktop" \
194 -t "$out/share/applications"
195 for size in 16 22 32 48 256 512; do
196 install -vDm 644 "gtk2_ardour/resources/Ardour-icon_''${size}px.png" \
197 "$out/share/icons/hicolor/''${size}x''${size}/apps/ardour${majorVersion}.png"
198 done
199 install -vDm 644 "ardour.1"* -t "$out/share/man/man1"
200
201 # install additional bundled beats, chords and progressions
202 cp -rp "${finalAttrs.bundledContent}"/* "$out/share/ardour${majorVersion}/media"
203 ''
204 + lib.optionalString videoSupport ''
205 # `harvid` and `xjadeo` must be accessible in `PATH` for video to work.
206 wrapProgram "$out/bin/ardour${majorVersion}" \
207 --prefix PATH : "${
208 lib.makeBinPath [
209 harvid
210 xjadeo
211 ]
212 }"
213 '';
214
215 LINKFLAGS = "-lpthread";
216
217 meta = {
218 description = "Multi-track hard disk recording software";
219 longDescription = ''
220 Ardour is a digital audio workstation (DAW), You can use it to
221 record, edit and mix multi-track audio and midi. Produce your
222 own CDs. Mix video soundtracks. Experiment with new ideas about
223 music and sound.
224
225 Please consider supporting the ardour project financially:
226 https://community.ardour.org/donate
227 '';
228 homepage = "https://ardour.org/";
229 license = lib.licenses.gpl2Plus;
230 mainProgram = "ardour8";
231 platforms = lib.platforms.linux;
232 maintainers = with lib.maintainers; [
233 magnetophon
234 mitchmindtree
235 ryand56
236 ];
237 };
238 }
239)