nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchurl,
5 cmake,
6 pkg-config,
7 boost,
8 curl,
9 SDL2,
10 SDL2_image,
11 libSM,
12 libXext,
13 libpng,
14 freetype,
15 libGLU,
16 libGL,
17 glew,
18 glm,
19 openal,
20 libogg,
21 libvorbis,
22}:
23
24stdenv.mkDerivation (finalAttrs: {
25 pname = "supertux";
26 version = "0.6.3";
27
28 src = fetchurl {
29 url = "https://github.com/SuperTux/supertux/releases/download/v${finalAttrs.version}/SuperTux-v${finalAttrs.version}-Source.tar.gz";
30 sha256 = "1xkr3ka2sxp5s0spp84iv294i29s1vxqzazb6kmjc0n415h0x57p";
31 };
32
33 postPatch = ''
34 sed '1i#include <memory>' -i external/partio_zip/zip_manager.hpp # gcc12
35 # Fix build with cmake 4. Remove for version >= 0.6.4.
36 # See <https://github.com/SuperTux/supertux/pull/3093>
37 substituteInPlace CMakeLists.txt --replace-fail \
38 'cmake_minimum_required(VERSION 3.1)' \
39 'cmake_minimum_required(VERSION 4.0)'
40 substituteInPlace external/physfs/CMakeLists.txt --replace-fail \
41 'cmake_minimum_required(VERSION 2.8.12)' \
42 'cmake_minimum_required(VERSION 4.0)'
43 substituteInPlace external/sexp-cpp/CMakeLists.txt --replace-fail \
44 'cmake_minimum_required(VERSION 3.0)' \
45 'cmake_minimum_required(VERSION 4.0)'
46 substituteInPlace external/squirrel/CMakeLists.txt --replace-fail \
47 'cmake_minimum_required(VERSION 2.8)' \
48 'cmake_minimum_required(VERSION 4.0)'
49 substituteInPlace external/tinygettext/CMakeLists.txt --replace-fail \
50 'cmake_minimum_required(VERSION 2.4)' \
51 'cmake_minimum_required(VERSION 4.0)'
52 substituteInPlace external/SDL_ttf/CMakeLists.txt --replace-fail \
53 'cmake_minimum_required(VERSION 3.0)' \
54 'cmake_minimum_required(VERSION 4.0)'
55 substituteInPlace external/discord-sdk/CMakeLists.txt --replace-fail \
56 'cmake_minimum_required (VERSION 3.2.0)' \
57 'cmake_minimum_required (VERSION 4.0)'
58 '';
59
60 nativeBuildInputs = [
61 pkg-config
62 cmake
63 ];
64
65 buildInputs = [
66 boost
67 curl
68 SDL2
69 SDL2_image
70 libSM
71 libXext
72 libpng
73 freetype
74 libGL
75 libGLU
76 glew
77 glm
78 openal
79 libogg
80 libvorbis
81 ];
82
83 cmakeFlags = [ "-DENABLE_BOOST_STATIC_LIBS=OFF" ];
84
85 postInstall = ''
86 mkdir $out/bin
87 ln -s $out/games/supertux2 $out/bin
88 '';
89
90 meta = {
91 description = "Classic 2D jump'n run sidescroller game";
92 homepage = "https://supertux.github.io/";
93 license = lib.licenses.gpl2Plus;
94 maintainers = with lib.maintainers; [ pSub ];
95 platforms = with lib.platforms; linux;
96 mainProgram = "supertux2";
97 };
98})