Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bumped Cataclysm: DDA to 0.C. #39

Merged
merged 1 commit into from
Jun 17, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions games-roguelike/cataclysm-dda/Manifest
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
DIST cataclysm-dda-0.9.tar.gz 7212569 SHA256 c9acddb6241e740a3caddbffba8a4d75fff7ec66c27661245b02d029d99dd03c SHA512 6cab56188207e366ef103a54b3c2df0fa864e49cd34cd50394e34aebb1106d4c24acca156080726b80e0f29fa2968374a1155d61f7894232dcdeb0037c941547 WHIRLPOOL 3cc9f865dbcfe1d4c8ef0b9bd705ffae6e4b48d912fc5b676713ba6b160084288e51bdf34120dec198dc2d54ad6f5d7aa048a4cbdd51e785409602155c8f04ed
DIST cataclysm-dda-0.9a.tar.gz 10993857 SHA256 4fcf019c928bc10723385eec28b68b1c4644313c8206364b5562db6304d5345e SHA512 f20200e062b65489c848399e1c0f8b0469d966fa0cc77553c62b92351ee4a200ab21655af1d120f0107b84be937d23647cc58d9277d8b738fb9c0e296be91c8e WHIRLPOOL d73023090dba90de22d8002aab670730a516737daef6ddb386f56505a24f7fa16b54b26ebc7e3b9815c392ef088c74082d2356f7333453d0c148b8b80a7833c3
DIST cataclysm-dda-0.9c.tar.gz 26887684 SHA256 69e947824626fffb505ca4ec44187ec94bba32c1e5957ba5c771b3445f958af6 SHA512 647eb18419f1f49dfe83f81ed09bb3553a496e9505098853b71ecaed47bd123c67031d23a76786764ed48adb867f7d6b9a20df314b8e3cb0ea0945ea411e2a12 WHIRLPOOL 5aa541b1ee5ab369646e1678fa5b033b7238a50a5f45fba820991f426438a3f2500fa2632a9cb4cb6c49d5d86a16518594de9bf96463ee1f4de49aeb5baa4ff0
143 changes: 143 additions & 0 deletions games-roguelike/cataclysm-dda/cataclysm-dda-0.9c-r1.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI=5

# Enforce Bash strictness.
set -e

#FIXME: C:DDA ships with an undocumented and currently unsupported
#
#"CMakeLists.txt" for building under CMake. Switch to such makefile when
#confirmed to be reliably working.

# Post-0.9 versions of C:DDA employ capitalized alphabetic letters rather than
# numbers (e.g., "0.A" rather than "1.0"). Since Portage permits version
# specifiers to contain only a single suffixing letter prefixed by one or more
# digits, we encode post-0.9 versions as "0.9${lowercase_letter}" in the ebuild
# filename and then manually strip the "9" and uppercase such letter here.
MY_PV="${PV/.9/.}"
MY_PV="${MY_PV^^}"

# See "COMPILING.md" in the tarball below for compilation instructions.
inherit games

DESCRIPTION="Roguelike set in a post-apocalyptic world"
HOMEPAGE="http://www.cataclysmdda.com"
SRC_URI="https://github.com/CleverRaven/Cataclysm-DDA/archive/${MY_PV}.tar.gz -> ${P}.tar.gz"

LICENSE="CC-BY-SA-3.0"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="clang lua ncurses sdl"
REQUIRED_USE="
lua? ( sdl )
|| ( ncurses sdl )
"

RDEPEND="
sys-devel/gettext:0=[nls]
sys-libs/glibc:2.2=
lua? ( >=dev-lang/lua-5.1:0= )
ncurses? ( sys-libs/ncurses:5= )
sdl? (
media-libs/libsdl2:0=
media-libs/sdl2-ttf:0=
media-libs/sdl2-image:0=[jpeg,png]
media-libs/freetype:2=
)
"
DEPEND="${RDEPEND}
clang? ( sys-devel/clang )
!clang? ( sys-devel/gcc[cxx] )
"

S="${WORKDIR}/Cataclysm-DDA-${MY_PV}"

# Absolute path of the target directory to install Cataclysm to.
CATACLYSM_HOME="${GAMES_PREFIX}/${PN}"

# The Makefile is surprisingly Gentoo-friendly. (Thanks!)
src_prepare() {
# Strip the following from the the Makefile:
#
# * Hardcoded optimizations (e.g., "-O3").
# * g++ option "-Werror", converting compiler warnings to errors and hence
# failing on the first (inevitable) warning.
sed -i\
-e '/OTHERS += /s~ -O3~~'\
-e '/RELEASE_FLAGS = /s~ -Werror~~'\
'Makefile'

# The Makefile assumes subdirectories "obj" and "obj/tiles" both exist,
# which (of course) they do not. Create such subdirectories manually.
mkdir -p obj/tiles
}

src_compile() {
# Options to be passed to emake() below. Unconditionally enable:
#
# * "RELEASE=1", compiling release rather than debug builds.
local -a emake_options; emake_options=( RELEASE=1 )
use clang && emake_options+=( CLANG=1 )
use lua && emake_options+=( LUA=1 )

# If optional Gentoo-specific string global ${LINGUAS} is defined (e.g., in
# "make.conf"), pass all such whitespace-delimited locales.
[ -n "${LINGUAS+x}" ] && emake_options+=( LANGUAGES="${LINGUAS}" )

# If enabling ncurses, compile the ncurses-based executable.
if use ncurses; then
einfo 'Compiling ncurses interface...'
emake "${emake_options[@]}"
fi

# If enabling SDL, compile the SDL-based executable.
if use sdl; then
einfo 'Compiling SDL interface...'
emake "${emake_options[@]}" TILES=1
fi
}

# The Makefile defines no "install" target. ("A pox on yer scurvy grave!")
src_install() {
# Install executable-agnostic data files.
insinto "${CATACLYSM_HOME}"
doins -r data

# If enabling ncurses, install the ncurses-based executable.
if use ncurses; then
# The "cataclysm" binary expects to be executed from its home directory.
# Install a shell script "cataclysm-dda-ncurses" ensuring this. While
# the tarball prebundles a similar wrapper "cataclysm-launcher", such
# script is both trivial and *NOT* terribly helpful.
games_make_wrapper "${PN}-ncurses" ./cataclysm "${CATACLYSM_HOME}"

# Install such executable.
exeinto "${CATACLYSM_HOME}"
doexe cataclysm
fi

# If enabling SDL, install the SDL-based executable and support files.
if use sdl; then
# Install such executable and wrapper, as above.
games_make_wrapper "${PN}-sdl" ./cataclysm-tiles "${CATACLYSM_HOME}"
exeinto "${CATACLYSM_HOME}"
doexe cataclysm-tiles

# Install SDL support files.
insinto "${CATACLYSM_HOME}"
doins -r gfx
fi

# Force game-specific user and group permissions.
prepgamesdirs

# Since playing Cataclysm requires write access to its home directory,
# forcefully grant such access to users in group "games". This is (clearly)
# non-ideal, but there's not much we can do about that... at the moment.
fperms -R g+w "${CATACLYSM_HOME}"

# Install documentation.
dodoc CONTRIBUTING.md README.md
}