about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/audio/cmus
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2019-01-07 02:18:36 +0000
committerAlyssa Ross <hi@alyssa.is>2019-01-07 02:18:47 +0000
commit36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2 (patch)
treeb3faaf573407b32aa645237a4d16b82778a39a92 /nixpkgs/pkgs/applications/audio/cmus
parent4e31070265257dc67d120c27e0f75c2344fdfa9a (diff)
parentabf060725d7614bd3b9f96764262dfbc2f9c2199 (diff)
downloadnixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.gz
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.bz2
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.lz
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.xz
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.zst
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.zip
Add 'nixpkgs/' from commit 'abf060725d7614bd3b9f96764262dfbc2f9c2199'
git-subtree-dir: nixpkgs
git-subtree-mainline: 4e31070265257dc67d120c27e0f75c2344fdfa9a
git-subtree-split: abf060725d7614bd3b9f96764262dfbc2f9c2199
Diffstat (limited to 'nixpkgs/pkgs/applications/audio/cmus')
-rw-r--r--nixpkgs/pkgs/applications/audio/cmus/default.nix134
-rw-r--r--nixpkgs/pkgs/applications/audio/cmus/option-debugging.patch42
2 files changed, 176 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/applications/audio/cmus/default.nix b/nixpkgs/pkgs/applications/audio/cmus/default.nix
new file mode 100644
index 000000000000..f8c5a4e5acff
--- /dev/null
+++ b/nixpkgs/pkgs/applications/audio/cmus/default.nix
@@ -0,0 +1,134 @@
+{ stdenv, fetchFromGitHub, runCommand, ncurses, pkgconfig
+, libiconv, CoreAudio
+
+, alsaSupport ? stdenv.isLinux, alsaLib ? null
+# simple fallback for everyone else
+, aoSupport ? !stdenv.isLinux, libao ? null
+, jackSupport ? false, libjack ? null
+, samplerateSupport ? jackSupport, libsamplerate ? null
+, ossSupport ? false, alsaOss ? null
+, pulseaudioSupport ? false, libpulseaudio ? null
+
+# TODO: add these
+#, artsSupport
+#, roarSupport
+#, sndioSupport
+#, sunSupport
+#, waveoutSupport
+
+, cddbSupport ? true, libcddb ? null
+, cdioSupport ? true, libcdio ? null, libcdio-paranoia ? null
+, cueSupport ? true, libcue ? null
+, discidSupport ? (!stdenv.isDarwin), libdiscid ? null
+, ffmpegSupport ? true, ffmpeg ? null
+, flacSupport ? true, flac ? null
+, madSupport ? true, libmad ? null
+, mikmodSupport ? true, libmikmod ? null
+, modplugSupport ? true, libmodplug ? null
+, mpcSupport ? true, libmpcdec ? null
+, tremorSupport ? false, tremor ? null
+, vorbisSupport ? true, libvorbis ? null
+, wavpackSupport ? true, wavpack ? null
+, opusSupport ? true, opusfile ? null
+
+, aacSupport ? false, faad2 ? null # already handled by ffmpeg
+, mp4Support ? false, mp4v2 ? null # ffmpeg does support mp4 better
+
+# not in nixpkgs
+#, vtxSupport ? true, libayemu ? null
+}:
+
+with stdenv.lib;
+
+assert samplerateSupport -> jackSupport;
+
+# vorbis and tremor are mutually exclusive
+assert vorbisSupport -> !tremorSupport;
+assert tremorSupport -> !vorbisSupport;
+
+let
+
+  mkFlag = b: f: dep: if b
+    then { flags = [ f ]; deps = [ dep ]; }
+    else { flags = []; deps = []; };
+
+  opts = [
+    # Audio output
+    (mkFlag alsaSupport       "CONFIG_ALSA=y"       alsaLib)
+    (mkFlag aoSupport         "CONFIG_AO=y"         libao)
+    (mkFlag jackSupport       "CONFIG_JACK=y"       libjack)
+    (mkFlag samplerateSupport "CONFIG_SAMPLERATE=y" libsamplerate)
+    (mkFlag ossSupport        "CONFIG_OSS=y"        alsaOss)
+    (mkFlag pulseaudioSupport "CONFIG_PULSE=y"      libpulseaudio)
+
+    #(mkFlag artsSupport      "CONFIG_ARTS=y")
+    #(mkFlag roarSupport      "CONFIG_ROAR=y")
+    #(mkFlag sndioSupport     "CONFIG_SNDIO=y")
+    #(mkFlag sunSupport       "CONFIG_SUN=y")
+    #(mkFlag waveoutSupport   "CONFIG_WAVEOUT=y")
+
+    # Input file formats
+    (mkFlag cddbSupport    "CONFIG_CDDB=y"    libcddb)
+    (mkFlag cdioSupport    "CONFIG_CDIO=y"    [ libcdio libcdio-paranoia ])
+    (mkFlag cueSupport     "CONFIG_CUE=y"     libcue)
+    (mkFlag discidSupport  "CONFIG_DISCID=y"  libdiscid)
+    (mkFlag ffmpegSupport  "CONFIG_FFMPEG=y"  ffmpeg)
+    (mkFlag flacSupport    "CONFIG_FLAC=y"    flac)
+    (mkFlag madSupport     "CONFIG_MAD=y"     libmad)
+    (mkFlag mikmodSupport  "CONFIG_MIKMOD=y"  libmikmod)
+    (mkFlag modplugSupport "CONFIG_MODPLUG=y" libmodplug)
+    (mkFlag mpcSupport     "CONFIG_MPC=y"     libmpcdec)
+    (mkFlag tremorSupport  "CONFIG_TREMOR=y"  tremor)
+    (mkFlag vorbisSupport  "CONFIG_VORBIS=y"  libvorbis)
+    (mkFlag wavpackSupport "CONFIG_WAVPACK=y" wavpack)
+    (mkFlag opusSupport   "CONFIG_OPUS=y"    opusfile)
+
+    (mkFlag mp4Support    "CONFIG_MP4=y"     mp4v2)
+    (mkFlag aacSupport    "CONFIG_AAC=y"     faad2)
+
+    #(mkFlag vtxSupport    "CONFIG_VTX=y"     libayemu)
+  ];
+
+  clangGCC = runCommand "clang-gcc" {} ''
+    #! ${stdenv.shell}
+    mkdir -p $out/bin
+    ln -s ${stdenv.cc}/bin/clang $out/bin/gcc
+    ln -s ${stdenv.cc}/bin/clang++ $out/bin/g++
+  '';
+
+in
+
+stdenv.mkDerivation rec {
+  name = "cmus-${version}";
+  version = "2.7.1";
+
+  src = fetchFromGitHub {
+    owner  = "cmus";
+    repo   = "cmus";
+    rev    = "v${version}";
+    sha256 = "0xd96py21bl869qlv1353zw7xsgq6v5s8szr0ldr63zj5fgc2ps5";
+  };
+
+  patches = [ ./option-debugging.patch ];
+
+  configurePhase = "./configure " + concatStringsSep " " ([
+    "prefix=$out"
+    "CONFIG_WAV=y"
+  ] ++ concatMap (a: a.flags) opts);
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ ncurses ]
+    ++ stdenv.lib.optional stdenv.cc.isClang clangGCC
+    ++ stdenv.lib.optionals stdenv.isDarwin [ libiconv CoreAudio ]
+    ++ concatMap (a: a.deps) opts;
+
+  makeFlags = [ "LD=$(CC)" ];
+
+  meta = with stdenv.lib; {
+    description = "Small, fast and powerful console music player for Linux and *BSD";
+    homepage = https://cmus.github.io/;
+    license = licenses.gpl2;
+    maintainers = [ maintainers.oxij ];
+    platforms = platforms.linux ++ platforms.darwin;
+  };
+}
diff --git a/nixpkgs/pkgs/applications/audio/cmus/option-debugging.patch b/nixpkgs/pkgs/applications/audio/cmus/option-debugging.patch
new file mode 100644
index 000000000000..84115e1480e1
--- /dev/null
+++ b/nixpkgs/pkgs/applications/audio/cmus/option-debugging.patch
@@ -0,0 +1,42 @@
+Shows build and link errors in configure for ease of debugging which
+options require what.
+diff --git a/scripts/checks.sh b/scripts/checks.sh
+index 64cbbf3..fab4d9b 100644
+--- a/scripts/checks.sh
++++ b/scripts/checks.sh
+@@ -425,7 +425,7 @@ try_compile()
+ 		echo "$1" > $__src || exit 1
+ 		shift
+ 		__cmd="$CC -c $CFLAGS $@ $__src -o $__obj"
+-		$CC -c $CFLAGS "$@" $__src -o $__obj 2>/dev/null
++		$CC -c $CFLAGS "$@" $__src -o $__obj
+ 		;;
+ 	cxx)
+ 		__src=`tmp_file prog.cc`
+@@ -433,7 +433,7 @@ try_compile()
+ 		echo "$1" > $__src || exit 1
+ 		shift
+ 		__cmd="$CXX -c $CXXFLAGS $@ $__src -o $__obj"
+-		$CXX -c $CXXFLAGS "$@" $__src -o $__obj 2>/dev/null
++		$CXX -c $CXXFLAGS "$@" $__src -o $__obj
+ 		;;
+ 	esac
+ 	return $?
+@@ -451,7 +451,7 @@ try_compile_link()
+ 		echo "$1" > $__src || exit 1
+ 		shift
+ 		__cmd="$CC $__src -o $__exe $CFLAGS $LDFLAGS $@"
+-		$CC $__src -o $__exe $CFLAGS $LDFLAGS "$@" 2>/dev/null
++		$CC $__src -o $__exe $CFLAGS $LDFLAGS "$@"
+ 		;;
+ 	cxx)
+ 		__src=`tmp_file prog.cc`
+@@ -459,7 +459,7 @@ try_compile_link()
+ 		echo "$1" > $__src || exit 1
+ 		shift
+ 		__cmd="$CXX $__src -o $__exe $CXXFLAGS $CXXLDFLAGS $@"
+-		$CXX $__src -o $__exe $CXXFLAGS $CXXLDFLAGS "$@" 2>/dev/null
++		$CXX $__src -o $__exe $CXXFLAGS $CXXLDFLAGS "$@"
+ 		;;
+ 	esac
+ 	return $?