aboutsummaryrefslogtreecommitdiffstats
path: root/devel/newt/Makefile
blob: 31488be425544b406efda59df27708939936a7d7 (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
# $FreeBSD$

PORTNAME=   newt
PORTVERSION=    0.52.14
CATEGORIES= devel
MASTER_SITES=   https://fedorahosted.org/releases/n/e/newt/

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

OPTIONS_DEFINE= PYTHON TCL NLS

USE_GMAKE=  yes
GNU_CONFIGURE=  yes
MAKE_ENV=   PCFLAGS="${CFLAGS}" TCLVERSION="tcl${TCL_VER}"
USE_LDCONFIG=   yes
MAKE_JOBS_UNSAFE=   yes

CPPFLAGS+=  -I${LOCALBASE}/include
LDFLAGS+=   -L${LOCALBASE}/lib -lcurses

PLIST_SUB=  SOVERSION="${SOVERSION}" \
        VERSION="${PORTVERSION}"

SUB_LIST=   VERSION="${PORTVERSION}"

MAN1=       whiptail.1

SOVERSION=  ${PORTVERSION:R:E}

.include <bsd.port.options.mk>

.if ${PORT_OPTIONS:MNLS}
USES+=      gettext
PLIST_SUB+= NLS=""
.else
CONFIGURE_ARGS+=--disable-nls
PLIST_SUB+= NLS="@comment "
.endif

.if ${PORT_OPTIONS:MPYTHON}
USE_PYTHON= -2.7
INSTALLS_EGGINFO=   yes
PLIST_SUB+= PYTHONOPT=""
SUB_FILES+= setup.py
.else
PLIST_SUB+= PYTHONOPT="@comment "
.endif

.if ${PORT_OPTIONS:MTCL}
USE_TCL=    84+
MAKE_ENV+=  TCL_LIBDIR=${TCL_LIBDIR:Q}
CPPFLAGS+=  -I${TCL_INCLUDEDIR:Q}
SUB_FILES+= pkgIndex.tcl
PLIST_SUB+= TCLOPT="" TCL_LIBDIR=${TCL_LIBDIR:S,${PREFIX}/,,}
.else
CONFIGURE_ARGS+=--without-tcl
PLIST_SUB+= TCLOPT="@comment "
.endif

post-patch:
    @${REINPLACE_CMD} -e \
        '/^SONAME/s|=.*|=${SOVERSION}|' ${WRKSRC}/configure
    @${REINPLACE_CMD} -e \
        's|@CPP@|@CC@ -E| ; \
         s|-I/usr/include/slang|| ; \
         /^PYTHONVERS/s|=.*|=${PYTHON_VERSION}| ; \
         /^pkgconfigdir/s|=.*|=${PREFIX}/libdata/pkgconfig| ; \
         s| -g | |g ; \
         /make -C/s|^|#| ; \
         /whiptcl.so/s|install|${TRUE}|' ${WRKSRC}/Makefile.in

post-build: apply-slist
.if ${PORT_OPTIONS:MPYTHON}
    @${LN} -sf libnewt.so.${SOVERSION} ${WRKSRC}/libnewt.so
    @(cd ${WRKSRC} && ${MAKE_ENV} ${PYTHON_CMD} ${WRKDIR}/setup.py \
        build)
.endif

post-install:
    @${STRIP_CMD} ${PREFIX}/bin/whiptail
.if ${PORT_OPTIONS:MNLS}
    @(cd ${WRKSRC}/po && ${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_FLAGS} \
        ${MAKEFILE} ${MAKE_ARGS} datadir=${PREFIX}/share \
        ${INSTALL_TARGET})
.endif
.if ${PORT_OPTIONS:MPYTHON}
    @(cd ${WRKSRC} && ${MAKE_ENV} ${PYTHON_CMD} ${WRKDIR}/setup.py \
        install --prefix=${PREFIX})
.endif
.if ${PORT_OPTIONS:MTCL}
    @${MKDIR} ${TCL_LIBDIR}/whip
    (cd ${WRKSRC} && ${INSTALL_DATA} whiptcl.so ${TCL_LIBDIR}/whip)
    (cd ${WRKDIR} && ${INSTALL_DATA} pkgIndex.tcl ${TCL_LIBDIR}/whip)
.endif
.if ${PORT_OPTIONS:MEXAMPLES}
    @${MKDIR} ${EXAMPLESDIR}
    (cd ${WRKSRC} && ${INSTALL_SCRIPT} peanuts.py popcorn.py ${EXAMPLESDIR})
.endif

.include <bsd.port.mk>