aboutsummaryrefslogtreecommitdiffstats
path: root/print/cups-base/Makefile
blob: a8fe717fb32d16e299ce5ad2eb255af142302cbb (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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
# New ports collection makefile for:    cups
# Date created:     2003-01-22
# Whom:         Alan Eldridge <alane@geeksrus.net>
#
# $FreeBSD$
#

PORTNAME=   cups
PORTVERSION=    1.4.2
DISTVERSIONSUFFIX=  -source
PORTREVISION=   0
CATEGORIES= print
MASTER_SITES=   EASYSW/${PORTNAME}/${DISTVERSION}
PKGNAMESUFFIX=  ${CUPS_SUFFIX}${PKGNAMESUFFIX2}

MAINTAINER= dinoex@FreeBSD.org
COMMENT=    Common UNIX Printing System: ${COMMENT2}

CONFLICTS=  LPRng-[0-9]*

USE_BZIP2=  yes
USE_GMAKE=  yes
GNU_CONFIGURE=  yes
CFLAGS+=    ${PTHREAD_CFLAGS}
CPPFLAGS=   -I${LOCALBASE}/include
LDFLAGS=    -L${LOCALBASE}/lib
DSOFLAGS=   -Wl,-rpath,${PREFIX}/lib -L${PREFIX}/lib ${LDFLAGS}
CONFIGURE_ENV=  CPPFLAGS="${CPPFLAGS}" LDFLAGS="${LDFLAGS}" DSOFLAGS="${DSOFLAGS}"
CONFIGURE_ARGS+=    --localstatedir=/var            \
            --disable-slp               \
            --disable-gssapi            \
            --with-cups-user=${CUPSOWN}     \
            --with-cups-group=${CUPSGRP}        \
            --with-system-groups=${CUPSSYSGRP}  \
            --with-docdir=${DOCSDIR}        \
            --with-icondir=${PREFIX}/share/icons    \
            --with-menudir=${DESKTOPDIR}        \
            --with-domainsocket=${CUPS_SOCKET}

OPTIONS?=   GNUTLS      "Build with GNUTLS library" on \
        PHP     "Build PHP support" off \
        PYTHON      "Build PYTHON support" off \
        LIBPAPER    "Build with libpaper support" off \
        DNSSD       "Build with DNS_SD (avahi) support" off \
        PAM     "Build with PAM support" off \
        LDAP        "Build with LDAP support" off \
        DBUS        "Build with DBUS support" off \
        GHOSTSCRIPT "Build pdftps with GHOSTSCRIPT" on \
        XDG_OPEN    "Build with XDG_OPEN as browser" off

CUPS_ETCDIR=    ${PREFIX}/etc/cups
CUPS_SPOOLDIR=  /var/spool/cups
CUPS_SOCKET?=   /var/run/cups.sock
WRKSRC=     ${WRKDIR}/${PORTNAME}-${DISTVERSION}

# file, dir ownership
CUPSGRP=    cups
CUPSOWN=    cups
CUPSSYSGRP= wheel

.include <bsd.port.pre.mk>

.if defined(CUPS_CLIENT)
CUPS_SUFFIX=    -client
COMMENT2=   Library cups
INSTALL_WRKSRC= ${WRKSRC}/cups
PLIST=      ${MASTERDIR}/pkg-plist.client
USE_LDCONFIG=   yes
PKGMESSAGE= ${NONEXISTENT}
DESCR=      ${MASTERDIR}/pkg-descr.client
.elif defined(CUPS_IMAGE)
CUPS_SUFFIX=    -image
LIB_DEPENDS+=   cups.2:${PORTSDIR}/${PKGCATEGORY}/cups-client \
        jpeg.10:${PORTSDIR}/graphics/jpeg \
        png.5:${PORTSDIR}/graphics/png \
        tiff.4:${PORTSDIR}/graphics/tiff
COMMENT2=   Library cupsimage
CONFIGURE_ARGS+=    --disable-pdftops
INSTALL_WRKSRC= ${WRKSRC}/filter
PLIST=      ${MASTERDIR}/pkg-plist.image
USE_LDCONFIG=   yes
PKGMESSAGE= ${NONEXISTENT}
DESCR=      ${MASTERDIR}/pkg-descr.image
.else
CUPS_SUFFIX=    -base
LIB_DEPENDS+=   cups.2:${PORTSDIR}/${PKGCATEGORY}/cups-client \
        cupsimage.2:${PORTSDIR}/${PKGCATEGORY}/cups-image
# force build if old cups is installed.
BUILD_DEPENDS+= ${LOCALBASE}/lib/libcups.a:${PORTSDIR}/${PKGCATEGORY}/cups-client
COMMENT2=   Server
USE_RC_SUBR=    cupsd
.endif

.if defined(CUPS_OVERWRITE_BASE)
PLIST_SUB+=     OVERWRITE=""
.else
PLIST_SUB+=     OVERWRITE="@comment "
.endif

.if !defined(WITHOUT_GNUTLS)
CONFIGURE_ARGS+=    --enable-gnutls --disable-openssl
LIB_DEPENDS+=       gnutls-openssl.40:${PORTSDIR}/security/gnutls
.else
CONFIGURE_ARGS+=    --disable-gnutls --enable-openssl
.include "${PORTSDIR}/Mk/bsd.openssl.mk"
.endif

.if !defined(CUPS_CLIENT) && !defined(CUPS_IMAGE) && defined(WITH_PHP)
CONFIGURE_ARGS+=    --with-php
USE_PHP=        yes
USE_PHP_BUILD=      yes
PLIST_SUB+=     PHP=""
.else
CONFIGURE_ARGS+=    --without-php
PLIST_SUB+=     PHP="@comment "
.endif

.if !defined(CUPS_CLIENT) && !defined(CUPS_IMAGE) && defined(WITH_GHOSTSCRIPT)
USE_GHOSTSCRIPT=    yes
CONFIGURE_ARGS+=    --enable-pdftops --with-pdftops=gs
PLIST_SUB+=     WITH_GHOSTSCRIPT=""
.else
PLIST_SUB+=     WITH_GHOSTSCRIPT="@comment "
.endif

.if !defined(CUPS_CLIENT) && !defined(CUPS_IMAGE) && defined(WITH_PYTHON)
CONFIGURE_ARGS+=    --with-python
USE_PYTHON=     yes
.include "${PORTSDIR}/Mk/bsd.python.mk"
.endif

.if !defined(CUPS_CLIENT) && !defined(CUPS_IMAGE) && defined(WITH_LIBPAPER)
CONFIGURE_ARGS+=    --enable-libpaper
LIB_DEPENDS+=       paper.2:${PORTSDIR}/print/libpaper
.endif

.if !defined(CUPS_CLIENT) && !defined(CUPS_IMAGE) && defined(WITH_DNSSD)
CONFIGURE_ARGS+=    --enable-dnssd \
            --with-dnssd-libs=${LOCALBASE}/lib/ \
            --with-dnssd-includes=${LOCALBASE}/include/avahi-compat-libdns_sd/
LIB_DEPENDS+=       dns_sd:${PORTSDIR}/net/avahi-libdns
.else
CONFIGURE_ARGS+=    --disable-dnssd
.endif

.if !defined(CUPS_CLIENT) && !defined(CUPS_IMAGE) && defined(WITH_PAM)
CONFIGURE_ARGS+=    --enable-pam
PLIST_SUB+=     WITH_PAMD=""
.else
CONFIGURE_ARGS+=    --disable-pam
PLIST_SUB+=     WITH_PAMD="@comment "
.endif

.if !defined(CUPS_CLIENT) && !defined(CUPS_IMAGE) && defined(WITH_LDAP)
USE_OPENLDAP=       yes
CONFIGURE_ARGS+=    --enable-ldap
.else
CONFIGURE_ARGS+=    --disable-ldap
.endif

.if !defined(CUPS_CLIENT) && !defined(CUPS_IMAGE) && defined(WITH_DBUS)
LIB_DEPENDS+=       dbus-1.3:${PORTSDIR}/devel/dbus
CONFIGURE_ARGS+=    --enable-dbus
.else
CONFIGURE_ARGS+=    --disable-dbus
.endif

.if !defined(CUPS_CLIENT) && !defined(CUPS_IMAGE) && defined(WITH_XDG_OPEN)
RUN_DEPENDS+=       xdg-open:${PORTSDIR}/devel/xdg-utils
.endif

.if defined(CUPS_CLIENT)
MAN1=   cups-config.1
.elif defined(CUPS_IMAGE)
.else
MAN1=   cancel.1 \
    cupstestdsc.1 \
    cupstestppd.1 \
    lp.1 \
    lpoptions.1 \
    lppasswd.1 \
    lpq.1 \
    lprm.1 \
    lpr.1 \
    lpstat.1 \
    ppdc.1 \
    ppdhtml.1 \
    ppdi.1 \
    ppdmerge.1 \
    ppdpo.1
MAN5=   classes.conf.5 \
    client.conf.5 \
    cups-snmp.conf.5 \
    cupsd.conf.5 \
    mailto.conf.5 \
    mime.convs.5 \
    mime.types.5 \
    ppdcfile.5 \
    printers.conf.5 \
    subscriptions.conf.5
MAN7=   backend.7 \
    drv.7 \
    filter.7 \
    notifier.7
MAN8=   accept.8 \
    cupsaccept.8 \
    cupsaddsmb.8 \
    cupsctl.8 \
    cupsd.8 \
    cupsenable.8 \
    cupsfilter.8 \
    cups-deviced.8 \
    cups-driverd.8 \
    cups-lpd.8 \
    cups-polld.8 \
    lpadmin.8 \
    lpinfo.8 \
    lpmove.8 \
    lpc.8

MLINKS= accept.8 reject.8 \
    cupsaccept.8 cupsreject.8 \
    cupsenable.8 cupsdisable.8
.endif

pre-configure::
    @${ECHO_MSG} Configuring CUPS with options:
    @${ECHO_MSG} ${CONFIGURE_ARGS} | fmt

post-patch:
.if defined(WITH_XDG_OPEN)
    @${REINPLACE_CMD} -e 's|htmlview|xdg-open|' ${WRKSRC}/desktop/cups.desktop.in
.endif
    @${REINPLACE_CMD} -e '/SILENT/d' ${WRKSRC}/Makedefs.in
    @${REINPLACE_CMD} -e 's|/etc/cups|${LOCALBASE}/etc/cups|g' ${WRKSRC}/man/*.man*
    @${REINPLACE_CMD} -e 's|-lpthreads.*;|${PTHREAD_LIBS};|g' \
        -e 's|/private/etc/pam.d|${LOCALBASE}/etc/pam.d|' \
        ${WRKSRC}/${CONFIGURE_SCRIPT}
.if defined(CUPS_CLIENT)
    @${REINPLACE_CMD} \
        -e 's|cups filter |cups |' \
        -e 's|backend berkeley cgi-bin driver locale man monitor||' \
        -e 's|notifier ppdc scheduler systemv test ||' \
        -e 's|$$.PHPDIR. ||' \
        -e 's|conf data doc $$.FONTS.ppd templates||' \
        -e 's|/usr/share|${PREFIX}/share|g' \
        ${WRKSRC}/Makefile
.elif defined(CUPS_IMAGE)
    @${REINPLACE_CMD} \
        -e 's|cups filter |filter |' \
        -e 's|backend berkeley cgi-bin driver locale man monitor||' \
        -e 's|notifier ppdc scheduler systemv test ||' \
        -e 's|$$.PHPDIR. ||' \
        -e 's|conf data doc $$.FONTS.ppd templates||' \
        -e 's|/usr/share|${PREFIX}/share|g' \
        ${WRKSRC}/Makefile
.else
    @${REINPLACE_CMD} \
        -e 's|cups backend|backend|' -e 's|filter ||' \
        -e 's|$$.INSTALL_SCRIPT. cups-config|echo skip: cups-config|' \
        -e 's|/usr/share|${PREFIX}/share|g' \
        -e 's|installhdrs$$||' \
        ${WRKSRC}/Makefile
    @${REINPLACE_CMD} \
        -e 's|cups-config.$$.MAN1EXT. ||' \
        ${WRKSRC}/man/Makefile
.endif

.if !defined(CUPS_CLIENT)
pre-build:
    ${CP} -p ${LOCALBASE}/lib/libcups.a ${WRKSRC}/cups/
    ${CP} -p ${LOCALBASE}/lib/libcups.so ${WRKSRC}/cups/
    ${CP} -p ${LOCALBASE}/lib/libcups.so.2 ${WRKSRC}/cups/
.if !defined(CUPS_IMAGE)
    ${CP} -p ${LOCALBASE}/lib/libcupsimage.so ${WRKSRC}/filter/
    ${CP} -p ${LOCALBASE}/lib/libcupsimage.so.2 ${WRKSRC}/filter/
.endif
.endif

.if defined(CUPS_IMAGE)
post-install:
    ${INSTALL_DATA} ${WRKSRC}/cups/raster.h ${PREFIX}/include/cups/
.endif

.if !defined(CUPS_CLIENT) && !defined(CUPS_IMAGE)
post-build:
    cd ${WRKSRC}/filter && ${MAKE} pdftops

pre-su-install:
    @${INSTALL} -d ${DESKTOPDIR}/
    if ! pw groupshow ${CUPSGRP}; then pw groupadd ${CUPSGRP} -g 193; fi
    if ! pw usershow ${CUPSOWN}; then pw useradd ${CUPSOWN} -g ${CUPSGRP} -u 193 \
        -h - -d ${NONEXISTENT} -s /usr/sbin/nologin -c "CUPS Owner"; fi
.if defined(CUPS_OVERWRITE_BASE)
    if test -e /usr/bin/lp; then ${CHMOD} -h 0 /usr/bin/lp; fi
    if test -e /usr/bin/lpq; then ${CHMOD} -h 0 /usr/bin/lpq; fi
    if test -e /usr/bin/lpr; then ${CHMOD} -h 0 /usr/bin/lpr; fi
    if test -e /usr/bin/lprm; then ${CHMOD} -h 0 /usr/bin/lprm; fi
    if test -e /usr/sbin/lpc; then ${CHMOD} -h 0 /usr/sbin/lpc; fi
.endif

post-install:
.if defined(WITH_GHOSTSCRIPT)
    ${INSTALL_PROGRAM} ${WRKSRC}/filter/pdftops ${PREFIX}/libexec/cups/filter/
.endif
    ${INSTALL} -d ${CUPS_ETCDIR}/
    ${CP} -p ${WRKSRC}/conf/snmp.conf ${WRKSRC}/conf/snmp.conf.N
.for f in cupsd.conf mime.convs mime.types snmp.conf
    ${INSTALL_DATA} ${WRKSRC}/conf/${f} ${CUPS_ETCDIR}/${f}.N
    cd ${CUPS_ETCDIR}/; if test ! -f ${f}; then ${CP} -p ${f}.N ${f}; fi
.endfor
    ${MKDIR} ${EXAMPLESDIR}
    ${INSTALL_DATA} ${FILESDIR}/lpt-cupsd.conf ${EXAMPLESDIR}/
    ${INSTALL} -d ${CUPS_SPOOLDIR}/tmp/
    ${CHOWN} -R ${CUPSOWN}:${CUPSGRP} ${CUPS_SPOOLDIR}/
    ${CHMOD} -R g+w ${CUPS_SPOOLDIR}/
    ${INSTALL} -d /var/cache/cups/
    ${CHOWN} root:${CUPSGRP} /var/cache/cups/
.endif

.if defined(CUPS_CLIENT)
post-install:
    ${INSTALL_SCRIPT} ${WRKSRC}/cups-config ${PREFIX}/bin/
    ${INSTALL_DATA} ${WRKSRC}/cups/libcups.a ${PREFIX}/lib/
    ${INSTALL_MAN} ${WRKSRC}/man/cups-config.man ${PREFIX}/man/man1/cups-config.1
.endif

.include <bsd.port.post.mk>