summaryrefslogtreecommitdiff
path: root/games/nethack-lib/Makefile.common
blob: a6b3d54200f7f74bcdac03bb0e9850d7e23ec1f1 (plain)
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
# $NetBSD: Makefile.common,v 1.22 2006/10/29 21:12:46 pooka Exp $
#

NETHACK_BASEVER=	3.4.3
NETHACK_VERSION=	${NETHACK_BASEVER}
NETHACK_DISTVER=	${NETHACK_BASEVER:S/.//g}
NETHACK_DIR=		nethackdir340

DISTNAME=		nethack-${NETHACK_DISTVER}-src
CATEGORIES=		games
MASTER_SITES=		ftp://ftp.sourceforge.net/pub/sourceforge/n/ne/nethack/
EXTRACT_SUFX=		.tgz

MAINTAINER=		pooka@NetBSD.org
HOMEPAGE=		http://www.nethack.org/

.if !defined(NO_BUILD)  # following stuff not needed for nethack meta pkg

WRKSRC=			${WRKDIR}/nethack-${NETHACK_BASEVER}
HAS_CONFIGURE=		yes
CONFIGURE_SCRIPT=	./sys/unix/setup.sh
USE_TOOLS+=		gzip

.include "../../mk/bsd.prefs.mk"

.if ${OPSYS} == "Darwin" || ${OPSYS} == "Linux"
SUBST_CLASSES+=		ttylib
SUBST_MESSAGE.ttylib=	Configuring to use ncurses
SUBST_STAGE.ttylib=	post-patch
SUBST_FILES.ttylib=	sys/unix/Makefile.src
SUBST_SED.ttylib=	-e 's,^WINTTYLIB = -ltermlib,WINTTYLIB = -lncurses,'
.endif
.include "../../mk/curses.buildlink3.mk"

.if ${OPSYS} == "Linux"
NETHACK_OS=		SYSV
.endif
NETHACK_OS?=		BSD

SUBST_CLASSES+=		os
SUBST_MESSAGE.os=	Configuring for $(NETHACK_OS)
SUBST_STAGE.os=		post-patch
SUBST_FILES.os=		include/unixconf.h
SUBST_SED.os=		-e 's,__NETHACK_OS__,${NETHACK_OS},'

NETHACK_GROUP=		games
PKG_GROUPS=             ${NETHACK_GROUP}

pre-configure:
	@${CHMOD} 755 ${WRKSRC}/sys/unix/setup.sh

post-patch:
	@${MV} ${WRKSRC}/include/config.h ${WRKSRC}/config.h-pre
	@${SED} -e 's@XXXPREFIXXXX@${PREFIX}@g'				\
		-e 's|@GZIP_PROGRAM@|'`${ECHO} ${GZIP_CMD}		\
		| ${AWK} '{ print $$1 }'`'|g'				\
		< ${WRKSRC}/config.h-pre > ${WRKSRC}/include/config.h
	@${RM} -f ${WRKSRC}/config.h-pre

.endif # !NO_BUILD