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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
|
# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python
GLIB_CONFIG_UNVERSAL='''\
#ifdef __i386__
#include "i386/glibconfig.h"
#elif defined(__ppc__)
#include "ppc/glibconfig.h"
#elif defined(__x86_64__)
#include "x86_64/glibconfig.h"
#else
#error "Unsupported Architecture"
#endif
'''
class Recipe(recipe.Recipe):
name = 'glib'
version = '2.32.4'
licenses = [License.LGPLv2Plus]
configure_sh = 'sh autogen.sh'
configure_options = ' --enable-static'
deps = ['libffi', 'zlib']
can_use_configure_cache = False
platform_deps = {Platform.WINDOWS: ['libiconv', 'gettext'],
Platform.DARWIN: ['libiconv', 'gettext'],
Platform.ANDROID: ['libiconv', 'gettext']}
files_libs = [
'libglib-2.0', 'libgio-2.0', 'libgmodule-2.0', 'libgobject-2.0',
'libgthread-2.0']
files_bins = ['gsettings', 'gdbus', 'gio-querymodules', 'glib-compile-schemas']
platform_files_schemas = {
Platform.WINDOWS: ['share/glib-2.0/schemas'],
Platform.DARWIN: ['share/glib-2.0/schemas'],
}
#FIXME: Fill it when needed
#files_gio = ['lib/gio/modules']
files_devel = [
'bin/glib-gettextize',
'bin/glib-mkenums',
'bin/glib-compile-resources%(bext)s',
'bin/glib-genmarshal%(bext)s',
'bin/gresource%(bext)s',
'lib/glib-2.0/include',
'lib/pkgconfig/gio-2.0.pc',
'lib/pkgconfig/glib-2.0.pc',
'lib/pkgconfig/gmodule-2.0.pc',
'lib/pkgconfig/gmodule-export-2.0.pc',
'lib/pkgconfig/gmodule-no-export-2.0.pc',
'lib/pkgconfig/gobject-2.0.pc',
'lib/pkgconfig/gthread-2.0.pc',
'include/glib-2.0']
platform_files_devel = {
Platform.WINDOWS: ['lib/pkgconfig/gio-windows-2.0.pc', 'include/gio-win32-2.0'],
Platform.LINUX: ['lib/pkgconfig/gio-unix-2.0.pc', 'include/gio-unix-2.0'],
Platform.DARWIN: ['lib/pkgconfig/gio-unix-2.0.pc', 'include/gio-unix-2.0'],
}
files_lang = ['glib20']
def _gio_flags(self, path1=None, path2=None, use_old_uri_scheme=False):
flags = ''
def escape(path):
return '\\\\\\\"%s\\\\\\\"' % path
if path1 is not None:
flags += ' -DGST_SDK_GLIB_GIO_DISTRO_GIO_MODULE_PATH=%s' % escape(path1)
if path2 is not None:
flags += ' -DGST_SDK_GLIB_GIO_DISTRO_GIO_MODULE_PATH2=%s' % escape(path2)
if use_old_uri_scheme:
flags += ' -DGST_SDK_GLIB_GIO_OLD_URI_SCHEME_HANDLERS=1'
return flags
def prepare(self):
if self.config.target_platform == Platform.ANDROID:
# Hack to fix building of the glib/tests/private test
self.make = '%s private_LDFLAGS=""' % self.make
elif self.config.target_platform == Platform.WINDOWS:
self.configure_options = '--with-libiconv=gnu'
elif 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', 'glib-2.0', 'include', arch, 'glibconfig.h'))
self.config_sh = 'CFLAGS="$CFLAGS -DHAVE_STRNDUP" ./configure'
elif self.config.target_platform == Platform.LINUX:
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._gio_flags('/usr/lib/gio/modules/', None, True)
elif self.config.target_distro == Distro.DEBIAN and self.config.target_distro_version in [DistroVersion.UBUNTU_NATTY, DistroVersion.UBUNTU_ONEIRIC, DistroVersion.UBUNTU_PRECISE]:
if self.config.target_arch == Architecture.X86:
self.config_sh = 'CFLAGS="%s" ./configure' % self._gio_flags('/usr/lib/gio/modules/', '/usr/lib/i386-linux-gnu/gio/modules')
elif self.config.target_arch == Architecture.X86_64:
self.config_sh = 'CFLAGS="%s" ./configure' % self._gio_flags('/usr/lib/gio/modules/', '/usr/lib/x86_64-linux-gnu/gio/modules')
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._gio_flags('/usr/lib/i386-linux-gnu/gio/modules')
elif self.config.target_arch == Architecture.X86_64:
self.config_sh = 'CFLAGS="%s" ./configure' % self._gio_flags('/usr/lib/x86_64-linux-gnu/gio/modules')
elif self.config.target_distro == Distro.REDHAT:
if self.config.target_distro_version in [DistroVersion.FEDORA_16, DistroVersion.FEDORA_17]:
if self.config.target_arch == Architecture.X86:
self.config_sh = 'CFLAGS="%s" ./configure' % self._gio_flags('/usr/lib/gio/modules')
elif self.config.target_arch == Architecture.X86_64:
self.config_sh = 'CFLAGS="%s" ./configure' % self._gio_flags('/usr/lib64/gio/modules/')
else:
self.config_sh = 'CFLAGS="%s" ./configure' % self._gio_flags('/usr/lib/gio/modules/')
elif self.config.target_distro == Distro.SUSE:
if self.config.target_arch == Architecture.X86:
self.config_sh = 'CFLAGS="%s" ./configure' % self._gio_flags('/usr/lib/gio/modules')
elif self.config.target_arch == Architecture.X86_64:
self.config_sh = 'CFLAGS="%s" ./configure' % self._gio_flags('/usr/lib64/gio/modules')
else:
from cerbero.errors import FatalError
raise FatalError(_("Add specific for other Linux distributions here"))
def post_install(self):
import shutil
if self.config.target_platform == Platform.WINDOWS:
shutil.copy(os.path.join(self.build_dir, 'glib', 'glibconfig.h.win32'),
os.path.join(self.config.prefix, 'lib', 'glib-2.0',
'include', 'glibconfig.h'))
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'
arch_dir = os.path.join(self.config.prefix, 'lib', 'glib-2.0',
'include', arch)
if not os.path.exists(arch_dir):
os.makedirs(arch_dir)
shutil.copyfile(os.path.join(self.build_dir, 'glib', 'glibconfig.h'),
os.path.join(arch_dir, 'glibconfig.h'))
with open(os.path.join(self.config.prefix, 'lib', 'glib-2.0',
'include', 'glibconfig.h'), 'w+') as f:
f.write(GLIB_CONFIG_UNVERSAL)
|