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

import os
from fnmatch import fnmatch

from cerbero.build.filesprovider import FilesProvider
from cerbero.utils import shell
from cerbero.tools.libtool import LibtoolLibrary


class Recipe(recipe.Recipe):
    name = 'nettle'
    version = '2.5'
    licenses = [License.LGPLv2_1Plus]
    configure_options = '--enable-shared'
    deps = ['gmp']

    files_bins = ['nettle-hash', 'nettle-lfib-stream']
    files_libs = ['libnettle', 'libhogweed']
    files_devel = ['include/nettle', 'lib/pkgconfig/nettle.pc', 'lib/pkgconfig/hogweed.pc']

    def configure(self):
        if self.config.target_platform == Platform.ANDROID:
            shell.replace(os.path.join(self.build_dir, 'Makefile.in'),
                {'SUBDIRS = tools testsuite examples':
                 'SUBDIRS = tools examples'})
        super(recipe.Recipe, self).configure()

    def post_install(self):
        # Create libtool libraries (.la)
        libtool_la = LibtoolLibrary('nettle', 4, 4, 0, self.config.libdir,
                self.config.target_platform)
        libtool_la.save()
        deps = ['nettle', 'gmp']
        if self.config.target_platform != Platform.LINUX:
            deps += ['iconv', 'intl']
        if self.config.target_platform != Platform.WINDOWS:
            deps += ['-lc']

        libtool_la = LibtoolLibrary('hogweed', 2, 2, 0, self.config.libdir,
                self.config.target_platform, deps)
        libtool_la.save()

        if self.config.target_platform == Platform.LINUX:
            # Fix the libs permissions to 0755 to make the rpm packaging happy.
            # Setting for all linux distros as this may affect suse as well.
            # It will not affect debian packaging as it will run dh_fixperms
            # which does the right thing for debian.
            libs = self.files_list_by_category(FilesProvider.LIBS_CAT)
            for lib in libs:
                f = os.path.join(self.config.prefix, lib)
                if os.path.isfile(f) and not os.path.islink(f) and \
                   fnmatch(f, '*.so.*'):
                    os.chmod(f, 0755)