summaryrefslogtreecommitdiff
path: root/recipes/gnutls.recipe
blob: 64772d8422ddd59f28798153d132a689f6b255ed (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
# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python

from cerbero.utils import shell
from cerbero.utils import needs_xcode8_sdk_workaround

class Recipe(recipe.Recipe):
    name = 'gnutls'
    version = '3.5.9'
    maj_ver = '.'.join(version.split('.')[0:2])
    url = 'ftp://ftp.gnutls.org/gcrypt/{0}/v{1}/{0}-{2}.tar.xz'.format(name, maj_ver, version)
    stype = SourceType.TARBALL
    # main library is LGPLv2+ and binaries is GPLv3+ and defined below
    licenses = [License.LGPLv2Plus]
    configure_options = "--enable-local-libopts --disable-guile --disable-openssl-compatibility \
        --without-p11-kit --enable-static --enable-zlib --enable-shared \
        --disable-doc --disable-tests --with-included-unistring"
    deps = ['zlib', 'nettle', 'libtasn1']
    # GnuTLS uses error.h, which is a GNU extension only available with glibc
    # bionic-fixup provides that to us for all platforms
    platform_deps = {
        Platform.WINDOWS: ['bionic-fixup'],
        Platform.ANDROID: ['bionic-fixup'],
        Platform.IOS: ['bionic-fixup'],
        Platform.DARWIN: ['bionic-fixup']
    }
    patches = [name + "/0003-Disable-ncrypt-support.patch",
               name + "/0001-Undefine-__USE_MINGW_ANSI_STDIO-as-otherwise-stdio.h.patch"]
    autoreconf = True

    files_libs = ['libgnutls', 'libgnutlsxx']
    files_bins = ['gnutls-cli', 'gnutls-serv', 'gnutls-cli-debug']
    licenses_bins = [License.GPLv3]
    files_devel = ['lib/pkgconfig/gnutls.pc', 'include/gnutls']
    files_lang = ['gnutls']

    def prepare(self):
        if needs_xcode8_sdk_workaround(self.config):
            self.append_env['ac_cv_func_clock_gettime'] = 'no'
            self.append_env['ac_cv_func_clock_settime'] = 'no'
        if self.config.target_platform == Platform.WINDOWS:
            self.configure_options += ' --enable-threads=win32'
            self.can_use_configure_cache = False
        if self.config.target_platform == Platform.DARWIN:
            self.configure_options += ' --disable-hardware-acceleration'
        if self.config.target_platform == Platform.ANDROID:
            self.configure_options += ' --disable-cxx'
        if self.config.target_platform == Platform.IOS:
            if self.config.target_arch == Architecture.ARM64:
                self.configure_options += ' --disable-hardware-acceleration'
            self.configure_options += ' --disable-cxx'

    def configure(self):
        if needs_xcode8_sdk_workaround(self.config):
            # There is no env var that can be set to make the AC_COMPILE_IFELSE
            # macro that checks this evaluate to 'no', so we change the symbol.
            # Edit configure.ac and not configure because we autoreconf later.
            shell.replace(os.path.join(self.build_dir, 'configure.ac'),
                          {'getentropy': 'getentropy_DISABLED_NOT_FOR_MACOS10_12'})
        if self.config.target_platform == Platform.ANDROID:
            # On Android, SIZE_MAX is define under limits.h
            shell.replace(os.path.join(self.build_dir, 'gl', 'read-file.c'),
                {'#include <stdint.h>':
                 '#include <limits.h>'})
        # Call configure from the base class
        super(recipe.Recipe, self).configure()