mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-23 23:43:30 +00:00
adding alsa-plugin and patching alsa so that you can tell it about additional plugins
svn path=/nixpkgs/trunk/; revision=17316
This commit is contained in:
parent
88e66ae7f4
commit
862fcb0252
@ -39,6 +39,7 @@ stdenv.mkDerivation rec {
|
||||
ln -s $out/share/man/man1/nvi.1 $out/share/man/man1/vi
|
||||
ln -s $out/share/man/man1/nvi.1 $out/share/man/man1/ex
|
||||
ln -s $out/share/man/man1/nvi.1 $out/share/man/man1/view
|
||||
ln -s $out/bin/{,vi-}nvi # create a symlink so that all vi(m) users will find it
|
||||
'';
|
||||
|
||||
meta = {
|
||||
|
64
pkgs/os-specific/linux/alsa-lib/alsa-plugin-dirs.patch
Normal file
64
pkgs/os-specific/linux/alsa-lib/alsa-plugin-dirs.patch
Normal file
@ -0,0 +1,64 @@
|
||||
diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c
|
||||
index 74d1d1a..17ffb12 100644
|
||||
--- a/src/pcm/pcm.c
|
||||
+++ b/src/pcm/pcm.c
|
||||
@@ -2042,6 +2042,19 @@ static const char *const build_in_pcms[] = {
|
||||
NULL
|
||||
};
|
||||
|
||||
+
|
||||
+// helper funcion used below
|
||||
+int file_exists(const char * filename)
|
||||
+{
|
||||
+ FILE * file;
|
||||
+ if (file = fopen(filename, "r"))
|
||||
+ {
|
||||
+ fclose(file);
|
||||
+ return 1;
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static int snd_pcm_open_conf(snd_pcm_t **pcmp, const char *name,
|
||||
snd_config_t *pcm_root, snd_config_t *pcm_conf,
|
||||
snd_pcm_stream_t stream, int mode)
|
||||
@@ -2141,8 +2154,38 @@ static int snd_pcm_open_conf(snd_pcm_t **pcmp, const char *name,
|
||||
err = -ENOMEM;
|
||||
goto _err;
|
||||
}
|
||||
- lib = buf1;
|
||||
sprintf(buf1, "%s/libasound_module_pcm_%s.so", ALSA_PLUGIN_DIR, str);
|
||||
+ if (!file_exists(buf1)){
|
||||
+ // try to locate plugin in one of ALSA_PLUGIN_DIRS which is colon separated list of paths
|
||||
+ char * pdirs = getenv("ALSA_PLUGIN_DIRS");
|
||||
+
|
||||
+ if (pdirs){ // env var set?
|
||||
+ char * saveptr;
|
||||
+ while (1) {
|
||||
+ char * dir_tok = strtok_r(pdirs, "::::", &saveptr); // "::::" to work around bug in glibc and -O2 ? ":" seems to cause a segfault
|
||||
+ if (dir_tok == NULL)
|
||||
+ break;
|
||||
+ char * so_file = malloc(strlen(str) + strlen(dir_tok) + 32);
|
||||
+ if (so_file == NULL) {
|
||||
+ err = -ENOMEM;
|
||||
+ goto _err;
|
||||
+ }
|
||||
+
|
||||
+ sprintf(so_file, "%s/libasound_module_pcm_%s.so", dir_tok, str);
|
||||
+
|
||||
+ if (file_exists(so_file)){
|
||||
+
|
||||
+ free(buf1);
|
||||
+ buf1 = so_file;
|
||||
+ break;
|
||||
+ } else {
|
||||
+ free (so_file);
|
||||
+ }
|
||||
+ pdirs = NULL;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ lib = buf1;
|
||||
}
|
||||
}
|
||||
#ifndef PIC
|
@ -10,6 +10,7 @@ stdenv.mkDerivation {
|
||||
# Fix pcm.h file in order to prevent some compilation bugs
|
||||
patchPhase = ''
|
||||
sed -i -e 's|//int snd_pcm_mixer_element(snd_pcm_t \*pcm, snd_mixer_t \*mixer, snd_mixer_elem_t \*\*elem);|/\*int snd_pcm_mixer_element(snd_pcm_t \*pcm, snd_mixer_t \*mixer, snd_mixer_elem_t \*\*elem);\*/|' include/pcm.h
|
||||
unset patchPhase; patchPhase
|
||||
'';
|
||||
meta = {
|
||||
description = "ALSA, the Advanced Linux Sound Architecture libraries";
|
||||
@ -21,4 +22,10 @@ stdenv.mkDerivation {
|
||||
|
||||
homepage = http://www.alsa-project.org/;
|
||||
};
|
||||
|
||||
patches = [
|
||||
/* allow specifying alternatives alsa plugin locations using
|
||||
export ALSA_PLUGIN_DIRS=$(nix-build -A alsaPlugins)/lib/alsa-lib */
|
||||
./alsa-plugin-dirs.patch
|
||||
];
|
||||
}
|
||||
|
24
pkgs/os-specific/linux/alsa-plugins/default.nix
Normal file
24
pkgs/os-specific/linux/alsa-plugins/default.nix
Normal file
@ -0,0 +1,24 @@
|
||||
args: with args;
|
||||
stdenv.mkDerivation {
|
||||
name = "alsa-plugins-1.0.19";
|
||||
|
||||
src = fetchurl {
|
||||
url = ftp://ftp.alsa-project.org/pub/plugins/alsa-plugins-1.0.19.tar.bz2;
|
||||
sha256 = "000iqwlz93ykl0w19hw4qjh3gcw7f45ykmi91cw2m7dg4iy0igk7";
|
||||
};
|
||||
|
||||
# TODO make this customizable
|
||||
buildInputs = [pkgconfig alsaLib pulseaudio];
|
||||
|
||||
|
||||
meta = {
|
||||
description = "plugins for alsa eg conneckt jack, pluseaudio applications easily to the daemons using alsa devices";
|
||||
longDescription = "
|
||||
use it like this: export ALSA_PLUGIN_DIRS=$(nix-build -A alsaPlugins)/lib/alsa-lib
|
||||
";
|
||||
homepage = http://alsa-project.org;
|
||||
license = "GPL2.1";
|
||||
maintainers = [args.lib.maintainers.marcweber];
|
||||
platforms = args.lib.platforms.linux;
|
||||
};
|
||||
}
|
@ -4884,6 +4884,10 @@ let
|
||||
inherit stdenv fetchurl;
|
||||
};
|
||||
|
||||
alsaPlugins = import ../os-specific/linux/alsa-plugins {
|
||||
inherit fetchurl stdenv lib pkgconfig alsaLib pulseaudio;
|
||||
};
|
||||
|
||||
alsaUtils = import ../os-specific/linux/alsa-utils {
|
||||
inherit stdenv fetchurl alsaLib gettext ncurses;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user