summaryrefslogtreecommitdiff
path: root/print/hplip/Makefile
blob: 80fd4429498d357bd7bd0f2508f8d9da12977f6e (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
# New ports collection makefile for:	hplip
# Date created:		1 April 2006
# Whom:			amistry@am-productions.biz
#
# $FreeBSD$
#

PORTNAME=	hplip
PORTVERSION=	3.11.5
PORTREVISION=	1
CATEGORIES=	print
MASTER_SITES=	SF

MAINTAINER=	makc@FreeBSD.org
COMMENT=	Drivers and utilities for HP Printers and All-in-One devices

LIB_DEPENDS=	jpeg.11:${PORTSDIR}/graphics/jpeg \
		cupsdriver.1:${PORTSDIR}/print/cups-base \
		cups.2:${PORTSDIR}/print/cups-client \
		cupsimage.2:${PORTSDIR}/print/cups-image \
		dbus-1.3:${PORTSDIR}/devel/dbus
RUN_DEPENDS=	espgs:${PORTSDIR}/print/cups-pstoraster \
		foomatic-rip:${PORTSDIR}/print/foomatic-filters \
		${PYTHON_SITELIBDIR}/dbus/_dbus.py:${PORTSDIR}/devel/py-dbus \
		xdg-open:${PORTSDIR}/devel/xdg-utils

CONFLICTS=	hpijs-[0-9]*

USE_GHOSTSCRIPT_RUN=	yes
USE_PYTHON=	2.5+
USE_GNOME=	pkgconfig pygobject

GNU_CONFIGURE=	yes
CONFIGURE_ARGS=	--enable-foomatic-ppd-install \
		--enable-foomatic-rip-hplip-install \
		--enable-hpijs-install \
		--with-cupsbackenddir=${PREFIX}/libexec/cups/backend \
		--with-cupsfilterdir=${PREFIX}/libexec/cups/filter \
		--with-icondir=${DESKTOPDIR} \
		--with-systraydir=${PREFIX}/etc/xdg/autostart \
		--with-hpppddir=${PREFIX}/share/ppd/HP \
		--with-mimedir=${PREFIX}/etc/cups \
		--with-docdir=${DOCSDIR} \
		--with-drvdir=${PREFIX}/libexec/cups/driver
CONFIGURE_ENV=	LDFLAGS="${LDFLAGS}"
CPPFLAGS+=	-I${LOCALBASE}/include
LDFLAGS+=	-L${LOCALBASE}/lib ${PTHREAD_LIBS}

USE_LDCONFIG=	yes
MAKE_JOBS_SAFE=	yes

SUB_FILES=	pkg-message
USE_DOS2UNIX=	yes
DOS2UNIX_REGEX=.+\.(c|cpp|h|py)$

FILES4FIX=	Makefile.in \
		base/codes.py \
		base/g.py \
		base/pkit.py \
		base/status.py \
		base/utils.py \
		check.py \
		fax/backend/hpfax.py \
		hplip.list.in \
		installer/core_install.py \
		installer/dcheck.py \
		installer/distros.dat \
		io/hpmud/hp-mkuri.c \
		prnt/cups.py \
		prnt/hpcups/HPCupsFilter.cpp \
		prnt/hpcups/Utils.cpp \
		prnt/hpijs/globals.cpp \
		prnt/hpijs/hpcupsfax.cpp \
		prnt/hpijs/hpijs.cpp \
		setup.py \
		ui/devmgr4.py \
		ui/setupform.py \
		ui4/devmgr5.py

OPTIONS=	QT "Graphical User Interface (Qt4)" on \
		FAX "PC Send Fax support" off \
		SNMP "Network/JetDirect support" off \
		SCAN "Scanning support" off \
		XSANE "Install XSane for scanning (requires SCAN)" off

.include <bsd.port.options.mk>

.if ${OSVERSION} < 800067
EXTRA_PATCHES+=	${PATCHDIR}/extrapatch-strnlen
.endif

.if ${OSVERSION} < 800069
LIB_DEPENDS+=	usb:${PORTSDIR}/devel/libusb
USB_INCLUDE=	${LOCALBASE}/include
.else
USB_INCLUDE=	/usr/include
.endif

.if !defined(WITHOUT_QT)
RUN_DEPENDS+=	${PYTHON_SITELIBDIR}/PyQt4/QtGui.so:${PORTSDIR}/x11-toolkits/py-qt4-gui \
		${PYTHON_SITELIBDIR}/dbus/mainloop/qt.so:${PORTSDIR}/devel/py-qt4-dbus
CONFIGURE_ARGS+=	--enable-qt4 \
			--enable-gui-build
PLIST_SUB+=	GUI=""
.else
CONFIGURE_ARGS+=	--disable-qt4 \
			--disable-gui-build
PLIST_SUB+=	GUI="@comment "
.endif

.if defined(WITH_FAX)
RUN_DEPENDS+=	${PYTHON_SITELIBDIR}/reportlab/__init__.py:${PORTSDIR}/print/py-reportlab2
CONFIGURE_ARGS+=	--enable-fax-build
PLIST_SUB+=	FAX=""
.else
CONFIGURE_ARGS+=	--disable-fax-build
PLIST_SUB+=	FAX="@comment "
.endif

.if defined(WITH_SNMP)
USE_OPENSSL=	yes
LIB_DEPENDS+=	netsnmp.30:${PORTSDIR}/net-mgmt/net-snmp
CONFIGURE_ARGS+=	--enable-network-build
. if ${ARCH} == i386
# http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/144833
CONFIGURE_ENV+=	LIBS="-lssp_nonshared"
. endif
.else
CONFIGURE_ARGS+=	--disable-network-build
.endif

.if defined(WITH_SCAN)
. if defined(WITH_XSANE)
RUN_DEPENDS+=	xsane:${PORTSDIR}/graphics/xsane
. endif
LIB_DEPENDS+=	sane.1:${PORTSDIR}/graphics/sane-backends
RUN_DEPENDS+=	${PYTHON_SITELIBDIR}/PIL/_imaging.so:${PORTSDIR}/graphics/py-imaging
CONFIGURE_ARGS+=	--enable-scan-build
PLIST_SUB+=	SCAN=""
.else
CONFIGURE_ARGS+=	--disable-scan-build
PLIST_SUB+=	SCAN="@comment "
.endif

.if defined(NOPORTDOCS)
CONFIGURE_ARGS+=	--enable-doc-build=no
.endif

post-patch:
	${REINPLACE_CMD} -e 's,-lpthread,${PTHREAD_LIBS},g' \
		-e 's|-ldld||g; s|-ldl||g' \
		${WRKSRC}/configure \
		${WRKSRC}/Makefile.in
	${REINPLACE_CMD} -e '/[[:space:]]install-dist_rulesDATA/ s,install-dist_rulesDATA,,' \
		-e '/[[:space:]]install-hplip_confDATA/ s,install-hplip_confDATA,,' \
		${WRKSRC}/Makefile.in
	${REINPLACE_CMD} -e 's,/etc/hp,${PREFIX}&,g' \
		-e 's,/etc/cups,${LOCALBASE}&,g' \
		-e 's,/etc/init.d,${LOCALBASE}/etc/rc.d,g' \
		-e 's,/etc/sane.d,${LOCALBASE}&,g' \
		-e 's,/usr/share,${LOCALBASE}/share,g' \
		-e 's,/usr/include,${LOCALBASE}/include,g' \
		${FILES4FIX:S,^,${WRKSRC}/,}
	${REINPLACE_CMD} -e 's,%USB_INCLUDE%,${USB_INCLUDE},' \
		${WRKSRC}/installer/core_install.py
.if defined(NOPORTDOCS)
	${REINPLACE_CMD} -e '/[[:space:]]install-docDATA/ s|install-docDATA||' \
		${WRKSRC}/Makefile.in
.endif

post-install:
	${INSTALL_DATA} ${WRKSRC}/hplip-systray.desktop ${PREFIX}/etc/xdg/autostart/hplip-systray.desktop
	${MKDIR} ${PREFIX}/etc/hp
	${INSTALL_DATA} ${WRKSRC}/hplip.conf ${PREFIX}/etc/hp/hplip.conf.sample
	if [ ! -f ${PREFIX}/etc/hp/hplip.conf ]; then \
		${INSTALL_DATA} ${PREFIX}/etc/hp/hplip.conf.sample \
			${PREFIX}/etc/hp/hplip.conf; \
	fi
	@${CAT} ${PKGMESSAGE}

.include <bsd.port.mk>