summaryrefslogtreecommitdiff
path: root/games/linux-sof/Makefile
blob: 0e8abe3502e1f308445ae7f97e2ce23bd6bafdb6 (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
# New ports collection makefile for:	linux-sof
# Date created:				09 October 2008
# Whom:					Alexander Logvinov <ports@logvinov.com>
#
# $FreeBSD$
#

PORTNAME=	sof
PORTVERSION=	1.06a
CATEGORIES=	games linux
MASTER_SITES=	http://updates.lokigames.com/${PORTNAME}/
PKGNAMEPREFIX=	linux-
DISTNAME=	${PORTNAME}-${PORTVERSION}-cdrom-x86
EXTRACT_SUFX=	.run

MAINTAINER=	ports@logvinov.com
COMMENT=	Soldier of Fortune for Linux

PATCH_DEPENDS=	xdelta:${PORTSDIR}/misc/xdelta

USE_LINUX=	yes
USE_XLIB=	yes
USE_LDCONFIG=	yes
NO_BUILD=	yes
NO_PACKAGE=	Distribution is 448MB; set FORCE_PACKAGE if you really want\
		to build this package
RESTRICTED=	Redistribution is limited, see license

XDELTA=		${LOCALBASE}/bin/xdelta patch
EXTRACT_FILES=	libopenal-0.0.so libSDL-1.1.so.0 README.105 README.106 base/pak2.pak
PORTDOCS=	README README.105 README.106
SUB_FILES=	pkg-message

.include <bsd.port.pre.mk>

do-extract:
	@${MKDIR} ${WRKSRC}/data ${WRKSRC}/patch
	@cd ${WRKSRC}/patch && ${SED} -e '1,/END_OF_STUB/d' ${_DISTDIR}/${DISTFILES} | \
		${GUNZIP_CMD} -q | ${TAR} xf -
.if !defined(CDROM_MOUNT)
	@${ECHO_CMD} "${PKGNAME} requires CDROM_MOUNT set to mount point of CD"
	@${FALSE}
.endif
.if !exists(${CDROM_MOUNT}/bin/x86/glibc-2.1/${PORTNAME})
	@${ECHO_CMD} "${PKGNAME} requires CD with Soldier of Fortune for Linux"
	@${FALSE}
.endif
	@${CP} ${CDROM_MOUNT}/bin/x86/glibc-2.1/${PORTNAME} ${CDROM_MOUNT}/kver.pub ${WRKSRC}/data
	@${CP} ${CDROM_MOUNT}/README ${WRKSRC}/data/
.for file in binaries paks
	@${TAR} x -C ${WRKSRC}/data -f ${CDROM_MOUNT}/${file}.tar.gz
.endfor
.for file in ${EXTRACT_FILES}
	@${GUNZIP_CMD} -qc ${WRKSRC}/patch/data/${file} > ${WRKSRC}/data/${file}
	@${RM} ${WRKSRC}/patch/data/${file}
.endfor

pre-patch:
	@cd ${WRKSRC}/patch/ && \
		${FIND} data -name "*.0" | \
		${SED} 's/\(.*\)\(.0\)/${XDELTA:S,/,\\/,g} & ${WRKSRC:S,/,\\/,g}\/\1 ${WRKSRC:S,/,\\/,g}\/\1.patched/' | ${SH}
	@cd ${WRKSRC} && \
		${FIND} data -name "*.patched" | \
		${SED} 's/\(.*\)\(.patched\)/${MV:S,/,\\/,g} & \1/' | ${SH}

post-patch:
	@${REINPLACE_CMD} -e "s|%%DATADIR%%|${DATADIR}|" ${WRKSRC}/data/${PORTNAME}

do-install:
	@${MKDIR} ${DATADIR}/base
	${INSTALL_PROGRAM} ${WRKSRC}/data/${PORTNAME} ${PREFIX}/bin
	${INSTALL_PROGRAM} ${WRKSRC}/data/${PORTNAME}-bin ${DATADIR}
	@${BRANDELF} -t Linux ${DATADIR}/${PORTNAME}-bin
	${INSTALL_DATA} ${WRKSRC}/data/kver.pub ${DATADIR}
	cd ${WRKSRC}/data && \
		${FIND} . -name "*.so*" -exec ${INSTALL_PROGRAM} {} ${DATADIR}/{} \; && \
		${FIND} base -name "*.pak" -exec ${INSTALL_DATA} {} ${DATADIR}/{} \;
.if !defined(NOPORTDOCS)
	@${MKDIR} ${DOCSDIR}
.for i in ${PORTDOCS}
	${INSTALL_DATA} ${WRKSRC}/data/${i} ${DOCSDIR}
.endfor
.endif

post-install:
	@${CAT} ${PKGMESSAGE}

.include <bsd.port.post.mk>