From e87c6a6793e535beefdce08a085d27c6f5ae2b80 Mon Sep 17 00:00:00 2001 From: Marc Weber Date: Mon, 22 Oct 2007 00:51:40 +0000 Subject: [PATCH] sox, ffmpeg_svn expressions added ghcPkgUtil defines a function to create setup-hook - creating a packagedatabase (nix-support/package.conf) - adding it to GHC_PACKAGE_PATH see comments for details svn path=/nixpkgs/trunk/; revision=9500 --- pkgs/applications/misc/audio/sox/default.nix | 58 +++++++++++++++++++ .../libraries/ffmpeg_svn_snapshot/default.nix | 11 ++++ .../libraries/haskell/generic/ghcPkgUtil.sh | 33 +++++++++++ .../libraries/libsamplerate/default.nix | 35 +++++++++++ pkgs/top-level/all-packages.nix | 29 ++++++++++ 5 files changed, 166 insertions(+) create mode 100644 pkgs/applications/misc/audio/sox/default.nix create mode 100644 pkgs/development/libraries/ffmpeg_svn_snapshot/default.nix create mode 100644 pkgs/development/libraries/haskell/generic/ghcPkgUtil.sh create mode 100644 pkgs/development/libraries/libsamplerate/default.nix diff --git a/pkgs/applications/misc/audio/sox/default.nix b/pkgs/applications/misc/audio/sox/default.nix new file mode 100644 index 00000000000..91bd5be0788 --- /dev/null +++ b/pkgs/applications/misc/audio/sox/default.nix @@ -0,0 +1,58 @@ +args: +( args.mkDerivationByConfigruation { + flagConfig = { + mandatory = { implies = [ "no_oss" "no_sun_audio" ]; }; + # are these options of interest? We'll see + #--disable-fftw disable usage of FFTW + #--enable-debug enable debugging + #--disable-cpu-clip disable tricky cpu specific clipper + alsa = { cfgOption = "--enable-alsa"; buildInputs = "alsa"; }; + no_alsa = { cfgOption = "--disable-alsa"; }; + libao = { cfgOption = "--enable-libao"; buildInputs = "libao"; }; + no_libao = { cfgOption = "--disable-libao"; }; + #oss = { cfgOption = "--enable-oss"; buildInputs = "oss"; }; + no_oss = { cfgOption = "--disable-oss"; }; + #sun_audio = { cfgOption = "--enable-sun-audio"; buildInputs = "sun_audio"; }; + no_sun_audio = { cfgOption = "--disable-sun_audio"; }; + + # These options should be autodetected by the configure script + /* + --without-sndfile Don't try to use libsndfile + --without-ogg Don't try to use Ogg Vorbis + --without-flac Don't try to use FLAC + --without-ffmpeg Don't try to use ffmpeg + --without-mad Don't try to use MAD (MP3 Audio Decoder) + --without-lame Don't try to use LAME (LAME Ain't an MP3 Encoder) + --without-amr-wb Don't try to use amr-wb + --without-amr-nb Don't try to use amr-nb + --without-samplerate Don't try to use libsamplerate (aka Secret Rabbit + Code) + --without-ladspa Don't try to use LADSPA + --with-ladspa-path Default search path for LADSPA plugins + */ + }; + + optionals = [ "libsndfile" "libogg" "flac" "ffmpeg" "libmad" "lame" + /* "amr-wb" "amr-nb" */ + "libsamplerate" /* "ladspa" */ ]; + + + extraAttrs = co : { + name = "sox-14.0.0"; + + src = args.fetchurl { + url = mirror://sourceforge/sox/sox-14.0.0.tar.gz; + sha256 = "1l7v04nlvb96y0w9crvm6nq8g50yxp3bkv6nb1c205s982inlalc"; + }; + + meta = { + description = "Sample Rate Converter for audio"; + homepage = http://www.mega-nerd.com/SRC/index.html; + # you can choose one of the following licenses: + license = [ "GPL" + { url=http://www.mega-nerd.com/SRC/libsamplerate-cul.pdf; + name="libsamplerate Commercial Use License"; + } ]; + }; + }; +} ) args diff --git a/pkgs/development/libraries/ffmpeg_svn_snapshot/default.nix b/pkgs/development/libraries/ffmpeg_svn_snapshot/default.nix new file mode 100644 index 00000000000..3719f1301a3 --- /dev/null +++ b/pkgs/development/libraries/ffmpeg_svn_snapshot/default.nix @@ -0,0 +1,11 @@ +{stdenv, fetchurl}: + +stdenv.mkDerivation { + name = "ffmpeg-svn"; + src = fetchurl { + url = http://ffmpeg.mplayerhq.hu/ffmpeg-export-snapshot.tar.bz2; + sha256 = "040a35f0c004323af14329c09ad3cff8d040e2cf9797d97cde3d9d83d02b4d87"; + }; + # !!! Hm, what are the legal consequences of --enable-gpl? + configureFlags = "--enable-shared --enable-pp --enable-gpl --disable-ffserver --disable-ffplay"; +} diff --git a/pkgs/development/libraries/haskell/generic/ghcPkgUtil.sh b/pkgs/development/libraries/haskell/generic/ghcPkgUtil.sh new file mode 100644 index 00000000000..e265195b321 --- /dev/null +++ b/pkgs/development/libraries/haskell/generic/ghcPkgUtil.sh @@ -0,0 +1,33 @@ +# mantainer: Marc Weber (marco-oweber@gmx.de) +# +# example usage: add ghcPkgUtil to buildInputs then somewhere in buildPhase: +# +# createEmptyPackageDatabaseAndSetupHook +# configure --with-package-db=$PACKAGE_DB +# ... compile ghc library ... +# add your library to propagatedBuildInputs instead of buildInputs +# in all depending libraries + + + +# creates a setup hook +# adding the package database +# nix-support/package.conf to GHC_PACKAGE_PATH +# if not already contained +setupHookRegisteringPackageDatabase(){ + ensureDir $out/nix-support; + local pkgdb=$out/nix-support/package.conf + cat >> $out/nix-support/setup-hook << EOF + + echo \$GHC_PACKAGE_PATH | grep -l $pkgdb &> /dev/null || \ + export GHC_PACKAGE_PATH=\$GHC_PACKAGE_PATH\${GHC_PACKAGE_PATH:+$PATH_DELIMITER}$pkgdb; +EOF +} + +# create an empty package database in which the new library can be registered. +createEmptyPackageDatabaseAndSetupHook(){ + ensureDir $out/nix-support; + PACKAGE_DB=$out/nix-support/package.conf; + echo '[]' > $PACKAGE_DB"; + setupHookRegisteringPackageDatabase +} diff --git a/pkgs/development/libraries/libsamplerate/default.nix b/pkgs/development/libraries/libsamplerate/default.nix new file mode 100644 index 00000000000..895772d7fc0 --- /dev/null +++ b/pkgs/development/libraries/libsamplerate/default.nix @@ -0,0 +1,35 @@ +args: +( args.mkDerivationByConfigruation { + flagConfig = { + mandatory = { buildInputs = ["pkgconfig"];}; + # are these options of interest? We'll see + #--disable-fftw disable usage of FFTW + #--enable-debug enable debugging + #--disable-cpu-clip disable tricky cpu specific clipper + + }; + + extraAttrs = co : { + name = "libsamplerate-0.1.2"; + + src = args.fetchurl { + url = http://www.mega-nerd.com/SRC/libsamplerate-0.1.2.tar.gz; + sha256 = "1m1iwzpcny42kcqv5as2nyb0ggrb56wzckpximqpp2y74dipdf4q"; + }; + + configurePhase = " + export LIBSAMPLERATE_CFLAGS=\"-I \$libsamplerate/include\" + export LIBSAMPLERATE_LIBS=\"-L \$libsamplerate/libs\" + ./configure --prefix=\$out"+co.configureFlags; + + meta = { + description = "Sample Rate Converter for audio"; + homepage = http://www.mega-nerd.com/SRC/index.html; + # you can choose one of the following licenses: + license = [ "GPL" + { url=http://www.mega-nerd.com/SRC/libsamplerate-cul.pdf; + name="libsamplerate Commercial Use License"; + } ]; + }; + }; +} ) args diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 9ea7dba743d..10b7866fe4f 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1562,6 +1562,10 @@ rec { inherit fetchurl stdenv; }; + ffmpeg_svn = import ../development/libraries/ffmpeg_svn_snapshot { + inherit fetchurl stdenv; + }; + # commented out because it's using the new configuration style proposal which is unstable # needs some testing .. @@ -1808,6 +1812,11 @@ rec { inherit fetchurl stdenv pkgconfig libusb; }; + # commented out because it's using the new configuration style proposal which is unstable + #libsamplerate = (import ../development/libraries/libsamplerate) { + # inherit fetchurl stdenv mkDerivationByConfigruation pkgconfig lib; + #}; + libgsf = import ../development/libraries/libgsf { inherit fetchurl stdenv perl perlXMLParser pkgconfig libxml2 gettext; inherit (gnome) glib; @@ -2231,6 +2240,11 @@ rec { ### DEVELOPMENT / LIBRARIES / HASKELL + # usage: see ghcPkgUtil.sh - use setup-new2 because of PATH_DELIMITER + ghcPkgUtil = runCommand "ghcPkgUtil-internal" + { ghcPkgUtil = ../development/libraries/haskell/generic/ghcPkgUtil.sh; } + "mkdir -p $out/nix-support; cp $ghcPkgUtil \$out/nix-support/setup-hook;"; + uulib64 = import ../development/libraries/haskell/uulib { # !!! remove? inherit stdenv fetchurl ghc; @@ -3806,6 +3820,21 @@ rec { inherit (xlibs) libXmu; }; + # commented out because it's using the new configuration style proposal which is unstable + /* + sox = import ../applications/misc/audio/sox { + inherit fetchurl stdenv lib mkDerivationByConfigruation; + # optional features + inherit alsaLib /*libao*/; + inherit libsndfile libogg flac libmad lame libsamplerate; + # Using the default nix ffmpeg I get this error when linking + # .libs/libsox_la-ffmpeg.o: In function `audio_decode_frame': + # /tmp/nix-7957-1/sox-14.0.0/src/ffmpeg.c:130: undefined reference to `avcodec_decode_audio2 + # That's why I'v added ffmpeg_svn + ffmpeg = ffmpeg_svn; + }; + */ + spoofax = import ../applications/editors/eclipse/plugins/spoofax { inherit fetchurl stdenv; };