summaryrefslogtreecommitdiff
path: root/recipes/dbus.recipe
blob: fef7cde4cb0f6ac3d6ee5ad7ba55a251b3537370 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python
import shutil

DBUS_ARCH_DEPS_UNVERSAL='''\
#ifdef __i386__
#include "i386/dbus-arch-deps.h"
#elif defined(__ppc__)
#include "ppc/dbus-arch-deps.h"
#elif defined(__x86_64__)
#include "x86_64/dbus-arch-deps.h"
#else
#error "Unsupported Architecture"
#endif
'''

class Recipe(recipe.Recipe):
    name = 'dbus'
    version = '1.6.4'
    # either AFLv2.1 or or GPLv2+
    licenses = [License.AFLv2_1]
    autoreconf = True
    deps = ['expat']
    configure_options = '--disable-xml-docs --disable-doxygen-docs ' \
                        '--disable-selinux --disable-libaudit ' \
                        '--disable-launchd --disable-tests '\
                        '--disable-x11-autolaunch --disable-Werror '

    files_libs = ['libdbus-1']
    files_bins = ['dbus-launch', 'dbus-send', 'dbus-daemon', 'dbus-monitor']
    files_devel = [
            'lib/pkgconfig/dbus-1.pc',
            'include/dbus-1.0/dbus/dbus-address.h',
            'include/dbus-1.0/dbus/dbus-bus.h',
            'include/dbus-1.0/dbus/dbus-connection.h',
            'include/dbus-1.0/dbus/dbus-errors.h',
            'include/dbus-1.0/dbus/dbus-macros.h',
            'include/dbus-1.0/dbus/dbus-memory.h',
            'include/dbus-1.0/dbus/dbus-message.h',
            'include/dbus-1.0/dbus/dbus-misc.h',
            'include/dbus-1.0/dbus/dbus-pending-call.h',
            'include/dbus-1.0/dbus/dbus-protocol.h',
            'include/dbus-1.0/dbus/dbus-server.h',
            'include/dbus-1.0/dbus/dbus-shared.h',
            'include/dbus-1.0/dbus/dbus-signature.h',
            'include/dbus-1.0/dbus/dbus-syntax.h',
            'include/dbus-1.0/dbus/dbus-threads.h',
            'include/dbus-1.0/dbus/dbus-types.h',
            'include/dbus-1.0/dbus/dbus.h',
            'lib/dbus-1.0/include/dbus/dbus-arch-deps.h',
    ]
    platform_files_bins = {
            Platform.LINUX: ['dbus-uuidgen', 'dbus-cleanup-sockets'],
            Platform.DARWIN: ['dbus-uuidgen', 'dbus-cleanup-sockets'],
    }
    platform_files_misc = {
            Platform.LINUX: ['libexec/dbus-daemon-launch-helper%(bext)s'],
            Platform.DARWIN: ['libexec/dbus-daemon-launch-helper%(bext)s'],
    }

    def prepare(self):
        if self.config.target_platform == Platform.LINUX:
            self.configure_options += ' --with-system-socket=/var/run/dbus/system_bus_socket'
        if self.config.target_platform == Platform.DARWIN:
            arch = self.config.target_arch
            if arch == Architecture.X86:
                arch = 'i386'
            self.files_devel.append(
                os.path.join('lib', 'dbus-1.0', 'include', 'dbus', arch, 'dbus-arch-deps.h'))

    def post_install(self):
        if self.config.target_platform == Platform.DARWIN:
            # For the universal build we need to ship glibconfig.h of both
            # architectures ina subfolder and include the correct one depending
            # on the compiler architecture
            arch = self.config.target_arch
            if arch == Architecture.X86:
                arch = 'i386'

            incl_dir = os.path.join(self.config.prefix, 'lib', 'dbus-1.0',
                                     'include', 'dbus')
            arch_dir = os.path.join(incl_dir, arch)
            if not os.path.exists(arch_dir):
                os.makedirs(arch_dir)
            shutil.copyfile(os.path.join(self.build_dir, 'dbus', 'dbus-arch-deps.h'),
                        os.path.join(arch_dir, 'dbus-arch-deps.h'))
            with open(os.path.join(incl_dir, 'dbus-arch-deps.h'), 'w+') as f:
                f.write(DBUS_ARCH_DEPS_UNVERSAL)