PDA

View Full Version : porting pips-lite?


tingo
May 13th, 2011, 23:25
I got myself a new printer (http://forums.freebsd.org/showthread.php?t=23792), and I couldn't find a good driver for it in ports. But it seems that the source for pips-lite (http://linux.avasys.jp/drivers/pipslite/doc/1.5.0-2/README) is available. Has anybody tried to port this?

tingo
May 22nd, 2011, 21:03
OK, so tonight I got my feet wet and tried porting pipslite (pipslite_1.5.0-3.tar.gz) myself. After fixing an easy one (including malloc.h instead of stdlib.h), I hit another snag:

Making all in filter-l2
/bin/sh ../../libtool --tag=CC --mode=link gcc
-CUPS_FILTER_PATH=\"/usr/local/local/libexec/cups/filter\"
-I../../lib-l2 -I../../src/filter-l2/ -g -O2
-Wall -o pipslitel2-filter analyze.o animate.o annotate.o attribute.o blob.o channel.o
color.o colorspace.o command.o composite.o compress.o constitute.o decorate.o delegate.o deprecate.o
display.o draw.o effect.o enhance.o error.o fx.o gem.o image.o list.o locale.o log.o magic.o
magick.o magick_endian.o map.o memory.o module.o monitor.o montage.o operator.o paint.o
pixel_cache.o pixel_iterator.o PreRvIcccm.o profile.o quantize.o registry.o render.o resize.o
resource.o segment.o semaphore.o shear.o signature.o static.o sun.o tempfile.o timer.o transform.o
tsd.o type.o unix_port.o utility.o version.o widget.o xwindow.o l2filter.o ../../lib-l2/liblitel2.la
-lcups -lm -lcupsimage -lcups -ljpeg -lm -lpthread
gcc -DCUPS_FILTER_PATH=\"/usr/local/local/libexec/cups/filter\" -I../../lib-l2 -I../../src/filter-l2/ -g
-O2 -Wall -o .libs/pipslitel2-filter analyze.o animate.o annotate.o attribute.o blob.o channel.o color.o
colorspace.o command.o composite.o compress.o constitute.o decorate.o delegate.o deprecate.o display.o
draw.o effect.o enhance.o error.o fx.o gem.o image.o list.o locale.o log.o magic.o magick.o
magick_endian.o map.o memory.o module.o monitor.o montage.o operator.o paint.o pixel_cache.o
pixel_iterator.o PreRvIcccm.o profile.o quantize.o registry.o render.o resize.o resource.o segment.o
semaphore.o shear.o signature.o static.o sun.o tempfile.o timer.o transform.o tsd.o type.o unix_port.o
utility.o version.o widget.o xwindow.o l2filter.o ../../lib-l2/.libs/liblitel2.so -lcupsimage -lcups
-ljpeg -lm -lpthread -Wl,--rpath -Wl, /usr/local/lib
/usr/bin/ld: cannot find -lcupsimage
*** Error code 1

Stop in /usr/home/tingo/work/pipslite/src/filter-l2.
*** Error code 1

Stop in /usr/home/tingo/work/pipslite/src.
*** Error code 1

Stop in /usr/home/tingo/work/pipslite.
*** Error code 1

Stop in /usr/home/tingo/work/pipslite.
The problem is that as far as I can tell, configure has figured it out correctly:
First I check cups-config:
root@kg-v2# cups-config --ldflags
-Wl,-R/usr/local/lib -L/usr/local/lib
and then I check what's in the Makefile:
tingo@kg-v2$ grep CUPS_LDFLAGS ./src/filter-l2/Makefile
CUPS_LDFLAGS = -Wl,-R/usr/local/lib -L/usr/local/lib
That looks correct to me. I tried googling, but didn't get anything that was helpful to me. Any pointer on how to fix this problem?

Pjoter
May 23rd, 2011, 12:23
Do you have print/cups-image package installed?

tingo
May 23rd, 2011, 18:53
I forgot to say, but the answer is yes:
root@kg-v2# portversion -v | grep cups
cups-base-1.4.6_4 = up-to-date with port
cups-client-1.4.6 = up-to-date with port
cups-image-1.4.6 = up-to-date with port
cups-pstoraster-8.15.4_6 = up-to-date with port

I'll have a look at configure options and see if that can help.

tingo
May 23rd, 2011, 21:37
OK, some more progress today. I'm currently using this configure line:
./configure --with-libintl-prefix=/usr/local LIBS=-lintl LDFLAGS=-L/usr/local/lib
Followed by
make clean; make

Which lands me here:

gcc -DHAVE_CONFIG_H -I. -I.. -I../src/filter-l2/magick -DCONFIG_FILE_PATH=\"/usr/local/etc/pipslite/pipslitedrc\" -I/usr/local/include
-g -O2 -Wall -MT cbtd_setup.o -MD -MP -MF .deps/cbtd_setup.Tpo -c -o cbtd_setup.o cbtd_setup.c
cbtd_setup.c: In function 'is_searching_printer':
cbtd_setup.c:70: error: '_IOC_READ' undeclared (first use in this function)
cbtd_setup.c:70: error: (Each undeclared identifier is reported only once
cbtd_setup.c:70: error: for each function it appears in.)
*** Error code 1

Stop in /usr/home/tingo/work/pipslite/daemon.
*** Error code 1

Stop in /usr/home/tingo/work/pipslite/daemon.
*** Error code 1

Stop in /usr/home/tingo/work/pipslite.
*** Error code 1

Stop in /usr/home/tingo/work/pipslite.

That was it for today.

wblock@
May 23rd, 2011, 22:22
Make a port, using one of the other CUPS filter ports as a template.

tingo
May 29th, 2011, 22:20
Make a port, using one of the other CUPS filter ports as a template.
That's the idea, I just need to get it to compile first. Hopefully I will have some time to work on it this week.

acheron
May 31st, 2011, 18:01
I was able to compile it with the following patch :

--- daemon/cbtd_setup.c.orig 2011-05-31 18:56:45.813178092 +0200
+++ daemon/cbtd_setup.c 2011-05-31 18:57:29.557178284 +0200
@@ -31,6 +31,7 @@

#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/ioccom.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <unistd.h>
@@ -67,7 +68,7 @@
memset(deviceid, 0x00, DEVICEID_LENGTH);

/* GET_DEVICE_ID = 1 */
- int iostatus = ioctl(fd, _IOC(_IOC_READ, 'P', 1, DEVICEID_LENGTH), deviceid);
+ int iostatus = ioctl(fd, _IOC(IOC_OUT, 'P', 1, DEVICEID_LENGTH), deviceid);
if (iostatus == 0) {
if (strstr(deviceid + 2, printer)) {
result = 0; /* found */

wblock@
May 31st, 2011, 21:47
That's the idea, I just need to get it to compile first. Hopefully I will have some time to work on it this week.

I meant that copying one of the existing ports may show how to get this one to compile on FreeBSD.

tingo
June 4th, 2011, 11:09
I was able to compile it with the following patch:

That patch helps - thanks!
But even so, for me it hangs at this sed command:

gcc -g -O2 -Wall -o pipslited cbtd.o cbtd_comserv.o cbtd_datatrans.o cbtd_setup.o cbtd_signal.o cbtd_thread.o cbtd_wrapper.o ecbteg.o
daemon_osfunc.o -L/usr/local/lib -lpthread /usr/local/lib/libintl.so /usr/local/lib/libiconv.so -Wl,--rpath -Wl,/usr/local/lib -Wl,
--rpath -Wl,/usr/local/lib
sed "s,%model_name%,lite,; s,%default_devpath%,/dev/usb/lp0," > pipslitedrc
I don't know why.
Update: ok, gmake worked better than make.

tingo
June 4th, 2011, 11:32
Ok, a new error:

gcc -DHAVE_CONFIG_H -I. -I.. -I../src/filter-l2/magick -I../src -I../status-monitor -D_THREAD_SAFE -D_REENTRANT -I/usr/local/include/gtk-2.0
-I/usr/local/lib/gtk-2.0/include -I/usr/local/include/atk-1.0 -I/usr/local/include/cairo -I/usr/local/include/gdk-pixbuf-2.0
-I/usr/local/include/pango-1.0 -I/usr/local/include/gio-unix-2.0/ -I/usr/local/include -I/usr/local/include/glib-2.0
-I/usr/local/lib/glib-2.0/include -I/usr/local/include/pixman-1 -I/usr/local/include/freetype2 -I/usr/local/include/drm
-I/usr/local/include -DPRTOPT_PATH=\"/usr/local/var/cache/pipslite/prtOpt.csv\" -DPAPER_PATH=\"/usr/local/share/pipslite/paper_list.csv\"
-DCACHEDIR_PATH=\"/usr/local/var/cache/pipslite/\" -DPPDINSTALL_SH=\"/usr/local/lib/pipslite/scripts/install-ppd.sh\" -g -O2 -Wall
-MT utility.o -MD -MP -MF .deps/utility.Tpo -c -o utility.o utility.c
utility.c: In function 'list_create_index':
utility.c:328: error: '__compar_fn_t' undeclared (first use in this function)
utility.c:328: error: (Each undeclared identifier is reported only once
utility.c:328: error: for each function it appears in.)
utility.c:328: error: expected ')' before 'list_handle'
utility.c: In function 'list_find_item':
utility.c:363: error: '__compar_fn_t' undeclared (first use in this function)
utility.c:363: error: expected ')' before 'list_handle'
gmake[2]: *** [utility.o] Error 1
gmake[2]: Leaving directory `/usr/home/tingo/work/pipslite/makeinstall'
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory `/usr/home/tingo/work/pipslite'
gmake: *** [all] Error 2
AFAICT, __compar_fn_t is a Linuxism. Do we have something in FreeBSD that I should replace it with? (I tried Google, but didn't find anything promising).

@acheron: did you not get this error?

tingo
June 4th, 2011, 11:38
I meant that copying one of the existing ports may show how to get this one to compile on FreeBSD.

Well, I prefer to only deal with one problem at a time. :-)
Getting into a port with dependencies and so on is something I'll tackle after I know what patches and so on to add to pipslite in order to get it compiled.

acheron
June 4th, 2011, 18:23
Replace __compar_fn_t with void*, don't know if the patch is right though.

tingo
June 4th, 2011, 19:46
Ok, I added this to ./makeinstall/utility.c:
#ifdef __FreeBSD__
typedef int (*__compar_fn_t) (__const void *, __const void *);
#endif
and now it compiles. Yay! ;^)

tingo
June 6th, 2011, 21:58
Ok, there is just one (more) thing I haven't figured out yet: why is there both a pipslite-filter and a pipslitel2-filter?
Here are the binaries in the build directories:
tingo@kg-v2$ pwd
/home/tingo/work/pipslite
tingo@kg-v2$ find . -type f -perm +a=x -print
./debian/rules
./src/filter-l2/.libs/pipslitel2-filter
./src/filter-l2/pipslitel2-filter
./src/pipslitelp
./src/pipslite-wrapper
./src/pipslite-filter
./makeinstall/pipslite-install
./config.guess
./status-monitor/pipslitestm
./missing
./lib/.libs/liblite.so.1
./mkinstalldirs
./depcomp
./daemon/pipslited
./install-sh
./config.sub
./configure
./lib-l2/.libs/liblitel2.so.1
./libtool
./config.status
Just ignoring the obvious (scripts for the build process) suspects gives this list:
./src/filter-l2/pipslitel2-filter
./src/pipslitelp
./src/pipslite-wrapper
./src/pipslite-filter
./makeinstall/pipslite-install
./status-monitor/pipslitestm
./daemon/pipslited
(I skipped the libraries for brevity).
So what is the difference between pipslite-filter and pipslitel2-filter?
All the ppd files uses pipslite-wrapper as a filter, so no help in looking there.

tingo
October 12th, 2011, 23:25
picking up this old thread.
Tonight I got a bit further with testing. I ran
su; gmake install
from the build directory.
Afterwards I configured my printer from the cups webinterface - worked nicely. However, the first test print failed, because cups couldn't find /usr/local/libexec/cups/filter/pipslite-wrapper
Somehow, the install process had copied a few files to /usr/local/local/libexec/cups/filter instead. i fixed that manually:
root@kg-v2# cp -pv /usr/local/local/libexec/cups/filter/p* /usr/local/libexec/cups/filter
/usr/local/local/libexec/cups/filter/pipslitel2-filter -> /usr/local/libexec/cups/filter/pipslitel2-filter
/usr/local/local/libexec/cups/filter/pipslite-wrapper -> /usr/local/libexec/cups/filter/pipslite-wrapper
/usr/local/local/libexec/cups/filter/pipslite-filter -> /usr/local/libexec/cups/filter/pipslite-filter
root@kg-v2#
After that, printing works.
There is still one snag: if I try to print a file from the command line with lpr, like this:
$ lpr -P printer filename.pdf
only the first page of the file is printed, and then cups reports (Jobs display, under the "state" column in the web interface):
stopped
"/usr/local/libexec/cups/filter/pstoraster failed"
I don't know if this is a cups problem, or a pips-lite problem.
Printing the same file from within acroread works.