aboutsummaryrefslogtreecommitdiffstats
path: root/games/cataclysm-dda/Makefile
blob: 913a9abd533984e7b40678e048c2c514837ef1e9 (plain) (blame)
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
# Created by: Vladimir Kondratiev <wulf@cicgroup.ru>
# $FreeBSD$

PORTNAME=   cataclysm-dda
PORTVERSION=    0.B
PORTEPOCH=  1
CATEGORIES= games
MASTER_SITES=   https://codeload.github.com/${GH_ACCOUNT}/${GH_PROJECT}/legacy.tar.gz/${GH_TAGNAME}?dummy=/:game \
        http://azmodean.polehammer.com/:sound
DISTFILES=  ${PORTNAME}-${PORTVERSION}.tar.gz:game
EXTRACT_ONLY=   ${PORTNAME}-${PORTVERSION}.tar.gz

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=       gmake shebangfix compiler:c++11-lib execinfo
SHEBANG_FILES=  lang/*.sh
bash_CMD=   /bin/sh

GH_ACCOUNT= CleverRaven
GH_PROJECT= Cataclysm-DDA
GH_TAGNAME= ${PORTVERSION}
GH_COMMIT=  293f250
MAKE_ARGS+= PREFIX=${PREFIX} RELEASE=1 USE_HOME_DIR=1
CXXFLAGS+=  -I${LOCALBASE}/include
LDFLAGS+=   -Wl,-rpath=${_GCC_RUNTIME} -L${LOCALBASE}/lib -lexecinfo

WRKSRC=     ${WRKDIR}/${GH_ACCOUNT}-${GH_PROJECT}-${GH_COMMIT}

MAKE_JOBS_UNSAFE=   yes

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

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

OPTIONS_SUB=    yes
REINPLACE_ARGS= -i ''

NCURSES_USES=   ncurses
SDL_USE=    SDL=sdl2,ttf2,image2
SDL_USES=   pkgconfig
SDL_MAKE_ARGS=  TILES=1 TILESTARGET=cataclysm
SDL_FETCH_DEPENDS=  ${NONEXISTENT}:${PORTSDIR}/x11-fonts/terminus-font:patch
SDL_BUILD_DEPENDS=  bdftopcf:${PORTSDIR}/x11-fonts/bdftopcf
NLS_USES=   gettext
NLS_LDFLAGS=    -lintl
NLS_MAKE_ARGS=  LOCALIZE=1
LUA_USES=   lua:51 pkgconfig
LUA_MAKE_ARGS=  LUA=1

.include <bsd.port.pre.mk>

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

.if ${PORT_OPTIONS:MSOUND}
.if ${PORT_OPTIONS:MSDL}
MAKE_ARGS+= SOUND=1
USE_SDL+=   mixer2
SOUND_FILES=    cataclysmthemeREV6.ogg Dark_Days_Ahead_demo_2.ogg
DISTFILES+= ${SOUND_FILES:S|$|:sound|}
.else
IGNORE=     Sound is not supported with ncurses UI.
.endif
.endif

post-patch:
    ${REINPLACE_CMD} -e '/^ *CXX *=/d ; /^ *LD *=/s/g++/$$(CXX)/ ; \
        /^ *CXXFLAGS *+*=/s/-O[s0-3]//; /^ *LOCALIZE *=/d ; \
        s/\(-lncurses\)\(w*\)/\1\2 -ltinfo\2/ ; \
        s/=$$(PREFIX)\//=$$(DESTDIR)$$(PREFIX)\// ; \
        /install/s/--mode=/-m / ; s/ -t\( $$(DATA_PREFIX)\)/\1/ ; \
        /cp -R/s/--no-preserve=ownership// ; \
        /^ *LUA_BINARY *=/s/lua/${LUA_CMD}/' ${WRKSRC}/Makefile
.if ! ${PORT_OPTIONS:MNLS}
    ${REINPLACE_CMD} -e '/LOCALE_DIR/s/^/#/' ${WRKSRC}/Makefile
.endif
.if ${PORT_OPTIONS:MNCURSES} && ${NCURSESBASE} == /usr
    ${REINPLACE_CMD} -e 's/$$(shell ncursesw5-config --libs)/-lncursesw/ ; \
        /$$(shell ncursesw5-config --cflags)/d' ${WRKSRC}/Makefile
.endif
.if ${PORT_OPTIONS:MSDL}
    ${REINPLACE_CMD} -e '/"file":/s|gfx|${DATADIR}/&|' \
        ${WRKSRC}/gfx/*/tile_config.json
    # replace bundled windows version of terminus font with X-compatible one
    ${CAT} `cd ${PORTSDIR}/x11-fonts/terminus-font; make -V WRKSRC`/ter-u14n.bdf \
        | bdftopcf | ${GZIP_CMD} > ${WRKSRC}/data/font/terminus.fon
.endif

post-install:
.if ${PORT_OPTIONS:MSOUND}
    cd ${WRKSRC}/data && ${COPYTREE_SHARE} sound ${STAGEDIR}${DATADIR}
    cd ${DISTDIR} && \
        ${INSTALL_DATA} ${SOUND_FILES} ${STAGEDIR}${DATADIR}/sound
.endif
    @${MKDIR} ${STAGEDIR}${DOCSDIR}
    ${FIND} ${WRKSRC} \( -name "*.md" -or -name "*.txt" \) \
        -exec ${INSTALL_DATA} {} ${STAGEDIR}${DOCSDIR}/ \;

.include <bsd.port.post.mk>