Ticket #7201: Portfile.2

File Portfile.2, 4.8 KB (added by aschenke@…, 18 years ago)

Portfile for hplip-0.9.10 (slightly-less-experimental)

Line 
1# $Id: $
2
3PortSystem       1.0
4name                 hplip
5version              0.9.10
6revision             0
7categories           print
8platforms        darwin
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   {
19                        /System/Library/StartupItems/PrintingServices/PrintingServices stop; \
20                        ${prefix}/etc/init.d/hplip start; \
21                        /System/Library/StartupItems/PrintingServices/PrintingServices start;
22                    }
23startupitem.stop    ${prefix}/etc/init.d/hplip stop
24startupitem.restart {
25                        /System/Library/StartupItems/PrintingServices/PrintingServices stop; \
26                        ${prefix}/etc/init.d/hplip restart; \
27                        /System/Library/StartupItems/PrintingServices/PrintingServices start;
28                    }
29
30depends_lib      port:libusb \
31                 port:jpeg \
32                 port:PyQt
33depends_run      bin:gs:espgs \
34                 port:py-readline
35
36configure.args   --disable-pp-build
37configure.env    LDFLAGS="-L${prefix}/lib" \
38                 CPPFLAGS="-I${prefix}/include -no-cpp-precomp -fno-common"
39
40# SANE needs backends in shared object format (.so); for some reason this file is not
41# built by the hplip Makefile, so we need to do it ourselves
42post-build       {
43                    system "gcc -flat_namespace -Wl,-undefined,suppress \
44                    -L${worksrcpath}/.libs -o ${worksrcpath}/libsane-hpaio.1.so -bundle \
45                    ${worksrcpath}/.libs/hpaio.o ${worksrcpath}/.libs/mfpdtf.o \
46                    ${worksrcpath}/.libs/pml.o ${worksrcpath}/.libs/scl.o \
47                    ${worksrcpath}/.libs/io.o -lcrypto -lpthread -lnetsnmp \
48                    -L${worksrcpath}/.libs/ -lhpip -lhplip-api"
49                 }
50   
51post-destroot    { 
52                    # install the (correct) backend library
53                    file delete ${destroot}${prefix}/lib/sane/libsane-hpaio.so
54                    file delete ${destroot}${prefix}/lib/sane/libsane-hpaio.so.1
55                    file delete ${destroot}${prefix}/lib/sane/libsane-hpaio.so.1.0.0
56                    xinstall -m 755 ${worksrcpath}/libsane-hpaio.1.so \
57                        ${destroot}${prefix}/lib/sane
58                   
59                    # need to use pythonw for PyQt scripts
60                    reinplace "s|/usr/bin/env python|/usr/bin/env pythonw|" \
61                         ${destroot}${prefix}/bin/hp-check
62                    reinplace "s|/usr/bin/env python|/usr/bin/env pythonw|" \
63                         ${destroot}${prefix}/bin/hp-print
64                    reinplace "s|/usr/bin/env python|/usr/bin/env pythonw|" \
65                         ${destroot}${prefix}/bin/hp-toolbox                                               
66                    reinplace "s|/usr/bin/env python|/usr/bin/env pythonw|" \
67                         ${destroot}${prefix}/bin/hp-fab
68                    reinplace "s|/usr/bin/env python|/usr/bin/env pythonw|" \
69                         ${destroot}${prefix}/bin/hp-sendfax
70                    reinplace "s|/usr/bin/env python|/usr/bin/env pythonw|" \
71                         ${destroot}${prefix}/bin/hp-unload                         
72
73                    # this file is provided by sane-backends port; don't need it
74                    file delete ${destroot}/etc/sane.d/dll.conf
75
76                    # this file is the hplip daemons script
77                    xinstall -m 755 -d ${destroot}${prefix}/etc/init.d/
78                    file copy ${destroot}/etc/init.d/hplip ${destroot}${prefix}/etc/init.d/hplip
79                    file delete ${destroot}/etc/init.d/hplip
80
81                    # need to change foomatic-rip to find Mac OS X CUPS filters
82                    reinplace "s|/usr/local|${prefix}|g" ${destroot}${prefix}/bin/foomatic-rip
83                    reinplace "s|/usr/lib/cups/filter|/usr/libexec/cups/filter|" \
84                        ${destroot}${prefix}/bin/foomatic-rip
85                 }
86
87post-install     {
88                    # if sane-backends is installed, add "hpaio" to dll.conf so it
89                    # will recognize the backend 
90                    if { [ file exists ${prefix}/etc/sane.d/dll.conf ] } then \
91                        {
92                            system "echo '# the following line is added by hplip to\
93                            support scanning by SANE' >> ${prefix}/etc/sane.d/dll.conf"
94                            system "echo 'hpaio' >> ${prefix}/etc/sane.d/dll.conf"
95                        }
96                 }