aboutsummaryrefslogtreecommitdiffstats
path: root/games/linux-ut/Makefile
blob: c7022b036547c834884502147854a346725f7ce1 (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
125
126
127
128
129
130
131
132
133
134
# New ports collection makefile for:    linux-ut
# Date created:     7 Jan 2006
# Whom:         Sean Farley <sean-freebsd@farley.org>
#
# $FreeBSD$
#

PORTNAME=   linux-ut
PORTVERSION=    451
CATEGORIES= games linux
MASTER_SITES=   http://liflg.0wnitsch.de/files/final/:p436 \
        http://www.utpg.org/patches/:p451
DISTFILES=  ${PATCH436FILES} \
        ${PATCH451FILES}
DIST_SUBDIR=    ${PORTNAME}

MAINTAINER= sean-freebsd@farley.org
COMMENT=    Unreal Tournament for Linux

RUN_DEPENDS=    ${LINUXBASE}/usr/lib/libSDL-1.2.so.0:${PORTSDIR}/devel/linux-sdl12

ONLY_FOR_ARCHS= i386
USE_LINUX=  yes
USE_XLIB=   yes
NO_BUILD=   yes
NO_PACKAGE= Distribution is 340MB; set FORCE_PACKAGE if you really want\
        to build this package
RESTRICTED= Redistribution is limited, see license
IS_INTERACTIVE= yes
WRKSRC=     ${WRKDIR}/${PKGNAME}

PATCH436FILES=  unreal.tournament_436-multilanguage.run:p436 \
        unreal.tournament.official.bonus.pack.collection.run:p436
PATCH451FILES=  UTPGPatch451.tar.bz2:p451

do-extract:
    @${MKDIR} ${WRKSRC}
.for file in ${PATCH436FILES:C/:.*//}
    @cd ${WRKSRC} &&\
        ${SED} -e '1,/exit $$res/d' ${_DISTDIR}/${file} | ${GUNZIP_CMD} -q | ${TAR} xf -
.endfor
    @${MV} ${WRKSRC}/bin/Linux/x86/ucc ${WRKSRC}/bin/.

post-patch:
    @${REINPLACE_CMD} -e "s|\(UT_DATA_PATH=\).*|\1\"${DATADIR}/System\"|"\
        ${WRKSRC}/bin/ucc
    @${REINPLACE_CMD} -e "s|^\(GAME_DIR=\).*|\1\"${DATADIR}\"|"\
        -e "/ll=/{N;d;}" ${WRKSRC}/bin/ut

# Installation steps performed:
#   - Verify path to CD content.
#   - Verify CD was correctly mounted.  -b option may be needed to mount it.
#   - Copy desired content off of CD to drive.  Windows files left behind.
#   - Extract files from Linux patch minus various language files (necessary?).
#   - Extract bonus pack.
#   - Patch .ini file to also use absolute paths to content in addition to the
#     relative paths for user saved content.
#   - Apply Linux patches.
#   - Install scripts and README's.
#   - Set permissions on files and directories.
do-install:
.if !defined(CDROM_MOUNT)
    @${ECHO_CMD} "${PKGNAME} requires CDROM_MOUNT set to mount point of CD"
    @${FALSE}
.endif
.if !exists(${CDROM_MOUNT}/NetGamesUSA.com)
    @${ECHO_CMD} \
        "NetGamesUSA.com not found on CD; try mounting with -b option"
    @${FALSE}
.endif
    @${ECHO_CMD} "Installing data from CD"
    @${MKDIR} ${DATADIR}
.for dir in Help Logs Maps Music NetGamesUSA.com Sounds System Textures Web
    @cd ${CDROM_MOUNT} &&\
        ${TAR} c --exclude '*.ICD' --exclude '*.bat' --exclude '*.dll'\
            --exclude '*.est*' --exclude '*.[Ee][Xx][Ee]'\
            --exclude '*.frt*' --exclude '*.ico' --exclude '*.itt*'\
            --exclude '*.mpi' --exclude '*.url' --exclude 'D3D*'\
            --exclude 'mplay*' -f - ${dir} |\
        ${TAR} x -C ${DATADIR} -f -
.endfor
    @${RM} ${DATADIR}/Logs/delete_me.txt
    @${ECHO_CMD} "Installing v436 patch files"
.for tarfile in Credits NetGamesUSA.com OpenGL.ini data
    @${TAR} zox -C ${DATADIR} --exclude '*.exe'\
        -f ${WRKSRC}/${tarfile}.tar.gz
.endfor
    @${ECHO_CMD} "Installing bonus pack"
.for ndx in 1 2 3 4
    @${TAR} jx -C ${DATADIR} -f ${WRKSRC}/bp${ndx}.tar.bz2
.endfor
    @${SED} -i "" -e 's|\\|/|g'\
        -e "/^Paths=/{h;s|\(Paths=\)\.\./|\1${DATADIR}/|;x;p;x;}"\
        ${DATADIR}/System/UnrealTournament.ini
    @${ECHO_CMD} "Applying v436 patch"
    @${WRKSRC}/setup.data/bin/FreeBSD/x86/loki_patch\
        ${WRKSRC}/setup.data/patch.dat ${DATADIR}
.for script in ucc ut
    @${INSTALL_SCRIPT} ${WRKSRC}/bin/${script} ${PREFIX}/bin/
.endfor
.for datafile in README README.Loki README.bonus.pack.collection
    @${INSTALL_DATA} ${WRKSRC}/${datafile} ${DATADIR}
.endfor
    @${ECHO_CMD} "Installing v${PORTVERSION} patch files"
    @${TAR} jx -C ${DATADIR} --exclude 'checkfiles.sh'\
        --exclude 'patch.md5' --exclude 'd3ddrv.int'\
        -f ${_DISTDIR}/${PATCH451FILES:C/:.*//}
    @cd ${DATADIR}/System &&\
        ${MV} -f glidedrv.int GlideDrv.int &&\
        ${MV} -f softdrv.int SoftDrv.int &&\
        ${MV} -f opengldrv.int OpenGlDrv.int &&\
        ${MV} -f galaxy.int Galaxy.int &&\
        ${MV} -f editor.int Editor.int &&\
        ${MV} -f windrv.int WinDrv.int
    @${ECHO_CMD} "Removing /usr/local from ut-bin's library search path"
    @UTBIN=${DATADIR}/System/ut-bin &&\
        FILESIZE=`/usr/bin/stat -f "%z" $${UTBIN}` &&\
        ${MV} $${UTBIN} $${UTBIN}.orig &&\
        ${SED} -Ee 's|:/usr/local|:/USR-LOCAL|' $${UTBIN}.orig |\
        ${HEAD} -c $${FILESIZE} > $${UTBIN} &&\
        ${RM} $${UTBIN}.orig
    @${ECHO_CMD} "Setting permissions"
    @${FIND} ${DATADIR} -print0 |\
        ${XARGS} -0 ${CHOWN} ${SHAREOWN}:${SHAREGRP}
    @${FIND} ${DATADIR} -type d -print0 | ${XARGS} -0 ${CHMOD} ${BINMODE}
    @${FIND} ${DATADIR} -type f -print0 | ${XARGS} -0 ${CHMOD} ${NOBINMODE}
    @${FIND} ${DATADIR} \( -name "*.so" -o -name "lib*.so*" \) -print0 |\
        ${XARGS} -0 ${CHMOD} ${BINMODE}
.for exec in ucc-bin ut-bin
    @${CHMOD} ${BINMODE} ${DATADIR}/System/${exec}
.endfor
    @${ECHO_CMD} "Install complete"

.include <bsd.port.mk>