1 # $NetBSD: Makefile,v 1.3 2012/06/14 07:43:46 sbd Exp $
6 MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=hplip/}
8 MAINTAINER= schnoebe@NetBSD.org
9 HOMEPAGE= http://hplipopensource.com/
10 COMMENT= HP Linux Imaging and Printing
11 LICENSE= gnu-gpl-v2 AND mit AND modified-bsd
13 PKG_DESTDIR_SUPPORT= user-destdir
15 CONFLICTS+= hpijs-[0-9]*
17 FILES_SUBST+= CUPS_USER=${CUPS_USER}
18 FILES_SUBST+= CUPS_GROUP=${CUPS_GROUP}
20 PKG_GROUPS_VARS+= CUPS_GROUP
21 PKG_USERS_VARS+= CUPS_USER
23 BUILD_DEFS+= CUPS_USER CUPS_GROUP VARBASE
27 USE_LANGUAGES= c c++ # fortran
28 USE_TOOLS+= aclocal autoconf automake gmake pkg-config
31 CONFIGURE_ARGS= --sysconfdir=${PKG_SYSCONFDIR} \
32 --localstatedir=${VARBASE} \
33 --with-cupsbackenddir=${PREFIX}/libexec/cups/backend \
34 --with-cupsfilterdir=${PREFIX}/libexec/cups/filter \
35 --with-hpppddir=${PREFIX}/share/hplip/ppd/HP
36 CONFIGURE_ARGS+= --enable-network-build
37 CONFIGURE_ARGS+= --disable-pp-build
38 CONFIGURE_ARGS+= --enable-hpcups-install
39 CONFIGURE_ARGS+= --enable-hpijs-install
40 CONFIGURE_ARGS+= --enable-cups-drv-install
41 CONFIGURE_ARGS+= --enable-cups-ppd-install
42 CONFIGURE_ARGS+= --enable-foomatic-drv-install
43 CONFIGURE_ARGS+= --enable-foomatic-ppd-install
44 CONFIGURE_ARGS+= --enable-foomatic-rip-hplip-install
46 EGDIR= ${PREFIX}/share/examples/${PKGBASE}
47 EGFILES= hp/hplip.conf
49 INSTALL_MAKE_FLAGS+= ${MAKE_FLAGS}
50 INSTALL_MAKE_FLAGS+= sysconfdir=${EGDIR}
51 INSTALL_MAKE_FLAGS+= localstatedir=${EGDIR}
52 INSTALL_MAKE_FLAGS+= systraydir=${EGDIR}/xdg/autostart
53 INSTALL_MAKE_FLAGS+= mimedir=${EGDIR}/cups
55 OWN_DIRS+= ${PKG_SYSCONFDIR}/hp
56 OWN_DIRS+= ${VARBASE}/lib/hp
57 OWN_DIRS+= ${PREFIX}/share/examples/hplip/log/hp
59 OWN_DIRS_PERMS+= ${PREFIX}/share/examples/hplip/log/hp ${CUPS_USER} ${CUPS_GROUP} 0774
65 .for file in ${EGFILES}
66 CONF_FILES+= ${EGDIR}/${file} ${PKG_SYSCONFDIR}/${file}
70 REPLACE_PYTHON= *.py */*.py */*/*.py
71 REPLACE_PYTHON+= fax/filters/pstotiff
72 REPLACE_PERL= prnt/filters/hpcac prnt/hpijs/foomatic-rip-hplip
76 SUBST_CLASSES+= strip-cr
77 SUBST_STAGE.strip-cr= post-extract
78 SUBST_MESSAGE.strip-cr= Strip trailing carriage returns
79 SUBST_FILES.strip-cr= prnt/hpcups/HPCupsFilter.cpp
80 SUBST_FILTER_CMD.strip-cr= ${TR} -d '\r'
82 SUBST_CLASSES+= fix-python
83 SUBST_STAGE.fix-python= post-configure
84 SUBST_MESSAGE.fix-python= Fixing python invocations in Python files.
85 SUBST_FILES.fix-python= check.py scan.py setup.py
86 SUBST_FILES.fix-python+= base/utils.py base/pkit.py
87 SUBST_FILES.fix-python+= installer/core_install.py
88 SUBST_FILES.fix-python+= ui/nodevicesform.py ui/devmgr4.py
89 SUBST_FILES.fix-python+= ui4/nodevicesdialog.py ui4/devmgr5.py
90 SUBST_SED.fix-python= -e 's,\(['\''"]\)python ,\1${PYTHONBIN} ,g'
92 SUBST_CLASSES+= fix-paths-0
93 SUBST_STAGE.fix-paths-0= pre-configure
94 SUBST_MESSAGE.fix-paths-0= Fixing /var/run in hplip.conf.in.
95 SUBST_FILES.fix-paths-0= hplip.conf.in
96 SUBST_SED.fix-paths-0= -e 's,run=/var/run,run=${VARBASE}/run,g'
98 SUBST_CLASSES+= fix-paths-1
99 SUBST_STAGE.fix-paths-1= post-configure
100 SUBST_MESSAGE.fix-paths-1= Fixing /etc and /var paths in Python and C++ files.
101 SUBST_FILES.fix-paths-1= check.py base/codes.py base/g.py base/utils.py
102 SUBST_FILES.fix-paths-1+= installer/core_install.py
103 SUBST_FILES.fix-paths-1+= fax/backend/hpfax.py prnt/cups.py
104 SUBST_FILES.fix-paths-1+= ui/devmgr4.py ui4/devmgr5.py
105 SUBST_FILES.fix-paths-1+= prnt/hpcups/HPCupsFilter.cpp prnt/hpcups/Utils.cpp
106 SUBST_FILES.fix-paths-1+= prnt/hpijs/globals.cpp prnt/hpijs/hpcupsfax.cpp
107 SUBST_FILES.fix-paths-1+= prnt/hpijs/hpijs.cpp
108 SUBST_SED.fix-paths-1= -e 's,\([ '\''"=]\)/etc/hp,\1${PKG_SYSCONFDIR}/hp,g'
109 SUBST_SED.fix-paths-1+= -e 's,\([ '\''"=]\)/etc/cups,\1${PKG_SYSCONFDIR}/cups,g'
110 SUBST_SED.fix-paths-1+= -e 's,\([ '\''"=]\)/etc/sane.d,\1${PKG_SYSCONFDIR}/sane.d,g'
111 SUBST_SED.fix-paths-1+= -e 's,\([ '\''"=]\)/var/lib/hp,\1${VARBASE}/lib/hp,g'
112 SUBST_SED.fix-paths-1+= -e 's,\([ '\''"=]\)/var/log/cups,\1${VARBASE}/log/cups,g'
113 SUBST_SED.fix-paths-1+= -e 's,\([ '\''"=]\)/var/spool/cups,\1${VARBASE}/spool/cups,g'
115 SUBST_CLASSES+= fix-paths-2
116 SUBST_STAGE.fix-paths-2= post-configure
117 SUBST_MESSAGE.fix-paths-2= Fixing additional paths in installer/core_install.py.
118 SUBST_FILES.fix-paths-2= installer/core_install.py
119 SUBST_SED.fix-paths-2= -e 's,"/etc/PolicyKit,"${PKG_SYSCONFDIR}/PolicyKit,g'
120 SUBST_SED.fix-paths-2+= -e 's,"/etc/polkit-1,"${PKG_SYSCONFDIR}/polkit-1,g'
121 SUBST_SED.fix-paths-2+= -e 's,"file:///etc/hp,"file://${PKG_SYSCONFDIR}/hp,g'
122 SUBST_SED.fix-paths-2+= -e 's,"/usr/lib/cups/driver,"${PREFIX}/libexec/cups/driver,g'
123 SUBST_SED.fix-paths-2+= -e 's,\([ '\''"=]\)/usr,\1${PREFIX},g'
125 SUBST_CLASSES+= fix-paths-3
126 SUBST_STAGE.fix-paths-3= post-configure
127 SUBST_MESSAGE.fix-paths-3= Fixing additional paths in base/pkit.py.
128 SUBST_FILES.fix-paths-3= base/pkit.py
129 SUBST_SED.fix-paths-3= -e 's,\([ '\''"=]\)/usr,\1${PREFIX},g'
131 SUBST_CLASSES+= fix-paths-4
132 SUBST_STAGE.fix-paths-4= post-configure
133 SUBST_MESSAGE.fix-paths-4= Fixing default PPD search path in base/g.py and prnt/cups.py.
134 SUBST_FILES.fix-paths-4= base/g.py prnt/cups.py
135 SUBST_SED.fix-paths-4= -e '\,ppd_search_path =, { s,/usr/\([a-z]*\);,/usr/\1;${PREFIX}/\1;,g ; }'
136 SUBST_SED.fix-paths-4+= -e 's,\([ '\''"=]\)/usr/share/ppd,\1${PREFIX}/share/ppd,g'
138 SUBST_CLASSES+= fix-paths-5
139 SUBST_STAGE.fix-paths-5= post-configure
140 SUBST_MESSAGE.fix-paths-5= Fixing paths in prnt/hpijs/foomatic-rip-hplip.
141 SUBST_FILES.fix-paths-5= prnt/hpijs/foomatic-rip-hplip
142 SUBST_SED.fix-paths-5= -e 's,\([ '\''"=]\)/etc/cups,\1${PKG_SYSCONFDIR}/cups,g'
143 SUBST_SED.fix-paths-5+= -e 's,\([ '\''"=]\)/etc/foomatic,\1${PKG_SYSCONFDIR}/foomatic,g'
144 SUBST_SED.fix-paths-5+= -e 's,\([ '\''"=]\)/var/spool,\1${VARBASE}/spool,g'
145 SUBST_SED.fix-paths-5+= -e 's,prefix = "/usr",prefix = "${PREFIX}",g'
146 SUBST_SED.fix-paths-5+= -e 's,\(path = "/usr/bin:\),\1${PREFIX}/bin:,g'
147 SUBST_SED.fix-paths-5+= -e 's,\(path = "/usr/lib/cups/filter:\),\1${PREFIX}/libexec/cups/filter:,g'
148 SUBST_SED.fix-paths-5+= -e '\,} elsif (-r "/usr/share/ppr, { N ; p ; s,"/usr,"${PREFIX},g ; }'
150 SUBST_CLASSES+= fix-paths-6
151 SUBST_STAGE.fix-paths-6= post-configure
152 SUBST_MESSAGE.fix-paths-6= Fixing paths in fax/filters/pstotiff.
153 SUBST_FILES.fix-paths-6= fax/filters/pstotiff
154 SUBST_SED.fix-paths-6= -e 's,"-I/usr/share/cups/fonts","-I${PREFIX}/share/cups/fonts",g'
155 SUBST_SED.fix-paths-6+= -e 's,"/usr/bin/gs","${PREFIX}/bin/gs",g'
157 # NetBSD has strnlen(3) since 5.99.12
158 .if ${OPSYS} == "NetBSD" && empty(OS_VERSION:M5.99.*) && empty(OS_VERSION:M[6-9].*)
159 SUBST_CLASSES+= fix-strnlen
160 SUBST_STAGE.fix-strnlen= post-configure
161 SUBST_MESSAGE.fix-strnlen= Replacing strnlen() with strlen() in two C++ files.
162 SUBST_FILES.fix-strnlen= prnt/hpijs/context2.cpp prnt/hpijs/ljzjscolor.cpp
163 SUBST_SED.fix-strnlen= -e 's/\([ (]\)strnlen(\([^,]*\), DevIDBuffSize)/\1strlen(\2)/g'
166 .include "../../mk/dlopen.buildlink3.mk"
167 BUILDLINK_TRANSFORM+= opt:-ldl:${BUILDLINK_LDADD.dl:Q}
170 cd ${WRKSRC} && aclocal && automake --add-missing --foreign && autoconf
172 INSTALLATION_DIRS+= share/cups/model
175 ${CHMOD} a-x ${DESTDIR}${PREFIX}/share/hplip/__init__.py
176 ${PY_COMPILE_ALL} ${DESTDIR}${PREFIX}/share/hplip
177 ${LN} -s ../../../share/hplip/ppd ${DESTDIR}${PREFIX}/share/cups/model/hplip-ppds
179 .include "../../lang/python/application.mk"
180 .include "../../lang/python/extension.mk"
181 .include "../../sysutils/desktop-file-utils/desktopdb.mk"
182 .include "../../mk/jpeg.buildlink3.mk"
183 .include "../../net/net-snmp/buildlink3.mk"
184 .include "../../print/cups/buildlink3.mk"
185 .include "../../print/ghostscript/buildlink3.mk"
186 .include "../../devel/libusb1/buildlink3.mk"
187 .include "../../security/openssl/buildlink3.mk"
188 .include "../../textproc/py-xml/buildlink3.mk"
189 .include "../../mk/pthread.buildlink3.mk"
190 .include "../../mk/bsd.pkg.mk"