# -*- 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)