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
138
139
140
141
142
143
|
# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python
from cerbero.build.build import modify_environment
from cerbero.tools.libtool import LibtoolLibrary
from cerbero.utils import shell, messages
from cerbero.errors import FatalError
class Recipe(recipe.Recipe):
name = 'openssl'
# Note: openssl helpfully moves tarballs somewhere else (old/x.y.z/)
# whenever a new release comes out, so make sure to mirror to fdo when
# bumping the release!
version = '1.1.0h'
licenses = [License.BSD_like]
stype = SourceType.TARBALL
url = 'https://ftp.openssl.org/source/{0}-{1}.tar.gz'.format(name, version)
deps = ['zlib']
# Parallel make fails randomly due to undefined macros, probably races
allow_parallel_build = False
files_bins = ['openssl']
files_libs = ['libcrypto', 'libssl']
files_devel = ['include/openssl', 'lib/pkgconfig/openssl.pc',
'lib/pkgconfig/libssl.pc', 'lib/pkgconfig/libcrypto.pc']
patches = ['openssl/0001-fix-arm-poly1305-linkage.patch']
def prepare(self):
# map platforms
if self.config.target_platform == Platform.IOS:
if self.config.target_arch == Architecture.ARMv7:
self.openssl_platform = 'BSD-generic32'
elif self.config.target_arch == Architecture.ARMv7S:
self.openssl_platform = 'BSD-generic32'
elif self.config.target_arch == Architecture.X86:
self.openssl_platform = 'BSD-generic32'
elif self.config.target_arch == Architecture.X86_64:
self.openssl_platform = 'BSD-generic64'
elif self.config.target_arch == Architecture.ARM64:
self.openssl_platform = 'BSD-generic64'
else:
raise NotImplementedError
elif self.config.target_platform == Platform.ANDROID:
if self.config.target_arch == Architecture.ARM:
self.openssl_platform = 'android-armeabi'
elif self.config.target_arch == Architecture.ARMv7:
self.openssl_platform = 'android-armeabi'
elif self.config.target_arch == Architecture.ARM64:
self.openssl_platform = 'android64-aarch64'
elif self.config.target_arch == Architecture.X86:
self.openssl_platform = 'android-x86'
elif self.config.target_arch == Architecture.X86_64:
self.openssl_platform = 'android64'
else:
raise NotImplementedError
self.make += ' CROSS_SYSROOT="{0}"'.format(self.config.sysroot)
elif self.config.target_platform == Platform.DARWIN:
if self.config.target_arch == Architecture.X86:
self.openssl_platform = 'darwin-i386-cc'
elif self.config.target_arch == Architecture.X86_64:
self.openssl_platform = 'darwin64-x86_64-cc'
else:
raise NotImplementedError
elif self.config.target_platform == Platform.LINUX:
if self.config.target_arch == Architecture.X86:
self.openssl_platform = 'linux-elf'
elif self.config.target_arch == Architecture.X86_64:
self.openssl_platform = 'linux-x86_64'
elif self.config.target_arch == Architecture.ARM:
self.openssl_platform = 'linux-armv4'
elif self.config.target_arch == Architecture.ARMv7:
self.openssl_platform = 'linux-armv4'
elif self.config.target_arch == Architecture.ARM64:
self.openssl_platform = 'linux-aarch64'
else:
raise NotImplementedError
elif self.config.target_platform == Platform.WINDOWS:
if self.config.target_arch == Architecture.X86:
self.openssl_platform = 'mingw'
elif self.config.target_arch == Architecture.X86_64:
self.openssl_platform = 'mingw64'
else:
raise NotImplementedError
# NOTE: CFLAG and LDFLAG are not typos!
# Need to add CFLAGS to CC because CFLAG is not used everywhere in the
# build, and we can't pass arguments via Configure because on Darwin,
# Configure reads the `-arch x86_64` as meaning that you want to use
# `x86_64` as the platform, and errors out about a redefined platform.
self.make += ' CC="$CC $CFLAGS" LDFLAG="$LDFLAGS -fPIC" CFLAG="$CFLAGS -fPIC -DOPENSSL_PIC"'
self.make_install = 'make install_sw'
# We probably don't need and can't use the tools on these platforms
if self.config.target_platform in (Platform.IOS, Platform.ANDROID):
self.make += ' build_libs openssl.pc libssl.pc libcrypto.pc'
self.make_install = 'make install_dev'
@modify_environment
def configure(self):
if self.config.platform == Platform.WINDOWS:
# Msys ships with a too-old perl, so we modify PATH to use the
# mingw-perl that was downloaded and installed by bootstrap.
openssl_path = os.path.join(self.config.mingw_perl_prefix, 'bin')
os.environ['PATH'] = openssl_path + ';' + os.environ['PATH']
perl, found, newer = shell.check_perl_version('5.10.0')
m = 'please run bootstrap again'
if newer is None:
raise FatalError('Perl not found, ' + m)
if newer is False:
raise FatalError('Configured Perl {!r} is {} which is too old, {}'
''.format(perl, found, m))
# OpenSSL guesses the libdir incorrectly on x86_64
config_sh = 'perl ./Configure --prefix=' + self.config.prefix + \
' --libdir=lib' + self.config.lib_suffix + ' '
if self.config.target_platform == Platform.IOS:
config_sh += ' no-shared no-dso '
else:
config_sh += ' shared '
if self.config.target_platform in (Platform.ANDROID, Platform.LINUX):
if self.config.target_arch == Architecture.ARMv7:
# Openssl can't seem to figure this out anymore
config_sh += ' -D__ARM_MAX_ARCH__=7 '
# ssl3 is needed by sphinx which is used by gst-validate, which tries
# to use this libssl and fails with undefined symbols. md2 is needed by
# librpmio.so.8, which is used during package generation on Fedora.
if self.config.target_platform == Platform.LINUX:
config_sh += ' enable-ssl3 enable-ssl3-method enable-md2 '
shell.call(config_sh + self.openssl_platform, self.build_dir)
def post_install(self):
# XXX: Don't forget to update this when the soname is bumped!
# We don't build shared libraries on iOS as the build system
# of openssl is broken and iOS does not support them anyway.
if self.config.target_platform != Platform.IOS:
libtool_la = LibtoolLibrary('ssl', 1, 1, 0, self.config.libdir,
self.config.target_platform,
deps=['crypto'])
libtool_la.save()
libtool_la = LibtoolLibrary('crypto', 1, 1, 0, self.config.libdir,
self.config.target_platform)
libtool_la.save()
|