aboutsummaryrefslogtreecommitdiffstats
path: root/x11-clocks/dclock/Makefile
blob: 0a4f4a5d9db97313559eebb58236f5190ab65abc (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
# Created by: David Leonard <leonard@dstc.edu.au>
# $FreeBSD$

PORTNAME=   dclock
PORTVERSION=    2.2.2
CATEGORIES= x11-clocks
MASTER_SITES=   http://opencircuitdesign.com/~tim/programs/dclock/archive/
EXTRACT_SUFX=   .tgz

MAINTAINER= ports@FreeBSD.org
COMMENT=    A 7-segment digital clock with some optional features

OPTIONS_DEFINE= SOX XFT DOCS
OPTIONS_DEFAULT=SOX XFT
SOX_DESC=   Install SOX to play audio

WRKSRC=     ${WRKDIR}/${PORTNAME}

USE_XORG=   x11 xt
USES=       pkgconfig

CPPFLAGS+=  -I${LOCALBASE}/include
LDFLAGS+=   -L${LOCALBASE}/lib -lX11 -lXt -lm

MAN1=       dclock.1
PORTDOCS=   README TODO
PLIST_FILES=    bin/dclock \
        lib/X11/app-defaults/DClock \
        %%DATADIR%%/sounds/bell.wav \
        %%DATADIR%%/sounds/digital.wav
PLIST_DIRS= %%DATADIR%%/sounds \
        %%DATADIR%%

.include <bsd.port.options.mk>

.if ${PORT_OPTIONS:MSOX}
RUN_DEPENDS+=   play:${PORTSDIR}/audio/sox
.endif

.if ${PORT_OPTIONS:MXFT}
USE_XORG+=  xft
CPPFLAGS+=  $$(freetype-config --cflags) -DXFT_SUPPORT
LDFLAGS+=   $$(freetype-config --libs) -lXft
.endif

post-patch:
.for i in Dclock.c Dclock.ad dclock.1
    @${REINPLACE_CMD} -e \
        's|%%DATADIR%%|${DATADIR}| ; \
         s|%%LOCALBASE%%|${LOCALBASE}|' ${WRKSRC}/${i}
.endfor

do-build:
    (cd ${WRKSRC} \
        && ${CC} ${CFLAGS} ${CPPFLAGS} *.c -o ${PORTNAME} ${LDFLAGS})

do-install:
    (cd ${WRKSRC} \
        && ${INSTALL_PROGRAM} dclock ${PREFIX}/bin \
        && ${INSTALL_MAN} dclock.1 ${MANPREFIX}/man/man1 \
        && ${INSTALL_DATA} Dclock.ad \
            ${PREFIX}/lib/X11/app-defaults/DClock)
    @${MKDIR} ${DATADIR}/sounds
    (cd ${WRKSRC}/sounds && ${INSTALL_DATA} *.wav ${DATADIR}/sounds)
.if ${PORT_OPTIONS:MDOCS}
    @${MKDIR} ${DOCSDIR}
.for f in ${PORTDOCS}
    (cd ${WRKSRC} && ${INSTALL_DATA} ${f} ${DOCSDIR})
.endfor
.endif

.include <bsd.port.mk>