aboutsummaryrefslogtreecommitdiffstats
path: root/www/websh/Makefile
blob: 1d9cebd3813dfb99cb1fa25eb9ab17104a85e510 (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
# Created by: Mikhail Teterin <mi@aldan.algebra.com>
# $FreeBSD$

PORTNAME=   websh
PORTVERSION=    3.6.0b5
PORTREVISION=   4
CATEGORIES= www tcl
MASTER_SITES=   ${MASTER_SITE_APACHE}
MASTER_SITE_SUBDIR=tcl/${PORTNAME}/source
EXTRACT_SUFX=   -src.tar.gz

MAINTAINER= mi@aldan.algebra.com
COMMENT=    Embeds a TCL8 interpreter in the Apache server

MAKE_JOBS_UNSAFE=   yes

TCL_DVER=   ${TCL_VER:S/.//}

USES=       gmake tcl:84,85,86
USE_AUTOTOOLS=  autoconf
WRKSRC=     ${WRKDIR}/${PORTNAME}-${PORTVERSION}/src/unix
CONFIGURE_ARGS+=--with-tclinclude=${TCL_INCLUDEDIR} \
        --with-tcl=${TCL_LIBDIR}
USE_LDCONFIG=   yes
SUB_FILES=  httpd.conf pkgIndex.tcl pkg-message
SUB_LIST+=  TCL_DVER=${TCL_DVER} WS_VER=${PORTVERSION}
SUB_LIST+=  APACHEETCDIR=${APACHEETCDIR} APACHEMODDIR=${APACHEMODDIR}
PLIST_SUB+= TCL_DVER=${TCL_DVER}
PLIST_SUB+= NOMINORVERSION=${TCL_VER:C/8.[345]//:C/^..*/"@comment "/}

PORTDOCS=   *
PORTEXAMPLES=   *

USE_APACHE= 22+
CONFIGURE_ARGS+=--with-httpdinclude=`apxs -q includedir`

CPPFLAGS+=  -I ${LOCALBASE}/include/apr-1
.if !defined(NO_WERROR) && ${CC} == "cc" || ${CC:T:Mgcc*} != ""
CPPFLAGS+=  -Wall -Werror
.endif

post-patch:
    ${REINPLACE_CMD} -e 's,/usr/local/websh,${PREFIX},' \
        ${WRKSRC:H:H}/doc/mod_websh/conf/websh.conf
    for p in ${WRKSRC:H:H}/doc/mod_websh/htdocs/*.html ; do \
        ${SED} -e 's,\.html,.whtml,g' < $$p >   \
            `${DIRNAME} $$p`/`${BASENAME} $$p .html`.whtml; \
    done
    ${REINPLACE_CMD} -e 's,\.html,.whtml,g' ${WRKSRC:H:H}/doc/mod_websh/htdocs/*.ws3
    ${REINPLACE_CMD} -e 's|__declspec(dllexport)|DLLEXPORT|' \
        ${WRKSRC}/../generic/*.[ch]

post-configure:
    # Remove the "STUBS" and the PACKAGE_* defines, which may conflict
    # with Apache's definitions:
    ${REINPLACE_CMD} -e 's,tclstub,tcl,'    \
        -e 's,-DPACKAGE_[^=]*=."[^"]*",,g' ${WRKSRC}/Makefile

post-build test:
    ${SETENV} LANG=C HOME=${WRKDIR} ${MAKE_CMD} -C ${WRKSRC} test | ${AWK} '\
        /Failed/ && $$NF {failed=1} \
        END {exit failed}   \
        {print}'

do-install:
    ${MKDIR} ${STAGEDIR}${PREFIX}/lib/${PORTNAME}
    ${INSTALL_DATA} ${WRKSRC:H:H}/doc/mod_websh/conf/*.ws3  \
        ${WRKDIR}/pkgIndex.tcl ${STAGEDIR}${PREFIX}/lib/${PORTNAME}/
    ${INSTALL_DATA} ${WRKSRC:H:H}/doc/mod_websh/conf/websh.conf \
        ${STAGEDIR}${PREFIX}/etc/websh.conf.dist
    ${MKDIR} ${STAGEDIR}${PREFIX}/${APACHEMODDIR}
    ${INSTALL_LIB} ${WRKSRC}/mod_websh${PORTVERSION}.so \
        ${STAGEDIR}${PREFIX}/${APACHEMODDIR}/mod_websh.so
    if [ -f ${WRKSRC}/libwebsh${TCL_DVER}.so.1.0 ]; then    \
        ${INSTALL_LIB} ${WRKSRC}/libwebsh${TCL_DVER}.so.1.0 \
            ${STAGEDIR}${PREFIX}/lib;   \
        ${LN} -sf libwebsh${TCL_DVER}.so.1.0    \
            ${STAGEDIR}${PREFIX}/lib/libwebsh${TCL_DVER}.so.1;  \
        ${LN} -sf libwebsh${TCL_DVER}.so.1.0    \
            ${STAGEDIR}${PREFIX}/lib/libwebsh${TCL_DVER}.so;    \
    else    \
        ${INSTALL_LIB} ${WRKSRC}/libwebsh${TCL_DVER}.so.1 \
            ${STAGEDIR}${PREFIX}/lib;   \
        ${LN} -sf libwebsh${TCL_DVER}.so.1  \
            ${STAGEDIR}${PREFIX}/lib/libwebsh${TCL_DVER}.so;    \
    fi
    ${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
    ${INSTALL_DATA} ${WRKSRC:H:H}/doc/mod_websh/htdocs/*.ws3    \
        ${WRKSRC:H:H}/doc/mod_websh/htdocs/*.whtml      \
        ${WRKDIR}/httpd.conf ${STAGEDIR}${EXAMPLESDIR}
    ${MKDIR} ${STAGEDIR}${DOCSDIR}
    ${INSTALL_DATA} ${WRKSRC:H:H}/doc/html/* ${STAGEDIR}${DOCSDIR}

.include <bsd.port.mk>