summaryrefslogtreecommitdiff
path: root/games/doomlegacy/Makefile
blob: 04f09fbfd9f260efc49e2c30d7a5c967ef389b66 (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
# Created by: Alexander G. Chetirbock <bock@bock.nnov.ru>
# $FreeBSD$

PORTNAME=	doomlegacy
DISTVERSION=	1.45_beta1
PORTREVISION=	1
PORTEPOCH=	1
CATEGORIES=	games
MASTER_SITES=	SF/${PORTNAME}/${DISTVERSION:S,_,%20,}/
DISTNAME=	${PORTNAME}_${DISTVERSION}_source
DISTFILES=	${DISTNAME}${EXTRACT_SUFX} \
		${PORTNAME}_${DISTVERSION}_common.zip

MAINTAINER=	games@FreeBSD.org
COMMENT=	Improved and extended version of Doom

LICENSE=	GPLv2

USES=		gmake tar:bzip2
USE_GL=		glu
USE_SDL=	mixer sdl

CFLAGS+=	-DSVN_REV=\\\"1107\\\"
WRKSRC=		${WRKDIR}/${DISTNAME:S,_beta1,,}/src

PLIST_FILES=	bin/${PORTNAME} share/doom/legacy.wad
PORTDOCS=	*

OPTIONS_DEFINE=	DOCS
OPTIONS_DEFINE_i386=	ASM

.if exists(/usr/include/netipx/ipx.h)
OPTIONS_DEFINE+=	IPX
IPX_DESC=	IPX protocol support
.endif

ASM_BUILD_DEPENDS=	nasm:${PORTSDIR}/devel/nasm
ASM_MAKE_ENV=		USEASM=1 OLD_DEPENDENCIES=1

.include <bsd.port.options.mk>

post-patch: .SILENT
# Adjust default WAD search path
	${REINPLACE_CMD} -e '/DEFWADS1/s|/.*|${DMDIR}"|' ${WRKSRC}/doomdef.h
# Provide better support for relative paths (for `-iwad' switch)
	${REINPLACE_CMD} -e "s|s\[0\] ==[^)]*|strchr(s, '/')|" \
		${WRKSRC}/d_main.c
# Unbreak on big-endian architectures
	${REINPLACE_CMD} -e '150s|^|#include "m_swap.h"|' \
		${WRKSRC}/p_spec.c
	${REINPLACE_CMD} -e '60s|^|#include "m_swap.h"|' \
		${WRKSRC}/p_switch.c
.if ! ${PORT_OPTIONS:MIPX}
	${REINPLACE_CMD} -e '/USE_IPX/s|define|undef|' ${WRKSRC}/doomdef.h
	${REINPLACE_CMD} -e 's| -lipx||' ${WRKSRC}/Makefile
.endif

pre-build:
	${ECHO_CMD} MAKE_OPTIONS_PRESENT=1 HAVE_MIXER=1 | ${XARGS} -n 1 \
		> ${BUILD_WRKSRC}/../make_options
	${MAKE_CMD} -C ${BUILD_WRKSRC} dirs

do-install:
	${INSTALL_PROGRAM} ${WRKSRC}/../bin/doomlegacy ${STAGEDIR}${PREFIX}/bin
	@${MKDIR} ${STAGEDIR}${DMDIR}
	${INSTALL_DATA} ${WRKDIR}/${PORTNAME}_1.45/legacy.wad \
		${STAGEDIR}${DMDIR}
	@${MKDIR} ${STAGEDIR}${DOCSDIR}
	(cd ${WRKSRC}/../docs && ${COPYTREE_SHARE} . ${STAGEDIR}${DOCSDIR})

.include "${.CURDIR}/../doom-data/Makefile.include"
.include <bsd.port.mk>