source: trunk/dports/devel/dbus/Portfile

Last change on this file was 153937, checked in by mcalhoun@…, 13 months ago

dbus: update version 1.10.10->1.10.12

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 12.5 KB
Line 
1# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4
2# $Id: Portfile 153937 2016-10-16 16:31:55Z ryandesign@macports.org $
3
4PortSystem      1.0
5PortGroup       muniversal 1.0
6
7name            dbus
8conflicts       dbus-devel
9version         1.10.12
10#revision        0
11maintainers     mcalhoun openmaintainer
12categories      devel
13platforms       darwin
14license         {AFL-2.1 GPL-2+}
15description     A message bus system, a simple way for applications to talk to one another.
16
17long_description \
18    ${description}
19
20homepage        https://www.freedesktop.org/wiki/Software/dbus/
21master_sites    https://dbus.freedesktop.org/releases/dbus/
22
23checksums       rmd160  b9e41301165810ae3b413da929b90de0815a9c75 \
24                sha256  210a79430b276eafc6406c71705e9140d25b9956d18068df98a70156dc0e475d
25
26# See r68276
27# For configure
28#    poll is always broken
29#    see https://trac.macports.org/ticket/47741#comment:12 for EXTERNAL authentication
30patchfiles      patch-bus-system.conf.in.diff \
31                patch-configure.diff
32
33# see https://bugs.freedesktop.org/show_bug.cgi?id=9449
34if {$macosx_deployment_target eq "10.4"} {
35    patchfiles-append patch-tiger-org.freedesktop.dbus-session.plist.in.diff
36} else {
37    patchfiles-append patch-org.freedesktop.dbus-session.plist.in.diff
38}
39
40depends_build       \
41    port:pkgconfig
42
43unset -nocomplain startup_root
44if { [variant_isset no_root] } {
45    set dbus_user     ${install.user}
46    set dbus_group    ${install.group}
47
48    # look for place to install startup files
49    if { [tbool startupitem.install] } {
50        # See #28121 and #42994
51        #set startup_root  [join [lrange [exec /usr/bin/dscl . -read Users/${install.user} NFSHomeDirectory] 1 end]]
52        #set startup_root  [join [lrange [exec /usr/bin/dscl '/Active Directory/All Domains' -read Users/${install.user} NFSHomeDirectory] 1 end]]
53        foreach datasource [list . "'/Active Directory/All Domains'" ] {
54            if { ! [catch {system "/usr/bin/dscl ${datasource} -read Users/${install.user} NFSHomeDirectory"}] } {
55                ui_debug "dscl found ${install.user} in ${datasource}"
56                set startup_root [join [lrange [exec /usr/bin/dscl ${datasource} -read Users/${install.user} NFSHomeDirectory] 1 end]]
57                break
58            } else {
59                ui_debug "dscl can not find ${install.user} in ${datasource}"
60            }
61        }
62        if { ! [info exists startup_root] } {
63            if { ![tbool startupitem.install] } {
64                ui_debug "Unable to find a valid home directory, but user disallows startup items."
65            } else {
66                ui_warn "Unable to find a valid home directory even though user requested startup items be installed."
67            }
68        }
69    }
70} else {
71    if { [variant_isset underscore] } {
72        set dbus_user     _messagebus
73    } else {
74        set dbus_user     messagebus
75    }
76    set dbus_group    ${dbus_user}
77
78    if { [tbool startupitem.install] } {
79        set startup_root  ""
80    }
81}
82add_users         ${dbus_user} group=${dbus_group} realname=Message\ Bus
83
84depends_lib     port:expat
85
86configure.args  --disable-doxygen-docs \
87                --disable-xml-docs \
88                --disable-ducktype-docs \
89                --without-x \
90                --enable-launchd \
91                --with-launchd-agent-dir=${prefix}/Library/LaunchAgents \
92                --with-dbus-user=${dbus_user} \
93                --disable-tests
94
95set sudo ""
96if {![variant_isset no_root]} {
97    set sudo "sudo "
98}
99
100# These variants are obsolete
101# dbus should respect the global variable startupitem.install set in ${prefix}/etc/macports/macports.conf
102# See https://guide.macports.org/#reference.startupitems
103if { [variant_isset startupitem] } {
104    pre-configure {
105        if { ![tbool startupitem.install] } {
106            ui_error "You have requested an obsolete variant that conflicts with the value of startupitem.install set in ${prefix}/etc/macports/macports.conf"
107            ui_error "If you want to install the startup items, please change the global variable in ${prefix}/etc/macports/macports.conf"
108            ui_error "Note: this will affect other ports"
109            ui_error "See https://guide.macports.org/#reference.startupitems"
110            return -code error "invalid obsolete variant"
111        } else {
112            ui_warn "You have requested an obsolete variant"
113            ui_warn "Installation of startup items are now determined by ${prefix}/etc/macports/macports.conf"
114            ui_warn "See https://guide.macports.org/#reference.startupitems"
115        }
116    }
117}
118
119if { [variant_isset no_startupitem] } {
120    pre-configure {
121        if { [tbool startupitem.install] } {
122            ui_error "You have requested an obsolete variant that conflicts with the value of startupitem.install set in ${prefix}/etc/macports/macports.conf"
123            ui_error "If you do not want to install the startup items, please change the global variable in ${prefix}/etc/macports/macports.conf"
124            ui_error "Note: this will affect other ports"
125            ui_error "See https://guide.macports.org/#reference.startupitems"
126            return -code error "invalid obsolete variant"
127        } else {
128            ui_warn "You have requested an obsolete variant"
129            ui_warn "Installation of startup items are now determined by ${prefix}/etc/macports/macports.conf"
130            ui_warn "See https://guide.macports.org/#reference.startupitems"
131        }
132    }
133}
134
135post-patch {
136    if { [tbool startupitem.create] } {
137        # Disable if installed into startup directory.
138        reinplace "s|</array>|</array>\\\n\\\n\\\t<key>Disabled</key>\\\n\\\t<true/>|" \
139            ${worksrcpath}/bus/org.freedesktop.dbus-session.plist.in
140    }
141}
142
143use_parallel_build  yes
144
145test.run        yes
146test.target     check
147
148pre-test {
149    if {![variant_isset test]} {
150        ui_error "test variant must be activated to enable test support."
151        error "Please enable test variant."
152    }
153}
154
155destroot.keepdirs \
156    ${destroot}${prefix}/share/dbus-1/services \
157    ${destroot}${prefix}/var/run/dbus \
158    ${destroot}${prefix}/etc/dbus-1/system.d \
159    ${destroot}${prefix}/etc/dbus-1/session.d
160
161set plistDir  ${prefix}/Library/LaunchDaemons
162set plistFl   ${plistDir}/org.freedesktop.dbus-system.plist
163
164set labelDaemon [file rootname [file tail ${plistFl}]]
165set labelAgent [file rootname org.freedesktop.dbus-session.plist]
166
167# universal_archs_to_use might not be set before pre-fetch.
168pre-destroot {
169    global merger_dont_diff merger_configure_env
170
171    # PortGroup muniversal has difficulty merging three files.
172    if {[info exists universal_archs_to_use] && [llength ${universal_archs_to_use}] == 3} {
173        set merger_dont_diff "${prefix}/lib/dbus-1.0/include/dbus/dbus-arch-deps.h"
174    }
175}
176
177post-destroot {
178    # Simplify startup script over startupitem.install.
179    # See #15081
180    xinstall -d -m 0755 ${destroot}${plistDir}
181    set plist [open "${destroot}${plistFl}" w 0644]
182
183    puts ${plist} "<?xml version='1.0' encoding='UTF-8'?>"
184    puts ${plist} "<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\""
185    puts ${plist} "\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\" >"
186    puts ${plist} "<plist version='1.0'>"
187    puts ${plist} "<dict>"
188
189    puts ${plist} "<key>Label</key><string>org.freedesktop.dbus-system</string>"
190
191    puts ${plist} "<key>ProgramArguments</key>"
192    puts ${plist} "<array>"
193    puts ${plist} "\t<string>${prefix}/bin/dbus-daemon</string>"
194    puts ${plist} "\t<string>--system</string>"
195    puts ${plist} "\t<string>--nofork</string>"
196    puts ${plist} "</array>"
197    if {$macosx_deployment_target eq "10.4"} {
198        puts ${plist} "<key>OnDemand</key><false/>"
199    } else {
200        puts ${plist} "<key>KeepAlive</key><true/>"
201    }
202
203    if { [tbool startupitem.install] } {
204        puts ${plist} "<key>Disabled</key><true/>"
205    }
206
207    puts ${plist} "</dict>"
208    puts ${plist} "</plist>"
209
210    close ${plist}
211
212    if { [info exists startup_root] } {
213        xinstall -d -m 0755 ${destroot}${startup_root}/Library/LaunchDaemons
214        xinstall -d -m 0755 ${destroot}${startup_root}/Library/LaunchAgents
215        ln -s ${plistFl} ${destroot}${startup_root}/Library/LaunchDaemons
216        ln -s ${prefix}/Library/LaunchAgents/org.freedesktop.dbus-session.plist ${destroot}${startup_root}/Library/LaunchAgents
217    }
218
219    system "env DYLD_LIBRARY_PATH=${destroot}${prefix}/lib ${destroot}${prefix}/bin/dbus-uuidgen --ensure=${destroot}${prefix}/var/lib/dbus/machine-id"
220}
221
222pre-activate {
223    if { [file exists ${prefix}/var/lib/dbus/machine-id] } {
224        # See #19234
225        delete ${prefix}/var/lib/dbus/machine-id
226    }
227}
228
229post-activate {
230    file attributes ${prefix}/var/run/dbus -group ${dbus_group} -owner ${dbus_user}
231    file attributes ${prefix}/libexec/dbus-daemon-launch-helper -group ${dbus_group}
232
233    if { [tbool startupitem.install] && ![variant_isset no_root] } {
234        file attributes ${prefix}/Library/LaunchAgents/org.freedesktop.dbus-session.plist -owner root -group wheel
235        file attributes ${prefix}/Library/LaunchDaemons/[file tail ${plistFl}] -owner root -group wheel
236    }
237}
238
239#pre-deactivate {
240#    if { [info exists startup_root] } {
241#        catch {system "launchctl unload ${startup_root}/Library/LaunchDaemons/[file tail ${plistFl}]"}
242#        catch {system "launchctl unload ${startup_root}/Library/LaunchAgents/org.freedesktop.dbus-session.plist"}
243#    }
244#}
245
246# XXX Building with tests enabled causes dbus to link with dbus-glib,
247# which it shouldn't do because that port depends on this one: see #30088
248variant test description {enable tests (Only Works if dbus is Already Installed)} {
249    ui_warn "This variant requires circular dependencies and only works if ${name} is already installed"
250
251    configure.args-replace  --disable-tests --enable-tests
252    configure.args-append   --without-dbus-glib
253    depends_build-append      port:glib2
254    depends_build-append      port:python27 port:dbus-python27 port:py27-gobject port:dbus-python
255    configure.python        ${prefix}/bin/python2.7
256}
257
258if { [info exists startup_root] } {
259    notes "############################################################################
260# Startup items have been generated that will aid in
261# starting ${name} with launchd. They are disabled
262# by default. Execute the following commands to start them,
263# and to cause them to launch at startup:
264#
265# ${sudo}launchctl load -w ${startup_root}/Library/LaunchDaemons/[file tail ${plistFl}]
266# launchctl load -w ${startup_root}/Library/LaunchAgents/org.freedesktop.dbus-session.plist
267############################################################################"
268} else {
269    notes "############################################################################
270# Startup items were not installed for ${name}
271# Some programs which depend on ${name} might not function properly.
272# To load ${name} manually, run
273#
274# launchctl load -w ${prefix}/Library/LaunchDaemons/[file tail ${plistFl}]
275# launchctl load -w ${prefix}/Library/LaunchAgents/org.freedesktop.dbus-session.plist
276############################################################################"
277}
278
279variant no_root conflicts underscore description {Run the DBUS daemon as MacPorts install user.} {
280    pre-fetch {
281        ###########
282        # WARNING #
283        ###########
284        # Do not error out later than in the fetch phase. In MacPorts 2.3.3,
285        # add_users root trashes the root user in the extract phase. See
286        # #45737.
287        if {${install.user} eq "root" || ${install.group} eq "wheel"} {
288            ui_error "The DBUS daemon should not be run as root."
289            error "Please do not use this variant with your MacPorts configuration."
290        }
291    }
292
293    # Files are installed into user's startup directory.
294    if { [tbool startupitem.install] } {
295        destroot.violate_mtree  yes
296    }
297}
298
299variant underscore conflicts no_root description {Put underscore in front of DBUS daemon user} {
300    # For darwin ${os.major} > 8, daemon users have an underscore in front of the usernames and groups.
301    # This variant allows the user to follow that convention.
302}
303
304set cross_opts  "ac_cv_have_abstract_sockets=no"
305if {${os.arch} eq "i386"} {
306    if { ${os.major} >= 10 } {
307        set merger_configure_env(ppc) ${cross_opts}
308    }
309    set merger_configure_env(ppc64)   ${cross_opts}
310} else {
311    set merger_configure_env(i386)    ${cross_opts}
312    set merger_configure_env(x86_64)  ${cross_opts}
313}
314
315# see #50619
316if {[vercmp ${os.version} 10.5.0] < 0} {
317    depends_build-append port:gmake
318    build.cmd ${prefix}/bin/gmake
319}
320
321livecheck.type  regex
322livecheck.url   [lindex ${master_sites} 0]
323livecheck.regex {dbus-(\d+\.\d*[02468](\.\d+)*)\.tar}
Note: See TracBrowser for help on using the repository browser.