aboutsummaryrefslogtreecommitdiffstats
path: root/net/punkbuster/Makefile
blob: 3ffcfad4659218e048e9e6a54b4dbc0fe93d6eb4 (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
# New ports collection makefile for:    punkbuster anti cheat server
# Date created:     29 Mar 2001
# Whom:         Mario Sergio Fujikawa Ferreira <lioux@FreeBSD.org>
#
# $FreeBSD$
#

PORTNAME=   punkbuster
PORTVERSION=    0.0.956
CATEGORIES= net linux
MASTER_SITES=   http://www.punkbuster.com/downloads/
DISTNAME=   pbsv${PORTVERSION:E}
DIST_SUBDIR=    punkbuster

MAINTAINER= lioux@FreeBSD.org

RUN_DEPENDS=    ${LINUXBASE}${PUNKBUSTER_DIR}${PUNKBUSTER_DATA}:${PUNKBUSTER_DATA_PORT}

NO_PACKAGE=     the software terms do not allow non-standard\
        ${PORTNAME} distributions

USE_LINUX_PREFIX=   yes
NO_WRKSUBDIR=   yes
NO_BUILD=   yes
PLIST_SUB=  PUNKBUSTER_DIR="${PUNKBUSTER_DIR:S/^\///}" \
        PUNKBUSTER_DOC_DIR="${PUNKBUSTER_DOC_DIR}"

INSTALL_DIR=    ${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m ${BINMODE}
SORT?=      /usr/bin/sort
STRIP_LINUX=    ${LINUXBASE}/usr/bin/strip

PUNKBUSTER_DIR= /usr/games/punkbuster/
PUNKBUSTER_PROGRAM= pb
PUNKBUSTER_DATA_PORT=   ${.CURDIR}/../punkbuster-data
PUNKBUSTER_DATA!=   cd ${PUNKBUSTER_DATA_PORT} && ${MAKE} -V PUNKBUSTER_DATA
PUNKBUSTER_DATA_DISTFILES!= cd ${PUNKBUSTER_DATA_PORT} && ${MAKE} -V DISTFILES
PUNKBUSTER_DOC_DIR= usr/doc/${PKGNAME}/

pre-everything:: pkgmessage-output

post-extract:
.for file in ${PUNKBUSTER_DATA_DISTFILES}
    @${RM} ${WRKSRC}/${file}
.endfor

post-patch:
.for extension in cfg htm ini pbq txt
    @${PERL} -pi -ne "s!\r\n!\n!" ${WRKSRC}/*.${extension}
.endfor
    @${PERL} -pi -ne "s!\r\n!\n!" ${WRKSRC}/README

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!^(${PUNKBUSTER_DIR:S/^\///}|${PUNKBUSTER_DOC_DIR})!!;' \
            -e 'print FDIR "${INSTALL_DIR}", \
                " ", "\"${PREFIX}/$$dir\"", \
                "\n" if $$dir =~ s!(^\@dirrm\s+)!!;' \
            -e 'print FFILES "${INSTALL_DATA}", \
                " ", "\"${WRKSRC}/$$file_partial\"", \
                " ", "\"${PREFIX}/$$file\" || true", \
                "\n" if ($$file !~ m!^\@!);' \
        -e '}' \
        -e 'close(FFILES);' \
        -e 'close(FDIR);' \
        -e 'close(FHANDLER);'

install-scripts:
    @${INSTALL_DIR} ${PREFIX}${PUNKBUSTER_DIR}
    @${SORT} ${WRKDIR}/dirs.sh.tmp > ${WRKDIR}/dirs.sh
    @${SH} ${WRKDIR}/dirs.sh
    @${SH} ${WRKDIR}/files.sh 2>/dev/true

pkgmessage-output:
    @${CAT} ${PKGMESSAGE}

do-install: install-parse-plist install-scripts pkgmessage-output
    @${CAT} ${PKGMESSAGE}

    @${INSTALL_DATA} ${WRKSRC}/pbsvhl.cfg \
        ${PREFIX}${PUNKBUSTER_DIR}/pbsvhl.cfg.sample
.if !exists(${PREFIX}${PUNKBUSTER_DIR}/pbsvhl.cfg)
    @${INSTALL_DATA} ${WRKSRC}/pbsvhl.cfg ${PREFIX}${PUNKBUSTER_DIR}
.endif
# humm, can we strip or the program will complain that the checksum changed?
    @${STRIP_LINUX} ${PREFIX}${PUNKBUSTER_DIR}${PUNKBUSTER_PROGRAM}
    @${CHMOD} ${BINMODE} ${PREFIX}${PUNKBUSTER_DIR}${PUNKBUSTER_PROGRAM}

.include <bsd.port.mk>