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

PORTNAME=   hplip
PORTVERSION=    3.10.5
CATEGORIES= print
MASTER_SITES=   SF

MAINTAINER= chris@officialunix.com
COMMENT=    Drivers and utilities for HP Printers and All-in-One devices

LIB_DEPENDS=    jpeg.11:${PORTSDIR}/graphics/jpeg \
        sane.1:${PORTSDIR}/graphics/sane-backends \
        cups.2:${PORTSDIR}/print/cups-base
RUN_DEPENDS=    ${PYTHON_SITELIBDIR}/reportlab/__init__.py:${PORTSDIR}/print/py-reportlab2 \
        espgs:${PORTSDIR}/print/cups-pstoraster \
        foomatic-rip:${PORTSDIR}/print/foomatic-filters \
        mDNSClientPosix:${PORTSDIR}/net/mDNSResponder

LATEST_LINK=    ${PORTNAME}3
CONFLICTS=  hpijs-[0-9]* hplip-2*

GNU_CONFIGURE=  yes
CONFIGURE_ARGS= --disable-dependency-tracking \
        --disable-pp-build \
        --enable-foomatic-ppd-install \
        --enable-foomatic-rip-hplip-install \
        --enable-hpijs-install \
        --with-icondir=${LOCALBASE}/share/applications \
        --with-cupsbackenddir=${LOCALBASE}/libexec/cups/backend \
        --with-cupsfilterdir=${LOCALBASE}/libexec/cups/filter \
        --with-drvdir=${LOCALBASE}/libexec/cups/driver \
        --with-hpppddir=${LOCALBASE}/share/ppd/HP \
        --with-mimedir=${LOCALBASE}/etc/cups \
        --with-docdir=${PREFIX}/share/doc/${PORTNAME}-${PORTVERSION}

USE_LDCONFIG=   yes
USE_GHOSTSCRIPT_RUN=    yes
USE_PYTHON= 25+
USE_RC_SUBR=    hpssd
MAKE_JOBS_SAFE= yes
SUB_FILES=  pkg-message
USE_DOS2UNIX=   yes
DOCSDIR=    ${PREFIX}/share/doc/${PORTNAME}-${PORTVERSION}

CPPFLAGS+=  -I${LOCALBASE}/include
LDFLAGS+=   -L${LOCALBASE}/lib ${PTHREAD_LIBS} -lcompat

CONFIGURE_ENV=  CPPFLAGS="${CPPFLAGS}" LDFLAGS="${LDFLAGS}"

OPTIONS=    QT "Build QT4 gui" off \
        DBUS "D-Bus support (required for fax tools)" off \
        XSANE "Scanning support via XSane" off \
        SNMP "Support for Simple Network Management Protocol" off

.include <bsd.port.options.mk>

.if ${OSVERSION} < 800069
LIB_DEPENDS+=   usb:${PORTSDIR}/devel/libusb
.endif

.if defined(WITH_SNMP) && (${ARCH} == i386)
BROKEN= can't link with libsnmp, net-mgmt/net-snmp should be fixed first
.endif

.if !defined(WITHOUT_QT)
USE_QT_VER= 4
QT_COMPONENTS=  gui
CONFIGURE_ARGS+=    --enable-qt4
RUN_DEPENDS+=   ${PYTHON_SITELIBDIR}/PyQt4/QtGui.so:${PORTSDIR}/x11-toolkits/py-qt4-gui
LIB_DEPENDS+=   pyglib-2.0:${PORTSDIR}/devel/py-gobject
.endif

.if !defined(WITHOUT_DBUS)
RUN_DEPENDS+=   ${PYTHON_SITELIBDIR}/dbus/_dbus.py:${PORTSDIR}/devel/py-dbus \
        ${PYTHON_SITELIBDIR}/dbus/mainloop/qt.so:${PORTSDIR}/devel/py-qt4-dbus
LIB_DEPENDS+=   dbus-1.3:${PORTSDIR}/devel/dbus
# fax added as, no dbus no fax
CONFIGURE_ARGS+=    --enable-dbus-build \
            --enable-fax-build
PLIST_SUB+= FAX=""
.else
CONFIGURE_ARGS+=    --disable-dbus-build \
            --disable-fax-build
PLIST_SUB+= FAX="@comment "
.endif

.if !defined(WITHOUT_XSANE)
RUN_DEPENDS+=   xsane:${PORTSDIR}/graphics/xsane
.endif

.if defined(WITH_SNMP)
LIB_DEPENDS+=   netsnmp.16:${PORTSDIR}/net-mgmt/net-snmp
CONFIGURE_ARGS+=    --enable-network-build
.else
CONFIGURE_ARGS+=    --disable-network-build
.endif

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

post-patch:
    @${REINPLACE_CMD} -e 's|/etc/hp|${LOCALBASE}/etc/hp|g ; \
            s|/etc/sane.d|${LOCALBASE}/etc/sane.d|g' \
        ${WRKSRC}/Makefile.in \
        ${WRKSRC}/check.py ${WRKSRC}/hpssd.py \
        ${WRKSRC}/base/g.py ${WRKSRC}/fax/backend/hpfax.py \
        ${WRKSRC}/installer/distros.dat \
        ${WRKSRC}/installer/core_install.py \
        ${WRKSRC}/prnt/hpijs/ljzjs.cpp \
        ${WRKSRC}/prnt/hpijs/globals.cpp \
        ${WRKSRC}/ui/devmgr4.py \
        ${WRKSRC}/ui4/devmgr5.py
    @${REINPLACE_CMD} -e 's|/etc/dbus-1/system.d|${LOCALBASE}/etc/dbus-1/system.d|g ; \
            s|/usr/share/dbus-1/system-services|${LOCALBASE}/share/dbus-1/system-services|g' \
        ${WRKSRC}/Makefile.in
    @${REINPLACE_CMD} 's|/etc/xdg|${PREFIX}&|g; s|-lpthread|${PTHREAD_LIBS}|g' \
        ${WRKSRC}/configure
    @${REINPLACE_CMD} -e 's|install-dist_prntSCRIPTS install-dist_rulesDATA|install-dist_prntSCRIPTS|g ; \
            s|install-hpPROGRAMS install-hplip_confDATA|install-hpPROGRAMS|g' \
        ${WRKSRC}/Makefile.in
    @${REINPLACE_CMD} -e 's|-ldld||g; s|-ldl||g; s|-dld||g' \
        ${WRKSRC}/configure \
        ${WRKSRC}/Makefile.in
    @${REINPLACE_CMD} -e 's|/usr/bin/env python|${LOCALBASE}/bin/python|g' \
        ${WRKSRC}/hpssd.py
.if defined(NOPORTDOCS)
    @${REINPLACE_CMD} -e '/[[:space:]]install-docDATA/ s|install-docDATA||' \
        ${WRKSRC}/Makefile.in
.endif

post-install:
    ${LN} -sf ${PREFIX}/share/hplip/hpssd.py ${PREFIX}/sbin/hpssd
    ${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
    ${ECHO_CMD} hpaio >> ${PREFIX}/etc/sane.d/dll.conf
    @${CAT} ${PKGMESSAGE}

.include <bsd.port.mk>