aboutsummaryrefslogtreecommitdiff
path: root/devel/newt/Makefile
blob: 7a56bbefb98ae446d6c8fef1f55cfb68f7ea8aba (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
# New ports collection makefile for:	newt
# Date created:		08 Jan 2000
# Whom:			Will Andrews <andrews@technologist.com>
#
# $FreeBSD$
#

PORTNAME=	newt
PORTVERSION=	0.52.11
PORTREVISION=	2
CATEGORIES=	devel
MASTER_SITES=	https://fedorahosted.org/releases/n/e/newt/
PKGNAMESUFFIX=	${PYTHONSUFFIX}${TCLSUFFIX}

MAINTAINER=	ports@FreeBSD.org
COMMENT=	Not Erik's Windowing Toolkit:  console I/O handling library#'

LIB_DEPENDS=	slang:${PORTSDIR}/devel/libslang2 \
		popt:${PORTSDIR}/devel/popt

GNU_CONFIGURE=	yes
USE_LDCONFIG=	yes
SOVERSION=	${PORTVERSION:R:E}
TCL_NODOT=	tcl${TCL_VER:S/.//}
CFLAGS+=	-Werror
MAKE_ENV+=	PCFLAGS="${CFLAGS}" TCLVERSION="tcl${TCL_VER}"
PLIST_SUB+=	SOVERSION=${SOVERSION} \
		VERSION=${PORTVERSION}	\
		EXAMPLESDIR="${EXAMPLESDIR:S,${PREFIX}/,,}"
SUB_LIST=	VERSION=${PORTVERSION}

USE_GMAKE=	yes
MAKE_JOBS_UNSAFE=	yes

.if defined(WITHOUT_NLS)
CONFIGURE_ARGS+=--disable-nls
.else
USE_GETTEXT=	yes
.endif
.if defined(WITH_PYTHON)
PYTHONSUFFIX=	-${PYTHON_PKGNAMEPREFIX:S/-//}
BUILD_DEPENDS+=	${PYDISTUTILS}
USE_PYTHON=	yes
MAKE_ENV+=	WITH_PYTHON=yes
PLIST_SUB+=	PYTHONOPT=""	\
		PYNUM=${PYTHON_VERSION:S/python//}
SUB_FILES+=	setup.py
.else
PLIST_SUB+=	PYTHONOPT="@comment "
.endif

.if defined(WITH_TCL)
USE_TCL=	84+
TCLSUFFIX=	-${TCL_NODOT}
MAKE_ENV+=	WITH_TCL=yes TCL_LIBDIR=${TCL_LIBDIR:Q}
PLIST_SUB+=	TCLOPT="" TCL_VER=${TCL_VER}${_TCL_THREADS_SUFFIX}
CPPFLAGS+=	-I${TCL_INCLUDEDIR:Q}
SUB_FILES+=	pkgIndex.tcl

pre-su-install:
	${MKDIR} ${TCL_LIBDIR}/whip

.else
PLIST_SUB+=	TCLOPT="@comment "
CONFIGURE_ARGS+=--without-tcl
.endif

MAN1=	whiptail.1

.include <bsd.port.pre.mk>

post-patch:
	${REINPLACE_CMD} -e 's,^\(SONAME=\).*,\1${SOVERSION},g' \
		${WRKSRC}/configure
	${REINPLACE_CMD} -e 's|/usr/include/slang|${LOCALBASE:Q}/include|' \
		-e 's|-lslang|-lcurses -L${LOCALBASE:Q}/lib -lslang|'	\
		-e 's|-ltcl8.4||'	\
		-e 's|^pkgconfigdir.*|pkgconfigdir=${LOCALBASE:Q}/libdata/pkgconfig|'	\
		-e 's,PYTHONVERS =.*,PYTHONVERS=${PYTHON_VER},' \
		${WRKSRC}/Makefile.in
	${REINPLACE_CMD} -e 's,PyMem_DEL,PyObject_DEL,g' \
		${WRKSRC}/snackmodule.c

.if defined(WITH_PYTHON)
pre-install:
	@${LN} -sf ${WRKSRC}/libnewt.so.${SOVERSION} ${WRKSRC}/libnewt.so
	@cd ${WRKSRC} && ${MAKE_ENV} ${PYTHON_CMD} ${WRKDIR}/setup.py build
.endif

post-install:
.if defined(WITH_TCL)
	${INSTALL_DATA} ${WRKDIR}/pkgIndex.tcl ${TCL_LIBDIR}/whip/
.endif
.if defined(WITH_PYTHON)
	@cd ${WRKSRC} && ${MAKE_ENV} ${PYTHON_CMD} ${WRKDIR}/setup.py install --prefix=${PREFIX}
.if !defined(NOPORTEXAMPLES)
	${MKDIR} ${EXAMPLESDIR}/
	${INSTALL_SCRIPT} ${WRKSRC}/peanuts.py ${WRKSRC}/popcorn.py ${EXAMPLESDIR}/
.endif
.endif

.include <bsd.port.post.mk>