summaryrefslogtreecommitdiffstats
path: root/games/ufoai/Makefile
blob: fc116c38c513c10172b37f7bed03c35c75e9ab43 (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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# Created by: Alonso Cardenas Marquez <acm@FreeBSD.org>
# $FreeBSD$

PORTNAME=	ufoai
PORTVERSION=	2.5
PORTREVISION=	3
CATEGORIES=	games
MASTER_SITES=	SF/${PORTNAME}/UFO_AI%202.x/${PORTVERSION}
DISTNAME=	${PORTNAME:S/$/-/}${PORTVERSION}-source
DIST_SUBDIR=	${PORTNAME}

MAINTAINER=	m.tsatsenko@gmail.com
COMMENT=	Strategy game featuring tactical combat

LIB_DEPENDS=	libvorbis.so:${PORTSDIR}/audio/libvorbis \
		libjpeg.so:${PORTSDIR}/graphics/jpeg \
		libpng.so:${PORTSDIR}/graphics/png \
		libcurl.so:${PORTSDIR}/ftp/curl \
		libtheora.so:${PORTSDIR}/multimedia/libtheora \
		libxvidcore.so:${PORTSDIR}/multimedia/xvid \
		libmxml.so:${PORTSDIR}/textproc/mxml
BUILD_DEPENDS=	zip:${PORTSDIR}/archivers/zip
RUN_DEPENDS=	${LOCALBASE}/share/${PORTNAME}/base/default.cfg:${PORTSDIR}/games/ufoai-data

USE_GL=		yes
USE_SDL=	sdl image mixer ttf
USE_CXXSTD=	c++11
USES=		compiler:c++11-lang execinfo gettext gmake openal:soft pkgconfig \
		python:build tar:bzip2
HAS_CONFIGURE=	yes
CONFIGURE_ARGS+=	--enable-release --target-os=freebsd
CPPFLAGS+=	-I${LOCALBASE}/include ${PTHREAD_CFLAGS}
LDFLAGS+=	-L${LOCALBASE}/lib ${PTHREAD_LIBS} -lexecinfo
CFLAGS+=	-I${LOCALBASE}/include

DATADIR=	share/${PORTNAME}
SUB_FILES=	pkg-message
WRKSRC=		${WRKDIR}/${PORTNAME:S/$/-/}${PORTVERSION}-source
UFO_DIR=	${PREFIX}/lib/${PORTNAME}
UFO_FILES=	ufo ufomodel

OPTIONS_DEFINE=		SERVER UFO2MAP UFORADIANT
OPTIONS_DEFAULT=	SERVER UFO2MAP

SERVER_DESC=		Install dedicated server
UFO2MAP_DESC=		Install UFO tools
UFORADIANT_DESC=	Install UFO map editor

.include <bsd.port.options.mk>

.if ${PORT_OPTIONS:MSERVER}
CONFIGURE_ARGS+=	--enable-ufoded
UFO_FILES+=	ufoded
PLIST_SUB+=	UFOSERVER=""
.else
CONFIGURE_ARGS+=	--disable-ufoded
PLIST_SUB+=	UFOSERVER="@comment "
.endif

.if ${PORT_OPTIONS:MUFO2MAP}
CONFIGURE_ARGS+=	--enable-ufo2map
UFO_FILES+=	ufo2map
PLIST_SUB+=	UFO2MAP=""
.else
CONFIGURE_ARGS+=	--disable-ufo2map
PLIST_SUB+=	UFO2MAP="@comment "
.endif

.if ${PORT_OPTIONS:MUFORADIANT}
CONFIGURE_ARGS+=--enable-uforadiant
USE_GNOME+=	gtk20 glib20 gtksourceview2 libxml2
LIB_DEPENDS+=	libgtkglext-x11-1.0.so:${PORTSDIR}/x11-toolkits/gtkglext
RADIANT_FILES=	colours.xml game.xml input.xml mapdef.template menu.xml user.xml
RADIANT_DIRS=	bitmaps i18n prefabs sourceviewer
PLIST_SUB+=	UFORADIANT=""
.else
CONFIGURE_ARGS+=--disable-uforadiant
PLIST_SUB+=	UFORADIANT="@comment "
.endif

.if ${OSVERSION} < 1000024
FAVORITE_COMPILER=	gcc
.endif

.include <bsd.port.pre.mk>

.if ${OSVERSION} < 900000
BROKEN=	Fails to build on 8.x
.endif

post-extract:
	@${MKDIR} ${WRKSRC}/base/maps ${WRKSRC}/base/models
	${REINPLACE_CMD} \
		-e 's|DEFAULT_COMPILER_CC=cc|DEFAULT_COMPILER_CC=${CC}|' \
		-e 's|DEFAULT_COMPILER_CXX=c++|DEFAULT_COMPILER_CXX=${CXX}|' \
		${WRKSRC}/configure
.if ${CHOSEN_COMPILER_TYPE} == "clang"
	${REINPLACE_CMD} \
		-e 's|-falign-loops=2 -falign-jumps=2 -falign-functions=2||' \
		${WRKSRC}/build/modes/release.mk
.endif

post-build:
	@cd ${WRKSRC} && ${MAKE_CMD} lang
.if $(PORT_OPTIONS:MUFORADIANT)
	@cd ${WRKSRC} && ${MAKE_CMD} uforadiant
.endif

do-install:
	${MKDIR} ${STAGEDIR}${UFO_DIR}
.for FILE in ${UFO_FILES}
	@${SED} \
		-e 's|@UFODIR@|${UFO_DIR}|' \
		-e 's|@APP@|${FILE}|' \
		${FILESDIR}/run.sh.in > ${WRKDIR}/${FILE}
	${INSTALL_PROGRAM} ${WRKSRC}/${FILE} ${STAGEDIR}${UFO_DIR}
	${INSTALL_SCRIPT} ${WRKDIR}/${FILE} ${STAGEDIR}${PREFIX}/bin
.endfor
	${MKDIR} ${STAGEDIR}${PREFIX}/${DATADIR}/base
	${INSTALL_PROGRAM} ${WRKSRC}/base/game.so ${STAGEDIR}${PREFIX}/${DATADIR}/base

.if ${PORT_OPTIONS:MUFORADIANT}
	${MKDIR} ${STAGEDIR}${UFO_DIR}/radiant
	@${SED} \
		-e 's|@UFODIR@|${UFO_DIR}/radiant|' \
		-e 's|@APP@|uforadiant|' \
		${FILESDIR}/run.sh.in > ${WRKDIR}/uforadiant
	${INSTALL_PROGRAM} ${WRKSRC}/radiant/uforadiant ${STAGEDIR}${UFO_DIR}/radiant
	${INSTALL_SCRIPT} ${WRKDIR}/uforadiant ${STAGEDIR}${PREFIX}/bin

.for FILE in ${RADIANT_FILES}
	${INSTALL_DATA} ${WRKSRC}/radiant/${FILE} ${STAGEDIR}${UFO_DIR}/radiant
.endfor

.for DIRE in ${RADIANT_DIRS}
	${MKDIR} ${STAGEDIR}${UFO_DIR}/radiant/${DIRE}
	cd ${WRKSRC}/radiant/${DIRE} && \
		${FIND} * -type d -exec ${MKDIR} "${STAGEDIR}${UFO_DIR}/radiant/${DIRE}/{}" \; && \
		${FIND} * -type f -exec ${INSTALL_DATA} "{}" "${STAGEDIR}${UFO_DIR}/radiant/${DIRE}/{}" \;
.endfor
.endif

	cd ${WRKSRC}/base/i18n && \
		${FIND} * -type d -exec ${MKDIR} "${STAGEDIR}${PREFIX}/${DATADIR}/base/i18n/{}" \; && \
			${FIND} * -type f -exec ${INSTALL_DATA} "{}" "${STAGEDIR}${PREFIX}/${DATADIR}/base/i18n/{}" \;
	${LN} -s ${PREFIX}/${DATADIR}/base ${STAGEDIR}${UFO_DIR}/base

.include <bsd.port.post.mk>
OpenPOWER on IntegriCloud