Ticket #7201: Portfile.7

File Portfile.7, 6.2 KB (added by aschenke@…, 17 years ago)

Portfile

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