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
|
# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python
import sys
import shutil
GRAPHENE_CONFIG_UNVERSAL='''\
#ifdef __i386__
#include "i386/graphene-config.h"
#elif defined(__ppc__)
#include "ppc/graphene-config.h"
#elif defined(__x86_64__)
#include "x86_64/graphene-config.h"
#elif defined(__arm__)
#include "arm/graphene-config.h"
#elif defined(__arm64__)
#include "arm64/graphene-config.h"
#else
#error "Unsupported Architecture"
#endif
'''
class Recipe(recipe.Recipe):
name = 'graphene'
stype = SourceType.TARBALL
version = '1.4.0'
url = 'https://github.com/ebassi/graphene/archive/{0}.tar.gz'.format(version)
licenses = [License.MIT]
# Disable NEON completly, it's broken and experimental
configure_options = ' --enable-static --enable-shared --disable-arm-neon'
deps = ['glib']
config_sh = 'sh ./autogen.sh'
files_libs = ['libgraphene-1.0']
files_typelibs = ['Graphene-1.0']
files_devel = [
'include/graphene-1.0',
'lib/graphene-1.0/include',
'lib/pkgconfig/graphene-1.0.pc',
'lib/pkgconfig/graphene-gobject-1.0.pc',
]
patches = ['graphene/0001-simd4f-Fix-a-compilation-error.patch']
def prepare(self):
if self.config.variants.gi:
self.deps.append("gobject-introspection")
# Graphene don't support SSE2 dynamically, disable for now
if self.config.target_arch == Architecture.X86:
self.configure_options += ' --disable-sse2 --disable-gcc-vector '
# -msse4.1 causes clang to segfault building graphene-matrix.c on OS X
# when building for x64_64. Disable it for now.
if self.config.target_platform in [Platform.DARWIN, Platform.IOS]:
arch = self.config.target_arch
if arch == Architecture.X86_64:
self.new_env['SSE41_CFLAGS'] = " "
def post_install(self):
if self.config.target_platform in [Platform.DARWIN, Platform.IOS]:
# For the universal build we need to ship graphene-config.h of all
# architectures in a subfolder and include the correct one depending
# on the compiler architecture
arch = self.config.target_arch
if arch == Architecture.X86:
arch = 'i386'
elif arch == Architecture.ARM64:
arch = 'arm64'
elif Architecture.is_arm(arch):
arch = 'arm'
arch_dir = os.path.join(self.config.prefix, 'lib', 'graphene-1.0',
'include', arch)
if not os.path.exists(arch_dir):
os.makedirs(arch_dir)
shutil.copyfile(os.path.join(self.build_dir, 'src', 'graphene-config.h'),
os.path.join(arch_dir, 'graphene-config.h'))
with open(os.path.join(self.config.prefix, 'lib', 'graphene-1.0',
'include', 'graphene-config.h'), 'w+') as f:
f.write(GRAPHENE_CONFIG_UNVERSAL)
|