Ticket #7201: Portfile.8

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