aboutsummaryrefslogtreecommitdiff
path: root/games/quake2-data/Makefile
blob: f6962e077c6eb52836e7c7eb24c82e0d494914e1 (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
# New ports collection makefile for:	quake2-data
# Date created:				28 Sep 2005
# Whom:					Alejandro Pulver <alejandro@varnet.biz>
#
# $FreeBSD$
#

PORTNAME=	data
PORTVERSION=	3.20
PORTREVISION=	3
CATEGORIES=	games
MASTER_SITES=	${MASTER_SITE_IDSOFTWARE:S|$|:data,src|}
MASTER_SITE_SUBDIR=	quake2/:data \
			quake2/source/:src
PKGNAMEPREFIX=	${Q2PKGNAMEPREFIX}
DISTFILES=	${Q2_UPDATE}:data \
		${Q2_SRC}:src

MAINTAINER=	alepulver@FreeBSD.org
COMMENT=	Quake II data files

USE_ZIP=	yes
NO_WRKSUBDIR=	yes

OPTIONS=	MANUAL "Install game manual" off \
		OPTIMIZED_CFLAGS "Enable compilation optimizations" on \
		SHAREWARE "Install demo version of the game data" off

LATEST_LINK=	${PKGNAMEPREFIX}${PORTNAME}
DATADIR=	${Q2DIR}
DOCSDIR=	${PREFIX}/share/doc/${LATEST_LINK}

Q2_DEMO=	q2-314-demo-x86.exe
Q2_SRC=		q2src${PORTVERSION:S/.//}.shar.Z
Q2_UPDATE=	q2-${PORTVERSION}-x86-full.exe

.include "Makefile.include"

.include <bsd.port.pre.mk>

.if defined(WITH_MANUAL) || defined(WITH_SHAREWARE)
DISTFILES+=	${Q2_DEMO}:data
.endif

.if defined(WITH_MANUAL)
PLIST_SUB+=	MANUAL=""
.else
PLIST_SUB+=	MANUAL="@comment "
.endif

.if defined(WITH_OPTIMIZED_CFLAGS)
MAKE_ENV+=	WITH_OPTIMIZED_CFLAGS=yes
.endif

.if defined(WITH_SHAREWARE)
PLIST_SUB+=	FULL="@comment " \
		SHAREWARE=""
.else
PLIST_SUB+=	FULL="" \
		SHAREWARE="@comment "
SUB_FILES=	pkg-message
PKGMESSAGE=	${WRKDIR}/pkg-message
.endif

do-extract:
	@${MKDIR} ${WRKDIR}
	@cd ${WRKDIR} && \
		uncompress -c ${DISTDIR}/${Q2_SRC} | ${TAIL} +434 | ${SH}
	@${UNZIP_CMD} -q -d ${WRKDIR} \
		${DISTDIR}/${Q2_UPDATE} baseq2/* -x *.dll
.if defined(WITH_MANUAL)
	@${UNZIP_CMD} -ajq -d ${WRKDIR}/DOCS \
		${DISTDIR}/${Q2_DEMO} Install/Data/DOCS/*
.endif
.if defined(WITH_SHAREWARE)
	@${RM} ${WRKDIR}/baseq2/pak[^0].pak
	@${UNZIP_CMD} -jq -d ${WRKDIR}/baseq2 \
		${DISTDIR}/${Q2_DEMO} Install/Data/baseq2/pak0.pak
.endif

post-extract:
	@${CP} ${FILESDIR}/${MAKEFILE} ${WRKSRC}

post-patch:
	@${REINPLACE_CMD} -e 's/__linux__/__unix__/' ${WRKSRC}/q_shared.[ch]

do-install:
	${MKDIR} ${DATADIR}/baseq2
	${INSTALL_PROGRAM} ${WRKSRC}/game.so ${DATADIR}/baseq2
	${CP} -R ${WRKSRC}/baseq2/* ${DATADIR}/baseq2
.if defined(WITH_MANUAL)
	@${MKDIR} ${DOCSDIR}
	@${CP} -R ${WRKSRC}/DOCS ${DOCSDIR}/manual
.endif

post-install:
.if !defined(WITH_SHAREWARE)
	@${ECHO_CMD}
	@${CAT} ${PKGMESSAGE}
	@${ECHO_CMD}
.endif

.include <bsd.port.post.mk>