aboutsummaryrefslogtreecommitdiffstats
path: root/sysutils/jfbterm/Makefile
blob: 70a1366441b8dfe26f1e575a417d3b39a070504b (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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# Created by: nrg milk <bsdports@gmail.com>
# $FreeBSD$

PORTNAME=   jfbterm
PORTVERSION=    0.6.1
DISTVERSIONPREFIX=${OPSYS}-
PORTREVISION=   5
CATEGORIES= sysutils
MASTER_SITES=   http://www.ac.auone-net.jp/~baba/${PORTNAME}/ \
        http://chirashi-no-ura.net/files/

MAINTAINER= ports@FreeBSD.org
COMMENT=    Multilingual terminal emulator for framebuffer

LICENSE=    BSD
LICENSE_FILE=   ${WRKSRC}/COPYING

ONLY_FOR_ARCHS= i386 amd64
ONLY_FOR_ARCHS_REASON=  requires VESA support in kernel

MAKE_JOBS_SAFE= yes
MAKEFILE=   ${FILESDIR}/BSDmakefile
MAKE_ENV+=  VERSION=${PORTVERSION} GUNZIP=${GUNZIP_CMD:N-*}
PLIST_SUB+= TERMCAP_ADD_RECORD="@exec ${TERMCAP_ADD_RECORD:S,^${PREFIX},%D,}" \
        TERMCAP_DEL_RECORD="@unexec ${TERMCAP_DEL_RECORD}" \
        TIC="@exec ${TIC} ${TERMINFO_FILE:S,^${PREFIX},%D,} 2>/dev/null || ${TRUE}"

CAP_MKDB?=  /usr/bin/cap_mkdb
TIC?=       ${LOCALBASE}/bin/tic
TERMINFO_FILE?= ${PREFIX}/share/misc/${PORTNAME}.terminfo

OPTIONS_DEFINE=     ICONV PNG SETUID TERMCAP UNIFONT
OPTIONS_DEFAULT=    ICONV PNG SETUID TERMCAP UNIFONT
PNG_DESC=       Splash .png support
SETUID_DESC=        Install jfbterm with setuid bit set
TERMCAP_DESC=       Add entry to termcap(5) file
UNIFONT_DESC=       Install pan-unicode font

.include <bsd.port.options.mk>

.if ${PORT_OPTIONS:MSETUID}
BINMODE?=   4555
.endif

ONLY_FOR_ARCHS+=amd64

.if !defined(INSTALL_AS_USER)
TERMCAP_FILE?=  /usr/share/misc/termcap
.else
TERMCAP_FILE?=  ~/.termcap
.endif

.if !defined(NO_INSTALL_MANPAGES)
MAN1=       ${PORTNAME}.1
MAN5=       ${PORTNAME}.conf.5
.endif

.if !${PORT_OPTIONS:MICONV}
MAKE_ENV+=  WITHOUT_ICONV=
.endif

.if !exists(/usr/include/iconv.h)
. if ${PORT_OPTIONS:MICONV}
.  if !defined(NO_SHARED)
USES+=      iconv
.  else
BUILD_DEPENDS+= ${LOCALBASE}/lib/libiconv.a:${PORTSDIR}/converters/libiconv
.  endif
. else
BUILD_DEPENDS+= ${LOCALBASE}/include/iconv.h:${PORTSDIR}/converters/libiconv
. endif
.endif

.if ${PORT_OPTIONS:MPNG}
. if !defined(NO_SHARED)
LIB_DEPENDS+=   png15:${PORTSDIR}/graphics/png
. else
BUILD_DEPENDS+= ${LOCALBASE}/lib/libpng.a:${PORTSDIR}/graphics/png
. endif
.else
MAKE_ENV+=  WITHOUT_PNG=
.endif

.if ${PORT_OPTIONS:MTERMCAP}
TERMCAP_ADD_RECORD= \
    ${ECHO_CMD} '\# begin of ${PORTNAME}.termcap' \
        >>${TERMCAP_FILE}; \
    ${CAT} ${PREFIX}/share/misc/${PORTNAME}.termcap \
        >>${TERMCAP_FILE}; \
    ${ECHO_CMD} '\# end of ${PORTNAME}.termcap' \
        >>${TERMCAP_FILE}; \
    if [ -f ${TERMCAP_FILE}.db ]; then \
        ${CAP_MKDB} ${TERMCAP_FILE}; \
    fi
TERMCAP_DEL_RECORD= \
    ${REINPLACE_CMD} -i '' '/^\# begin of ${PORTNAME}\.termcap/, \
        /^\# end of ${PORTNAME}\.termcap/d' \
        ${TERMCAP_FILE}; \
    if [ -f ${TERMCAP_FILE}.db ]; then \
        ${CAP_MKDB} ${TERMCAP_FILE}; \
    fi
.else
TERMCAP_ADD_RECORD= ${DO_NADA}
TERMCAP_DEL_RECORD= ${DO_NADA}
.endif

.if ${PORT_OPTIONS:MUNIFONT}
RUN_DEPENDS+=   ${LOCALBASE}/lib/X11/fonts/local/unifont.pcf.gz:${PORTSDIR}/x11-fonts/gnu-unifont
.endif

post-extract:   .SILENT
    cd ${WRKSRC} && ${RM} -f \
        aclocal.m4 config.* configure install-sh \
        missing mkinstalldirs stamp-h* Makefile Makefile.in
    ${CP} ${WRKSRC}/${PORTNAME}.conf.sample.${OPSYS} \
        ${WRKSRC}/${PORTNAME}.conf.sample

post-patch: .SILENT
    ${REINPLACE_CMD} -e 's|/usr/local|${PREFIX}|g' \
        -e 's|\(share\)/${PORTNAME}/\(fonts\)|\1/misc/\2|' \
        ${WRKSRC}/*.[0-9] ${WRKSRC}/*.conf.sample
.if !${PORT_OPTIONS:MTERMCAP}
    ${REINPLACE_CMD} '/^term/s/:.*/: xterm/' \
        ${WRKSRC}/${PORTNAME}.conf.sample
.endif

do-install:
    ${INSTALL_PROGRAM} ${WRKSRC}/${PORTNAME} ${PREFIX}/bin
    ${INSTALL_DATA} ${WRKSRC}/${PORTNAME}.conf.sample ${PREFIX}/etc
    if [ ! -f ${PREFIX}/etc/${PORTNAME}.conf ]; then \
        ${INSTALL_DATA} ${PREFIX}/etc/${PORTNAME}.conf.sample \
            ${PREFIX}/etc/${PORTNAME}.conf; \
    fi
.if !defined(NO_INSTALL_MANPAGES)
    ${INSTALL_MAN} ${WRKSRC}/${MAN1} ${MAN1PREFIX}/man/man1
    ${INSTALL_MAN} ${WRKSRC}/${MAN5} ${MAN5PREFIX}/man/man5
.endif
.if !defined(NOPORTDATA)
    ${INSTALL_DATA} ${WRKSRC}/termcap.${PORTNAME} ${PREFIX}/share/misc/${PORTNAME}.termcap
    ${INSTALL_DATA} ${WRKSRC}/terminfo.${PORTNAME} ${PREFIX}/share/misc/${PORTNAME}.terminfo
    ${MKDIR} ${PREFIX}/share/misc/fonts
    ${INSTALL_DATA} ${WRKSRC}/fonts/*.pcf.gz ${PREFIX}/share/misc/fonts
. if ${PORT_OPTIONS:MTERMCAP}
    ${TERMCAP_ADD_RECORD}
. endif
    -${TIC} ${TERMINFO_FILE} 2>/dev/null
.endif

.include <bsd.port.mk>