1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-05 06:27:37 +00:00

- 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
This commit is contained in:
Tijl Coosemans 2016-03-21 11:21:28 +00:00
parent 10b8502908
commit 88ed0378c2
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=411553
6 changed files with 109 additions and 70 deletions

View File

@ -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 # arm
ONLY_FOR_ARCHS= amd64 i386
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-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
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:
${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>

View File

@ -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)

View File

@ -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:

View File

@ -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;
}

View File

@ -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/

View File

@ -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