From 2c0ad22666f1529359cbc40db0334cf3c2755bf1 Mon Sep 17 00:00:00 2001 From: Nikolay Amiantov Date: Tue, 4 Nov 2014 06:13:01 +0300 Subject: [PATCH] crawl: fix, update, add console version --- pkgs/games/crawl/default.nix | 61 +++++++++++++++++------- pkgs/games/crawl/makefile_misc.patch | 39 --------------- pkgs/games/crawl/makefile_prefix.patch | 11 ----- pkgs/games/crawl/makefile_rltiles.patch | 21 -------- pkgs/games/crawl/makefile_rltiles2.patch | 10 ---- pkgs/games/crawl/makefile_sdlimg.patch | 19 -------- pkgs/top-level/all-packages.nix | 6 ++- 7 files changed, 50 insertions(+), 117 deletions(-) delete mode 100644 pkgs/games/crawl/makefile_misc.patch delete mode 100644 pkgs/games/crawl/makefile_prefix.patch delete mode 100644 pkgs/games/crawl/makefile_rltiles.patch delete mode 100644 pkgs/games/crawl/makefile_rltiles2.patch delete mode 100644 pkgs/games/crawl/makefile_sdlimg.patch diff --git a/pkgs/games/crawl/default.nix b/pkgs/games/crawl/default.nix index 6cb48d85f852..ba320e18d946 100644 --- a/pkgs/games/crawl/default.nix +++ b/pkgs/games/crawl/default.nix @@ -1,24 +1,53 @@ -{ stdenv, fetchurl, sqlite, lua, which, zlib, pkgconfig, dejavu_fonts, - libpng, perl, SDL, SDL_image, ncurses, mesa}: +{ stdenv, fetchurl, which, sqlite, lua5_1, perl, zlib, pkgconfig, ncurses +, dejavu_fonts, libpng, SDL, SDL_image, mesa, freetype +, tileMode ? true +}: +let version = "0.15.2"; +in stdenv.mkDerivation rec { - name = "crawl-0.14.1"; - src = fetchurl { - url = "http://downloads.sourceforge.net/project/crawl-ref/Stone%20Soup/0.14.1/stone_soup-0.14.1-nodeps.tar.xz"; - sha256 = "91726d0224b93ba26b5d4bd3762bc5aabe1f02974ea6c937be89dc6c6ab7a4dd"; - }; + name = "crawl-${version}" + (if tileMode then "-tiles" else ""); + src = fetchurl { + url = "mirror://sourceforge/crawl-ref/Stone%20Soup/${version}/stone_soup-${version}-nodeps.tar.xz"; + sha256 = "1qi1g8w0sxmwrv96hnay20gpwp1xn2xcq1cw9iwn1yq112484fp9"; + }; - patches = [ ./makefile_fonts.patch ./makefile_sqlite.patch - ./makefile_rltiles.patch ./makefile_rltiles2.patch - ./makefile_misc.patch ./makefile_prefix.patch - ]; + patches = [ ./makefile_fonts.patch ./makefile_sqlite.patch ]; - buildInputs = [stdenv pkgconfig lua zlib sqlite which libpng perl SDL - dejavu_fonts SDL_image ncurses mesa]; + nativeBuildInputs = [ pkgconfig which perl ]; - preBuild = "cd source"; + # Still unstable with luajit + buildInputs = [ lua5_1 zlib sqlite ncurses ] + ++ stdenv.lib.optionals tileMode + [ libpng SDL SDL_image freetype mesa ]; - makeFlags = "TILES=y"; + preBuild = '' + cd source + # Related to issue #1963 + sed -i 's/-fuse-ld=gold//g' Makefile + for i in util/*.pl; do + patchShebangs $i + done + patchShebangs util/gen-mi-enum + ''; - inherit dejavu_fonts sqlite SDL_image SDL; + makeFlags = [ "prefix=$(out)" "FORCE_CC=gcc" "FORCE_CXX=g++" "HOSTCXX=g++" + "SAVEDIR=~/.crawl" "sqlite=${sqlite}" ] + ++ stdenv.lib.optionals tileMode [ "TILES=y" "dejavu_fonts=${dejavu_fonts}" ]; + + postInstall = if tileMode then "mv $out/bin/crawl $out/bin/crawl-tiles" else ""; + + enableParallelBuilding = true; + + meta = with stdenv.lib; { + description = "Open-source, single-player, role-playing roguelike game"; + longDescription = '' + Open-source, single-player, role-playing roguelike game of exploration and + treasure-hunting in dungeons filled with dangerous and unfriendly monsters + in a quest to rescue the mystifyingly fabulous Orb of Zot. + ''; + platforms = platforms.linux; + licenses = with licenses; [ gpl2Plus bsd2 bsd3 mit zlib cc0 ]; + maintainers = maintainers.abbradar; + }; } diff --git a/pkgs/games/crawl/makefile_misc.patch b/pkgs/games/crawl/makefile_misc.patch deleted file mode 100644 index 3849e79234b0..000000000000 --- a/pkgs/games/crawl/makefile_misc.patch +++ /dev/null @@ -1,39 +0,0 @@ ---- old/source/Makefile 2014-05-05 23:22:48.051952484 +0200 -+++ new/source/Makefile 2014-05-05 23:20:46.576617833 +0200 -@@ -71,6 +71,9 @@ - - GAME = crawl - -+ -+CFLAGS := $(NIX_CFLAGS_COMPILE) -+ - # Disable GNU Make implicit rules and variables. Leaving them enabled will slow - # down MinGW and Cygwin builds by a very VERY noticeable degree. Besides, we have - # _explicit_ rules defined for everything. So we don't need them. -@@ -979,7 +983,7 @@ - ifdef ANDROID - CFLAGS := $(CFOPTIMIZE) $(CFOTHERS) $(CFWARN) $(CFLAGS) - else --CFLAGS := $(CFOPTIMIZE) $(CFOTHERS) $(CFWARN) -+CFLAGS := $(CFOPTIMIZE) $(CFOTHERS) $(CFWARN) $(CFLAGS) - endif - CFLAGS_L := $(CFOPTIMIZE_L) $(DEFINES_L) $(CFWARN_L) $(INCLUDES_L) $(CFOTHERS_L) - ALL_CFLAGS := $(CFLAGS) $(CFLAGS_L) -@@ -1392,7 +1396,7 @@ - $(RM) -r $(DOXYGEN_HTML_GEN) - - $(GAME): $(OBJECTS) $(EXTRA_OBJECTS) $(CONTRIB_LIBS) dat/dlua/tags.lua -- +$(QUIET_LINK)$(CXX) $(LDFLAGS) $(EXTRA_OBJECTS) $(OBJECTS) -o $(GAME) $(LIBS) -+ g++ $(LDFLAGS) $(EXTRA_OBJECTS) $(OBJECTS) -o $(GAME) $(LIBS) - - debug: all - debug-lite: all -@@ -1492,7 +1496,7 @@ - $(QUIET_GEN)util/gen-luatags.pl - - mi-enum.h: mon-info.h util/gen-mi-enum -- $(QUIET_GEN)util/gen-mi-enum -+ perl util/gen-mi-enum - - $(RLTILES)/dc-unrand.txt: art-data.h - diff --git a/pkgs/games/crawl/makefile_prefix.patch b/pkgs/games/crawl/makefile_prefix.patch deleted file mode 100644 index 869d703b125d..000000000000 --- a/pkgs/games/crawl/makefile_prefix.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- old/source/Makefile 2014-05-06 08:52:24.752163702 +0200 -+++ new/source/Makefile 2014-05-06 09:08:01.992018819 +0200 -@@ -344,7 +344,7 @@ - endif - - chroot_prefix := --prefix := -+prefix := $(out) - - ifeq ($(patsubst %/local,%,$(patsubst %/,%,$(prefix))),/usr) - FHS := yes diff --git a/pkgs/games/crawl/makefile_rltiles.patch b/pkgs/games/crawl/makefile_rltiles.patch deleted file mode 100644 index e08859c989b3..000000000000 --- a/pkgs/games/crawl/makefile_rltiles.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- old/source/rltiles/Makefile 2014-04-17 10:17:31.596400123 +0000 -+++ new/source/rltiles/Makefile 2014-04-17 14:36:07.263108690 +0000 -@@ -20,7 +20,8 @@ - - ifdef TILES - ifndef CONTRIB_SDL -- SDL_CFLAGS := $(shell sdl-config --cflags 2> /dev/null || echo "-I../contrib/install/$(ARCH)/include/SDL") -+ SDL_CFLAGS := $(shell sdl-config --cflags 2> /dev/null) -+ SDL_IMG_CFLAGS := $(shell pkg-config --cflags-only-I SDL_image 2> /dev/null) - SDL_LDFLAGS := $(shell sdl-config --libs 2> /dev/null && echo "-lSDL_image" || echo "../contrib/install/$(ARCH)/lib/libSDL.a ../contrib/install/$(ARCH)/lib/libSDLmain.a ../contrib/install/$(ARCH)/lib/libSDL_image.a") - else - SDL_CFLAGS := -I../contrib/install/$(ARCH)/include/SDL -@@ -35,7 +36,7 @@ - PNG_LIB := ../contrib/install/$(ARCH)/lib/libpng.a ../contrib/install/$(ARCH)/lib/libz.a - endif - -- CFLAGS += $(SDL_CFLAGS) $(PNG_INCLUDE) -+ CFLAGS += $(SDL_CFLAGS) $(SDL_IMG_CFLAGS) $(PNG_INCLUDE) -I$(SDL_image)/include -I$(SDL)/include - LDFLAGS += $(SDL_LDFLAGS) $(PNG_LIB) - - CFLAGS += -DUSE_TILE diff --git a/pkgs/games/crawl/makefile_rltiles2.patch b/pkgs/games/crawl/makefile_rltiles2.patch deleted file mode 100644 index 2508ad0a54ca..000000000000 --- a/pkgs/games/crawl/makefile_rltiles2.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- old/source/rltiles/Makefile 2014-05-05 23:22:48.054952469 +0200 -+++ new/source/rltiles/Makefile 2014-05-05 22:45:07.742667726 +0200 -@@ -142,6 +128,6 @@ - $(QUIET_HOSTCXX)$(HOSTCXX) $(CFLAGS) -MMD -c $< -o $@ - - $(TILEGEN): $(OBJECTS) -- $(QUIET_HOSTLINK)$(HOSTCXX) $(OBJECTS) -o $@ $(LDFLAGS) -+ g++ $(OBJECTS) -o $@ $(LDFLAGS) - - .PHONY: all clean distclean diff --git a/pkgs/games/crawl/makefile_sdlimg.patch b/pkgs/games/crawl/makefile_sdlimg.patch deleted file mode 100644 index e6c7101de720..000000000000 --- a/pkgs/games/crawl/makefile_sdlimg.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- old/source/Makefile 2014-04-14 13:00:22.331058910 +0000 -+++ new/source/Makefile 2014-04-14 13:02:11.102204544 +0000 -@@ -672,6 +672,7 @@ - FREETYPE_LDFLAGS := $(shell $(PKGCONFIG) freetype2 --libs-only-L) $(shell $(PKGCONFIG) freetype2 --libs-only-l) - - SDL_INCLUDE := $(shell $(PKGCONFIG) sdl --cflags-only-I) -+SDL_IMG_INCLUDE := $(shell $(PKGCONFIG) SDL_image --cflags-only-I) - SDL_CFLAGS := $(shell $(PKGCONFIG) sdl --cflags-only-other) - SDL_LDFLAGS := $(shell $(PKGCONFIG) sdl --libs-only-L) $(shell $(PKGCONFIG) sdl --libs-only-l) - -@@ -694,7 +695,7 @@ - endif - - DEFINES_L += $(PNG_CFLAGS) $(FREETYPE_CFLAGS) $(SDL_CFLAGS) --INCLUDES_L += $(PNG_INCLUDE) $(FREETYPE_INCLUDE) $(SDL_INCLUDE) -+INCLUDES_L += $(PNG_INCLUDE) $(FREETYPE_INCLUDE) $(SDL_INCLUDE) $(SDL_IMG_INCLUDE) - - endif # TILES - diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 7c62680f6204..fdff38ba9612 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -667,7 +667,11 @@ let flex = flex_2_5_35; }; - crawl = callPackage ../games/crawl { lua = lua5; }; + crawlTiles = callPackage ../games/crawl { }; + + crawl = callPackage ../games/crawl { + tileMode = false; + }; cv = callPackage ../tools/misc/cv { };