Ticket #42776: Portfile

File Portfile, 6.3 KB (added by okmacports@…, 11 years ago)
Line 
1# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
2# $Id: $
3PortSystem      1.0
4
5name            hplip
6version         3.14.3
7revision        0
8categories      graphics
9platforms       darwin macosx
10homepage        http://hplipopensource.com
11license         {GPL-2 MIT BSD}
12maintainers johnfreed.com:okmacports
13description printing, scanning, and faxing for HP inkjet and laser printers
14long_description        HPLIP is an HP developed solution for printing, scanning, and faxing with HP inkjet and laser based printers
15master_sites    sourceforge:project/hplip/hplip/${version}
16
17checksums       rmd160  ebd307f9bf5831cbeac2b274f210aa8e2fc4e6b8 \
18        sha256  1805b103639b51b9d908921e1e77db66c6e78b792aa51e405a5415e8e1c55e6e
19
20patchfiles      patch-Makefile.am \
21        patch-Makefile.in \
22        patch-base_codes.py \
23        patch-base_g.py \
24        patch-base_utils.py \
25        patch-check.py \
26        patch-fax_backend_hpfax.py \
27        patch-hplip.conf.in \
28        patch-hplip.list.in \
29        patch-installer_core-install.py \
30        patch-installer_dcheck.py \
31        patch-installer_distros.dat \
32        patch-io_hpmud_files \
33        patch-ip_hpip.h \
34        patch-prnt_hpcups_files \
35        patch-prnt_hpijs_context2.cpp \
36        patch-prnt_hpijs_globals.cpp \
37        patch-prnt_hpijs_ljzjscolor.cpp \
38        patch-python \
39        patch-ui4_devmgr5.py \
40        patch-ui_devmgr4.py
41
42depends_lib-append      port:libusb \
43        port:jpeg \
44        port:sane-backends \
45        port:openssl \
46        port:net-snmp \
47        port:xorg-libpthread-stubs
48
49depends_run     bin:gs:espgs
50
51variant python26 conflicts python27 python32 description {Use python 2.6} {
52        depends_run-append      port:python26
53        depends_lib-append      port:dbus-python26
54}
55
56variant python27 conflicts python26 python32 description {Use python 2.7} {
57        depends_run-append      port:python27
58        depends_lib-append      port:dbus-python27
59}
60
61variant python32 conflicts python26 python27 description {Use python 3.2} {
62        depends_run-append      port:python32
63        depends_lib-append      port:dbus-python32
64}
65
66set python_branch 0
67
68if { [variant_isset python26] } {
69        set python_branch 2.6
70        set python_version 26
71}
72
73if { [variant_isset python27] } {
74        set python_branch 2.7
75        set python_version 27
76}
77
78if { [variant_isset python32] } {
79        set python_branch 3.2
80        set python_version 32
81}
82
83if { ${python_branch} == 0 } {
84        default_variants +python27
85        set python_branch 2.7
86        set python_version 27
87}
88
89set python_prefix       ${frameworks_dir}/Python.framework/Versions/${python_branch}
90set python_pkgd ${python_prefix}/lib/python${python_branch}/site-packages
91
92configure.python        ${python_prefix}/bin/python${python_branch}
93
94configure.env-append    PKG_CONFIG_LIBDIR=${prefix}/lib/pkgconfig PKG_CONFIG=${prefix}/pkg-config
95configure.env-append    DBUS_LIBS='-L${prefix}/lib -ldbus-1' DBUS_CFLAGS='-I${prefix}/include/dbus-1.0 -I${prefix}/lib/dbus-1.0/include'
96configure.cppflags-append       -I${python_prefix}/include
97configure.cflags-append -DDESTDIR=${prefix} -DPYTHON_EXEC_PREFIX=${python_prefix}
98
99configure.args  --disable-gui-build \
100        --disable-qt4 \
101        --with-cupsbackenddir=${prefix}/libexec/cups/backend \
102        --with-cupsfilterdir=${prefix}/libexec/cups/filter \
103        --with-icondir=${prefix}/share/applications \
104        --with-docdir=${prefix}/share/doc/${name} \
105        --with-htmldir=${prefix}/share/doc/${name} \
106        --with-hpppddir=${prefix}/share/ppd/HP \
107        --with-drvdir=${prefix}/share/cups/drv/hp \
108        --docdir=${prefix}/share/doc/${name} \
109        --htmldir=${prefix}/share/doc/${name} \
110        --datadir=${python_pkgd} 
111
112variant gui description {Build graphical interface}     {
113        depends_lib-append port:py${python_version}-pyqt4
114        configure.args-delete --disable-gui-build --disable-qt4
115               
116        post-destroot {
117                # need to use pythonw for PyQt scripts
118                reinplace "s|/usr/bin/env python|/usr/bin/env pythonw|" \
119                        ${destroot}${python_pkgd}/hplip/check.py\
120                        ${destroot}${python_pkgd}/hplip/print.py\
121                        ${destroot}${python_pkgd}/hplip/toolbox.py\
122                        ${destroot}${python_pkgd}/hplip/fab.py\
123                        ${destroot}${python_pkgd}/hplip/sendfax.py\
124                        ${destroot}${python_pkgd}/hplip/unload.py
125        }
126}
127
128post-patch {
129        #don't hardcode $prefix
130        reinplace "s|@PREFIX@|${prefix}|" ${worksrcpath}/installer/dcheck.py \
131                ${worksrcpath}/Makefile.am \
132                ${worksrcpath}/Makefile.in \
133                ${worksrcpath}/base/codes.py \
134                ${worksrcpath}/base/g.py \
135                ${worksrcpath}/check.py \
136                ${worksrcpath}/fax/backend/hpfax.py \
137                ${worksrcpath}/hplip.conf.in \
138                ${worksrcpath}/hplip.list.in \
139                ${worksrcpath}/installer/core_install.py \
140                ${worksrcpath}/installer/distros.dat \
141                ${worksrcpath}/prnt/hpijs/globals.cpp \
142                ${worksrcpath}/ui4/devmgr5.py \
143                ${worksrcpath}/ui/devmgr4.py
144
145        #don't hardcode $python_prefix
146        reinplace "s|@PYTHON_PREFIX@|${python_prefix}|" ${worksrcpath}/installer/core_install.py
147
148        # kludge because HFS is case insensitive for filenames
149        file rename ${worksrcpath}/prnt/hpcups/Utils.h ${worksrcpath}/prnt/hpcups/HPCupsUtils.h
150        file rename ${worksrcpath}/prnt/hpcups/Utils.cpp ${worksrcpath}/prnt/hpcups/HPCupsUtils.cpp
151}
152
153
154post-destroot   {       
155
156        # Deleting fax drivers
157        file delete ${destroot}/usr/share/cups/mime/pstotiff.convs
158        file delete ${destroot}/usr/share/cups/mime/pstotiff.types
159
160        # don't need these
161        file delete ${destroot}/etc/xdg/autostart/hplip-systray.desktop
162        file delete ${destroot}/usr/share/hal/fdi/preprobe/10osvendor/20-hplip-devices.fdi
163        file delete ${destroot}/usr/share/applications/hplip.desktop
164        file delete ${destroot}/usr/lib/systemd/system/hplip-printer@.service
165        file delete ${destroot}/etc/udev/rules.d/56-hpmud.rules
166
167        # delete dll.conf file, which HPLIP does wrong, and do it right
168        file delete ${destroot}${prefix}/etc/sane.d/dll.conf
169        file mkdir ${destroot}${prefix}/etc/sane.d/dll.d/
170        file copy -force ${filespath}/hpaio ${destroot}${prefix}/etc/sane.d/dll.d/hpaio
171
172        #install python modules into site-packages
173        file copy ${worksrcpath}/.libs/cupsext.so ${destroot}${python_pkgd}/${name}/
174        file copy ${worksrcpath}/.libs/hpmudext.so ${destroot}${python_pkgd}/${name}/
175        file copy ${worksrcpath}/.libs/pcardext.so ${destroot}${python_pkgd}/${name}/
176        file copy ${worksrcpath}/.libs/scanext.so ${destroot}${python_pkgd}/${name}/
177}
178
179
180notes "You will get the following error if you have not properly set up dbus:
181Dynamic session lookup supported but failed: launchd did not provide a socket path, verify that org.freedesktop.dbus-session.plist is loaded!
182
183To repair this, you must launch the dbus daemon systemwide:
184sudo launchctl load -w /Library/LaunchDaemons/org.freedesktop.dbus-system.plist
185
186Then for EACH user who wants access, the user must launch the dbus agent:
187launchctl load -w /Library/LaunchAgents/org.freedesktop.dbus-session.plist"