aboutsummaryrefslogtreecommitdiffstats
path: root/x11-toolkits/tk85/Makefile
blob: 055c58d6effb60571b3ac5fe24642b121e6d4346 (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
# Created by: Martin Matuska <mm@FreeBSD.org>
# $FreeBSD$

PORTNAME=   tk
PORTVERSION=    8.5.13
CATEGORIES= x11-toolkits
MASTER_SITES=   SF/tcl/Tcl/${PORTVERSION}
DISTNAME=   ${PORTNAME}${PORTVERSION}-src

MAINTAINER= tcltk@FreeBSD.org
COMMENT=    Graphical toolkit for Tcl

LICENSE=    BSD

LICENSE_TERMS=  ${WRKSRC}/../license.terms

LATEST_LINK=    tk85
USE_XORG=   x11
USE_LDCONFIG=   yes
WRKSRC=     ${WRKDIR}/${DISTNAME:S/-src//}/unix
GNU_CONFIGURE=  yes
TK_VER=     8.5
SHORT_TK_VER=   85
CONFIGURE_ARGS= --enable-shared --with-tcl=${TCL_LIBDIR} \
        --includedir=${PREFIX}/include/tk${TK_VER} \
        --enable-man-suffix=.${MAN_SUFFIX}
CONFIGURE_ENV=  PORTSDIR=${PORTSDIR} TK_LIB_FILE=libtk${SHORT_TK_VER}.so.1 \
        ac_cv_path_tclsh="${LOCALBASE}/bin/tclsh${TK_VER}"
LATEST_LINK=    ${PORTNAME}${SHORT_TK_VER}
MAN_SUFFIX= ${LATEST_LINK}

INSTALL_TARGET= install

MAKE_ENV=   SHORT_TK_VER=${SHORT_TK_VER}
PLIST_SUB=  TK_VER=${TK_VER} SHORT_TK_VER=${SHORT_TK_VER}
NOPRECIOUSMAKEVARS= yes # Otherwise 'make readmes' is broken
MANCOMPRESSED=  no
DATADIR=    ${PREFIX}/share/${PORTNAME}${TK_VER}
SUB_FILES=  pkgIndex.tcl

MAKE_JOBS_SAFE= yes

USE_TCL=    ${SHORT_TK_VER}

OPTIONS_DEFINE= TK85_MAN XFT DEMOS THREADS
OPTIONS_DEFAULT=    XFT THREADS
TK85_MAN_DESC=  Install tk 8.5 function manpages
XFT_DESC=   Use Xft fonts
DEMOS_DESC= Install demos

SUB_LIST+=  TCLPATCHLEVEL="${PORTVERSION}"

.include <bsd.port.pre.mk>

DATADIR=    ${PREFIX}/share/${PORTNAME}${TCL_VER}

.if ${PORT_OPTIONS:MXFT}
CONFIGURE_ARGS+=    --enable-xft
LIB_DEPENDS+=   Xft:${PORTSDIR}/x11-fonts/libXft
.else
CONFIGURE_ARGS+=    --disable-xft
.endif

.if ${PORT_OPTIONS:MTHREADS}
CONFIGURE_ARGS+=    --enable-threads
.else
CONFIGURE_ARGS+=    --disable-threads
.endif

MAN1=   wish${TCL_VER}.1

.if ${PORT_OPTIONS:MDEMOS}
INSTALL_TARGET+=    install install-demos
PLIST_SUB+= DEMOS=""
.else
PLIST_SUB+= DEMOS="@comment "
.endif

.if ${PORT_OPTIONS:MTK85_MAN}
INSTALL_TARGET+=install-doc
.include "${.CURDIR}/Makefile.man"
.endif

TKBASE?=    ${PORTSDIR}/${PKGCATEGORY}/${LATEST_LINK}

post-patch:
    @${REINPLACE_CMD} -e 's|X11/Intrinsic.h|X11/Xlib.h|g' ${WRKSRC}/configure
    @${REINPLACE_CMD} -e 's|@TK_SHARED_BUILD@|#@TK_SHARED_BUILD@|g; s|%%LOCALBASE%%|${LOCALBASE}|g' ${WRKSRC}/Makefile.in

post-configure:
    ${REINPLACE_CMD} \
        -e 's|${WRKDIRPREFIX}${.CURDIR}|$${WRKDIRPREFIX}${TKBASE}|' \
        ${WRKSRC}/tkConfig.sh
    ${REINPLACE_CMD} -e 's|-Wl,--rpath -Wl,/usr/local/lib||g' ${WRKSRC}/Makefile

post-install:
    ${INSTALL_DATA} ${WRKDIR}/pkgIndex.tcl ${PREFIX}/lib/tk${TK_VER}/

regression-test:    build
    cd ${WRKSRC}; ${MAKE} test
    ${ECHO_CMD} "package require Tk" | tclsh${TK_VER}
    ${ECHO_CMD} "load libtk${SHORT_TK_VER}.so" | tclsh${TK_VER}

.include <bsd.port.post.mk>