aboutsummaryrefslogtreecommitdiff
path: root/games/utserver-to/Makefile
blob: cd7685b7fc01ac7da150538731d12096dbb2e1dd (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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# New ports collection makefile for:	UT Mod: Tactical Ops
# Date created:				Sat Oct  6 11:40:35 EDT 2001
# Whom:					pat@databits.net et al
#
# $FreeBSD$
#

PORTNAME?=	to
PORTVERSION?=	0.2.b
CATEGORIES=	games linux
MASTER_SITES?=	ftp://files.gamesmania.de/pub/gamesmania/utstation/mods/to20/ \
		ftp://ftp2.extreme-players.de/ut/mod/tacticalops/ \
		ftp://ftp.gigabell.net/pub/exp/ut/mod/tacticalops/ \
		ftp://ftp.task.gda.pl/mirror/ftp.extreme-players.de/exp/ut/mod/tacticalops/ \
		ftp://downloads.khabal.com/pub/Download/unreal/mods/
PKGNAMEPREFIX=	utserver-
.ifndef(DISTFILES)
DISTNAME?=	TOb200ManualInstall
.endif

MAINTAINER?=	pat@databits.net

RUN_DEPENDS=	${LINUXBASE}/usr/games/ut-server/System/ucc-bin:${UTSERVER_PORT}

ONLY_FOR_ARCHS=	i386
USE_LINUX_PREFIX=	yes
NO_CDROM=	"Size; the data set is much too big"
NO_BUILD=	yes
.if (${PORTNAME}==to)
EXECUTABLES+=	TacticalOpsLinux\\w+
EXTRA_CLEAN_FILES+=	.+/TacticalOpsLinux.+
.endif
.ifndef(DONT_USE_ZIP)
USE_ZIP=	yes
.endif
.ifndef(DO_USE_WRKSUBDIR)
NO_WRKSUBDIR=	yes
.endif
.if defined(DO_USE_STRIP) && exists(${LINUXBASE}/usr/bin/strip)
STRIP=	${LINUXBASE}/usr/bin/strip
.else
STRIP=
.endif

UTDIR=		usr/games/ut-server/${UTSUBDIR}/
PLIST_SUB+=	UTDIR="${UTDIR}"
INSTALL_DIR=	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m ${BINMODE}
SORT?=		/usr/bin/sort

UTSERVER_PORT=	${.CURDIR}/../utserver
MASTERPKGMESSAGE!=	cd ${UTSERVER_PORT} && ${MAKE} -V PKGMESSAGE

# files which should be installed with executable perms
EXECUTABLES+=	.sh

.if defined(HAS_WIERDPATCHES) && defined(DISTFILES)
post-extract:
.for files in ${DISTFILES:S/${EXTRACT_ONLY}//}
	@cd ${WRKSRC} && ${EXTRACT_CMD} ${EXTRACT_BEFORE_ARGS} \
		${DISTDIR}/${DIST_SUBDIR}/${files}
.endfor
.endif

pre-patch:
# remove trailing ^M
	@find -E ${WRKDIR} -type f \
		-iregex ".*\.(bat|cfg|gam|htm|html|inf|ini|int|lst|pl|pm|sc|sh|scr|txt|url|uhtm)" \
		-exec ${PERL} -pi -ne 's!\r\n!\n!' {} 1>/dev/null 2>&1 \;
.ifdef(EXTRA_CLEAN_FILES)
.for pattern in ${EXTRA_CLEAN_FILES}
	@find -E ${WRKDIR} -type f \
		-iregex "${pattern}" \
		-exec ${PERL} -pi -ne 's!\r\n!\n!' {} 1>/dev/null 2>&1 \;
.endfor
.endif

# Parses PLIST
# Contributed by <lioux@FreeBSD.org>
do-install: install-parse-plist install-scripts

install-parse-plist: generate-plist
	@${PERL} -e 'open(FHANDLER,"${TMPPLIST}");' \
		-e 'open(FDIR,">${WRKDIR}/dirs.sh.tmp");' \
		-e 'open(FFILES,">${WRKDIR}/files.sh");' \
		-e 'while (!eof(FHANDLER)) {' \
			-e 'chop($$file = <FHANDLER>);' \
			-e '$$dir = $$file_partial = $$file;' \
			-e '$$file_partial =~ s!^${UTDIR}!!;' \
			-e 'print FDIR "${INSTALL_DIR}", \
				" ", "\"${PREFIX}/$$dir\"", \
				"\n" if $$dir =~ s!(^\@dirrm\s+)!!;' \
			-e 'if ($$file !~ m!^\@!) {' \
				-e '$$program_flag = 0;' \
				-e 'if ("${EXECUTABLES}" ne "") {' \
					-e 'foreach $$program_pattern \
						(split (/\s+/,"${EXECUTABLES}")) {' \
						-e '($$program_flag = 1 , break) \
							if ($$file =~ /$$program_pattern$$/);' \
					-e '}' \
				-e '}' \
				-e 'print FFILES ($$program_flag == 0) ? \
					"${INSTALL_DATA}" : "${INSTALL_PROGRAM}", \
					" ", "\"${WRKSRC}/$$file_partial\"", \
					" ", "\"${PREFIX}/$$file\"", \
					"\n";' \
			-e '}' \
		-e '}' \
		-e 'close(FFILES);' \
		-e 'close(FDIR);' \
		-e 'close(FHANDLER);'
	@${SORT} ${WRKDIR}/dirs.sh.tmp > ${WRKDIR}/dirs.sh

install-scripts:
.for script in dirs files
	@${SH} ${WRKDIR}/${script}.sh
.endfor

post-install:
	@${CAT} ${MASTERPKGMESSAGE}
.if exists(${.CURDIR}/pkg-message)
	@${CAT} ${.CURDIR}/pkg-message
.endif

.include <bsd.port.mk>