games-roguelike/dungeon-crawl-stone-soup: improve

This commit is contained in:
Julian Ospald 2016-02-19 14:14:54 +01:00
parent bde4ed91c0
commit 8c4aedc6b1
No known key found for this signature in database
GPG Key ID: 220CD1C5BDEED020
6 changed files with 190 additions and 182 deletions

View File

@ -1,10 +1,12 @@
# Copyright 2016 Julian Ospald <hasufell@posteo.de> # Copyright 2016 Julian Ospald <hasufell@posteo.de>
# Distributed under the terms of the GNU General Public License v2 # Distributed under the terms of the GNU General Public License v2
require gtk-icon-cache require gtk-icon-cache game
MY_P="stone_soup-${PV}" MY_PN=stone_soup
SUMMARY="Dungeon Crawl Stone Soup is a role-playing roguelike game of exploration and treasure-hunting in dungeons" MY_PNV=${MY_PN}-${PV}
SUMMARY="Single-player, role-playing roguelike game"
DESCRIPTION=" DESCRIPTION="
Dungeon Crawl Stone Soup is a free roguelike game of exploration Dungeon Crawl Stone Soup is a free roguelike game of exploration
and treasure-hunting in dungeons filled with dangerous and and treasure-hunting in dungeons filled with dangerous and
@ -24,7 +26,7 @@ DESCRIPTION="
playing, and, in general, have a blast! playing, and, in general, have a blast!
" "
HOMEPAGE="https://crawl.develz.org/wordpress/" HOMEPAGE="https://crawl.develz.org/wordpress/"
DOWNLOADS="https://crawl.develz.org/release/${MY_P}-nodeps.tar.xz" DOWNLOADS="https://crawl.develz.org/release/${MY_PNV}-nodeps.tar.xz"
LICENCES=" LICENCES="
GPL-2 GPL-2
@ -38,11 +40,8 @@ LICENCES="
SLOT="0" SLOT="0"
PLATFORMS="~amd64 ~x86" PLATFORMS="~amd64 ~x86"
MYOPTIONS=" MYOPTIONS="
( tiles [[ description = [ Do graphical (tiled) build instead of
ncurses [[ description = [ Enable for console (uses ncurses) ncurses build ] ]]
based build ] ]]
tiles [[ description = [ Enable for graphical (tiled) build ] ]]
) [[ number-selected = exactly-one ]]
" "
RESTRICT="test" RESTRICT="test"
@ -51,7 +50,7 @@ DEPENDENCIES="
dev-lang/lua:5.1 dev-lang/lua:5.1
dev-db/sqlite:3 dev-db/sqlite:3
sys-libs/zlib sys-libs/zlib
ncurses? ( sys-libs/ncurses ) !tiles? ( sys-libs/ncurses )
tiles? ( tiles? (
fonts/dejavu fonts/dejavu
media-libs/freetype:2 media-libs/freetype:2
@ -69,45 +68,70 @@ DEPENDENCIES="
tiles? ( sys-libs/ncurses ) tiles? ( sys-libs/ncurses )
" "
WORK=${WORKBASE}/${MY_P}/source WORK=${WORKBASE}/${MY_PNV}/source
MY_SAVEDIR=/var/lib/games/${MY_PN}
# https://github.com/crawl/crawl/pull/237
DEFAULT_SRC_PREPARE_PATCHES=( DEFAULT_SRC_PREPARE_PATCHES=(
-p2 "${FILES}"/${PNV}-respect-flags-and-compiler.patch -p3 "${FILES}"/0001-${PV}-MAKE-use-PKGCONFIG-to-get-ncurses-flags-if-available.patch
-p2 "${FILES}"/${PNV}-Use-pkg-config-for-linking-to-ncurses.patch -p3 "${FILES}"/0002-${PV}-MAKE-always-use-PKGCONFIG-instead-of-pkg-config.patch
-p3 "${FILES}"/0004-${PV}-MAKE-allow-to-skip-automagic-gold-linker-detection.patch
) )
DEFAULT_SRC_COMPILE_PARAMS=( DEFAULT_SRC_COMPILE_PARAMS=(
USE_LUAJIT=
BUILD_LUA=
DATADIR="/usr/share/${PN}" DATADIR="/usr/share/${PN}"
V=1 SAVEDIR=${MY_SAVEDIR}
DESTDIR="${IMAGE}"
bin_prefix="${IMAGE}/usr/$(exhost --target)/bin"
prefix_fp=""
prefix="/usr" prefix="/usr"
SAVEDIR="~/.crawl"
CFOPTIMIZE="${CXXFLAGS}" USE_LUAJIT=
LDFLAGS="${LDFLAGS}" BUILD_ALL=
NO_TRY_GOLD=y
V=1
INSTALL_UGRP=wizard:games
MCHMOD=ug+s
EXTERNAL_FLAGS="${CXXFLAGS}"
EXTERNAL_LDFLAGS="${LDFLAGS}"
AR="${AR}" AR="${AR}"
RANLIB="${RANLIB}" RANLIB="${RANLIB}"
CC="${CC}" CC="${CC}"
CXX="${CXX}" CXX="${CXX}"
PKGCONFIG="${PKG_CONFIG}" PKGCONFIG="${PKG_CONFIG}"
STRIP=touch STRIP=echo
) )
src_compile() { src_compile() {
export HOSTCXX=${CXX} export HOSTCXX=${CXX} GXX=${CXX}
emake "${DEFAULT_SRC_COMPILE_PARAMS[@]}" $(option tiles "TILES=y" "") emake "${DEFAULT_SRC_COMPILE_PARAMS[@]}" \
$(option tiles "TILES=y" "")
} }
src_install() { src_install() {
emake "${DEFAULT_SRC_COMPILE_PARAMS[@]}" \ emake "${DEFAULT_SRC_COMPILE_PARAMS[@]}" \
$(option tiles "TILES=y" "") \ $(option tiles "TILES=y" "") \
DESTDIR="${IMAGE}" \
prefix_fp="" \
bin_prefix="${IMAGE}/usr/$(exhost --target)/bin" \
install install
# don't relocate docs, needed at runtime keepdir ${MY_SAVEDIR}/morgue
rm -rf "${IMAGE}/usr/share/${PN}/docs/license" keepdir ${MY_SAVEDIR}/saves/db
preserve_scores "${IMAGE}"${MY_SAVEDIR}
dovarlibgames -R
}
pkg_preinst() {
game_pkg_preinst
gtk-icon-cache_pkg_preinst
}
pkg_postinst() {
game_pkg_postinst
gtk-icon-cache_pkg_postinst
} }

View File

@ -0,0 +1,45 @@
From 7927399449c4e10a91329fc11239f7979cdf0496 Mon Sep 17 00:00:00 2001
From: Julian Ospald <hasufell@posteo.de>
Date: Fri, 19 Feb 2016 12:30:24 +0100
Subject: [PATCH 1/3] MAKE: use PKGCONFIG to get ncurses flags, if available
This fixes build failures on some distributions:
https://bugs.gentoo.org/show_bug.cgi?id=527034
Upstream pull-request:
https://github.com/crawl/crawl/pull/237
---
crawl-ref/source/Makefile | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/crawl-ref/source/Makefile b/crawl-ref/source/Makefile
index e9c54db..3702c4c 100644
--- a/crawl-ref/source/Makefile
+++ b/crawl-ref/source/Makefile
@@ -1013,17 +1013,17 @@ endif
# Your ncurses library may include Unicode support, and you may not have a
# separate libncursesw; this is the case on Mac OS/Darwin.
ifdef LIBNCURSES_IS_UNICODE
-NC_LIB = ncurses
-NC_INCLUDE = $(NC_PREFIX)/include/ncurses
+NC_LIBS = $(shell $(PKGCONFIG) --libs ncurses 2>/dev/null || echo "-L$(NC_PREFIX)/lib -lncurses")
+NC_CFLAGS = $(shell $(PKGCONFIG) --cflags ncurses 2>/dev/null || echo "-isystem $(NC_PREFIX)/include/ncurses")
else
-NC_LIB = ncursesw
-NC_INCLUDE = $(NC_PREFIX)/include/ncursesw
+NC_LIBS = $(shell $(PKGCONFIG) --libs ncursesw || echo "-L$(NC_PREFIX)/lib -lncursesw")
+NC_CFLAGS = $(shell $(PKGCONFIG) --cflags ncursesw 2>/dev/null || echo "-isystem $(NC_PREFIX)/include/ncursesw")
endif
-INCLUDES_L += -isystem $(NC_INCLUDE)
+CFOTHERS_L += $(NC_CFLAGS)
ifndef TILES
-LIBS += -L$(NC_PREFIX)/lib -l$(NC_LIB)
+LIBS += $(NC_LIBS)
endif
endif
--
2.7.1

View File

@ -0,0 +1,54 @@
From 39d12bfca474695bdfeee8e749137cb93e1c5d0b Mon Sep 17 00:00:00 2001
From: Julian Ospald <hasufell@posteo.de>
Date: Fri, 19 Feb 2016 12:34:07 +0100
Subject: [PATCH 2/3] MAKE: always use $(PKGCONFIG) instead of pkg-config
This fixes build failures on distributions that use special
binary prefixes and PATHs.
Upstream pull-request:
https://github.com/crawl/crawl/pull/237
---
crawl-ref/source/Makefile | 2 +-
crawl-ref/source/rltiles/Makefile | 5 +++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/crawl-ref/source/Makefile b/crawl-ref/source/Makefile
index 3702c4c..839e0c5 100644
--- a/crawl-ref/source/Makefile
+++ b/crawl-ref/source/Makefile
@@ -605,7 +605,7 @@ endif
#
ifndef NO_PKGCONFIG
-ifeq ($(shell which pkg-config 2> /dev/null),)
+ifeq ($(shell which $(PKGCONFIG) 2> /dev/null),)
NO_PKGCONFIG = YesPlease
endif
endif
diff --git a/crawl-ref/source/rltiles/Makefile b/crawl-ref/source/rltiles/Makefile
index 98e01ec..3d97d7a 100644
--- a/crawl-ref/source/rltiles/Makefile
+++ b/crawl-ref/source/rltiles/Makefile
@@ -10,6 +10,7 @@ endif
# Also, cross-compilation with no system libraries for host rather than target
# is not supported. If host=target, contribs are enough.
+PKGCONFIG = pkg-config
CFLAGS := -O2 $(STDFLAG) -g -Wall -Wextra -Wno-parentheses -Wno-unused-parameter
ifdef ANDROID
@@ -20,8 +21,8 @@ endif
ifdef TILES
ifndef NO_PKGCONFIG
- PNG_INCLUDE := $(shell pkg-config libpng --cflags 2> /dev/null || echo "-I../contrib/install/$(ARCH)/include")
- PNG_LIB := $(shell pkg-config libpng --libs 2> /dev/null || echo "../contrib/install/$(ARCH)/lib/libpng.a ../contrib/install/$(ARCH)/lib/libz.a")
+ PNG_INCLUDE := $(shell $(PKGCONFIG) libpng --cflags 2> /dev/null || echo "-I../contrib/install/$(ARCH)/include")
+ PNG_LIB := $(shell $(PKGCONFIG) libpng --libs 2> /dev/null || echo "../contrib/install/$(ARCH)/lib/libpng.a ../contrib/install/$(ARCH)/lib/libz.a")
else
PNG_INCLUDE := -I../contrib/install/$(ARCH)/include
PNG_LIB := ../contrib/install/$(ARCH)/lib/libpng.a ../contrib/install/$(ARCH)/lib/libz.a
--
2.7.1

View File

@ -0,0 +1,40 @@
From 2c22f71a1d853e720a1daf1c6cf83b9b0b6f7b18 Mon Sep 17 00:00:00 2001
From: Julian Ospald <hasufell@posteo.de>
Date: Fri, 19 Feb 2016 14:03:41 +0100
Subject: [PATCH] MAKE: allow to skip automagic gold linker detection
This causes build failures on exherbo otherwise.
Upstream pull-request:
https://github.com/crawl/crawl/pull/237
---
crawl-ref/source/Makefile | 3 +++
1 file changed, 3 insertions(+)
diff --git a/crawl-ref/source/Makefile b/crawl-ref/source/Makefile
index 484f801..6fbd534 100644
--- a/crawl-ref/source/Makefile
+++ b/crawl-ref/source/Makefile
@@ -46,6 +46,7 @@
# USE_ICC -- set to use Intel's compiler
# LTO -- set for better optimization but slower compilation,
# requires gcc4.6+
+# NO_TRY_GOLD -- if set don't try to detect a working gold linker
# NOASSERTS -- set to disable assertion checks (ignored in debug mode)
# NOWIZARD -- set to disable wizard mode. Use if you have untrusted
# remote players without DGL.
@@ -1048,9 +1049,11 @@ CFWARN := -wd383,810,869,981,1418 -we14,193,304
CFWARN_L :=
endif
+ifndef NO_TRY_GOLD
ifeq (,$(shell echo 'int main(){return 1;}'|$(GXX) -x c++ - -o /dev/null -fuse-ld=gold 2>&1))
LDFLAGS += -fuse-ld=gold
endif
+endif
LDFLAGS += $(CFOPTIMIZE) $(CFOPTIMIZE_L) $(EXTERNAL_LDFLAGS)
--
2.7.1

View File

@ -1,49 +0,0 @@
From 88579f929f0fc777762de1ad0895264ad077e0ee Mon Sep 17 00:00:00 2001
From: Julian Ospald <hasufell@gentoo.org>
Date: Mon, 27 Oct 2014 20:48:03 +0100
Subject: [PATCH 2/2] Use pkg-config for linking to ncurses
Gentoo-Bug: https://bugs.gentoo.org/show_bug.cgi?id=527034
---
source/Makefile | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/source/Makefile b/source/Makefile
index df51e70..2db2781 100644
--- a/source/Makefile
+++ b/source/Makefile
@@ -956,17 +956,15 @@ endif
# Your ncurses library may include Unicode support, and you may not have a
# separate libncursesw; this is the case on Mac OS/Darwin.
ifdef LIBNCURSES_IS_UNICODE
-NC_LIB = ncurses
-NC_INCLUDE = $(NC_PREFIX)/include/ncurses
+NC_LIBS = $(shell $(PKGCONFIG) --libs ncurses 2>/dev/null || echo "-L$(NC_PREFIX)/lib -lncurses")
+NC_CFLAGS = $(shell $(PKGCONFIG) --cflags ncurses 2>/dev/null || echo "-isystem $(NC_PREFIX)/include/ncurses")
else
-NC_LIB = ncursesw
-NC_INCLUDE = $(NC_PREFIX)/include/ncursesw
+NC_LIBS = $(shell $(PKGCONFIG) --libs ncursesw || echo "-L$(NC_PREFIX)/lib -lncursesw")
+NC_CFLAGS = $(shell $(PKGCONFIG) --cflags ncursesw 2>/dev/null || echo "-isystem $(NC_PREFIX)/include/ncursesw")
endif
-INCLUDES_L += -isystem $(NC_INCLUDE)
-
ifndef TILES
-LIBS += -L$(NC_PREFIX)/lib -l$(NC_LIB)
+LIBS += $(NC_LIBS)
endif
endif
@@ -1111,7 +1109,7 @@ CFLAGS := $(CFOPTIMIZE) $(CFOTHERS) $(CFWARN) $(CFLAGS)
else
CFLAGS := $(CFOPTIMIZE) $(CFOTHERS) $(CFWARN)
endif
-CFLAGS_L := $(CFOPTIMIZE_L) $(DEFINES_L) $(CFWARN_L) $(INCLUDES_L) $(CFOTHERS_L)
+CFLAGS_L := $(CFOPTIMIZE_L) $(DEFINES_L) $(CFWARN_L) $(INCLUDES_L) $(CFOTHERS_L) $(NC_CFLAGS)
ALL_CFLAGS := $(CFLAGS) $(CFLAGS_L)
YACC_CFLAGS := $(ALL_CFLAGS) -Wno-unused-function -Wno-sign-compare -DYYENABLE_NLS=0 -DYYLTYPE_IS_TRIVIAL=0
--
2.1.2

View File

@ -1,106 +0,0 @@
From aaa7cde91e4b086164f0c7f46569a34bfbb4e479 Mon Sep 17 00:00:00 2001
From: Julian Ospald <hasufell@gentoo.org>
Date: Sun, 3 May 2015 15:05:43 +0200
Subject: [PATCH] Respect flags and compiler
---
Makefile | 5 ++---
rltiles/Makefile | 22 +++++++++++-----------
2 files changed, 13 insertions(+), 14 deletions(-)
diff --git a/source/Makefile b/source/Makefile
index fed3373..9bb8406 100644
--- a/source/Makefile
+++ b/source/Makefile
@@ -105,7 +105,7 @@ include Makefile.obj
# Which C++ standard to support
STDFLAG = -std=c++11
-CFOTHERS := -pipe $(EXTERNAL_FLAGS)
+CFOTHERS := $(EXTERNAL_FLAGS)
CFWARN :=
CFWARN_L := -Wall -Wformat-security -Wundef
@@ -826,7 +826,6 @@ ifdef FULLDEBUG
DEFINES += -DFULLDEBUG
endif
ifdef DEBUG
-CFOTHERS := -ggdb $(CFOTHERS)
DEFINES += -DDEBUG
endif
ifndef NOWIZARD
@@ -1644,7 +1643,7 @@ ifdef ANDROID
# prove that tiles were generated properly
grep tile_info rltiles/*.cc| head
else
- +$(MAKE) -C $(RLTILES) all ARCH=$(ARCH) TILES=$(TILES)$(WEBTILES)
+ $(MAKE) -C $(RLTILES) all V=$(V) ARCH=$(ARCH) DEBUG=$(DEBUG) TILES=$(TILES)$(WEBTILES)
endif
$(TILEDEFSRCS) $(TILEDEFHDRS) $(ORIGTILEFILES): build-rltiles
diff --git a/source/rltiles/Makefile b/source/rltiles/Makefile
index 98e01ec..9b8b491 100644
--- a/source/rltiles/Makefile
+++ b/source/rltiles/Makefile
@@ -1,7 +1,7 @@
uname_S := $(shell uname -s)
ifneq (,$(findstring MINGW,$(uname_S)))
-LDFLAGS += -lmingw32
+LIBS += -lmingw32
endif
# Note: since generation of tiles is done on the host, we don't care about
@@ -10,7 +10,7 @@ endif
# Also, cross-compilation with no system libraries for host rather than target
# is not supported. If host=target, contribs are enough.
-CFLAGS := -O2 $(STDFLAG) -g -Wall -Wextra -Wno-parentheses -Wno-unused-parameter
+CXXFLAGS := $(STDFLAG) -Wall -Wextra -Wno-parentheses -Wno-unused-parameter
ifdef ANDROID
CXXFLAGS :=
@@ -27,24 +27,24 @@ ifdef TILES
PNG_LIB := ../contrib/install/$(ARCH)/lib/libpng.a ../contrib/install/$(ARCH)/lib/libz.a
endif
- CFLAGS += $(PNG_INCLUDE)
- LDFLAGS += $(PNG_LIB)
+ CXXFLAGS += $(PNG_INCLUDE)
+ LIBS += $(PNG_LIB)
- CFLAGS += -DUSE_TILE
+ CXXFLAGS += -DUSE_TILE
endif
ifdef DEBUG
-CFLAGS += -O0 -DDEBUG -ggdb
+CXXFLAGS += -O0 -DDEBUG -ggdb
endif
ifneq (,$(findstring MINGW,$(uname_S)))
-LDFLAGS += -lgdi32 -lwinmm -lole32 -loleaut32 -limm32 -lshell32 -lversion -luuid
+LIBS += -lgdi32 -lwinmm -lole32 -loleaut32 -limm32 -lshell32 -lversion -luuid
endif
ifeq ($(uname_S),Darwin)
-LDFLAGS += -framework AppKit -framework AudioUnit -framework CoreAudio -framework ForceFeedback -framework Carbon -framework IOKit -framework OpenGL
+LIBS += -framework AppKit -framework AudioUnit -framework CoreAudio -framework ForceFeedback -framework Carbon -framework IOKit -framework OpenGL
endif
ifeq ($(uname_S),Linux)
-LDFLAGS += -ldl -lpthread
+LIBS += -ldl -lpthread
endif
# Attempt to use a full compiler name, to make
@@ -130,9 +130,9 @@ clean:
distclean: clean
%.o: %.cc .cflags
- $(QUIET_HOSTCXX)$(HOSTCXX) $(CFLAGS) -MMD -c $< -o $@
+ $(QUIET_HOSTCXX)$(HOSTCXX) $(CXXFLAGS) -MMD -c $< -o $@
$(TILEGEN): $(OBJECTS)
- $(QUIET_HOSTLINK)$(HOSTCXX) $(OBJECTS) -o $@ $(LDFLAGS)
+ $(QUIET_HOSTLINK)$(HOSTCXX) $(CXXFLAGS) $(OBJECTS) -o $@ $(LDFLAGS) $(LIBS)
.PHONY: all clean distclean