Ticket #7201: Portfile.4

File Portfile.4, 6.2 KB (added by aschenke@…, 18 years ago)

Portfile for hplip 0.9.10 (partly-working)

Line 
1# $Id: $
2
3PortSystem       1.0
4name                 hplip
5version              0.9.10
6revision             0
7categories           print
8platforms        macosx
9maintainers          darwinports@opendarwin.org
10description          printing, scanning, and faxing for HP inkjet and laser printers
11long_description HPLIP is an HP developed solution for printing, scanning, and \
12                 faxing with HP inkjet and laser based printers
13master_sites     sourceforge
14checksums            md5 349489b10fb44d1bf105b04ff5352551
15
16# create startup item for the hplip daemons
17startupitem.create  yes
18startupitem.start   { ${prefix}/etc/init.d/hplip start }
19startupitem.stop    { ${prefix}/etc/init.d/hplip stop }
20startupitem.restart { ${prefix}/etc/init.d/hplip restart }
21                   
22patchfiles       patch-io_hpiod_device.cpp
23
24depends_lib      port:libusb \
25                 port:jpeg \
26                 port:PyQt \
27                 port:sane-backends
28depends_run      bin:gs:espgs \
29                 port:py-readline \
30                 port:py-reportlab
31
32configure.args   --disable-pp-build
33configure.env    LDFLAGS="-L${prefix}/lib" \
34                 CPPFLAGS="-I${prefix}/include"
35
36# change location so we don't have to install hplip.conf in root /etc               
37pre-configure    {
38                    reinplace "s|/etc/hp|${prefix}/etc/hp|g" ${worksrcpath}/base/g.py
39                    reinplace "s|/etc/hp|${prefix}/etc/hp|g" ${worksrcpath}/fax/backend/hpfax.py
40                    reinplace "s|/etc/hp|${prefix}/etc/hp|g" ${worksrcpath}/hpssd.py
41                    reinplace "s|/etc/hp|${prefix}/etc/hp|g" ${worksrcpath}/io/hpiod/hpiod.h
42                    reinplace "s|/etc/hp|${prefix}/etc/hp|g" ${worksrcpath}/Makefile.am
43                    reinplace "s|/etc/hp|${prefix}/etc/hp|g" ${worksrcpath}/Makefile.in
44                    reinplace "s|/etc/hp|${prefix}/etc/hp|g" ${worksrcpath}/prnt/hpijs/hplip_api.h
45                 }
46
47# SANE needs backends in shared object (.so) format; for some reason this file is not
48# built by the hplip Makefile, so we need to do it ourselves
49post-build       {
50                    system "gcc -bundle -flat_namespace -undefined suppress \
51                    -L${worksrcpath}/.libs -o ${worksrcpath}/.libs/libsane-hpaio.1.0.0.so \
52                    ${worksrcpath}/.libs/*.o -fno-common -fPIC"
53                 }
54   
55post-destroot    { 
56                    # install the (correct) backend library
57                    file delete ${destroot}${prefix}/lib/sane/libsane-hpaio.so
58                    file delete ${destroot}${prefix}/lib/sane/libsane-hpaio.so.1
59                    file delete ${destroot}${prefix}/lib/sane/libsane-hpaio.so.1.0.0
60                    file copy ${worksrcpath}/.libs/libsane-hpaio.1.0.0.so \
61                          ${destroot}${prefix}/lib/sane/libsane-hpaio.1.0.0.so
62                    system "cd ${destroot}${prefix}/lib/sane && ln -s -f libsane-hpaio.1.0.0.so \
63                         libsane-hpaio.1.so && ln -s -f libsane-hpaio.1.0.0.so \
64                         libsane-hpaio.so"
65                    file copy ${destroot}${prefix}/lib/libsane-hpaio.la \
66                         ${destroot}${prefix}/lib/sane/libsane-hpaio.la
67                         
68                    reinplace "s|dylib|so|g" ${destroot}${prefix}/lib/sane/libsane-hpaio.la
69                    reinplace "s|shouldnotlink=no|shouldnotlink=yes|" ${destroot}${prefix}/lib/sane/libsane-hpaio.la
70                    reinplace "s|libdir='/opt/local/lib'|libdir='/opt/local/lib/sane'|" \
71                         ${destroot}${prefix}/lib/sane/libsane-hpaio.la
72 
73                    file delete ${destroot}${prefix}/lib/libsane-hpaio.1.dylib
74                    file delete ${destroot}${prefix}/lib/libsane-hpaio.1.0.0.dylib
75                    file delete ${destroot}${prefix}/lib/libsane-hpaio.dylib
76                    file delete ${destroot}${prefix}/lib/libsane-hpaio.la                   
77
78                    # need to use pythonw for PyQt scripts
79                    reinplace "s|/usr/bin/env python|/usr/bin/env pythonw|" \
80                         ${destroot}${prefix}/bin/hp-check
81                    reinplace "s|/usr/bin/env python|/usr/bin/env pythonw|" \
82                         ${destroot}${prefix}/bin/hp-print
83                    reinplace "s|/usr/bin/env python|/usr/bin/env pythonw|" \
84                         ${destroot}${prefix}/bin/hp-toolbox                                               
85                    reinplace "s|/usr/bin/env python|/usr/bin/env pythonw|" \
86                         ${destroot}${prefix}/bin/hp-fab
87                    reinplace "s|/usr/bin/env python|/usr/bin/env pythonw|" \
88                         ${destroot}${prefix}/bin/hp-sendfax
89                    reinplace "s|/usr/bin/env python|/usr/bin/env pythonw|" \
90                         ${destroot}${prefix}/bin/hp-unload                         
91
92                    # this file is provided by sane-backends port; don't need it
93                    file delete ${destroot}/etc/sane.d/dll.conf
94                   
95                    # dont need this; moved to ${prefix}/etc
96                    file delete ${destroot}/etc/hp/hplip.conf
97                   
98                    # this file is the hplip daemons script
99                    xinstall -m 755 -d ${destroot}${prefix}/etc/init.d/
100                    file copy ${destroot}/etc/init.d/hplip ${destroot}${prefix}/etc/init.d/hplip
101                    file delete ${destroot}/etc/init.d/hplip
102
103                    # need to change foomatic-rip to find Mac OS X CUPS filters
104                    reinplace "s|/usr/local|${prefix}|g" ${destroot}${prefix}/bin/foomatic-rip
105                    reinplace "s|/usr/lib/cups/filter|/usr/libexec/cups/filter|" \
106                        ${destroot}${prefix}/bin/foomatic-rip
107                 }
108
109post-install     {
110                    # if sane-backends is installed, add "hpaio" to dll.conf so it
111                    # will recognize the hpaio backend 
112                    if { [ file exists ${prefix}/etc/sane.d/dll.conf ] } then \
113                        {
114                            system "echo '# the following line is added by hplip to\
115                            support scanning by SANE' >> ${prefix}/etc/sane.d/dll.conf"
116                            system "echo 'hpaio' >> ${prefix}/etc/sane.d/dll.conf"
117                        }
118                 }