about summary refs log tree commit diff
path: root/pkgs/development/libraries/portaudio/default.nix
diff options
context:
space:
mode:
authorJason \"Don\" O'Conal <lovek323@gmail.com>2013-07-06 17:56:54 +1000
committerRok Garbas <rok@garbas.si>2013-07-06 13:46:18 +0200
commitcd5f3dc1fa16a20f8bd909e80c1fe8f7cf148b1b (patch)
tree5336c40387a2d333a9d4db5858ef089f8b1524b9 /pkgs/development/libraries/portaudio/default.nix
parentda7db90068a435c754110f6aea315c7b6aca772b (diff)
portaudio: fix build on darwin
* remove alsaLib from build inputs
* add --build=x86_64 to configure flags
* add --without-oss to configure flags
* add --enable-static to configure flags
* add --enable-shared to configure flags
* add framework header files
* disable failed tests
* copy all headers on install
* build with gccApple
Diffstat (limited to 'pkgs/development/libraries/portaudio/default.nix')
-rw-r--r--pkgs/development/libraries/portaudio/default.nix37
1 files changed, 32 insertions, 5 deletions
diff --git a/pkgs/development/libraries/portaudio/default.nix b/pkgs/development/libraries/portaudio/default.nix
index 89361bf31216a..36e2e10ee0836 100644
--- a/pkgs/development/libraries/portaudio/default.nix
+++ b/pkgs/development/libraries/portaudio/default.nix
@@ -8,13 +8,40 @@ stdenv.mkDerivation rec {
     sha256 = "168vmcag3c5y3zwf7h5298ydh83g72q5bznskrw9cr2h1lrx29lw";
   };
 
-  buildInputs = [ alsaLib pkgconfig ];
-  
-  meta = {
+  buildInputs = [ pkgconfig ]
+    ++ stdenv.lib.optional (!stdenv.isDarwin) alsaLib;
+
+  configureFlags = stdenv.lib.optionals stdenv.isDarwin
+    [ "--build=x86_64" "--without-oss" "--enable-static" "--enable-shared" ];
+
+  preBuild = stdenv.lib.optionalString stdenv.isDarwin ''
+    sed -i '50 i\
+      #include <CoreAudio/AudioHardware.h>\
+      #include <CoreAudio/AudioHardwareBase.h>\
+      #include <CoreAudio/AudioHardwareDeprecated.h>' \
+      include/pa_mac_core.h
+
+    # disable two tests that don't compile
+    sed -i -e 105d Makefile
+    sed -i -e 107d Makefile
+  '';
+
+  # not sure why, but all the headers seem to be installed by the make install
+  installPhase = if stdenv.isDarwin then ''
+    mkdir -p "$out"
+    cp -r include "$out"
+    cp -r lib "$out"
+  '' else ''
+    make install
+  '';
+
+  meta = with stdenv.lib; {
     description = "Portable cross-platform Audio API";
-    homepage = http://www.portaudio.com/;
+    homepage    = http://www.portaudio.com/;
     # Not exactly a bsd license, but alike
-    license = "BSD";
+    license     = licenses.bsd;
+    maintainers = with maintainers; [ lovek323 ];
+    platforms   = platforms.unix;
   };
 
   passthru = {