diff --git a/default.nix b/default.nix index ff019bb..85af6bc 100644 --- a/default.nix +++ b/default.nix @@ -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 { }; } diff --git a/pkgs/widelands/bincmake.patch b/pkgs/widelands/bincmake.patch new file mode 100644 index 0000000..ed6a991 --- /dev/null +++ b/pkgs/widelands/bincmake.patch @@ -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() diff --git a/pkgs/widelands/default.nix b/pkgs/widelands/default.nix new file mode 100644 index 0000000..8b96dcc --- /dev/null +++ b/pkgs/widelands/default.nix @@ -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/" + ''; +}