aboutsummaryrefslogtreecommitdiff
path: root/print/hplip-plugin/Makefile
blob: 3079453f9c9f171b771f533e9b82adb5419ab0b9 (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
# Created by: amistry@am-productions.biz
# $FreeBSD$

PORTNAME=	hplip-plugin
PORTVERSION=	3.14.4
CATEGORIES=	print
MASTER_SITES=	http://www.openprinting.org/download/printdriver/auxfiles/HP/plugins/
DISTNAME=	hplip-${DISTVERSION}-plugin
EXTRACT_SUFX=	.run

MAINTAINER=	ports@FreeBSD.org
COMMENT=	Binary plugin for some HP Printers and All-in-One devices

RUN_DEPENDS=	hp-plugin:${PORTSDIR}/print/hplip

USE_PYTHON=	yes
NO_BUILD=	yes
RESTRICTED=	User must accept the license terms
NO_PACKAGE=	${RESTRICTED}
IS_INTERACTIVE=	yes
WRKSRC=		${WRKDIR}/plugin_tmp
HPLIP_FAKEDIR=	${WRKDIR}/hplip_fakedir
MAKE_ENV=	HOME=/dev/null

ONLY_FOR_ARCHS=	amd64 i386

PLUGIN_LINKS=	fax/plugins/fax_marvell \
		prnt/plugins/hbpl1 \
		prnt/plugins/lj \
		scan/plugins/bb_marvell \
		scan/plugins/bb_soap \
		scan/plugins/bb_soapht

PLUGIN_DIRS=	data/firmware \
		data/plugins \
		fax/plugins \
		prnt/plugins \
		scan/plugins

PLIST_SUB+=	LINARCH="${LINARCH}"

.include <bsd.port.pre.mk>

.if ${ARCH} == "i386"
LINARCH=	x86_32
.elif ${ARCH} == "amd64"
LINARCH=	x86_64
.endif

do-extract:
	@${MKDIR} ${WRKDIR}
	@cd ${WRKDIR} && ${SH} ${DISTDIR}/${DISTNAME}${EXTRACT_SUFX} --keep --noexec

post-patch:
#	${REINPLACE_CMD} -e 's|ok, ans = tui.enter_yes_no.*|ok, ans = 1, 1|' \
#		${WRKSRC}/plugin_install.py
	${REINPLACE_CMD} -e 's|rules,||;s|rules_alt,||' ${WRKSRC}/plugin.spec
	${REINPLACE_CMD} -e 's|/etc/hp|${HPLIP_FAKEDIR}|g' \
		${WRKSRC}/plugin_install.py

do-install:
# fake hplip installation
	${MKDIR} ${HPLIP_FAKEDIR}
	${SED} -e 's,${LOCALBASE}/share/hplip,${HPLIP_FAKEDIR},' \
		${LOCALBASE}/etc/hp/hplip.conf > ${HPLIP_FAKEDIR}/hplip.conf
	${MKDIR} ${HPLIP_FAKEDIR}
	${LN} -sf ${LOCALBASE}/share/hplip/base ${HPLIP_FAKEDIR}
	${LN} -sf ${LOCALBASE}/share/hplip/prnt ${HPLIP_FAKEDIR}
	${CP} -R ${LOCALBASE}/share/hplip/installer ${HPLIP_FAKEDIR}
	${REINPLACE_CMD} -e 's,HOMEDIR = .*,HOMEDIR = "${STAGEDIR}${PREFIX}/share/hplip",' \
		${HPLIP_FAKEDIR}/installer/pluginhandler.py
# install hplip-plugin
	${MKDIR} ${PLUGIN_DIRS:S,^,${STAGEDIR}${PREFIX}/share/hplip/,}
	(cd ${WRKSRC} && ${PYTHON_CMD} -B plugin_install.py)
.for i in ${PLUGIN_LINKS}
	${LN} -sf ${i:T}-${LINARCH}.so ${STAGEDIR}${PREFIX}/share/hplip/${i}.so
.endfor

.include <bsd.port.post.mk>