mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-26 04:43:09 +03:00
steam: add steamPackages namespace, build our own runtime
This commit is contained in:
parent
8b034964d1
commit
6c9ee645ec
47
pkgs/games/steam/build-runtime.sh
Normal file
47
pkgs/games/steam/build-runtime.sh
Normal file
@ -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"
|
@ -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
|
||||
mkdir -p steamrt
|
||||
|
||||
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}/{,*/})
|
||||
|
||||
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";
|
||||
|
@ -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
|
||||
|
109
pkgs/games/steam/runtime-wrapped.nix
Normal file
109
pkgs/games/steam/runtime-wrapped.nix
Normal file
@ -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 = [];
|
||||
}
|
38
pkgs/games/steam/steam.nix
Normal file
38
pkgs/games/steam/steam.nix
Normal file
@ -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 ];
|
||||
};
|
||||
}
|
@ -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 { };
|
||||
|
Loading…
Reference in New Issue
Block a user