porting pips-lite?

porting started

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:
Code:
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:
Code:
root@kg-v2# cups-config --ldflags
-Wl,-R/usr/local/lib -L/usr/local/lib
and then I check what's in the Makefile:
Code:
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?
 
I forgot to say, but the answer is yes:
Code:
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.
 
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:
Code:
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 said:
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.
 
I was able to compile it with the following patch :
Code:
--- 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 */
 
tingo said:
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.
 
acheron said:
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:
Code:
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.
 
Ok, a new error:
Code:
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?
 
wblock said:
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.
 
Ok, I added this to ./makeinstall/utility.c:
Code:
#ifdef __FreeBSD__
typedef int (*__compar_fn_t) (__const void *, __const void *);
#endif
and now it compiles. Yay! ;^)
 
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:
Code:
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.
 
picking up this old thread.
Tonight I got a bit further with testing. I ran
Code:
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:
Code:
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:
Code:
$ 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):
Code:
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.
 
Back
Top