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


class Recipe(recipe.Recipe):
    name = 'gmp'
    version = '5.1.3'
    url = 'http://ftp.gnu.org/gnu/gmp/gmp-5.1.3.tar.xz'
    stype = SourceType.TARBALL
    licenses = [License.LGPLv3Plus]
    patches = ['gmp/0001-Use-results-from-configure-script-for-read-only-data.patch']

    files_libs = ['libgmp']
    files_devel = ['include/gmp.h']

    def prepare(self):
        if self.config.target_platform == Platform.WINDOWS:
            self.configure_options = ' --enable-shared --disable-static'
        elif self.config.target_platform == Platform.IOS:
            self.configure_options = ' --disable-assembly'

    def post_install(self):
        if self.config.target_platform == Platform.WINDOWS:
            src = os.path.join(self.config.prefix, 'lib', 'libgmp-10.dll')
            dll = os.path.join(self.config.prefix, 'bin', 'libgmp-10.dll')
            dll_a = os.path.join(self.config.prefix, 'lib', 'libgmp.dll.a')
            if os.path.exists(dll_a):
                os.remove(dll_a)
            shutil.copy(src, dll)
            shutil.copy(src, dll_a)
            gmp_la = os.path.join(self.config.prefix, 'lib', 'libgmp.la')
            shell.replace(gmp_la, {'libgmp.lib': 'libgmp.dll.a'})