3
0
Fork 0
forked from mirrors/nixpkgs

i686 support for GSB

This commit is contained in:
Jack Cummings 2013-09-30 22:45:43 -07:00 committed by Bjørn Forsman
parent e6f2ac65e2
commit 1dd072f70d

View file

@ -2,7 +2,7 @@
, curl3, SDL, SDL_image, libpng12, libjpeg62, libvorbis, libogg, openal, mesa , curl3, SDL, SDL_image, libpng12, libjpeg62, libvorbis, libogg, openal, mesa
, libX11, libXext, libXft, fontconfig, zlib }: , libX11, libXext, libXft, fontconfig, zlib }:
# TODO: add i686 support assert stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux";
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "gsb-1.56.0"; name = "gsb-1.56.0";
@ -20,6 +20,8 @@ stdenv.mkDerivation rec {
sha256 = "12jsz9v55w9zxwiz4kbm6phkv60q3c2kyv5imsls13385pzwcs8i"; sha256 = "12jsz9v55w9zxwiz4kbm6phkv60q3c2kyv5imsls13385pzwcs8i";
}; };
arch = if stdenv.system == "i686-linux" then "x86" else "x86_64";
phases = "unpackPhase installPhase"; phases = "unpackPhase installPhase";
# XXX: stdenv.lib.makeLibraryPath doesn't pick up /lib64 # XXX: stdenv.lib.makeLibraryPath doesn't pick up /lib64
@ -33,17 +35,21 @@ stdenv.mkDerivation rec {
ensureDir $out/libexec/positech/GSB/ ensureDir $out/libexec/positech/GSB/
ensureDir $out/bin ensureDir $out/bin
patchelf --interpreter "$(cat $NIX_GCC/nix-support/dynamic-linker)" --set-rpath $libPath ./GSB.bin.x86_64 patchelf \
--interpreter "$(cat $NIX_GCC/nix-support/dynamic-linker)" \
--set-rpath $libPath \
./GSB.bin.$arch
cp -r * $out/libexec/positech/GSB/ cp -r * $out/libexec/positech/GSB/
rm -rf $out/libexec/positech/GSB/lib64/ rm -rf $out/libexec/positech/GSB/lib64/
rm -rf $out/libexec/positech/GSB/lib/
#makeWrapper doesn't do cd. :( #makeWrapper doesn't do cd. :(
cat > $out/bin/GSB << EOF cat > $out/bin/GSB << EOF
#!/bin/sh #!/bin/sh
cd $out/libexec/positech/GSB cd $out/libexec/positech/GSB
exec ./GSB.bin.x86_64 exec ./GSB.bin.$arch
EOF EOF
chmod +x $out/bin/GSB chmod +x $out/bin/GSB
''; '';
@ -62,7 +68,7 @@ stdenv.mkDerivation rec {
homepage = http://www.positech.co.uk/gratuitousspacebattles/index.html; homepage = http://www.positech.co.uk/gratuitousspacebattles/index.html;
license = [ "unfree" ]; license = [ "unfree" ];
maintainers = with stdenv.lib.maintainers; [ jcumming ]; maintainers = with stdenv.lib.maintainers; [ jcumming ];
platforms = [ "x86_64-linux"] ; platforms = [ "x86_64-linux" "i686-linux" ] ;
}; };
} }