2021-01-15 05:31:39 +01:00
|
|
|
{ lib, stdenv, cmake, pkg-config, git, curl, SDL2, xercesc, openal, lua, libvlc
|
2023-03-15 13:56:52 +01:00
|
|
|
, libjpeg, wxGTK32, cppunit, ftgl, glew, libogg, libvorbis, buildEnv, libpng
|
2021-05-07 23:18:14 +02:00
|
|
|
, fontconfig, freetype, xorg, makeWrapper, bash, which, gnome, libGLU, glib
|
2022-06-08 20:47:06 +02:00
|
|
|
, fetchFromGitHub, fetchpatch
|
2016-09-04 13:43:23 +02:00
|
|
|
}:
|
2014-10-11 18:55:08 +02:00
|
|
|
let
|
2018-01-04 14:43:35 +01:00
|
|
|
version = "3.13.0";
|
2014-10-11 18:55:08 +02:00
|
|
|
lib-env = buildEnv {
|
|
|
|
name = "megaglest-lib-env";
|
2018-01-04 14:43:35 +01:00
|
|
|
paths = [ SDL2 xorg.libSM xorg.libICE xorg.libX11 xorg.libXext
|
2014-10-11 18:55:08 +02:00
|
|
|
xercesc openal libvorbis lua libjpeg libpng curl fontconfig ftgl freetype
|
2023-03-15 13:56:52 +01:00
|
|
|
stdenv.cc.cc glew libGLU wxGTK32 ];
|
2014-10-11 18:55:08 +02:00
|
|
|
};
|
|
|
|
path-env = buildEnv {
|
|
|
|
name = "megaglest-path-env";
|
2021-05-07 23:18:14 +02:00
|
|
|
paths = [ bash which gnome.zenity ];
|
2014-10-11 18:55:08 +02:00
|
|
|
};
|
|
|
|
in
|
|
|
|
stdenv.mkDerivation {
|
2019-08-13 23:52:01 +02:00
|
|
|
pname = "megaglest";
|
|
|
|
inherit version;
|
2014-10-11 18:55:08 +02:00
|
|
|
|
2017-12-21 20:53:42 +01:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "MegaGlest";
|
|
|
|
repo = "megaglest-source";
|
2019-09-09 01:38:31 +02:00
|
|
|
rev = version;
|
2017-12-21 20:53:42 +01:00
|
|
|
fetchSubmodules = true;
|
2018-01-04 14:43:35 +01:00
|
|
|
sha256 = "0fb58a706nic14ss89zrigphvdiwy5s9dwvhscvvgrfvjpahpcws";
|
2014-10-11 18:55:08 +02:00
|
|
|
};
|
|
|
|
|
2022-06-08 20:47:06 +02:00
|
|
|
patches = [
|
|
|
|
# Pull upstream fix for -fno-common toolchains
|
|
|
|
(fetchpatch {
|
|
|
|
name = "fno-common.patch";
|
|
|
|
url = "https://github.com/MegaGlest/megaglest-source/commit/5a3520540276a6fd06f7c88e571b6462978e3eab.patch";
|
|
|
|
sha256 = "0y554kjw56dikq87vs709pmq97hdx9hvqsk27f81v4g90m3b3qhi";
|
|
|
|
})
|
2023-03-15 13:56:52 +01:00
|
|
|
# Pull upstream and Debian fixes for wxWidgets 3.2
|
|
|
|
(fetchpatch {
|
|
|
|
name = "get-rid-of-manual-wxPaintEvent-creation-1.patch";
|
|
|
|
url = "https://github.com/MegaGlest/megaglest-source/commit/e09ba53c436279588f769d6ce8852e74d58f8391.patch";
|
|
|
|
hash = "sha256-1ZG6AjnLXW18wwad05kjH7W5rTaP1SDpZ5zLH4nRQt4=";
|
|
|
|
})
|
|
|
|
(fetchpatch {
|
|
|
|
name = "get-rid-of-manual-wxPaintEvent-creation-2.patch";
|
|
|
|
url = "https://sources.debian.org/data/main/m/megaglest/3.13.0-9/debian/patches/fbd0cfb17ed759d24aeb577a602b0d97f7895cc2.patch";
|
|
|
|
hash = "sha256-aMDDboNdH22r7YOiZCEApwz+FpM60anBp82tLwiIH6g=";
|
|
|
|
})
|
|
|
|
(fetchpatch {
|
|
|
|
name = "get-rid-of-manual-wxPaintEvent-creation-3.patch";
|
|
|
|
url = "https://github.com/MegaGlest/megaglest-source/commit/5801b1fafff8ad9618248d4d5d5c751fdf52be2f.patch";
|
|
|
|
hash = "sha256-/RpBoT1JsSFtOrAXphHrPp9DnTbaEN/2h8EZmQ9PIPU=";
|
|
|
|
})
|
|
|
|
(fetchpatch {
|
|
|
|
name = "fix-editor-and-g3dviewer-for-wx-3.1.x.patch";
|
|
|
|
url = "https://github.com/MegaGlest/megaglest-source/commit/789e1cdf371137b729e832e28a5feb6e97a3a243.patch";
|
|
|
|
hash = "sha256-fK7vkHCu6bqVB6I7vMsWMGiczSdxVgo1KqqBNMkEbfM=";
|
|
|
|
})
|
2022-06-08 20:47:06 +02:00
|
|
|
];
|
|
|
|
|
2022-08-15 05:40:21 +02:00
|
|
|
nativeBuildInputs = [ cmake pkg-config makeWrapper git ];
|
2023-03-15 13:56:52 +01:00
|
|
|
buildInputs = [ curl SDL2 xercesc openal lua libpng libjpeg libvlc wxGTK32
|
2022-08-15 05:40:21 +02:00
|
|
|
glib cppunit fontconfig freetype ftgl glew libogg libvorbis libGLU ];
|
2014-10-11 18:55:08 +02:00
|
|
|
|
2020-12-31 08:48:55 +01:00
|
|
|
cmakeFlags = [
|
2022-10-14 05:13:11 +02:00
|
|
|
"-DCMAKE_INSTALL_PREFIX=${placeholder "out"}"
|
2020-12-31 08:48:55 +01:00
|
|
|
"-DBUILD_MEGAGLEST=On"
|
|
|
|
"-DBUILD_MEGAGLEST_MAP_EDITOR=On"
|
|
|
|
"-DBUILD_MEGAGLEST_MODEL_IMPORT_EXPORT_TOOLS=On"
|
|
|
|
"-DBUILD_MEGAGLEST_MODEL_VIEWER=On"
|
|
|
|
];
|
2014-10-11 18:55:08 +02:00
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
for i in $out/bin/*; do
|
|
|
|
wrapProgram $i \
|
|
|
|
--prefix LD_LIBRARY_PATH ":" "${lib-env}/lib" \
|
|
|
|
--prefix PATH ":" "${path-env}/bin"
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
2021-01-15 05:31:39 +01:00
|
|
|
meta = with lib; {
|
2020-10-26 05:08:40 +01:00
|
|
|
description = "An entertaining free (freeware and free software) and open source cross-platform 3D real-time strategy (RTS) game";
|
2020-12-31 08:48:55 +01:00
|
|
|
license = licenses.gpl3;
|
2022-01-03 16:53:12 +01:00
|
|
|
homepage = "https://megaglest.org/";
|
2020-12-31 08:48:55 +01:00
|
|
|
maintainers = [ maintainers.matejc ];
|
|
|
|
platforms = platforms.linux;
|
2014-10-11 18:55:08 +02:00
|
|
|
};
|
|
|
|
}
|