Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SuperTuxKart: Replaced some bundled libraries with system ones #91421

Merged
merged 2 commits into from
Jun 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions pkgs/development/libraries/wiiuse/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{ lib
, stdenv
, fetchFromGitHub
, cmake
, pkg-config
, bluez
}:
stdenv.mkDerivation rec {

pname = "WiiUse";
version = "0.15.5";

src = fetchFromGitHub {
owner = "wiiuse";
repo = "wiiuse";
rev = "${version}";
sha256 = "05gc3s0wxx7ga4g32yyibyxdh46rm9bbslblrc72ynrjxq98sg13";
};

nativeBuildInputs = [ cmake ];

buildInputs = [ (lib.getDev bluez) ];

cmakeFlags = [ "-DBUILD_EXAMPLE_SDL=NO" ];

meta = with lib; {
description = "Feature complete cross-platform Wii Remote access library";
license = licenses.gpl3;
homepage = "https://github.com/wiiuse/wiiuse";
maintainers = with maintainers; [ shamilton ];
platforms = with platforms; linux;
};
}
67 changes: 48 additions & 19 deletions pkgs/games/super-tux-kart/default.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{ stdenv, fetchFromGitHub, fetchsvn, cmake, pkgconfig, makeWrapper
, openal, freealut, libGLU, libGL, libvorbis, libogg, gettext, curl, freetype
, fribidi, libtool, bluez, libjpeg, libpng, zlib, libX11, libXrandr, enet, harfbuzz }:

{ lib, stdenv, fetchFromGitHub, fetchsvn, cmake, pkgconfig, makeWrapper
, openal, freealut, libGLU, libGL, libvorbis, libogg, gettext, curl, freetype, glew
, fribidi, libtool, bluez, libjpeg, libpng, zlib, libX11, libXrandr, harfbuzz
, mcpp, wiiuse, angelscript
}:
let
dir = "stk-code";
assets = fetchsvn {
Expand All @@ -11,44 +12,72 @@ let
name = "stk-assets";
};

# List of bundled libraries in stk-code/lib to keep
# Those are the libraries that cannot be replaced
# with system packages.
bundledLibraries = [
# Bullet 2.87 is incompatible (bullet 2.79 needed whereas 2.87 is packaged)
# The api changed in a lot of classes, too much work to adapt
"bullet"
# Upstream Libenet doesn't yet support IPv6,
# So we will use the bundled libenet which
# has been fixed to support it.
"enet"
# Internal library of STK, nothing to do about it
"graphics_utils"
# This irrlicht is bundled with cmake
# whereas upstream irrlicht still uses
# archaic Makefiles, too complicated to switch to.
"irrlicht"
# Not packaged to this date
"libraqm"
# Not packaged to this date
"libsquish"
];
in stdenv.mkDerivation rec {

pname = "supertuxkart";
version = "1.1";

srcs = [
(fetchFromGitHub {
owner = "supertuxkart";
repo = "stk-code";
rev = version;
sha256 = "01vxxl94583ixswzmi4caz8dk64r56pn3zxh7v63zml60yfvxbvp";
name = dir;
})
];
src = fetchFromGitHub {
owner = "supertuxkart";
repo = "stk-code";
rev = version;
sha256 = "01vxxl94583ixswzmi4caz8dk64r56pn3zxh7v63zml60yfvxbvp";
name = dir;
};

# Deletes all bundled libs in stk-code/lib except those
# That couldn't be replaced with system packages
postPatch = ''
find lib -maxdepth 1 -type d | egrep -v "^lib$|${(lib.concatStringsSep "|" bundledLibraries)}" | xargs -n1 -L1 -r -I{} rm -rf {}
'';

nativeBuildInputs = [ cmake gettext libtool pkgconfig makeWrapper ];

buildInputs = [
libX11 libXrandr
openal freealut libGLU libGL libvorbis libogg zlib freetype
curl fribidi bluez libjpeg libpng enet harfbuzz
openal freealut libGLU libGL libvorbis libogg zlib freetype glew
curl fribidi bluez libjpeg libpng harfbuzz
mcpp wiiuse angelscript
];

enableParallelBuilding = true;

cmakeFlags = [
"-DBUILD_RECORDER=OFF" # libopenglrecorder is not in nixpkgs
"-DUSE_SYSTEM_ANGELSCRIPT=OFF" # doesn't work with 2.31.2 or 2.32.0
"-DCHECK_ASSETS=OFF"
"-DUSE_SYSTEM_WIIUSE=ON"
"-DUSE_SYSTEM_ANGELSCRIPT=ON"
];

# Obtain the assets directly from the fetched store path, to avoid duplicating assets across multiple engine builds
preFixup = ''
wrapProgram $out/bin/supertuxkart --set-default SUPERTUXKART_ASSETS_DIR "${assets}"
'';

sourceRoot = dir;
enableParallelBuilding = true;

meta = with stdenv.lib; {
meta = with lib; {
description = "A Free 3D kart racing game";
longDescription = ''
SuperTuxKart is a Free 3D kart racing game, with many tracks,
Expand Down
2 changes: 2 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7691,6 +7691,8 @@ in

whsniff = callPackage ../applications/networking/sniffers/whsniff { };

wiiuse = callPackage ../development/libraries/wiiuse { };

woeusb = callPackage ../tools/misc/woeusb { };

chase = callPackage ../tools/system/chase { };
Expand Down