steam-run-native: init

Refactor Steam so that native steam-run can be built as a free package and
expose it so that Hydra builds needed i686 packages.
This commit is contained in:
Nikolay Amiantov 2017-10-16 02:58:04 +03:00
parent 12d6fed2ba
commit 38ffe0e1f6
5 changed files with 34 additions and 32 deletions

View File

@ -1,5 +1,5 @@
{ stdenv, lib, writeScript, buildFHSUserEnv, steam { stdenv, lib, writeScript, buildFHSUserEnv, steam
, steam-runtime, steam-runtime-i686 ? null , steam-runtime-wrapped, steam-runtime-wrapped-i686 ? null
, withJava ? false , withJava ? false
, withPrimus ? false , withPrimus ? false
, extraPkgs ? pkgs: [ ] # extra packages to add to targetPkgs , extraPkgs ? pkgs: [ ] # extra packages to add to targetPkgs
@ -69,9 +69,9 @@ in buildFHSUserEnv rec {
extraBuildCommands = '' extraBuildCommands = ''
mkdir -p steamrt mkdir -p steamrt
ln -s ../lib/steam-runtime steamrt/${steam-runtime.arch} ln -s ../lib/steam-runtime steamrt/${steam-runtime-wrapped.arch}
${lib.optionalString (steam-runtime-i686 != null) '' ${lib.optionalString (steam-runtime-wrapped-i686 != null) ''
ln -s ../lib32/steam-runtime steamrt/${steam-runtime-i686.arch} ln -s ../lib32/steam-runtime steamrt/${steam-runtime-wrapped-i686.arch}
''} ''}
''; '';
@ -96,8 +96,8 @@ in buildFHSUserEnv rec {
inherit multiPkgs extraBuildCommands; inherit multiPkgs extraBuildCommands;
runScript = runScript =
let ldPath = map (x: "/steamrt/${steam-runtime.arch}/" + x) steam-runtime.libs let ldPath = map (x: "/steamrt/${steam-runtime-wrapped.arch}/" + x) steam-runtime-wrapped.libs
++ lib.optionals (steam-runtime-i686 != null) (map (x: "/steamrt/${steam-runtime-i686.arch}/" + x) steam-runtime-i686.libs); ++ lib.optionals (steam-runtime-wrapped-i686 != null) (map (x: "/steamrt/${steam-runtime-wrapped-i686.arch}/" + x) steam-runtime-wrapped-i686.libs);
in writeScript "steam-run" '' in writeScript "steam-run" ''
#!${stdenv.shell} #!${stdenv.shell}
run="$1" run="$1"

View File

@ -4,14 +4,18 @@ let
callPackage = newScope self; callPackage = newScope self;
self = rec { self = rec {
steamArch = if pkgs.stdenv.system == "x86_64-linux" then "amd64"
else if pkgs.stdenv.system == "i686-linux" then "i386"
else abort "Unsupported platform";
steam-runtime = callPackage ./runtime.nix { }; steam-runtime = callPackage ./runtime.nix { };
steam-runtime-wrapped = callPackage ./runtime-wrapped.nix { }; steam-runtime-wrapped = callPackage ./runtime-wrapped.nix { };
steam = callPackage ./steam.nix { }; steam = callPackage ./steam.nix { };
steam-fonts = callPackage ./fonts.nix { }; steam-fonts = callPackage ./fonts.nix { };
steam-chrootenv = callPackage ./chrootenv.nix { steam-chrootenv = callPackage ./chrootenv.nix {
steam-runtime-i686 = steam-runtime-wrapped-i686 =
if pkgs.system == "x86_64-linux" if steamArch == "amd64"
then pkgs.pkgsi686Linux.steamPackages.steam-runtime then pkgs.pkgsi686Linux.steamPackages.steam-runtime-wrapped
else null; else null;
}; };
}; };

View File

@ -1,4 +1,4 @@
{ stdenv, lib, perl, pkgs, steam-runtime { stdenv, steamArch, lib, perl, pkgs, steam-runtime
, nativeOnly ? false , nativeOnly ? false
, runtimeOnly ? false , runtimeOnly ? false
}: }:
@ -96,6 +96,13 @@ let
allPkgs = ourRuntime ++ steamRuntime; allPkgs = ourRuntime ++ steamRuntime;
gnuArch = if steamArch == "amd64" then "x86_64-linux-gnu"
else if steamArch == "i386" then "i386-linux-gnu"
else abort "Unsupported architecture";
libs = [ "lib/${gnuArch}" "lib" "usr/lib/${gnuArch}" "usr/lib" ];
bins = [ "bin" "usr/bin" ];
in stdenv.mkDerivation rec { in stdenv.mkDerivation rec {
name = "steam-runtime-wrapped"; name = "steam-runtime-wrapped";
@ -103,10 +110,13 @@ in stdenv.mkDerivation rec {
builder = ./build-wrapped.sh; builder = ./build-wrapped.sh;
installPhase = '' passthru = {
buildDir "${toString steam-runtime.libs}" "${toString (map lib.getLib allPkgs)}" inherit gnuArch libs bins;
buildDir "${toString steam-runtime.bins}" "${toString (map lib.getBin allPkgs)}" arch = steamArch;
''; };
meta.hydraPlatforms = []; installPhase = ''
buildDir "${toString libs}" "${toString (map lib.getLib allPkgs)}"
buildDir "${toString bins}" "${toString (map lib.getBin allPkgs)}"
'';
} }

View File

@ -1,10 +1,6 @@
{ stdenv, fetchurl, writeText, python2, dpkg, binutils }: { stdenv, steamArch, fetchurl, writeText, python2, dpkg, binutils }:
let arch = if stdenv.system == "x86_64-linux" then "amd64" let input = builtins.getAttr steamArch (import ./runtime-generated.nix { inherit fetchurl; });
else if stdenv.system == "i686-linux" then "i386"
else abort "Unsupported platform";
input = builtins.getAttr arch (import ./runtime-generated.nix { inherit fetchurl; });
inputFile = writeText "steam-runtime.json" (builtins.toJSON input); inputFile = writeText "steam-runtime.json" (builtins.toJSON input);
@ -18,17 +14,6 @@ in stdenv.mkDerivation {
python2 ${./build-runtime.py} -i ${inputFile} -r $out python2 ${./build-runtime.py} -i ${inputFile} -r $out
''; '';
passthru = rec {
inherit arch;
gnuArch = if arch == "amd64" then "x86_64-linux-gnu"
else if arch == "i386" then "i386-linux-gnu"
else abort "Unsupported architecture";
libs = [ "lib/${gnuArch}" "lib" "usr/lib/${gnuArch}" "usr/lib" ];
bins = [ "bin" "usr/bin" ];
};
meta = with stdenv.lib; { meta = with stdenv.lib; {
description = "The official runtime used by Steam"; description = "The official runtime used by Steam";
homepage = https://github.com/ValveSoftware/steam-runtime; homepage = https://github.com/ValveSoftware/steam-runtime;

View File

@ -17942,6 +17942,9 @@ with pkgs;
}; };
steam-run = steam.run; steam-run = steam.run;
steam-run-native = (steam.override {
nativeOnly = true;
}).run;
stepmania = callPackage ../games/stepmania { stepmania = callPackage ../games/stepmania {
ffmpeg = ffmpeg_2; ffmpeg = ffmpeg_2;