aboutsummaryrefslogtreecommitdiffstats
path: root/net-im/jabber-pyaim/Makefile
blob: 8ff7980aaed53e7746ba8d496f3f38d6e5ec54ee (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
# Created by: Derek Kulinski <takeda@takeda.tk>
# $FreeBSD$

PORTNAME=   pyaim
PORTVERSION=    0.8a
PORTREVISION=   1
CATEGORIES= net-im
MASTER_SITES=   GOOGLE_CODE
PKGNAMEPREFIX=  jabber-
PKGNAMESUFFIX=  -transport
DISTNAME=   ${PORTNAME}-t-${PORTVERSION}
DIST_SUBDIR=    jabber

MAINTAINER= ports@FreeBSD.org
COMMENT=    Python AIM-Transport for Jabber

PROJECTHOST=    pyaimt

OPTIONS_DEFINE= EJABBERD TWISTED1
EJABBERD_DESC=  transport with ejabberd
TWISTED1_DESC=  old py-twisted 1.x

NO_BUILD=   yes
USE_PYTHON= yes
USE_RC_SUBR=    jabber-pyaim-transport
LOCAL_PYTHON=   ${PYTHON_CMD}

SUB_LIST=   PYTHON_CMD=${LOCAL_PYTHON}

INST_DIR=   ${PREFIX}/lib/jabber/${PORTNAME}

PORTDOCS=   COPYING README NEWS AUTHORS INSTALL

NO_STAGE=   yes
.include <bsd.port.options.mk>
.include <bsd.port.pre.mk>

.if ${PORT_OPTIONS:MEJABBERD}
JABBER_USER?=   ejabberd
SUB_LIST+=  JABBER_REQUIRE=ejabberd
.else
JABBER_USER?=   jabber
SUB_LIST+=  JABBER_REQUIRE=jabberd
.endif

.if ${PORT_OPTIONS:MTWISTED1}
RUN_DEPENDS+=   ${PYTHON_SITELIBDIR}/twisted/__init__.py:${PORTSDIR}/devel/py-twisted
.else
RUN_DEPENDS+=   ${PYTHON_SITELIBDIR}/twisted/__init__.py:${PORTSDIR}/devel/py-twistedCore \
        ${PYTHON_SITELIBDIR}/twisted/web/__init__.py:${PORTSDIR}/www/py-twistedWeb \
        ${PYTHON_SITELIBDIR}/twisted/words/__init__.py:${PORTSDIR}/net-im/py-twistedWords
.endif

SUB_LIST+=  JABBER_USER=${JABBER_USER}

post-patch:
    @${RM} -f ${WRKSRC}/src/main.py.orig
    @${REINPLACE_CMD} -i "" -e '/spooldir/s|\.\.|/var/spool/jabber|' \
        -e 's|\.\./PyAIMt.pid|/var/jabberd/pid/PyAIMt.pid|' \
        ${WRKSRC}/config_example.xml
    @${REINPLACE_CMD} -i "" -e 's|spooldir = "\.\."|spooldir = "/var/spool/jabber"|g' \
        -e 's|pid = ""|pid = "/var/jabberd/pid/PyAIMt.pid"|g' \
        ${WRKSRC}/src/config.py
    @${REINPLACE_CMD} -i "" 's|"config\.xml"|"${PREFIX}/etc/jabber-pyaim.xml"|' \
        ${WRKSRC}/src/main.py
    @${REINPLACE_CMD} -i "" 's|#!.*$$|#!${LOCAL_PYTHON}|' \
        ${WRKSRC}/PyAIMt.py

do-install:
    ${MKDIR} ${INST_DIR}/src ${INST_DIR}/data
    ${INSTALL_SCRIPT} ${WRKSRC}/PyAIMt.py ${INST_DIR}
    @${CP} -Rv ${WRKSRC}/data/* ${INST_DIR}/data/
    @${CP} -Rv ${WRKSRC}/src/* ${INST_DIR}/src/
    ${MKDIR} ${EXAMPLESDIR}/etc
    ${INSTALL_DATA} ${WRKSRC}/config_example.xml ${EXAMPLESDIR}/etc/jabber-pyaim.xml
    @[ -f ${PREFIX}/etc/jabber-pyaim.xml ] || ${CP} -v ${EXAMPLESDIR}/etc/jabber-pyaim.xml ${PREFIX}/etc/jabber-pyaim.xml
.if ${PORT_OPTIONS:MDOCS}
    ${MKDIR} ${DOCSDIR}
.for portdoc in ${PORTDOCS}
    ${INSTALL_DATA} ${WRKSRC}/${portdoc} ${DOCSDIR}/
.endfor
.endif
    ${LOCAL_PYTHON} ${PYTHON_LIBDIR}/compileall.py ${INST_DIR}/src

post-install:
    @${ECHO_CMD}
    @${ECHO_CMD} "**************************************************************************************"
    @${ECHO_CMD} "Remember to edit ${PREFIX}/etc/jabber-pyaim.xml to suit your needs."
    @${ECHO_CMD} "Follow the setup instructions at: http://wiki.blathersource.org/wiki/index.php/PyAIMt."
    @${ECHO_CMD} "**************************************************************************************"
    @${ECHO_CMD}

.include <bsd.port.post.mk>