aboutsummaryrefslogtreecommitdiffstats
path: root/comms/smstools3/Makefile
blob: f45bf97f05f54424707887517a8db624784c9629 (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
# Created by: Martin Matuska <mm@FreeBSD.org>
# $FreeBSD$

PORTNAME=   smstools
PORTVERSION=    3.1.15
PORTREVISION=   1
CATEGORIES= comms
MASTER_SITES=   http://smstools3.kekekasvi.com/packages/
DISTNAME=   smstools3-${PORTVERSION}

MAINTAINER= madpilot@FreeBSD.org
COMMENT=    SMS Gateway software for GSM modems and mobile phones

LICENSE=    GPLv2
LICENSE_FILE=   ${WRKSRC}/LICENSE

CONFLICTS=  gnokii-[0-9]* smstools-2.* sendsms-[0-9]*

OPTIONS_DEFINE= STATS EXAMPLES DOCS
OPTIONS_DEFAULT=    STATS
STATS_DESC= Build status and statistics support

WRKSRC=     ${WRKDIR}/smstools3

USES=       gmake shebangfix
SHEBANG_FILES=  scripts/hex2dec scripts/hex2bin
SHEBANG_LANG=   awk
awk_OLD_CMD=    /bin/gawk
awk_CMD=    ${LOCALBASE}/bin/awk
USE_RC_SUBR=    smsd
SPOOLDIR?=  /var/spool/sms
LOGDIR?=    /var/log/smsd
PIDDIR?=    /var/run/smsd
SMSD_USER?= uucp
SMSD_GROUP?=    dialer
SUB_LIST+=  SPOOLDIR="${SPOOLDIR}" LOGDIR="${LOGDIR}" PIDDIR="${PIDDIR}" \
        SMSD_USER="${SMSD_USER}" SMSD_GROUP="${SMSD_GROUP}"
PLIST_SUB+= SPOOLDIR="${SPOOLDIR}" LOGDIR="${LOGDIR}" PIDDIR="${PIDDIR}" \
        SMSD_USER="${SMSD_USER}" SMSD_GROUP="${SMSD_GROUP}"
SUB_FILES=  pkg-install pkg-deinstall

PORTDOCS=   *
PORTEXAMPLES=   .procmailrc .qmailrc *

.include <bsd.port.options.mk>

.if ${PORT_OPTIONS:MSTATS}
LIB_DEPENDS+=   libmm.so:${PORTSDIR}/devel/mm
CFLAGS+=    -I${LOCALBASE}/include
.else
CFLAGS+=    -DNOSTATS
.endif
SMSTOOLS_DEFAULT_COMPORT?=  /dev/cuau0

post-patch:
    @${REINPLACE_CMD} -e 's|%%PREFIX%%|${PREFIX}|g' \
            -e 's|%%STAGEDIR%%|${STAGEDIR}|g' \
        ${WRKSRC}/Makefile ${WRKSRC}/install.sh ${WRKSRC}/src/smsd_cfg.h
    @${REINPLACE_CMD} 's|/dev/ttyS0|${SMSTOOLS_DEFAULT_COMPORT}|g' \
        ${WRKSRC}/examples/smsd.conf.easy \
        ${WRKSRC}/examples/smsd.conf.full \
        ${WRKSRC}/examples/smsd.conf.non-root
    @${REINPLACE_CMD} 's|/bin/bash|/bin/sh|g' \
        ${WRKSRC}/scripts/*

post-install:
    ${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/smsd
    @${MKDIR} ${STAGEDIR}${DATADIR}
    @for file in `${FIND} ${WRKSRC}/scripts -type f ! -name 'README' ! -name '*.bak'`; do \
        ${INSTALL_SCRIPT} $$file ${STAGEDIR}${DATADIR}/; \
    done
.for FILE in sendsms sms2html sms2unicode unicode2sms
    @${LN} -sf ${DATADIR}/${FILE} ${STAGEDIR}${PREFIX}/bin/${FILE}
.endfor
    @${INSTALL_DATA} ${WRKSRC}/examples/smsd.conf.easy ${STAGEDIR}${PREFIX}/etc/smsd.conf.sample
    @${MKDIR} ${STAGEDIR}${DOCSDIR}/slideshow
    @${INSTALL_DATA} ${WRKSRC}/doc/*.html ${STAGEDIR}${DOCSDIR}/
    @${INSTALL_DATA} ${WRKSRC}/doc/slideshow/* ${STAGEDIR}${DOCSDIR}/slideshow
    @${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
    @for file in `${FIND} ${WRKSRC}/examples -type f ! -name 'README'`; do \
        ${INSTALL_SCRIPT} $$file ${STAGEDIR}${EXAMPLESDIR}/; \
    done
    @${MKDIR} ${STAGEDIR}${SPOOLDIR}/incoming ${STAGEDIR}${SPOOLDIR}/outgoing \
        ${STAGEDIR}${SPOOLDIR}/checked ${STAGEDIR}${LOGDIR} \
        ${STAGEDIR}${PIDDIR}
    @${CHOWN} -R ${SMSD_USER}:${SMSD_GROUP} ${STAGEDIR}${SPOOLDIR} \
        ${STAGEDIR}${LOGDIR} ${STAGEDIR}${PIDDIR}

.include <bsd.port.mk>