nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 fetchpatch,
6 cmake,
7 libsndfile,
8 libsamplerate,
9 flex,
10 bison,
11 boost,
12 gettext,
13 portaudio,
14 alsa-lib ? null,
15 libpulseaudio ? null,
16 libjack2 ? null,
17 liblo ? null,
18 ladspa-sdk ? null,
19 fluidsynth ? null,
20 # , gmm ? null # opcodes don't build with gmm 5.1
21 eigen ? null,
22 curl ? null,
23 tcltk ? null,
24 fltk ? null,
25}:
26
27stdenv.mkDerivation (finalAttrs: {
28 pname = "csound";
29 version = "7.0.0-beta.10";
30
31 hardeningDisable = [ "format" ];
32
33 src = fetchFromGitHub {
34 owner = "csound";
35 repo = "csound";
36 tag = finalAttrs.version;
37 hash = "sha256-l3dSVt5rgyj98ZCZltqKAJx/0Afl4R03flLXBcivtwg=";
38 };
39
40 cmakeFlags = [
41 "-DBUILD_CSOUND_AC=0"
42 ] # fails to find Score.hpp
43 ++ lib.optional stdenv.hostPlatform.isDarwin "-DCS_FRAMEWORK_DEST=${placeholder "out"}/lib"
44 # Ignore gettext in CMAKE_PREFIX_PATH on cross to prevent find_program picking up the wrong gettext
45 ++ lib.optional (
46 stdenv.hostPlatform != stdenv.buildPlatform
47 ) "-DCMAKE_IGNORE_PATH=${lib.getBin gettext}/bin";
48
49 nativeBuildInputs = [
50 cmake
51 flex
52 bison
53 gettext
54 ];
55 buildInputs = [
56 libsndfile
57 libsamplerate
58 boost
59 ]
60 ++ lib.optionals stdenv.hostPlatform.isDarwin [
61 portaudio
62 ]
63 ++ lib.optionals stdenv.hostPlatform.isLinux (
64 builtins.filter (optional: optional != null) [
65 alsa-lib
66 libpulseaudio
67 libjack2
68 liblo
69 ladspa-sdk
70 fluidsynth
71 eigen
72 curl
73 tcltk
74 fltk
75 ]
76 );
77
78 postInstall = lib.optional stdenv.hostPlatform.isDarwin ''
79 mkdir -p $out/Library/Frameworks
80 ln -s $out/lib/CsoundLib64.framework $out/Library/Frameworks
81 '';
82
83 meta = {
84 description = "Sound design, audio synthesis, and signal processing system, providing facilities for music composition and performance on all major operating systems and platforms";
85 homepage = "https://csound.com/";
86 license = lib.licenses.lgpl21Plus;
87 maintainers = with lib.maintainers; [ marcweber ];
88 platforms = lib.platforms.unix;
89 broken = stdenv.hostPlatform.isDarwin;
90 };
91})