summaryrefslogtreecommitdiff
path: root/recipes/gtk.recipe
blob: 216e8a990085f600cbc3298df8c9d045298876ed (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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python


class Recipe(recipe.Recipe):
    name = 'gtk+'
    version = '2.24.11'
    # TODO: check license - some source files are LGPLv2, others LGPLv2+,
    #       others LGPLv2.1+, COPYING is LGPLv2 and the webpage states LGPLv2.1
    licenses = [License.LGPLv2_1Plus]
    configure_options = '--with-included-immodules '
    deps = ['glib', 'atk', 'pango', 'gdk-pixbuf', 'cairo']
    platform_deps = {
        Platform.WINDOWS: ['libstdc++'],
        }

    files_libs = ['libgailutil']
    files_bins = ['gtk-update-icon-cache', 'gtk-query-immodules-2.0']
    files_devel = [
        'bin/gtk-demo%(bext)s',
        'bin/gtk-builder-convert',
        'lib/gtk-2.0/include',
        'lib/pkgconfig/gtk+-2.0.pc',
        'lib/pkgconfig/gdk-2.0.pc',
        'lib/pkgconfig/gail.pc',
        'include/gtk-2.0',
        'include/gail-1.0',
        'share/gtk-2.0/demo',
    ]
    files_modules = ['lib/gtk-2.0/modules/libgail%(mext)s']
    platform_files_libs = {
        Platform.WINDOWS: ['libgtk-win32-2.0', 'libgdk-win32-2.0'],
        Platform.DARWIN: ['libgtk-quartz-2.0', 'libgdk-quartz-2.0'],
        Platform.LINUX: ['libgtk-x11-2.0', 'libgdk-x11-2.0'],
        }
    platform_files_devel = {
        Platform.WINDOWS: [
            'lib/pkgconfig/gtk+-win32-2.0.pc', 'lib/pkgconfig/gdk-win32-2.0.pc'],
        Platform.DARWIN: [
            'lib/pkgconfig/gtk+-quartz-2.0.pc', 'lib/pkgconfig/gdk-quartz-2.0.pc'],
        Platform.LINUX: [
            'lib/pkgconfig/gtk+-x11-2.0.pc', 'lib/pkgconfig/gdk-x11-2.0.pc'],
        }
    platform_files_themes = {
        Platform.LINUX: [
            'share/themes/Default/gtk-2.0-key/gtkrc'],
        Platform.WINDOWS: [
            'share/themes/MS-Windows/gtk-2.0/gtkrc',
            'lib/gtk-2.0/2.10.0/engines/libwimp.dll',]
        }
    platform_files_modules = {
        Platform.LINUX: [
            'lib/gtk-2.0/modules/libferret%(mext)s',],
        Platform.DARWIN: [
            'lib/gtk-2.0/modules/libferret%(mext)s',],
        }
    files_lang = ['gtk20', 'gtk20-properties']


    def _gtk_flags(self, module_path1=None, module_path2=None, theme_path=None):
        flags = ''
        def escape(path):
            return '\\\\\\\"%s\\\\\\\"' % path
        if module_path1 is not None:
            flags += ' -DGST_SDK_GTK_DISTRO_GTK_MODULE_PATH=%s' % escape(module_path1)
        if module_path2 is not None:
            flags += ' -DGST_SDK_GTK_DISTRO_GTK_MODULE_PATH2=%s' % escape(module_path2)
        if theme_path is not None:
            flags += ' -DGST_SDK_GTK_DISTRO_GTK_THEME_PATH=%s' % escape(theme_path)
        return flags

    def prepare(self):
        if self.config.target_platform != Platform.LINUX:
            self.configure_options += ' --disable-gtk-doc'
        if self.config.target_platform == Platform.WINDOWS:
            self.configure_options += '--disable-papi --disable-cups '
        elif self.config.target_platform == Platform.DARWIN:
            self.configure_options += '--with-gdktarget=quartz '
        elif self.config.target_platform == Platform.LINUX:
            # Can't change CFLAGS and use configure cache
            self.can_use_configure_cache = False
            if self.config.target_distro == Distro.DEBIAN and self.config.target_distro_version in [DistroVersion.DEBIAN_SQUEEZE, DistroVersion.UBUNTU_LUCID, DistroVersion.UBUNTU_MAVERICK]:
                self.config_sh = 'CFLAGS="%s" ./configure' % self._gtk_flags('/usr/lib/gtk-2.0', None, '/usr/share/themes')
            elif self.config.target_distro == Distro.DEBIAN and self.config.target_distro_version in [DistroVersion.UBUNTU_NATTY, DistroVersion.UBUNTU_ONEIRIC, DistroVersion.UBUNTU_PRECISE, DistroVersion.UBUNTU_QUANTAL]:
                if self.config.target_arch == Architecture.X86:
                    self.config_sh = 'CFLAGS="%s" ./configure' % self._gtk_flags('/usr/lib/gtk-2.0', '/usr/lib/i386-linux-gnu/gtk-2.0', '/usr/share/themes')
                elif self.config.target_arch == Architecture.X86_64:
                    self.config_sh = 'CFLAGS="%s" ./configure' % self._gtk_flags('/usr/lib/gtk-2.0', '/usr/lib/x86_64-linux-gnu/gtk-2.0', '/usr/share/themes')
            elif self.config.target_distro == Distro.DEBIAN and self.config.target_distro_version in [DistroVersion.DEBIAN_WHEEZY]:
                if self.config.target_arch == Architecture.X86:
                    self.config_sh = 'CFLAGS="%s" ./configure' % self._gtk_flags('/usr/lib/i386-linux-gnu/gtk-2.0', None, '/usr/share/themes')
                elif self.config.target_arch == Architecture.X86_64:
                    self.config_sh = 'CFLAGS="%s" ./configure' % self._gtk_flags('/usr/lib/x86_64-linux-gnu/gtk-2.0', None, '/usr/share/themes')
            elif self.config.target_distro == Distro.REDHAT:
                if self.config.target_distro_version in [DistroVersion.FEDORA_16, DistroVersion.FEDORA_17, DistroVersion.FEDORA_18]:
                    if self.config.target_arch == Architecture.X86:
                        self.config_sh = 'CFLAGS="%s" ./configure' % self._gtk_flags('/usr/lib/gtk-2.0', None, '/usr/share/themes')
                    elif self.config.target_arch == Architecture.X86_64:
                        self.config_sh = 'CFLAGS="%s" ./configure' % self._gtk_flags('/usr/lib64/gtk-2.0', None, '/usr/share/themes')
                else:
                    self.config_sh = 'CFLAGS="%s" ./configure' % self._gtk_flags('/usr/lib/gtk-2.0', None, '/usr/share/themes')
            elif self.config.target_distro == Distro.SUSE:
                if self.config.target_arch == Architecture.X86:
                    self.config_sh = 'CFLAGS="%s" ./configure' % self._gtk_flags('/usr/lib/gtk-2.0', None, '/usr/share/themes')
                elif self.config.target_arch == Architecture.X86_64:
                    self.config_sh = 'CFLAGS="%s" ./configure' % self._gtk_flags('/usr/lib64/gtk-2.0', None, '/usr/share/themes')
            else:
                from cerbero.errors import FatalError
                raise FatalError(_("Add specific for other Linux distributions here"))