diff options
-rw-r--r-- | pkgs/games/steam/build-runtime.sh | 47 | ||||
-rw-r--r-- | pkgs/games/steam/chrootenv.nix | 122 | ||||
-rw-r--r-- | pkgs/games/steam/default.nix | 43 | ||||
-rw-r--r-- | pkgs/games/steam/runtime-wrapped.nix | 109 | ||||
-rw-r--r-- | pkgs/games/steam/steam.nix | 38 | ||||
-rw-r--r-- | pkgs/top-level/all-packages.nix | 8 |
6 files changed, 215 insertions, 152 deletions
diff --git a/pkgs/games/steam/build-runtime.sh b/pkgs/games/steam/build-runtime.sh new file mode 100644 index 000000000000..ddf974671a03 --- /dev/null +++ b/pkgs/games/steam/build-runtime.sh @@ -0,0 +1,47 @@ +source $stdenv/setup + +outp=$out/lib/steam-runtime + +buildDir() { + paths="$1" + pkgs="$2" + + for pkg in $pkgs; do + echo "adding package $pkg" + for path in $paths; do + if [ -d $pkg/$path ]; then + cd $pkg/$path + for file in *; do + found="" + for i in $paths; do + if [ -e "$outp/$i/$file" ]; then + found=1 + break + fi + done + if [ -z "$found" ]; then + mkdir -p $outp/$path + ln -s "$pkg/$path/$file" $outp/$path + sovers=$(echo $file | perl -ne 'print if s/.*?\.so\.(.*)/\1/') + if [ ! -z "$sovers" ]; then + fname=''${file%.''${sovers}} + for ver in ''${sovers//./ }; do + found="" + for i in $paths; do + if [ -e "$outp/$i/$fname" ]; then + found=1 + break + fi + done + [ -n "$found" ] || ln -s "$pkg/$path/$file" "$outp/$path/$fname" + fname="$fname.$ver" + done + fi + fi + done + fi + done + done +} + +eval "$installPhase" diff --git a/pkgs/games/steam/chrootenv.nix b/pkgs/games/steam/chrootenv.nix index bb459d16819d..cbf5b92760b3 100644 --- a/pkgs/games/steam/chrootenv.nix +++ b/pkgs/games/steam/chrootenv.nix @@ -1,14 +1,13 @@ -{ lib, buildFHSUserEnv, steam-runtime -, withRuntime ? false -, withJava ? false -, withPrimus ? false +{ lib, buildFHSUserEnv +, withJava ? false +, withPrimus ? false }: buildFHSUserEnv { name = "steam"; targetPkgs = pkgs: with pkgs; [ - steam-original + steamPackages.steam # Errors in output without those pciutils python2 @@ -31,125 +30,24 @@ buildFHSUserEnv { xlibs.libX11 xlibs.libXfixes - glib - gtk2 - bzip2 - zlib - libpulseaudio - gdk_pixbuf - # Not formally in runtime but needed by some games gst_all_1.gstreamer gst_all_1.gst-plugins-ugly - ] ++ lib.optionals withRuntime [ - # Without these it silently fails - xlibs.libXinerama - xlibs.libXdamage - xlibs.libXcursor - xlibs.libXrender - xlibs.libXScrnSaver - xlibs.libXi - xlibs.libSM - xlibs.libICE - gnome2.GConf - freetype - openalSoft - curl - nspr - nss - fontconfig - cairo - pango - alsaLib - expat - dbus - cups - libcap - SDL2 - libusb1 - dbus_glib - libav - atk - # Only libraries are needed from those two - udev182 - networkmanager098 - - # Verified games requirements - xlibs.libXmu - xlibs.libxcb - xlibs.libpciaccess - mesa_glu - libuuid - libogg - libvorbis - SDL - SDL2_image - glew110 - openssl - libidn - # Other things from runtime - xlibs.libXinerama - flac - freeglut - libjpeg - libpng12 - libsamplerate - libmikmod - libtheora - pixman - speex - SDL_image - SDL_ttf - SDL_mixer - SDL2_net - SDL2_ttf - SDL2_mixer - gstreamer - gst_plugins_base + steamPackages.steam-runtime-wrapped ]; extraBuildCommands = '' [ -d lib64 ] && mv lib64/steam lib - # FIXME: maybe we should replace this with proper libcurl-gnutls - ln -s libcurl.so.4 lib/libcurl-gnutls.so.4 - [ -d lib64 ] && ln -s libcurl.so.4 lib64/libcurl-gnutls.so.4 - '' + lib.optionals withRuntime '' - mkdir -p steamrt/usr - ln -s lib32 steamrt/lib - - if [ -d lib64 ]; then - ln -s ${steam-runtime}/i386/usr/bin steamrt/bin - else - ln -s ${steam-runtime}/amd64/usr/bin steamrt/bin - fi - - ln -s ${steam-runtime}/i386/etc steamrt/etc - ln -s ${steam-runtime}/i386/usr/include steamrt/usr/include - - cp -rsf --no-preserve mode ${steam-runtime}/i386/usr/lib steamrt/lib32 - cp -rsf ${steam-runtime}/i386/lib/* steamrt/lib32 - - cp -rsf --no-preserve mode ${steam-runtime}/amd64/usr/lib steamrt/lib64 - cp -rsf ${steam-runtime}/amd64/lib/* steamrt/lib64 - - libs=$(ls -dm --quoting-style=escape steamrt/lib{32,64}/{,*/}) + mkdir -p steamrt - echo 'export STEAM_RUNTIME=0' > steamrt/profile - echo 'export PATH=$PATH:/steamrt/bin' >> steamrt/profile - echo -n 'export LD_LIBRARY_PATH=/' >> steamrt/profile - echo -n $libs | sed 's/\/, /:\//g' | sed 's/\/$//g' >> steamrt/profile - echo ':$LD_LIBRARY_PATH' >> steamrt/profile + ln -s ../lib64/steam-runtime steamrt/amd64 + ln -s ../lib/steam-runtime steamrt/i386 ''; - profile = if withRuntime then '' - source /steamrt/profile - '' else '' - # Ugly workaround for https://github.com/ValveSoftware/steam-for-linux/issues/3504 - export LD_PRELOAD=/lib32/libpulse.so:/lib64/libpulse.so:/lib32/libasound.so:/lib64/libasound.so:$LD_PRELOAD - # Another one for https://github.com/ValveSoftware/steam-for-linux/issues/3801 - export LD_PRELOAD=/lib32/libstdc++.so:/lib64/libstdc++.so:$LD_PRELOAD + profile = '' + export STEAM_RUNTIME=/steamrt ''; runScript = "steam"; diff --git a/pkgs/games/steam/default.nix b/pkgs/games/steam/default.nix index 2f2ce921176d..c2a28a53ae6e 100644 --- a/pkgs/games/steam/default.nix +++ b/pkgs/games/steam/default.nix @@ -1,38 +1,13 @@ -{stdenv, fetchurl, traceDeps ? false}: +{ pkgs, newScope }: -stdenv.mkDerivation rec { - name = "${program}-original-${version}"; - program = "steam"; - version = "1.0.0.49"; +let + callPackage = newScope self; - src = fetchurl { - url = "http://repo.steampowered.com/steam/pool/steam/s/steam/${program}_${version}.tar.gz"; - sha256 = "1c1gl5pwvb5gnnnqf5d9hpcjnfjjgmn4lgx8v0fbx1am5xf3p2gx"; + self = rec { + steam-runtime = callPackage ./runtime.nix { }; + steam-runtime-wrapped = callPackage ./runtime-wrapped.nix { }; + steam = callPackage ./steam.nix { }; + steam-chrootenv = callPackage ./chrootenv.nix { }; }; - traceLog = "/tmp/steam-trace-dependencies.log"; - - installPhase = '' - make DESTDIR=$out install - mv $out/usr/* $out #*/ - rmdir $out/usr - - rm $out/bin/steamdeps - ${stdenv.lib.optionalString traceDeps '' - cat > $out/bin/steamdeps <<EOF - #! /bin/bash - echo \$1 >> ${traceLog} - cat \$1 >> ${traceLog} - echo >> ${traceLog} - EOF - chmod +x $out/bin/steamdeps - ''} - ''; - - meta = with stdenv.lib; { - description = "A digital distribution platform"; - homepage = http://store.steampowered.com/; - license = licenses.unfree; - maintainers = with maintainers; [ jagajaga ]; - }; -} +in self diff --git a/pkgs/games/steam/runtime-wrapped.nix b/pkgs/games/steam/runtime-wrapped.nix new file mode 100644 index 000000000000..238626c4ab4c --- /dev/null +++ b/pkgs/games/steam/runtime-wrapped.nix @@ -0,0 +1,109 @@ +{ stdenv, perl, pkgs, steam-runtime +, nativeOnly ? false +, runtimeOnly ? false +}: + +assert !(nativeOnly && runtimeOnly); + +let + runtimePkgs = with pkgs; [ + # Required + glib + gtk2 + bzip2 + zlib + gdk_pixbuf + + # Without these it silently fails + xlibs.libXinerama + xlibs.libXdamage + xlibs.libXcursor + xlibs.libXrender + xlibs.libXScrnSaver + xlibs.libXi + xlibs.libSM + xlibs.libICE + gnome2.GConf + freetype + curl + nspr + nss + fontconfig + cairo + pango + expat + dbus + cups + libcap + SDL2 + libusb1 + dbus_glib + libav + atk + # Only libraries are needed from those two + udev182 + networkmanager098 + + # Verified games requirements + xlibs.libXmu + xlibs.libxcb + xlibs.libpciaccess + mesa_glu + libuuid + libogg + libvorbis + SDL + SDL2_image + glew110 + openssl + libidn + + # Other things from runtime + xlibs.libXinerama + flac + freeglut + libjpeg + libpng12 + libsamplerate + libmikmod + libtheora + pixman + speex + SDL_image + SDL_ttf + SDL_mixer + SDL2_net + SDL2_ttf + SDL2_mixer + gstreamer + gst_plugins_base + ]; + + overridePkgs = with pkgs; [ + gcc48.cc # libstdc++ + libpulseaudio + alsaLib + openalSoft + ]; + + ourRuntime = if runtimeOnly then [] + else if nativeOnly then runtimePkgs ++ overridePkgs + else overridePkgs; + steamRuntime = stdenv.lib.optional (!nativeOnly) steam-runtime; + +in stdenv.mkDerivation rec { + name = "steam-runtime-wrapped"; + + allPkgs = ourRuntime ++ steamRuntime; + + nativeBuildInputs = [ perl ]; + + builder = ./build-runtime.sh; + + installPhase = '' + buildDir "${toString steam-runtime.libs}" "$allPkgs" + buildDir "${toString steam-runtime.bins}" "$allPkgs" + ''; + + meta.hydraPlatforms = []; +} diff --git a/pkgs/games/steam/steam.nix b/pkgs/games/steam/steam.nix new file mode 100644 index 000000000000..2f2ce921176d --- /dev/null +++ b/pkgs/games/steam/steam.nix @@ -0,0 +1,38 @@ +{stdenv, fetchurl, traceDeps ? false}: + +stdenv.mkDerivation rec { + name = "${program}-original-${version}"; + program = "steam"; + version = "1.0.0.49"; + + src = fetchurl { + url = "http://repo.steampowered.com/steam/pool/steam/s/steam/${program}_${version}.tar.gz"; + sha256 = "1c1gl5pwvb5gnnnqf5d9hpcjnfjjgmn4lgx8v0fbx1am5xf3p2gx"; + }; + + traceLog = "/tmp/steam-trace-dependencies.log"; + + installPhase = '' + make DESTDIR=$out install + mv $out/usr/* $out #*/ + rmdir $out/usr + + rm $out/bin/steamdeps + ${stdenv.lib.optionalString traceDeps '' + cat > $out/bin/steamdeps <<EOF + #! /bin/bash + echo \$1 >> ${traceLog} + cat \$1 >> ${traceLog} + echo >> ${traceLog} + EOF + chmod +x $out/bin/steamdeps + ''} + ''; + + meta = with stdenv.lib; { + description = "A digital distribution platform"; + homepage = http://store.steampowered.com/; + license = licenses.unfree; + maintainers = with maintainers; [ jagajaga ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index bdd7411791bf..762e3e6641f2 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -13779,17 +13779,13 @@ let stardust = callPackage ../games/stardust {}; - steam-original = lowPrio (callPackage ../games/steam { }); - - steam = callPackage ../games/steam/chrootenv.nix { + steamPackages = callPackage ../games/steam { }; + steam = steamPackages.steam-chrootenv.override { # DEPRECATED withJava = config.steam.java or false; withPrimus = config.steam.primus or false; - withRuntime = config.steam.withRuntime or true; }; - steam-runtime = callPackage ../games/steam/runtime.nix { }; - stuntrally = callPackage ../games/stuntrally { }; superTux = callPackage ../games/super-tux { }; |