add widelands

master
Christian Ulrich 2021-02-18 00:27:50 +01:00
parent c071983afb
commit 8e9ae34855
No known key found for this signature in database
GPG Key ID: 8241BE099775A097
3 changed files with 75 additions and 0 deletions

View File

@ -37,4 +37,6 @@ self: super:
squashfs-avm-be = super.callPackage ./pkgs/squashfs-avm-be/default.nix { };
ui = super.callPackage ./pkgs/nim-packages/ui.nix { };
widelands = super.callPackage ./pkgs/widelands/default.nix { };
}

View File

@ -0,0 +1,21 @@
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -25,6 +25,8 @@
# Packagers (or people using make install) have to set this variable to an absolute path.
wl_set_if_unset(WL_INSTALL_DATADIR "./data")
+wl_set_if_unset(WL_INSTALL_BINARY "./bin")
+
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7)
message(FATAL_ERROR "Widelands needs GCC >= 4.7 to compile.")
--- a/cmake/WlFunctions.cmake
+++ b/cmake/WlFunctions.cmake
@@ -276,5 +276,5 @@
#Quoting the CMake documentation on DESTINATION:
#"If a relative path is given it is interpreted relative to the value of CMAKE_INSTALL_PREFIX"
- install(TARGETS ${NAME} DESTINATION "." COMPONENT ExecutableFiles)
+ install(TARGETS ${NAME} DESTINATION ${WL_INSTALL_BINARY} COMPONENT ExecutableFiles)
endfunction()

View File

@ -0,0 +1,52 @@
{ lib, stdenv, fetchurl, cmake, python, gettext
, boost, libpng, zlib, glew, lua, doxygen, icu
, SDL2, SDL2_image, SDL2_mixer, SDL2_net, SDL2_ttf
}:
stdenv.mkDerivation rec {
pname = "widelands";
version = "21";
meta = with lib; {
description = "RTS with multiple-goods economy";
homepage = "http://widelands.org/";
longDescription = ''
Widelands is a real time strategy game based on "The Settlers" and "The
Settlers II". It has a single player campaign mode, as well as a networked
multiplayer mode.
'';
license = licenses.gpl2Plus;
platforms = platforms.linux;
maintainers = with maintainers; [ raskin jcumming ];
hydraPlatforms = [];
};
patches = [
./bincmake.patch
];
src = fetchurl {
url = "https://launchpad.net/widelands/build${version}/build${version}/+download/widelands-build${version}-source.tar.gz";
sha256 = "sha256-YB4OTG+Rs/sOzizRuD7PsCNEobkZT7tw7z9w4GmU41c=";
};
preConfigure = ''
cmakeFlags="
-DWL_INSTALL_BASEDIR=$out
-DWL_INSTALL_DATADIR=$out/share/widelands
-DWL_INSTALL_BINARY=$out/bin
"
'';
nativeBuildInputs = [ cmake python gettext ];
buildInputs = [
boost libpng zlib glew lua doxygen icu
SDL2 SDL2_image SDL2_mixer SDL2_net SDL2_ttf
];
postInstall = ''
mkdir -p "$out/share/applications/"
cp -v "../xdg/org.widelands.Widelands.desktop" "$out/share/applications/"
'';
}