setbfree: 0.8.12 -> 0.8.13 (#372025)
[NixPkgs.git] / pkgs / by-name / me / megaglest / package.nix
blob642af48e909917f0f046d0922ad3150bbf4fcc4d
2   lib,
3   stdenv,
4   cmake,
5   pkg-config,
6   git,
7   curl,
8   SDL2,
9   xercesc,
10   openal,
11   lua,
12   libvlc,
13   libjpeg,
14   wxGTK32,
15   cppunit,
16   ftgl,
17   glew,
18   libogg,
19   libvorbis,
20   buildEnv,
21   libpng,
22   fontconfig,
23   freetype,
24   xorg,
25   makeWrapper,
26   bash,
27   which,
28   zenity,
29   libGLU,
30   glib,
31   fetchFromGitHub,
32   fetchpatch,
34 let
35   version = "3.13.0";
36   lib-env = buildEnv {
37     name = "megaglest-lib-env";
38     paths = [
39       SDL2
40       xorg.libSM
41       xorg.libICE
42       xorg.libX11
43       xorg.libXext
44       xercesc
45       openal
46       libvorbis
47       lua
48       libjpeg
49       libpng
50       curl
51       fontconfig
52       ftgl
53       freetype
54       stdenv.cc.cc
55       glew
56       libGLU
57       wxGTK32
58     ];
59   };
60   path-env = buildEnv {
61     name = "megaglest-path-env";
62     paths = [
63       bash
64       which
65       zenity
66     ];
67   };
69 stdenv.mkDerivation {
70   pname = "megaglest";
71   inherit version;
73   src = fetchFromGitHub {
74     owner = "MegaGlest";
75     repo = "megaglest-source";
76     rev = version;
77     fetchSubmodules = true;
78     sha256 = "0fb58a706nic14ss89zrigphvdiwy5s9dwvhscvvgrfvjpahpcws";
79   };
81   patches = [
82     # Pull upstream fix for -fno-common toolchains
83     (fetchpatch {
84       name = "fno-common.patch";
85       url = "https://github.com/MegaGlest/megaglest-source/commit/5a3520540276a6fd06f7c88e571b6462978e3eab.patch";
86       sha256 = "0y554kjw56dikq87vs709pmq97hdx9hvqsk27f81v4g90m3b3qhi";
87     })
88     # Pull upstream and Debian fixes for wxWidgets 3.2
89     (fetchpatch {
90       name = "get-rid-of-manual-wxPaintEvent-creation-1.patch";
91       url = "https://github.com/MegaGlest/megaglest-source/commit/e09ba53c436279588f769d6ce8852e74d58f8391.patch";
92       hash = "sha256-1ZG6AjnLXW18wwad05kjH7W5rTaP1SDpZ5zLH4nRQt4=";
93     })
94     (fetchpatch {
95       name = "get-rid-of-manual-wxPaintEvent-creation-2.patch";
96       url = "https://sources.debian.org/data/main/m/megaglest/3.13.0-9/debian/patches/fbd0cfb17ed759d24aeb577a602b0d97f7895cc2.patch";
97       hash = "sha256-aMDDboNdH22r7YOiZCEApwz+FpM60anBp82tLwiIH6g=";
98     })
99     (fetchpatch {
100       name = "get-rid-of-manual-wxPaintEvent-creation-3.patch";
101       url = "https://github.com/MegaGlest/megaglest-source/commit/5801b1fafff8ad9618248d4d5d5c751fdf52be2f.patch";
102       hash = "sha256-/RpBoT1JsSFtOrAXphHrPp9DnTbaEN/2h8EZmQ9PIPU=";
103     })
104     (fetchpatch {
105       name = "fix-editor-and-g3dviewer-for-wx-3.1.x.patch";
106       url = "https://github.com/MegaGlest/megaglest-source/commit/789e1cdf371137b729e832e28a5feb6e97a3a243.patch";
107       hash = "sha256-fK7vkHCu6bqVB6I7vMsWMGiczSdxVgo1KqqBNMkEbfM=";
108     })
109   ];
111   nativeBuildInputs = [
112     cmake
113     pkg-config
114     makeWrapper
115     git
116   ];
117   buildInputs = [
118     curl
119     SDL2
120     xercesc
121     openal
122     lua
123     libpng
124     libjpeg
125     libvlc
126     wxGTK32
127     glib
128     cppunit
129     fontconfig
130     freetype
131     ftgl
132     glew
133     libogg
134     libvorbis
135     libGLU
136   ];
138   cmakeFlags = [
139     "-DCMAKE_INSTALL_PREFIX=${placeholder "out"}"
140     "-DBUILD_MEGAGLEST=On"
141     "-DBUILD_MEGAGLEST_MAP_EDITOR=On"
142     "-DBUILD_MEGAGLEST_MODEL_IMPORT_EXPORT_TOOLS=On"
143     "-DBUILD_MEGAGLEST_MODEL_VIEWER=On"
144   ];
146   postInstall = ''
147     for i in $out/bin/*; do
148       wrapProgram $i \
149         --prefix LD_LIBRARY_PATH ":" "${lib-env}/lib" \
150         --prefix PATH ":" "${path-env}/bin"
151     done
152   '';
154   meta = with lib; {
155     description = "Entertaining free (freeware and free software) and open source cross-platform 3D real-time strategy (RTS) game";
156     license = licenses.gpl3;
157     homepage = "https://megaglest.org/";
158     maintainers = [ maintainers.matejc ];
159     platforms = platforms.linux;
160   };