From 834cd6c886bece46a553203f03522f192b66da2c Mon Sep 17 00:00:00 2001 From: "Jason \\\"Don\\\" O'Conal" Date: Fri, 6 Sep 2013 11:47:49 +1000 Subject: [PATCH] beret: Fix build on darwin (close #923) --- pkgs/development/libraries/SDL/default.nix | 11 ++-- .../libraries/SDL_image/default.nix | 11 ++-- .../libraries/SDL_mixer/default.nix | 16 ++--- pkgs/games/beret/default.nix | 14 +++-- pkgs/servers/pulseaudio/default.nix | 62 +++++++++---------- pkgs/top-level/all-packages.nix | 16 ++++- 6 files changed, 74 insertions(+), 56 deletions(-) diff --git a/pkgs/development/libraries/SDL/default.nix b/pkgs/development/libraries/SDL/default.nix index 899c3bb5c8d8..e58397fa9a5b 100644 --- a/pkgs/development/libraries/SDL/default.nix +++ b/pkgs/development/libraries/SDL/default.nix @@ -23,10 +23,11 @@ let ''; in stdenv.mkDerivation rec { - name = "SDL-1.2.15"; + version = "1.2.15"; + name = "SDL-${version}"; src = fetchurl { - url = "http://www.libsdl.org/release/${name}.tar.gz"; + url = "http://www.libsdl.org/release/${name}.tar.gz"; sha256 = "005d993xcac8236fpvd1iawkz4wqjybkpn8dbwaliqz5jfkidlyn"; }; @@ -49,8 +50,10 @@ stdenv.mkDerivation rec { passthru = {inherit openglSupport;}; - meta = { + meta = with stdenv.lib; { description = "A cross-platform multimedia library"; - homepage = http://www.libsdl.org/; + homepage = http://www.libsdl.org/; + maintainers = with maintainers; [ lovek323 ]; + platforms = platforms.unix; }; } diff --git a/pkgs/development/libraries/SDL_image/default.nix b/pkgs/development/libraries/SDL_image/default.nix index 8f0d59bc2122..a1d839504770 100644 --- a/pkgs/development/libraries/SDL_image/default.nix +++ b/pkgs/development/libraries/SDL_image/default.nix @@ -4,11 +4,11 @@ stdenv.mkDerivation rec { name = "SDL_image-1.2.12"; src = fetchurl { - url = "http://www.libsdl.org/projects/SDL_image/release/${name}.tar.gz"; + url = "http://www.libsdl.org/projects/SDL_image/release/${name}.tar.gz"; sha256 = "16an9slbb8ci7d89wakkmyfvp7c0cval8xw4hkg0842nhhlp540b"; }; - buildInputs = [SDL libpng libjpeg libtiff libungif libXpm]; + buildInputs = [ SDL libpng libjpeg libtiff libungif libXpm ]; postInstall = '' sed -i -e 's,"SDL.h",,' \ @@ -19,9 +19,10 @@ stdenv.mkDerivation rec { ln -sv SDL/SDL_image.h $out/include/SDL_image.h ''; - meta = { + meta = with stdenv.lib; { description = "SDL image library"; - homepage = "http://www.libsdl.org/projects/SDL_image/"; - platforms = stdenv.lib.platforms.linux; + homepage = http://www.libsdl.org/projects/SDL_image/; + maintainers = with maintainers; [ lovek323 ]; + platforms = platforms.unix; }; } diff --git a/pkgs/development/libraries/SDL_mixer/default.nix b/pkgs/development/libraries/SDL_mixer/default.nix index af83f19dbbde..f5b40daaf68c 100644 --- a/pkgs/development/libraries/SDL_mixer/default.nix +++ b/pkgs/development/libraries/SDL_mixer/default.nix @@ -1,14 +1,13 @@ { stdenv, fetchurl, SDL, libogg, libvorbis, enableNativeMidi ? false }: stdenv.mkDerivation rec { - pname = "SDL_mixer"; - version = "1.2.8"; - - name = "${pname}-${version}"; + pname = "SDL_mixer"; + version = "1.2.12"; + name = "${pname}-${version}"; src = fetchurl { - url = "http://www.libsdl.org/projects/${pname}/release/${name}.tar.gz"; - sha256 = "a8222a274778ff16d0e3ee49a30db27a48a4d357169a915fc599a764e405e0b6"; + url = "http://www.libsdl.org/projects/${pname}/release/${name}.tar.gz"; + sha256 = "0alrhqgm40p4c92s26mimg9cm1y7rzr6m0p49687jxd9g6130i0n"; }; buildInputs = [SDL libogg libvorbis]; @@ -17,7 +16,10 @@ stdenv.mkDerivation rec { postInstall = "ln -s $out/include/SDL/SDL_mixer.h $out/include/"; - meta = { + meta = with stdenv.lib; { description = "SDL multi-channel audio mixer library"; + homepage = http://www.libsdl.org/projects/SDL_mixer/; + maintainers = with maintainers; [ lovek323 ]; + platforms = platforms.unix; }; } diff --git a/pkgs/games/beret/default.nix b/pkgs/games/beret/default.nix index 2e252a5cd540..a92fe4d7c672 100644 --- a/pkgs/games/beret/default.nix +++ b/pkgs/games/beret/default.nix @@ -6,8 +6,9 @@ stdenv.mkDerivation { buildInputs = [ SDL SDL_image SDL_ttf SDL_mixer ]; NIX_CFLAGS_COMPILE = "-I${SDL}/include/SDL"; - - NIX_CFLAGS_LINK = "-lgcc_s"; + NIX_CFLAGS_LINK = stdenv.lib.optionalString (!stdenv.isDarwin) "-lgcc_s"; + NIX_LDFLAGS = stdenv.lib.optionalString stdenv.isDarwin + "-framework CoreFoundation -framework OpenGL -framework Cocoa"; patches = [ ./use-home-dir.patch ]; @@ -28,11 +29,12 @@ stdenv.mkDerivation { cp -av tahoma.ttf images music rooms sfx $out/share ''; - meta = { + meta = with stdenv.lib; { description = "A 2D puzzle-platformer game about a scientist with telekinetic abilities"; - homepage = http://kiwisauce.com/beret/; - platforms = stdenv.lib.platforms.all; - license = stdenv.lib.licenses.lgpl2; + homepage = http://kiwisauce.com/beret/; + license = licenses.lgpl2; + maintainers = with maintainers; [ lovek323 ]; + platforms = platforms.all; }; } diff --git a/pkgs/servers/pulseaudio/default.nix b/pkgs/servers/pulseaudio/default.nix index 46f6735edeec..629dcb5bbce8 100644 --- a/pkgs/servers/pulseaudio/default.nix +++ b/pkgs/servers/pulseaudio/default.nix @@ -1,11 +1,9 @@ { stdenv, fetchurl, pkgconfig, gnum4, gdbm, libtool, glib, dbus, avahi -, gconf, gtk, intltool, gettext -, alsaLib, libsamplerate, libsndfile, speex, bluez, sbc, udev, libcap +, gconf, gtk, intltool, gettext, alsaLib, libsamplerate, libsndfile, speex +, bluez, sbc, udev, libcap, json_c , jackaudioSupport ? false, jackaudio ? null , x11Support ? false, xlibs -, json_c -, useSystemd ? false, systemd ? null -}: +, useSystemd ? false, systemd ? null }: assert jackaudioSupport -> jackaudio != null; @@ -18,20 +16,18 @@ stdenv.mkDerivation rec { }; # Since `libpulse*.la' contain `-lgdbm' and `-lcap', it must be propagated. - propagatedBuildInputs = [ gdbm libcap ]; + propagatedBuildInputs + = [ gdbm ] ++ stdenv.lib.optionals (!stdenv.isDarwin) [ libcap ]; buildInputs = - [ pkgconfig gnum4 libtool intltool glib dbus avahi - libsamplerate libsndfile speex alsaLib bluez sbc udev - json_c - #gtk gconf - ] + [ pkgconfig gnum4 libtool intltool glib dbus avahi libsamplerate libsndfile + speex json_c ] ++ stdenv.lib.optional jackaudioSupport jackaudio ++ stdenv.lib.optionals x11Support [ xlibs.xlibs xlibs.libXtst xlibs.libXi ] - ++ stdenv.lib.optional useSystemd systemd; + ++ stdenv.lib.optional useSystemd systemd + ++ stdenv.lib.optionals (!stdenv.isDarwin) [ alsaLib bluez sbc udev ]; preConfigure = '' - # Move the udev rules under $(prefix). sed -i "src/Makefile.in" \ -e "s|udevrulesdir[[:blank:]]*=.*$|udevrulesdir = $out/lib/udev/rules.d|g" @@ -42,19 +38,32 @@ stdenv.mkDerivation rec { -e "s|chmod r+s |true |" ''; - configureFlags = '' - --disable-solaris --disable-hal --disable-jack - --disable-oss-output --disable-oss-wrapper - --localstatedir=/var --sysconfdir=/etc - ${if jackaudioSupport then "--enable-jack" else ""} - ''; - - installFlags = "sysconfdir=$(out)/etc pulseconfdir=$(out)/etc/pulse"; + configureFlags = + [ "--disable-solaris" "--disable-jack" "--disable-oss-output" + "--disable-oss-wrapper" "--localstatedir=/var" "--sysconfdir=/etc" ] + ++ stdenv.lib.optional jackaudioSupport "--enable-jack" + ++ stdenv.lib.optional stdenv.isDarwin "--with-mac-sysroot=/"; enableParallelBuilding = true; - meta = { + # not sure what the best practices are here -- can't seem to find a way + # for the compiler to bring in stdlib and stdio (etc.) properly + # the alternative is to copy the files from /usr/include to src, but there are + # probably a large number of files that would need to be copied (I stopped + # after the seventh) + NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.isDarwin + "-I/usr/include"; + + installFlags = "sysconfdir=$(out)/etc pulseconfdir=$(out)/etc/pulse"; + + meta = with stdenv.lib; { description = "PulseAudio, a sound server for POSIX and Win32 systems"; + homepage = http://www.pulseaudio.org/; + # Note: Practically, the server is under the GPL due to the + # dependency on `libsamplerate'. See `LICENSE' for details. + licenses = licenses.lgpl2Plus; + maintainers = with maintainers; [ lovek323 ]; + platforms = platforms.unix; longDescription = '' PulseAudio is a sound server for POSIX and Win32 systems. A @@ -65,14 +74,5 @@ stdenv.mkDerivation rec { sample format or channel count and mixing several sounds into one are easily achieved using a sound server. ''; - - homepage = http://www.pulseaudio.org/; - - # Note: Practically, the server is under the GPL due to the - # dependency on `libsamplerate'. See `LICENSE' for details. - licenses = "LGPLv2+"; - - maintainers = [ ]; - platforms = stdenv.lib.platforms.gnu; }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 21a3a3c87d00..01d1d1fac16c 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -5402,14 +5402,24 @@ let SDL = callPackage ../development/libraries/SDL { openglSupport = mesaSupported; - alsaSupport = true; + alsaSupport = (!stdenv.isDarwin); x11Support = true; - pulseaudioSupport = false; # better go through ALSA + pulseaudioSupport = stdenv.isDarwin; # better go through ALSA + + # resolve the unrecognized -fpascal-strings option error + stdenv = if stdenv.isDarwin + then clangStdenv + else stdenv; }; SDL_gfx = callPackage ../development/libraries/SDL_gfx { }; - SDL_image = callPackage ../development/libraries/SDL_image { }; + SDL_image = callPackage ../development/libraries/SDL_image { + # provide an Objective-C compiler + stdenv = if stdenv.isDarwin + then clangStdenv + else stdenv; + }; SDL_mixer = callPackage ../development/libraries/SDL_mixer { };