diff --git a/pkgs/misc/emulators/retroarch/cores.nix b/pkgs/misc/emulators/retroarch/cores.nix new file mode 100644 index 000000000000..f1cef0acc1c2 --- /dev/null +++ b/pkgs/misc/emulators/retroarch/cores.nix @@ -0,0 +1,170 @@ +{ stdenv, fetchgit, pkgconfig, makeWrapper, python27 +, retroarch, fluidsynth, mesa, SDL, libpng, libjpeg, libvorbis, zlib }: + +let + + d2u = stdenv.lib.replaceChars ["-"] ["_"]; + + mkLibRetroCore = ({ core, src, description, ... }@a: + stdenv.lib.makeOverridable stdenv.mkDerivation rec { + + name = "libretro-${core}-${version}"; + version = "20140902"; + inherit src; + + buildInputs = [ makeWrapper retroarch zlib ] ++ a.extraBuildInputs or []; + + buildPhase = "make -f Makefile.libretro"; + installPhase = '' + COREDIR="$out/lib/retroarch/cores" + mkdir -p $out/bin + mkdir -p $COREDIR + mv ${d2u core}_libretro.so $COREDIR/. + makeWrapper ${retroarch}/bin/retroarch $out/bin/retroarch-${core} \ + --add-flags "-L $COREDIR/${d2u core}_libretro.so $@" + ''; + + passthru.libretroCore = "/lib/retroarch/cores"; + + meta = with stdenv.lib; { + inherit description; + homepage = "http://www.libretro.com/"; + license = licenses.gpl3Plus; + maintainers = [ maintainers.edwtjo ]; + platforms = platforms.linux; + }; + } // a); + + fetchRetro = { repo, rev, sha256 }: + fetchgit { + inherit rev sha256; + url = "https://github.com/libretro/${repo}.git"; + fetchSubmodules = true; + }; + +in + +{ + + _4do = (mkLibRetroCore rec { + core = "4do"; + src = fetchRetro { + repo = core + "-libretro"; + rev = "961812bc421f3fbfd83ea211783bb511a0b6d31c"; + sha256 = "0217iq8sj8gn161c3mj632csl1da8ir2ffxxdillpcddv6ppsayl"; + }; + description = "Port of 4DO/libfreedo to libretro"; + }).override { + buildPhase = "make"; + }; + + desmume = mkLibRetroCore rec { + core = "desmume"; + src = fetchRetro { + repo = core + "-libretro"; + rev = "1dd58e4a9fa375b6909cd8718165a429d4b8bd6d"; + sha256 = "137bw9316qxm8s6p0bzyvk39dv5b5bn60fgllmyj9z5y8x5lrc9l"; + }; + description = "libretro wrapper for desmume NDS emulator"; + }; + + fceumm = mkLibRetroCore rec { + core = "fceumm"; + src = fetchRetro { + repo = "libretro-" + core; + rev = "17e081541c9d36d0658e7139afa5b085aa0316c9"; + sha256 = "0cn74z976rgjh7hf0yb1sdjlm347157893s2z397rgjvks8xssb0"; + }; + description = "FCEUmm libretro port"; + }; + + mupen64plus = (mkLibRetroCore rec { + core = "mupen64plus"; + src = fetchRetro { + repo = core + "-libretro"; + rev = "2251b3aba2a5bb233ff49dd9b6472f2c0feb9b83"; + sha256 = "04g93kj6n5vddbzfb30d8n711kg0yxfnl5v567aa854misn6gfxd"; + }; + description = "Libretro port of Mupen64 Plus, GL only"; + + extraBuildInputs = [ mesa ]; + }).override { + buildPhase = "make WITH_DYNAREC=${if stdenv.system == "x86_64-linux" then "x86_64" else "x86"}"; + }; + + scummvm = (mkLibRetroCore rec { + core = "scummvm"; + src = fetchRetro { + repo = core; + rev = "c00247171ba8201614e85556c638b8825dc9f225"; + sha256 = "1wir3x928b37va6gn14bmwsydkpk4afma5hppmbivw4qp8mj25pa"; + }; + description = "Libretro port of ScummVM"; + + extraBuildInputs = [ fluidsynth libjpeg libvorbis mesa SDL ]; + }).override { + buildPhase = "cd backends/platform/libretro/build/;make"; + }; + + snes9x-next = mkLibRetroCore rec { + core = "snes9x-next"; + src = fetchRetro { + repo = core; + rev = "461d92be09e1857d215f51aeea448a8e180bbfdd"; + sha256 = "0ci453qsyrv3brmy2szngis2xyvxilcv9yhc2qjz285mirg6fj57"; + }; + description = "Optimized port/rewrite of SNES9x 1.52+ to Libretro"; + }; + + stella = (mkLibRetroCore rec { + core = "stella"; + src = fetchRetro { + repo = core + "-libretro"; + rev = "c7ee7ca7e8a29c986f49306c75832972f5749f72"; + sha256 = "15wy9h3a2qk66lh8x40b3a9il0zkdflqil1h51zjmhq2zzsq8p95"; + }; + description = "Port of Stella to libretro"; + }).override { + buildPhase = "make"; + }; + + picodrive = (mkLibRetroCore rec { + core = "picodrive"; + src = fetchRetro { + repo = core; + rev = "d84817550ac064fbba7ee718fb3baeda7d5546da"; + sha256 = "17zh9m2v7h1cifzz8dcwqm4wn94zyhz6g85gf0aw6xylxahza627"; + }; + description = "Fast MegaDrive/MegaCD/32X emulator"; + + extraBuildInputs = [ libpng SDL ]; + }).override { + patchPhase = "sed -i -e 's,SDL_CONFIG=\".*\",SDL_CONFIG=\"${SDL}/bin/sdl-config\",' configure"; + configurePhase = "./configure"; + }; + + ppsspp = (mkLibRetroCore rec { + core = "ppsspp"; + src = fetchRetro { + repo = "libretro-" + core; + rev = "6ee828171218b26e124c5e8fa7877e6ee1d5ff79"; + sha256 = "1559d4k3h0a2dv3684j4w924p2dg8z2j1fwhy7w9mhb5z4kddjhk"; + }; + description = "ppsspp libretro port"; + + extraBuildInputs = [ mesa ]; + }).override{ + buildPhase = "cd libretro && make"; + }; + + vba-next = mkLibRetroCore rec { + core = "vba-next"; + src = fetchRetro { + repo = core; + rev = "fb095107f83df5f93b8ba4833eaf43901f42c0c0"; + sha256 = "0fvq1dfll27vjbmyh4qsp2nw166jsd91sjmf1sl84z56ab3q3iw8"; + }; + description = "VBA-M libretro port"; + }; + +} \ No newline at end of file diff --git a/pkgs/misc/emulators/retroarch/default.nix b/pkgs/misc/emulators/retroarch/default.nix index 8bc53da8f0c8..d110f2b789e2 100644 --- a/pkgs/misc/emulators/retroarch/default.nix +++ b/pkgs/misc/emulators/retroarch/default.nix @@ -4,7 +4,7 @@ }: stdenv.mkDerivation rec { - name = "retroarch-0.9.9.7"; + name = "retroarch-bare-0.9.9.7"; src = fetchgit { url = "https://github.com/libretro/RetroArch.git"; @@ -20,7 +20,7 @@ stdenv.mkDerivation rec { preConfigure = '' configureFlags="--global-config-dir=$out/etc" ''; - + meta = { description = "Modular multi-system game/emulator system"; homepage = "http://www.libretro.com/"; diff --git a/pkgs/misc/emulators/retroarch/master.nix b/pkgs/misc/emulators/retroarch/master.nix index 44bd6649045c..2efb43e5d5ee 100644 --- a/pkgs/misc/emulators/retroarch/master.nix +++ b/pkgs/misc/emulators/retroarch/master.nix @@ -1,8 +1,11 @@ -{ stdenv, fetchgit, pkgconfig, ffmpeg, mesa, nvidia_cg_toolkit, freetype, libxml2, libv4l -, coreutils, python34, which, udev, alsaLib, libX11, libXext, libXxf86vm, libXdmcp, SDL -, pulseaudio ? null }: +{ stdenv, fetchgit, pkgconfig, ffmpeg, mesa, nvidia_cg_toolkit +, freetype, libxml2, libv4l, coreutils, python34, which, udev, alsaLib +, libX11, libXext, libXxf86vm, libXdmcp, SDL, pulseaudio ? null }: + stdenv.mkDerivation rec { - name = "retroarch-20140902"; + name = "retroarch-bare-${version}"; + version = "20140902"; + src = fetchgit { url = git://github.com/libretro/RetroArch.git; rev = "0856091296c2e47409f36e13007805d71db69483"; @@ -19,10 +22,10 @@ stdenv.mkDerivation rec { enableParallelBuilding = true; - meta = { + meta = with stdenv.lib; { homepage = http://libretro.org/; description = "Multi-platform emulator frontend for libretro cores"; - license = stdenv.lib.licenses.gpl3; - maintainers = with stdenv.lib.maintainers; [ MP2E ]; + license = licenses.gpl3; + maintainers = with maintainers; [ MP2E ]; }; } diff --git a/pkgs/misc/emulators/retroarch/wrapper.nix b/pkgs/misc/emulators/retroarch/wrapper.nix new file mode 100644 index 000000000000..f7e903ef5290 --- /dev/null +++ b/pkgs/misc/emulators/retroarch/wrapper.nix @@ -0,0 +1,36 @@ +{ stdenv, lib, makeWrapper, retroarch, cores }: + +let + + p = builtins.parseDrvName retroarch.name; + +in + +stdenv.mkDerivation { + name = "retroarch-" + p.version; + version = p.version; + + buildInputs = [ makeWrapper ]; + + buildCommand = '' + mkdir -p $out/lib + $(for coreDir in $cores + do + $(ln -s $coreDir/*.so $out/lib/.) + done) + makeWrapper ${retroarch}/bin/retroarch $out/bin/retroarch \ + --suffix-each LD_LIBRARY_PATH ':' "$cores" \ + --add-flags "-L $out/lib/ --menu" \ + ''; + + cores = map (x: x + x.libretroCore) cores; + preferLocalBuild = true; + + meta = with retroarch.meta; { + inherit license homepage; + description = description + + " (with cores: " + + lib.concatStrings (lib.intersperse ", " (map (x: ""+x.name) cores)) + + ")"; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 6e5e6d92a4b2..af3980aff7e4 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1220,7 +1220,7 @@ let * objections before removal. The feature is integer coordinates */ graphviz_2_0 = callPackage ../tools/graphics/graphviz/2.0.nix { }; - + /* Readded by Michael Raskin. There are programs in the wild * that do want 2.32 but not 2.0 or 2.36. Please give a day's notice for * objections before removal. The feature is libgraph. @@ -7169,7 +7169,7 @@ let tomcat6 = callPackage ../servers/http/tomcat/6.0.nix { }; tomcat7 = callPackage ../servers/http/tomcat/7.0.nix { }; - + tomcat8 = callPackage ../servers/http/tomcat/8.0.nix { }; tomcat_mysql_jdbc = callPackage ../servers/http/tomcat/jdbc/mysql { }; @@ -9819,7 +9819,7 @@ let }; stella = callPackage ../misc/emulators/stella { }; - + linuxstopmotion = callPackage ../applications/video/linuxstopmotion { }; sweethome3d = recurseIntoAttrs ( (callPackage ../applications/misc/sweethome3d { }) @@ -10215,6 +10215,27 @@ let gtk_modules = [ libcanberra ]; }; + wrapRetroArch = { retroarch }: + let + cfg = stdenv.lib.attrByPath [ "retroarch" ] {} config; + in + import ../misc/emulators/retroarch/wrapper.nix { + inherit stdenv lib makeWrapper retroarch; + cores = with libretro; + ([ ] + ++ lib.optional (cfg.enable4do or false) _4do + ++ lib.optional (cfg.enableDesmume or false) desmume + ++ lib.optional (cfg.enableFceumm or false) fceumm + ++ lib.optional (cfg.enableMupen64Plus or false) mupen64plus + ++ lib.optional (cfg.enablePicodrive or false) picodrive + ++ lib.optional (cfg.enablePPSSPP or false) ppsspp + ++ lib.optional (cfg.enableScummVM or false) scummvm + ++ lib.optional (cfg.enableSnes9xNext or false) snes9x-next + ++ lib.optional (cfg.enableStella or false) stella + ++ lib.optional (cfg.enableVbaNext or false) vba-next + ); + }; + wxhexeditor = callPackage ../applications/editors/wxhexeditor { }; wxcam = callPackage ../applications/video/wxcam { @@ -10222,7 +10243,7 @@ let inherit intltool; wxGTK = wxGTK28; gtk = gtk2; - }; + }; x11vnc = callPackage ../tools/X11/x11vnc { }; @@ -10376,12 +10397,11 @@ let zim = callPackage ../applications/office/zim { pygtk = pyGtkGlade; }; - + zotero = callPackage ../applications/office/zotero { }; zynaddsubfx = callPackage ../applications/audio/zynaddsubfx { }; - ### GAMES alienarena = callPackage ../games/alienarena { }; @@ -10897,7 +10917,7 @@ let libnm-qt = callPackage ../development/libraries/libnm-qt { }; - massif-visualizer = callPackage ../development/tools/analysis/massif-visualizer { }; + massif-visualizer = callPackage ../development/tools/analysis/massif-visualizer { }; networkmanagement = callPackage ../tools/networking/networkmanagement { }; @@ -11477,8 +11497,15 @@ let putty = callPackage ../applications/networking/remote/putty { }; - retroarch = callPackage ../misc/emulators/retroarch { }; - retroarchMaster = callPackage ../misc/emulators/retroarch/master.nix { }; + retroarchBare = callPackage ../misc/emulators/retroarch { }; + + retroarchBareMaster = callPackage ../misc/emulators/retroarch/master.nix { }; + + retroarch = wrapRetroArch { retroarch = retroarchBareMaster; }; + + libretro = recurseIntoAttrs (callPackage ../misc/emulators/retroarch/cores.nix { + retroarch = retroarchBareMaster; + }); rssglx = callPackage ../misc/screensavers/rss-glx { };