summaryrefslogtreecommitdiff
path: root/recipes/glib-networking-static.recipe
blob: 53e80639d35207cf40d76c7a76d7198f6de68283 (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
# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python
import shutil
import os
from cerbero.errors import FatalError
from cerbero.utils.shell import which

class Recipe(recipe.Recipe):
    name = 'glib-networking-static'
    version = '2.42.1'
    licenses = [License.LGPLv2Plus]
    stype = SourceType.TARBALL
    url = 'http://ftp.gnome.org/pub/gnome/sources/glib-networking/2.42/glib-networking-%(version)s.tar.xz'
    tarball_dirname = 'glib-networking-%(version)s'
    autoreconf = True
    configure_options = "--without-ca-certificates --enable-static-modules --enable-static --enable-more-warnings"
    deps = ['glib', 'gnutls', 'glib-networking']
    patches = ['glib-networking/0001-Add-support-for-static-modules.patch',
               'glib-networking/0002-Get-the-CA-certificate-path-from-the-environment-var.patch',
               'glib-networking/0003-tlsconnection-fix-memleak.patch']

    files_devel = ['lib/gio/modules/static/libgiognutls.a',
                   'lib/gio/modules/static/libgiognutls.la']

    def prepare(self):
        self.tmp_destdir = os.path.join(self.build_dir, 'static-build')

        querymodule_path = None
        if self.config.target_platform in [Platform.DARWIN, Platform.IOS]:
          # For the universal build we need to use the right gio-querymodules
          arch = self.config.target_arch
          querymodule_path = os.path.join(self.config.prefix, arch, 'bin', 'gio-querymodules')
        else:
          querymodule_path = os.path.join(self.config.prefix, 'bin', 'gio-querymodules')

        if not self.config.prefix_is_executable():
          querymodule_path = which('true')

        if self.config.target_platform in [Platform.ANDROID, Platform.IOS]:
          self.append_env['CFLAGS'] = ' -DGST_CA_CERTIFICATES_FROM_ENV'

        self.config_sh = 'GIO_QUERYMODULES=%s %s' % (querymodule_path, self.config_sh)

    def install(self):
        plugins_dir = os.path.join(self.config.prefix,
                                    os.path.dirname(self.files_devel[0]))
        if not os.path.exists(plugins_dir):
            os.makedirs(plugins_dir)
        shutil.copy(os.path.join(self.build_dir, 'tls', 'gnutls', '.libs',
            'libgiognutls.a'), plugins_dir)
        shutil.copy(os.path.join(self.build_dir, 'tls', 'gnutls', '.libs',
            'libgiognutls.la'), plugins_dir)