Ticket #7201: Portfile.3

File Portfile.3, 6.2 KB (added by aschenke@…, 19 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
27depends_run      bin:gs:espgs \
28                 port:py-readline
29
30configure.args   --disable-pp-build
31configure.env    LDFLAGS="-L${prefix}/lib" \
32                 CPPFLAGS="-I${prefix}/include"
33
34# change location so we don't have to install hplip.conf in root /etc               
35pre-configure    {
36                    reinplace "s|/etc/hp|${prefix}/etc/hp|g" ${worksrcpath}/base/g.py
37                    reinplace "s|/etc/hp|${prefix}/etc/hp|g" ${worksrcpath}/fax/backend/hpfax.py
38                    reinplace "s|/etc/hp|${prefix}/etc/hp|g" ${worksrcpath}/hpssd.py
39                    reinplace "s|/etc/hp|${prefix}/etc/hp|g" ${worksrcpath}/io/hpiod/hpiod.h
40                    reinplace "s|/etc/hp|${prefix}/etc/hp|g" ${worksrcpath}/Makefile.am
41                    reinplace "s|/etc/hp|${prefix}/etc/hp|g" ${worksrcpath}/Makefile.in
42                    reinplace "s|/etc/hp|${prefix}/etc/hp|g" ${worksrcpath}/prnt/hpijs/hplip_api.h
43                 }
44
45# SANE needs backends in shared object (.so) format; for some reason this file is not
46# built by the hplip Makefile, so we need to do it ourselves
47post-build       {
48                    system "gcc -bundle -flat_namespace -undefined suppress \
49                    -L${worksrcpath}/.libs -o ${worksrcpath}/.libs/libsane-hpaio.1.0.0.so \
50                    ${worksrcpath}/.libs/*.o -fno-common -fPIC"
51                 }
52   
53post-destroot    { 
54                    # install the (correct) backend library
55                    file delete ${destroot}${prefix}/lib/sane/libsane-hpaio.so
56                    file delete ${destroot}${prefix}/lib/sane/libsane-hpaio.so.1
57                    file delete ${destroot}${prefix}/lib/sane/libsane-hpaio.so.1.0.0
58                    file copy ${worksrcpath}/.libs/libsane-hpaio.1.0.0.so \
59                          ${destroot}${prefix}/lib/sane/libsane-hpaio.1.0.0.so
60                    system "cd ${destroot}${prefix}/lib/sane && ln -s -f libsane-hpaio.1.0.0.so \
61                         libsane-hpaio.1.so && ln -s -f libsane-hpaio.1.0.0.so \
62                         libsane-hpaio.so"
63                    file copy ${destroot}${prefix}/lib/libsane-hpaio.la \
64                         ${destroot}${prefix}/lib/sane/libsane-hpaio.la
65                         
66                    reinplace "s|dylib|so|g" ${destroot}${prefix}/lib/sane/libsane-hpaio.la
67                    reinplace "s|shouldnotlink=no|shouldnotlink=yes|" ${destroot}${prefix}/lib/sane/libsane-hpaio.la
68                    reinplace "s|libdir='/opt/local/lib'|libdir='/opt/local/lib/sane'|" \
69                         ${destroot}${prefix}/lib/sane/libsane-hpaio.la
70 
71                    file delete ${destroot}${prefix}/lib/libsane-hpaio.1.dylib
72                    file delete ${destroot}${prefix}/lib/libsane-hpaio.1.0.0.dylib
73                    file delete ${destroot}${prefix}/lib/libsane-hpaio.dylib
74                    file delete ${destroot}${prefix}/lib/libsane-hpaio.la                   
75
76                    # need to use pythonw for PyQt scripts
77                    reinplace "s|/usr/bin/env python|/usr/bin/env pythonw|" \
78                         ${destroot}${prefix}/bin/hp-check
79                    reinplace "s|/usr/bin/env python|/usr/bin/env pythonw|" \
80                         ${destroot}${prefix}/bin/hp-print
81                    reinplace "s|/usr/bin/env python|/usr/bin/env pythonw|" \
82                         ${destroot}${prefix}/bin/hp-toolbox                                               
83                    reinplace "s|/usr/bin/env python|/usr/bin/env pythonw|" \
84                         ${destroot}${prefix}/bin/hp-fab
85                    reinplace "s|/usr/bin/env python|/usr/bin/env pythonw|" \
86                         ${destroot}${prefix}/bin/hp-sendfax
87                    reinplace "s|/usr/bin/env python|/usr/bin/env pythonw|" \
88                         ${destroot}${prefix}/bin/hp-unload                         
89
90                    # this file is provided by sane-backends port; don't need it
91                    file delete ${destroot}/etc/sane.d/dll.conf
92                   
93                    # dont need this; moved to ${prefix}/etc
94                    file delete ${destroot}/etc/hp/hplip.conf
95                   
96                    # this file is the hplip daemons script
97                    xinstall -m 755 -d ${destroot}${prefix}/etc/init.d/
98                    file copy ${destroot}/etc/init.d/hplip ${destroot}${prefix}/etc/init.d/hplip
99                    file delete ${destroot}/etc/init.d/hplip
100
101                    # need to change foomatic-rip to find Mac OS X CUPS filters
102                    reinplace "s|/usr/local|${prefix}|g" ${destroot}${prefix}/bin/foomatic-rip
103                    reinplace "s|/usr/lib/cups/filter|/usr/libexec/cups/filter|" \
104                        ${destroot}${prefix}/bin/foomatic-rip
105                 }
106
107post-install     {
108                    # if sane-backends is installed, add "hpaio" to dll.conf so it
109                    # will recognize the backend 
110                    if { [ file exists ${prefix}/etc/sane.d/dll.conf ] } then \
111                        {
112                            system "echo '# the following line is added by hplip to\
113                            support scanning by SANE' >> ${prefix}/etc/sane.d/dll.conf"
114                            system "echo 'hpaio' >> ${prefix}/etc/sane.d/dll.conf"
115                        }
116                 }