aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortijl <tijl@FreeBSD.org>2016-03-21 19:21:28 +0800
committertijl <tijl@FreeBSD.org>2016-03-21 19:21:28 +0800
commit781c5363d3a6657c67326035fac0a88427e10fa3 (patch)
tree6be4c69a1d14bd80c94150e60e16182c4a8202e2
parent70fa34692bc1dff5243857b14e33979c91e4f7c8 (diff)
downloadfreebsd-ports-gnome-781c5363d3a6657c67326035fac0a88427e10fa3.tar.gz
freebsd-ports-gnome-781c5363d3a6657c67326035fac0a88427e10fa3.tar.zst
freebsd-ports-gnome-781c5363d3a6657c67326035fac0a88427e10fa3.zip
- These binary plugins are compiled for Linux and some require glibc
functions that our libc does not provide so they fail to load. Implement the glibc functions in a wrapper library for each plugin. - Do all of the building and installing from do-build and do-install. The upstream install scripts require too many hacks to stay inside the work directory. - Add LICENSE information. PR: 208142 Tested by: avg
-rw-r--r--print/hplip-plugin/Makefile72
-rw-r--r--print/hplip-plugin/files/patch-installPlugin.py11
-rw-r--r--print/hplip-plugin/files/patch-plugin_install.py14
-rw-r--r--print/hplip-plugin/files/wrap.c73
-rw-r--r--print/hplip-plugin/pkg-descr4
-rw-r--r--print/hplip-plugin/pkg-plist1
6 files changed, 107 insertions, 68 deletions
diff --git a/print/hplip-plugin/Makefile b/print/hplip-plugin/Makefile
index ba5f1952055f..4820a634c6d5 100644
--- a/print/hplip-plugin/Makefile
+++ b/print/hplip-plugin/Makefile
@@ -3,6 +3,7 @@
PORTNAME= hplip-plugin
PORTVERSION= 3.16.2
+PORTREVISION= 1
CATEGORIES= print
MASTER_SITES= http://hplipopensource.com/hplip-web/plugin/
DISTNAME= hplip-${DISTVERSION}-plugin
@@ -11,18 +12,18 @@ EXTRACT_SUFX= .run
MAINTAINER= makc@FreeBSD.org
COMMENT= Binary plugin for some HP Printers and All-in-One devices
+LICENSE= HPLIP_PLUGIN
+LICENSE_NAME= HPLIP Driver Plug-in License
+LICENSE_PERMS= none
+LICENSE_FILE= ${WRKSRC}/license.txt
+
RUN_DEPENDS= hp-plugin:${PORTSDIR}/print/hplip
RESTRICTED= License agreement is required
-USES= python
-NO_BUILD= yes
-WRKSRC= ${WRKDIR}/plugin_tmp
-HPLIP_FAKEDIR= ${WRKDIR}/hplip_fakedir
-
-ONLY_FOR_ARCHS= amd64 i386
+ONLY_FOR_ARCHS= amd64 i386 # arm
-PLUGIN_LINKS= fax/plugins/fax_marvell \
+PLUGINS= fax/plugins/fax_marvell \
prnt/plugins/hbpl1 \
prnt/plugins/lj \
scan/plugins/bb_escl \
@@ -30,12 +31,6 @@ PLUGIN_LINKS= fax/plugins/fax_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>
@@ -47,36 +42,33 @@ LINARCH= x86_64
.endif
do-extract:
- @${MKDIR} ${WRKDIR}
- @(cd ${WRKDIR} && ${SH} ${DISTDIR}/${DISTNAME}${EXTRACT_SUFX} \
- --keep --noexec --nox11)
+ @${SH} ${DISTDIR}/${DISTNAME}${EXTRACT_SUFX} \
+ --keep --noexec --nox11 --target ${WRKSRC}
-post-patch:
- @${REINPLACE_CMD} -e 's|ok, ans = tui.enter_yes_no.*|ok, ans = 1, 1|' \
- -e 's|/etc/hp|${HPLIP_FAKEDIR}|' \
- ${WRKSRC}/plugin_install.py \
- ${WRKSRC}/installPlugin.py
+do-build:
+ ${CC} ${CFLAGS} -Wall -fPIC -c ${FILESDIR}/wrap.c -o ${WRKSRC}/wrap.o
+.for p in ${PLUGINS}
+ (cd ${WRKSRC} && ${BRANDELF} -t FreeBSD ${p:T}-${LINARCH}.so && \
+ ${CC} ${CFLAGS} ${LDFLAGS} -shared -fPIC -o ${p:T}.so wrap.o \
+ ${p:T}-${LINARCH}.so -Wl,-rpath,${PREFIX}/share/hplip/${p:H})
+.endfor
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",' \
- -e 's,/var/lib/hp/hplip.state,${STAGEDIR}&,' \
- ${HPLIP_FAKEDIR}/installer/pluginhandler.py \
- ${HPLIP_FAKEDIR}/installer/core_install.py
- ${MKDIR} ${STAGEDIR}/var/lib/hp
-# install hplip-plugin
- ${MKDIR} ${PLUGIN_DIRS:S,^,${STAGEDIR}${PREFIX}/share/hplip/,}
- (cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${PYTHON_CMD} -B \
- plugin_install.py -i)
-.for i in ${PLUGIN_LINKS}
- ${LN} -sf ${i:T}-${LINARCH}.so ${STAGEDIR}${PREFIX}/share/hplip/${i}.so
+ ${MKDIR} ${STAGEDIR}${PREFIX}/share/hplip/data/firmware
+ ${INSTALL_DATA} ${WRKSRC}/*.fw.gz \
+ ${STAGEDIR}${PREFIX}/share/hplip/data/firmware
+ ${MKDIR} ${PLUGINS:H:S,^,${STAGEDIR}${PREFIX}/share/hplip/,}
+.for p in ${PLUGINS}
+ ${INSTALL_LIB} ${WRKSRC}/${p:T}-${LINARCH}.so \
+ ${STAGEDIR}${PREFIX}/share/hplip/${p}-${LINARCH}.so
+ ${INSTALL_LIB} ${WRKSRC}/${p:T}.so \
+ ${STAGEDIR}${PREFIX}/share/hplip/${p}.so
.endfor
+ ${INSTALL_DATA} ${WRKSRC}/plugin.spec ${STAGEDIR}${PREFIX}/share/hplip
+ ${MKDIR} ${STAGEDIR}/var/lib/hp
+ ${ECHO_CMD} '[plugin]' > ${STAGEDIR}/var/lib/hp/hplip.state
+ ${ECHO_CMD} 'installed = 1' >> ${STAGEDIR}/var/lib/hp/hplip.state
+ ${ECHO_CMD} 'eula = 1' >> ${STAGEDIR}/var/lib/hp/hplip.state
+ ${ECHO_CMD} 'version = ${PORTVERSION}' >> ${STAGEDIR}/var/lib/hp/hplip.state
.include <bsd.port.post.mk>
diff --git a/print/hplip-plugin/files/patch-installPlugin.py b/print/hplip-plugin/files/patch-installPlugin.py
deleted file mode 100644
index bffc708dfc42..000000000000
--- a/print/hplip-plugin/files/patch-installPlugin.py
+++ /dev/null
@@ -1,11 +0,0 @@
---- installPlugin.py.orig 2016-02-08 09:48:27 UTC
-+++ installPlugin.py
-@@ -52,7 +52,7 @@ pluginObj = pluginhandler.PluginHandle()
-
- status = False
-
--if os.geteuid() == 0:
-+if True:
- status = pluginObj.copyFiles(os.getcwd())
- if status == True:
- sys.exit(0)
diff --git a/print/hplip-plugin/files/patch-plugin_install.py b/print/hplip-plugin/files/patch-plugin_install.py
deleted file mode 100644
index 675530c0313a..000000000000
--- a/print/hplip-plugin/files/patch-plugin_install.py
+++ /dev/null
@@ -1,14 +0,0 @@
---- plugin_install.py.orig 2016-02-08 09:48:27 UTC
-+++ plugin_install.py
-@@ -50,10 +50,8 @@ def startGUIInstall():
-
- def installPlugin():
- exec_str = sys.executable
-- passwordObj = password.Password(mode)
- cmd = "%s installPlugin.py"%exec_str
-- cmd = passwordObj.getAuthCmd()%cmd
-- status, output = utils.run(cmd, passwordObj)
-+ status, output = utils.run(cmd)
- if status == 0:
- result = True
- else:
diff --git a/print/hplip-plugin/files/wrap.c b/print/hplip-plugin/files/wrap.c
new file mode 100644
index 000000000000..dcf6194fb76b
--- /dev/null
+++ b/print/hplip-plugin/files/wrap.c
@@ -0,0 +1,73 @@
+/* $FreeBSD$ */
+
+/* dummy implementation of glibc functions needed by plugins */
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <syslog.h>
+
+void
+__assert_fail( const char *msg, const char *file, unsigned int line,
+ const char *func ) {
+ fprintf( stderr, "Assertion failed: (%s), function %s, file %s, line %u\n",
+ msg, func, file, line );
+ abort();
+}
+
+int
+__fprintf_chk( FILE *fp, int flag, char const *format, ... ) {
+ va_list ap;
+ int res;
+
+ va_start( ap, format );
+ res = vfprintf( fp, format, ap );
+ va_end( ap );
+ return( res );
+}
+
+int
+__printf_chk( int flag, char const *format, ... ) {
+ va_list ap;
+ int res;
+
+ va_start( ap, format );
+ res = vprintf( format, ap );
+ va_end( ap );
+ return( res );
+}
+
+int
+__snprintf_chk( char *s, size_t maxlen, int flag, size_t slen,
+ char const *format, ... ) {
+ va_list ap;
+ int res;
+
+ va_start( ap, format );
+ res = vsnprintf( s, maxlen, format, ap );
+ va_end( ap );
+ return( res );
+}
+
+char *
+__strcpy_chk( char *dest, char const *src, size_t destlen ) {
+ return( strcpy( dest, src ));
+}
+
+void
+__syslog_chk( int priority, int flag, char const *format, ... ) {
+ va_list ap;
+
+ va_start( ap, format );
+ vsyslog( priority, format, ap );
+ va_end( ap );
+}
+
+#undef stderr
+FILE *stderr;
+
+static __attribute__(( constructor )) void
+init_stderr( void ) {
+ stderr = __stderrp;
+}
diff --git a/print/hplip-plugin/pkg-descr b/print/hplip-plugin/pkg-descr
index 8d1ebebb4f1f..3ec2cbc2fbbf 100644
--- a/print/hplip-plugin/pkg-descr
+++ b/print/hplip-plugin/pkg-descr
@@ -1,3 +1,3 @@
-Firmware and binary drivers from some HPLIP supported printers.
+Firmware and binary drivers for some HPLIP supported printers.
-WWW: http://hplipopensource.com/hplip-web/index.html
+WWW: http://hplipopensource.com/
diff --git a/print/hplip-plugin/pkg-plist b/print/hplip-plugin/pkg-plist
index 84e28ae373e1..6d6fce46d327 100644
--- a/print/hplip-plugin/pkg-plist
+++ b/print/hplip-plugin/pkg-plist
@@ -11,7 +11,6 @@ share/hplip/data/firmware/hp_laserjet_p1505.fw.gz
share/hplip/data/firmware/hp_laserjet_professional_p1102.fw.gz
share/hplip/data/firmware/hp_laserjet_professional_p1102w.fw.gz
share/hplip/data/firmware/hp_laserjet_professional_p1566.fw.gz
-share/hplip/data/plugins/license.txt
share/hplip/fax/plugins/fax_marvell-%%LINARCH%%.so
share/hplip/fax/plugins/fax_marvell.so
share/hplip/plugin.spec