aboutsummaryrefslogtreecommitdiffstats
path: root/devel/tcllib/Makefile
blob: 208da9ded07bf0d9dd0e175cdc7a0dee160672fe (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
105
106
107
108
109
110
111
# Created by: Mikhail Teterin <mi@aldan.algebra.com>
# $FreeBSD$

PORTNAME=   tcllib
DISTVERSIONPREFIX=  ${PORTNAME}_
DISTVERSION=    1_18
PORTREVISION=   1
CATEGORIES= devel tcl

MAINTAINER= tcltk@FreeBSD.org
COMMENT=    Collection of utility modules for Tcl

LICENSE=    TclTk
LICENSE_NAME=   Tcl/Tk License
LICENSE_FILE=   ${WRKSRC}/license.terms
LICENSE_PERMS=  dist-mirror dist-sell pkg-mirror pkg-sell auto-accept

OPTIONS_DEFINE?=DOCS MANPAGES
OPTIONS_SUB=    yes

WRKSRC=     ${WRKDIR}/tcllib-tcllib_${DISTVERSION}
USE_GITHUB= yes
GH_ACCOUNT= tcltk
USES+=      tcl
GNU_CONFIGURE=  yes
CONFIGURE_ENV+= ac_cv_path_tclsh="${TCLSH}"
MAKE_ENV+=  LANG=C
TEST_TARGET=    do-test
PORTDOCS=   *

INSTALL_ARGS=   -pkgs -pkg-path ${STAGEDIR}${PREFIX}/lib/tcllib \
        -apps -app-path ${STAGEDIR}${PREFIX}/bin \
        -no-wait -no-gui -no-examples

.include <bsd.port.options.mk>

#
# Man pages
#
.if ${PORT_OPTIONS:MMANPAGES} && !(defined(ALL_TARGET) && !empty(${ALL_TARGET:Mcritcl}))
ALL_TARGET+=    nroff-doc
INSTALL_ARGS+=  -nroff-path ${STAGEDIR}${PREFIX}/man/mann
.else
INSTALL_ARGS+=  -no-nroff
.endif

#
# HTML documentation
#
.if ${PORT_OPTIONS:MDOCS} && !(defined(ALL_TARGET) && !empty(${ALL_TARGET:Mcritcl}))
ALL_TARGET+=    html-doc
INSTALL_ARGS+=  -html-path ${STAGEDIR}${DOCSDIR}
.else
INSTALL_ARGS+=  -no-html
.endif

.if !target(post-patch)
post-patch:
#
#   Ensure, the detailed output of vendors' self-tests is
#   available in addition to the pretty progress report:
#
    ${REINPLACE_CMD} -e 's,test run,test run -l testlog,' \
        -e 's,$$(libdir)/@PACKAGE@@VERSION@,$$(libdir)/@PACKAGE@,' \
        ${WRKSRC}/Makefile.in
    ${FIND} ${WRKSRC}/apps -type f ! -name "*.man" | ${XARGS} \
       ${REINPLACE_CMD} -e 's,exec tclsh,exec ${TCLSH},' -e 's,/usr/bin/env tclsh,${TCLSH},'
#
#   patch(1) adds a newline at eof, so we need to remove it here
#
    ${AWK} 'NR > 1 { print h } { h = $$0 } END { ORS = ""; print h }' \
       ${WRKSRC}/modules/doctools/tests/text/04 > ${WRKSRC}/modules/doctools/tests/text/04.new
    ${MV} ${WRKSRC}/modules/doctools/tests/text/04.new ${WRKSRC}/modules/doctools/tests/text/04
#
#   man pages have the .tcllib suffix, so there's no need to have a
#   tcllib_ prefix too
#
    cd ${WRKSRC} && \
    for man in `${FIND} . -name "tcllib_*.man"`; do \
        ${MV} $$man `echo $$man | ${SED} -e 's|tcllib_||'`; \
    done && \
    for man in `${FIND} . -name "tcllib_*.n"`; do \
        ${MV} $$man `echo $$man | ${SED} -e 's|tcllib_||'`; \
    done

#
#   add the .tcllib suffix to man pages
#
    cd ${WRKSRC} && \
    for man in `${FIND} . -name "*.man"`; do \
        ${MV} $$man `echo $$man | ${SED} -e 's|man$$|tcllib.man|'`; \
    done && \
    for man in `${FIND} . -name "*.n"`; do \
        ${MV} $$man `echo $$man | ${SED} -e 's|n$$|tcllib.n|'`; \
    done

#
#   remove all .orig files
#
    ${FIND} ${WRKSRC} -type f -name "*.orig" -delete
.endif

.if !target(do-install)
do-install:
    cd ${WRKSRC} && ${TCLSH} ./installer.tcl ${INSTALL_ARGS}
.endif

do-test:
    cd ${WRKSRC} && ${SETENV} LANG=C LC_ALL=en_US.UTF-8 DISPLAY= TZ=utc ${MAKE} test

.include <bsd.port.mk>