diff --git a/pkgs/development/libraries/libofa/default.nix b/pkgs/development/libraries/libofa/default.nix new file mode 100644 index 000000000000..b3c69646452e --- /dev/null +++ b/pkgs/development/libraries/libofa/default.nix @@ -0,0 +1,14 @@ +{ stdenv, fetchurl, expat, curl, fftw }: + +stdenv.mkDerivation rec { + name = "libofa-0.9.3"; + + propagatedBuildInputs = [ expat curl fftw ]; + + patches = [ ./libofa-0.9.3-gcc-4.patch ./libofa-0.9.3-gcc-4.3.patch ./gcc-4.x.patch ]; + + src = fetchurl { + url = "http://musicip-libofa.googlecode.com/files/${name}.tar.gz"; + sha256 = "184ham039l7lwhfgg0xr2vch2xnw1lwh7sid432mh879adhlc5h2"; + }; +} diff --git a/pkgs/development/libraries/libofa/gcc-4.x.patch b/pkgs/development/libraries/libofa/gcc-4.x.patch new file mode 100644 index 000000000000..50f72bb428c6 --- /dev/null +++ b/pkgs/development/libraries/libofa/gcc-4.x.patch @@ -0,0 +1,12 @@ +diff --git a/examples/example.cpp b/examples/example.cpp +index ef978d5..7d58a0f 100644 +--- a/examples/example.cpp ++++ b/examples/example.cpp +@@ -10,6 +10,7 @@ + #include "protocol.h" + + #include ++#include + + AudioData* loadWaveFile(char *file); + AudioData* loadDataUsingLAME(char *file); diff --git a/pkgs/development/libraries/libofa/libofa-0.9.3-gcc-4.3.patch b/pkgs/development/libraries/libofa/libofa-0.9.3-gcc-4.3.patch new file mode 100644 index 000000000000..7682e3710514 --- /dev/null +++ b/pkgs/development/libraries/libofa/libofa-0.9.3-gcc-4.3.patch @@ -0,0 +1,36 @@ +Fix build with gcc >=4.3 +diff -ur libofa-0.9.3.orig/examples/example.cpp libofa-0.9.3/examples/example.cpp +--- libofa-0.9.3.orig/examples/example.cpp 2006-05-10 21:05:37.000000000 +0300 ++++ libofa-0.9.3/examples/example.cpp 2008-04-16 15:51:49.000000000 +0300 +@@ -9,6 +9,8 @@ + + #include "protocol.h" + ++#include ++ + AudioData* loadWaveFile(char *file); + AudioData* loadDataUsingLAME(char *file); + +Vain hakemistossa libofa-0.9.3/examples: example.cpp.orig +diff -ur libofa-0.9.3.orig/examples/protocol.cpp libofa-0.9.3/examples/protocol.cpp +--- libofa-0.9.3.orig/examples/protocol.cpp 2006-05-10 21:05:42.000000000 +0300 ++++ libofa-0.9.3/examples/protocol.cpp 2008-04-16 15:51:49.000000000 +0300 +@@ -8,6 +8,7 @@ + -------------------------------------------------------------------*/ + #include + #include ++#include + #include + #include + #include +diff -ur libofa-0.9.3.orig/lib/signal_op.cpp libofa-0.9.3/lib/signal_op.cpp +--- libofa-0.9.3.orig/lib/signal_op.cpp 2006-05-10 21:01:12.000000000 +0300 ++++ libofa-0.9.3/lib/signal_op.cpp 2008-04-16 15:51:49.000000000 +0300 +@@ -12,6 +12,7 @@ + // DATE CREATED: 1/12/06 + + ++#include + #include + #include "signal_op.h" + #include "AFLIB/aflibConverter.h" diff --git a/pkgs/development/libraries/libofa/libofa-0.9.3-gcc-4.patch b/pkgs/development/libraries/libofa/libofa-0.9.3-gcc-4.patch new file mode 100644 index 000000000000..920c383c657b --- /dev/null +++ b/pkgs/development/libraries/libofa/libofa-0.9.3-gcc-4.patch @@ -0,0 +1,39 @@ +--- a/lib/JAMA/tnt_math_utils.h 2006-06-17 01:46:22.000000000 +0300 ++++ b/lib/JAMA/tnt_math_utils.h 2006-06-17 01:47:02.000000000 +0300 +@@ -20,11 +20,20 @@ + namespace TNT + { + /** ++ @returns the absolute value of a real (no-complex) scalar. ++*/ ++template ++Real abs(const Real &a) ++{ ++ return (a > 0 ? a : -a); ++} ++/** + @returns hypotenuse of real (non-complex) scalars a and b by + avoiding underflow/overflow + using (a * sqrt( 1 + (b/a) * (b/a))), rather than + sqrt(a*a + b*b). + */ ++ + template + Real hypot(const Real &a, const Real &b) + { +@@ -56,15 +65,6 @@ + } + */ + +-/** +- @returns the absolute value of a real (no-complex) scalar. +-*/ +-template +-Real abs(const Real &a) +-{ +- return (a > 0 ? a : -a); +-} +- + } + #endif + /* MATH_UTILS_H */ diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 3373cd4e781c..551812977b44 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -3309,6 +3309,8 @@ let libnova = callPackage ../development/libraries/libnova { }; + libofa = callPackage ../development/libraries/libofa { }; + libofx = callPackage ../development/libraries/libofx { }; libogg = callPackage ../development/libraries/libogg { };