about summary refs log tree commit diff
path: root/nixpkgs/pkgs/games/widelands
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2019-01-07 02:18:36 +0000
committerAlyssa Ross <hi@alyssa.is>2019-01-07 02:18:47 +0000
commit36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2 (patch)
treeb3faaf573407b32aa645237a4d16b82778a39a92 /nixpkgs/pkgs/games/widelands
parent4e31070265257dc67d120c27e0f75c2344fdfa9a (diff)
parentabf060725d7614bd3b9f96764262dfbc2f9c2199 (diff)
downloadnixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.gz
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.bz2
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.lz
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.xz
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.zst
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.zip
Add 'nixpkgs/' from commit 'abf060725d7614bd3b9f96764262dfbc2f9c2199'
git-subtree-dir: nixpkgs
git-subtree-mainline: 4e31070265257dc67d120c27e0f75c2344fdfa9a
git-subtree-split: abf060725d7614bd3b9f96764262dfbc2f9c2199
Diffstat (limited to 'nixpkgs/pkgs/games/widelands')
-rw-r--r--nixpkgs/pkgs/games/widelands/bincmake.patch21
-rw-r--r--nixpkgs/pkgs/games/widelands/default.nix58
2 files changed, 79 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/games/widelands/bincmake.patch b/nixpkgs/pkgs/games/widelands/bincmake.patch
new file mode 100644
index 000000000000..ed6a99125223
--- /dev/null
+++ b/nixpkgs/pkgs/games/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/nixpkgs/pkgs/games/widelands/default.nix b/nixpkgs/pkgs/games/widelands/default.nix
new file mode 100644
index 000000000000..daf56b27e5d2
--- /dev/null
+++ b/nixpkgs/pkgs/games/widelands/default.nix
@@ -0,0 +1,58 @@
+{ stdenv, fetchurl, cmake, python, gettext
+, boost, libpng, zlib, glew, lua, doxygen, icu
+, SDL2, SDL2_image, SDL2_mixer, SDL2_net, SDL2_ttf
+}:
+
+stdenv.mkDerivation rec {
+  name = "widelands-${version}";
+  version = "19";
+
+  meta = with stdenv.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}-src-gcc7.tar.bz2";
+    sha256 = "0n2lb1c2dix32j90nir96zfqivn63izr1pmabjnhns3wbb7vhwzg";
+  };
+
+  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
+  ];
+
+  prePatch = ''
+    substituteInPlace ./debian/org.widelands.widelands.desktop --replace "/usr/share/games/widelands/data/" "$out/share/widelands/"
+  '';
+
+  postInstall = ''
+    mkdir -p "$out/share/applications/"
+    cp -v "../debian/org.widelands.widelands.desktop" "$out/share/applications/"
+  '';
+
+  enableParallelBuilding = true;
+}