aboutsummaryrefslogtreecommitdiffstats
path: root/print/cups-base/Makefile
blob: 2de2214ccb74aea868cc137790221d90223bb995 (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
# Created by: Alan Eldridge <alane@geeksrus.net>
# $FreeBSD$

PORTNAME=   cups
PORTVERSION=    1.7.3
DISTVERSIONSUFFIX=  -source
#PORTREVISION=  defined further
CATEGORIES= print
MASTER_SITES=   http://www.cups.org/software/${DISTVERSION}/ \
        EASYSW/${PORTNAME}/${DISTVERSION}
PKGNAMESUFFIX=  ${CUPS_SUFFIX}${PKGNAMESUFFIX2}

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

LICENSE=    GPLv2

CONFLICTS=  LPRng-[0-9]*

UNIQUENAME= ${PORTNAME}${PKGNAMESUFFIX}

USES+=      gmake pkgconfig tar:bzip2
DESTDIRNAME=    DSTROOT
GNU_CONFIGURE=  yes
CPPFLAGS+=  -I${LOCALBASE}/include
LDFLAGS+=   -L${LOCALBASE}/lib
DSOFLAGS=   -Wl,-rpath,${PREFIX}/lib ${LDFLAGS} ${LIBS}
CONFIGURE_ENV=  DSOFLAGS="${DSOFLAGS}"
CONFIGURE_ARGS+=    --localstatedir=/var            \
            --disable-gssapi            \
            --with-cups-user=${USERS}       \
            --with-cups-group=${GROUPS}     \
            --with-system-groups=${CUPSSYSGRP}  \
            --with-docdir=${DOCSDIR}        \
            --with-menudir=${DESKTOPDIR}        \
            --with-domainsocket=${CUPS_SOCKET}  \
            --with-cachedir=${CUPS_CACHEDIR}    \
            --with-pam-module="unix"        \
            --enable-ssl

CUPS_CACHEDIR?= /var/db/cups
CUPS_SPOOLDIR=  /var/spool/cups
CUPS_SOCKET?=   /var/run/cups.sock
CUPS_PDFTOPS?=  ${LOCALBASE}/libexec/xpdf/pdftops
WRKSRC=     ${WRKDIR}/${PORTNAME}-${DISTVERSION}

CUPSSYSGRP= wheel
# GROUPS/USERS does not work here
GROUPS= cups
USERS=      cups

# UNIQUENAME must be set before bsd.port.pre.mk so OPTIONSFILE can be included
OPTIONS_SINGLE=     SSL
OPTIONS_SINGLE_SSL= GNUTLS OPENSSL
OPTIONS_DEFAULT=    OPENSSL
OPTIONS_SUB=        yes
.if defined(CUPS_CLIENT)
PORTREVISION=   4
LICENSE=    LGPL21
CUPS_SUFFIX=    -client
OPTIONS_RADIO=      ZEROCONF
OPTIONS_RADIO_ZEROCONF= AVAHI MDNSRESPONDER
OPTIONS_DEFAULT+=   MDNSRESPONDER
.elif defined(CUPS_IMAGE)
PORTREVISION=   3
CUPS_SUFFIX=    -image
LICENSE=    LGPL21
.else
PORTREVISION=   4
CUPS_SUFFIX=    -base
# No DOCS option.  Files are needed by web interface.
OPTIONS_DEFINE=     DBUS ICONS LIBPAPER LIBUSB PAM XDG_OPEN
OPTIONS_GROUP=      WEB
OPTIONS_GROUP_WEB=  JAVA PERL PHP PYTHON
OPTIONS_RADIO=      ZEROCONF
OPTIONS_RADIO_ZEROCONF= AVAHI MDNSRESPONDER
OPTIONS_DEFAULT+=   LIBPAPER MDNSRESPONDER ICONS
.endif

ICONS_DESC=     Desktop icons
LIBUSB_DESC=        USB support
WEB_DESC=       Interpreters for web interfaces
XDG_OPEN_DESC=      Build with XDG_OPEN as browser
ZEROCONF_DESC=      Zeroconf support

.include <bsd.port.options.mk>

.if defined(CUPS_CLIENT)
COMMENT2=   Library cups
INSTALL_WRKSRC= ${WRKSRC}/cups
PLIST=      ${MASTERDIR}/pkg-plist.client
USES+=      iconv
LIBS+=      ${ICONV_LIB}
USE_LDCONFIG=   yes
PKGMESSAGE= ${NONEXISTENT}
DESCR=      ${MASTERDIR}/pkg-descr.client
.elif defined(CUPS_IMAGE)
LIB_DEPENDS+=   libcups.so:${PORTSDIR}/${PKGCATEGORY}/cups-client \
        libjpeg.so:${PORTSDIR}/graphics/jpeg \
        libpng.so:${PORTSDIR}/graphics/png \
        libtiff.so:${PORTSDIR}/graphics/tiff
# force build if old cups is installed.
BUILD_DEPENDS+= cups-client${PKGNAMESUFFIX2}>=${PORTVERSION}:${PORTSDIR}/${PKGCATEGORY}/cups-client
COMMENT2=   Library cupsimage
INSTALL_WRKSRC= ${WRKSRC}/filter
PLIST=      ${MASTERDIR}/pkg-plist.image
USE_LDCONFIG=   yes
PKGMESSAGE= ${NONEXISTENT}
DESCR=      ${MASTERDIR}/pkg-descr.image
.else
LIB_DEPENDS+=   libcups.so:${PORTSDIR}/${PKGCATEGORY}/cups-client \
        libcupsimage.so:${PORTSDIR}/${PKGCATEGORY}/cups-image
# force build if old cups is installed.
BUILD_DEPENDS+= cups-client${PKGNAMESUFFIX2}>=${PORTVERSION}:${PORTSDIR}/${PKGCATEGORY}/cups-client
BUILD_DEPENDS+= cups-image${PKGNAMESUFFIX2}>=${PORTVERSION}:${PORTSDIR}/${PKGCATEGORY}/cups-image
COMMENT2=   Server
USE_RC_SUBR=    cupsd
PLIST_SUB+= CACHEDIR="${CUPS_CACHEDIR}"
BROKEN_ia64=    stack-protector not supported on ia64
.endif

.if defined(CUPS_OVERWRITE_BASE)
PLIST_SUB+=     OVERWRITE=""
CONFIGURE_ARGS+=    --with-printcap=/etc/printcap
.else
PLIST_SUB+=     OVERWRITE="@comment "
CONFIGURE_ARGS+=    --with-printcap=${PREFIX}/etc/printcap
.endif

.if ${PORT_OPTIONS:MGNUTLS}
CONFIGURE_ARGS+=    --disable-openssl --enable-gnutls
LIB_DEPENDS+=       libgcrypt.so:${PORTSDIR}/security/libgcrypt \
            libgnutls.so:${PORTSDIR}/security/gnutls
.endif

.if ${PORT_OPTIONS:MOPENSSL}
USE_OPENSSL=        yes
CONFIGURE_ARGS+=    --disable-gnutls --enable-openssl
.endif

# Don't use CONFIGURE_ARGS+=--without-* to disable web interpreters because it
# will set the path of the interpreter to "no" and set it's existence to TRUE.
.if !defined(CUPS_CLIENT) && !defined(CUPS_IMAGE)
. if ${PORT_OPTIONS:MJAVA}
CONFIGURE_ARGS+=    --with-java=${JAVA}
USE_JAVA=       yes
. endif

. if ${PORT_OPTIONS:MPERL}
CONFIGURE_ARGS+=    --with-perl=${PERL}
USES+=          perl5
. endif

. if ${PORT_OPTIONS:MPHP}
CONFIGURE_ARGS+=    --with-php=${LOCALBASE}/bin/php-cgi
USE_PHP=        yes
USE_PHP_BUILD=      yes
WANT_PHP_CGI=       yes
. endif

. if ${PORT_OPTIONS:MPYTHON}
CONFIGURE_ARGS+=    --with-python=${PYTHON_CMD}
USES+=          python
. endif

. if ${PORT_OPTIONS:MLIBPAPER}
CONFIGURE_ARGS+=    --enable-libpaper
LIB_DEPENDS+=       libpaper.so:${PORTSDIR}/print/libpaper
. endif

. if ${PORT_OPTIONS:MPAM}
CONFIGURE_ARGS+=    --enable-pam
. else
CONFIGURE_ARGS+=    --disable-pam
. endif

. if ${PORT_OPTIONS:MDBUS}
LIB_DEPENDS+=       libdbus-1.so:${PORTSDIR}/devel/dbus
CONFIGURE_ARGS+=    --enable-dbus
. else
CONFIGURE_ARGS+=    --disable-dbus
. endif

. if ${PORT_OPTIONS:MXDG_OPEN}
RUN_DEPENDS+=       xdg-open:${PORTSDIR}/devel/xdg-utils
. endif

. if ${PORT_OPTIONS:MLIBUSB}
CONFIGURE_ARGS+=    --enable-libusb
. else
CONFIGURE_ARGS+=    --disable-libusb
. endif

. if ${PORT_OPTIONS:MICONS}
INSTALLS_ICONS= yes
CONFIGURE_ARGS+=    --with-icondir=${PREFIX}/share/icons
. endif

SUB_FILES+= ulpt-cupsd.conf ulpt-cupsd.sh
.endif

.if !defined(CUPS_IMAGE)
. if ${PORT_OPTIONS:MMDNSRESPONDER}
LIB_DEPENDS+=       libdns_sd.so:${PORTSDIR}/net/mDNSResponder
CONFIGURE_ARGS+=    --enable-dnssd
CONFIGURE_ARGS+=    --with-dnssd-includes=${LOCALBASE}/include
CONFIGURE_ARGS+=    --disable-avahi
SUB_LIST+=      ZEROCONF="mdnsd"
. elif ${PORT_OPTIONS:MAVAHI}
CONFIGURE_ARGS+=    --enable-avahi
CONFIGURE_ARGS+=    --disable-dnssd
LIB_DEPENDS+=       libavahi-client.so:${PORTSDIR}/net/avahi-app
SUB_LIST+=      ZEROCONF="avahi_daemon"
. else
CONFIGURE_ARGS+=    --disable-dnssd
CONFIGURE_ARGS+=    --disable-avahi
SUB_LIST+=      ZEROCONF=""
. endif
.endif

.if ${OSVERSION} < 1000036 && ${ARCH} == i386
LIBS+=      -lssp_nonshared
.endif

post-patch:
.if ${ARCH} == "amd64"
    @${REINPLACE_CMD} -e 's|@PIEFLAGS@||' ${WRKSRC}/Makedefs.in
.endif
.if ${PORT_OPTIONS:MMDNSRESPONDER}
    @${REINPLACE_CMD} -e 's|Darwin|FreeBSD|' \
        ${WRKSRC}/backend/Makefile
.endif
.if  ${PORT_OPTIONS:MXDG_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|/private/etc/pam.d|${LOCALBASE}/etc/pam.d|' \
        -e 's|-D_LARGEFILE64_SOURCE||g' \
        ${WRKSRC}/${CONFIGURE_SCRIPT}
    @${REINPLACE_CMD} -e 's|\.default|.sample|'\
        ${WRKSRC}/cgi-bin/admin.c\
        ${WRKSRC}/CHANGES-1.3.txt\
        ${WRKSRC}/conf/Makefile\
        ${WRKSRC}/packaging/cups.list.in\
        ${WRKSRC}/packaging/cups.spec\
        ${WRKSRC}/packaging/cups.spec.in
.if defined(CUPS_CLIENT)
    @${REINPLACE_CMD} \
        -e 's|cups test|cups|' \
        -e 's|cups filter |cups |' \
        -e 's|driver ppdc scheduler||' \
        -e 's|$$.PHPDIR. $$.FONTS.||' \
        ${WRKSRC}/Makefile
.elif defined(CUPS_IMAGE)
    @${REINPLACE_CMD} \
        -e 's|cups test||' \
        -e 's|cups filter |filter |' \
        -e 's|driver ppdc scheduler||' \
        -e 's|$$.PHPDIR. $$.FONTS.||' \
        ${WRKSRC}/Makefile
.else
    @${REINPLACE_CMD} \
        -e 's|cups test|test|' \
        -e 's|cups filter driver|driver|' \
        -e '/cd cups/d' \
        -e 's|$$.INSTALL_SCRIPT. cups-config|echo skip: cups-config|' \
        ${WRKSRC}/Makefile
    @${REINPLACE_CMD} \
        -e 's|cups-config.$$.MAN1EXT. ||' \
        ${WRKSRC}/man/Makefile
.endif

post-configure:
.if defined(CUPS_CLIENT)
    @${REINPLACE_CMD} \
        -e 's|filter .* templates||' \
        ${WRKSRC}/Makedefs
.elif defined(CUPS_IMAGE)
    @${REINPLACE_CMD} \
        -e 's|filter .* templates|filter|' \
        ${WRKSRC}/Makedefs
.else
    @${REINPLACE_CMD} \
        -e 's|filter backend|backend|' \
        -e 's|/etc/pam.d|${LOCALBASE}/etc/pam.d|'\
        ${WRKSRC}/Makedefs
.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

post-install:
    ${CHMOD} u+w ${STAGEDIR}${PREFIX}/lib/*.so.*
    ${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/*.so.*
    ${CHMOD} u-w ${STAGEDIR}${PREFIX}/lib/*.so.*
.if defined(CUPS_CLIENT)
    ${INSTALL_SCRIPT} ${WRKSRC}/cups-config ${STAGEDIR}${PREFIX}/bin
    ${INSTALL_DATA} ${WRKSRC}/cups/libcups.a ${STAGEDIR}${PREFIX}/lib
    ${INSTALL_MAN} ${WRKSRC}/man/cups-config.man ${STAGEDIR}${PREFIX}/man/man1/cups-config.1
.elif defined(CUPS_IMAGE)
.else
    ${LN} -sf lpr ${STAGEDIR}${PREFIX}/bin/lpr-cups
    ${MKDIR} ${STAGEDIR}${ETCDIR}/
.for f in cupsd.conf mime.convs mime.types snmp.conf
    test -f ${STAGEDIR}${ETCDIR}/${f} && ${RM} -f ${STAGEDIR}${ETCDIR}/${f} || ${TRUE}
    ${INSTALL_DATA} ${WRKSRC}/conf/${f} ${STAGEDIR}${ETCDIR}/${f}.sample
.endfor
    @${MV} ${STAGEDIR}${ETCDIR}/cups-files.conf ${STAGEDIR}${ETCDIR}/cups-files.conf.sample
    @${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
    ${INSTALL_DATA} ${WRKDIR}/ulpt-cupsd.conf ${STAGEDIR}${EXAMPLESDIR}/
    ${INSTALL_SCRIPT} ${WRKDIR}/ulpt-cupsd.sh ${STAGEDIR}${PREFIX}/sbin/
.endif

.include <bsd.port.mk>