summaryrefslogtreecommitdiff
path: root/games/cataclysm-dda/Makefile
blob: 8b5a2bd33001471d6164a4594b24f6797a22017f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# Created by: Vladimir Kondratiev <wulf@cicgroup.ru>
# $FreeBSD$

PORTNAME=	cataclysm-dda
PORTVERSION=	0.C
PORTEPOCH=	1
CATEGORIES=	games

MAINTAINER=	ports@FreeBSD.org
COMMENT=	Fork/variant of Cataclysm Roguelike by Whales

LICENSE=	CCPL.BY-SA.30
LICENSE_NAME=	Creative Commons Attribution-ShareAlike 3.0 Unported License
LICENSE_FILE=	${WRKSRC}/LICENSE.txt
LICENSE_PERMS=	dist-mirror dist-sell pkg-mirror pkg-sell auto-accept

USES=		alias compiler:c++11-lib execinfo gmake shebangfix
SHEBANG_FILES=	lang/*.sh
bash_CMD=	/bin/sh

USE_GITHUB=	yes
GH_ACCOUNT=	CleverRaven
GH_PROJECT=	Cataclysm-DDA

MAKE_ARGS=	CXX="${CXX}" LD="${CXX}" RELEASE=1

CPPFLAGS+=	${EXECINFO_CPPFLAGS}
LDFLAGS+=	${EXECINFO_LDFLAGS} -lexecinfo

MAKE_JOBS_UNSAFE=	yes

OPTIONS_DEFINE=	NLS DOCS LUA SOUND
OPTIONS_DEFAULT=NCURSES
OPTIONS_SINGLE=	UI
OPTIONS_SINGLE_UI=	NCURSES SDL
OPTIONS_SUB=	yes

UI_DESC=	User Interface
SOUND_DESC=	Sound support (SDL UI only)

NCURSES_USES=	ncurses
SDL_USE=	SDL=image2,ttf2
SDL_USES=	pkgconfig
SDL_MAKE_ARGS=	TILES=1 TILESTARGET=cataclysm
SDL_RUN_DEPENDS=terminus-font>0:x11-fonts/terminus-font
SDL_CPPFLAGS=	$$(sdl2-config --cflags)
SDL_LDFLAGS=	$$(sdl2-config --libs)
SDL_DESKTOP_ENTRIES="Cataclysm-DDA" "" "" "cataclysm" "" ""
NLS_USES=	gettext
NLS_LDFLAGS=	-L${LOCALBASE}/lib -lintl
NLS_MAKE_ARGS_OFF=LOCALIZE=0
NLS_CPPFLAGS=	-I${LOCALBASE}/include
LUA_USES=	lua pkgconfig
LUA_MAKE_ARGS=	LUA=1 LUA_BINARY="${LUA_CMD}"
SOUND_MASTER_SITES=	http://polehammer.com/azmodean/:sound
SOUND_DISTFILES=	${SOUND_FILES:S/$/:sound/}
SOUND_EXTRACT_ONLY=	${DISTNAME}${EXTRACT_SUFX}
SOUND_USE=		SDL=mixer2
SOUND_MAKE_ARGS=	SOUND=1
SOUND_IMPLIES=		SDL

SOUND_FILES=	cataclysmthemeREV6.ogg Dark_Days_Ahead_demo_2.ogg

.include <bsd.port.pre.mk>

.if ${CHOSEN_COMPILER_TYPE} == clang && ${COMPILER_VERSION} >= 36
CXXFLAGS+=	-Wno-inconsistent-missing-override
.endif

.if ${CHOSEN_COMPILER_TYPE} == gcc
CPPFLAGS+=	-DCATA_NO_CPP11_STRING_CONVERSIONS
.endif

post-patch:
	 @${REINPLACE_CMD} -e \
		'/CXXFLAGS/s|-O[0-3s]|| ; \
		 /LDFLAGS/s|-s$$|| ; \
		 s|$$(shell ncursesw5-config --cflags)|| ; \
		 s|$$(shell ncursesw5-config --libs)|-lncursesw -ltinfow| ; \
		 s|\($$(CXX)\) \($$(DEFINES)\)|\1 $$(CPPFLAGS) \2| ; \
		 s|\([[:blank:]]\)\($$(DATA_PREFIX)\)|\1$$(DESTDIR)\2| ; \
		 s|\([[:blank:]]\)\($$(BIN_PREFIX)\)|\1$$(DESTDIR)\2| ; \
		 s|--mode=|-m | ; \
		 s|--no-preserve=ownership|| ; \
		 s|-t || ; \
		 s|\([[:blank:]]\)\($$(LOCALE_DIR)\)|\1$$(DESTDIR)\2| ; \
		 s|\(=\)\($$(LOCALE_DIR)\)|\1$$(DESTDIR)\2|' \
		${WRKSRC}/Makefile
	@${REINPLACE_CMD} -e \
		's|/usr/local/share/fonts|${LOCALBASE}/share/fonts|' \
		${WRKSRC}/src/sdltiles.cpp

post-patch-NLS-off:
	 @${REINPLACE_CMD} -e \
		'/LOCALE_DIR/s|^|#|' \
		${WRKSRC}/Makefile

post-install:
	${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/cataclysm
# replace bundled windows version of terminus font with X-compatible one
	${RM} ${STAGEDIR}${DATADIR}/font/terminus.fon
	${LN} -sf ${PREFIX}/share/fonts/terminus/ter-u14n.pcf.gz \
		${STAGEDIR}${DATADIR}/font/terminus.fon

post-install-SOUND-on:
	cd ${WRKSRC}/data && ${COPYTREE_SHARE} sound ${STAGEDIR}${DATADIR}
	cd ${DISTDIR} && ${INSTALL_DATA} ${SOUND_FILES} \
		${STAGEDIR}${DATADIR}/sound

post-install-DOCS-on:
	@${MKDIR} ${STAGEDIR}${DOCSDIR}
	@(cd ${WRKSRC}/doc && ${COPYTREE_SHARE} . \
		${STAGEDIR}${DOCSDIR})

.include <bsd.port.post.mk>