summaryrefslogtreecommitdiff
path: root/recipes/zlib.recipe
blob: 8900c8377f884fec851fc03e27c1eefba64c660a (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
# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python
from cerbero.tools.libtool import LibtoolLibrary


class Recipe(recipe.Recipe):
    name = 'zlib'
    version = '1.2.8'
    stype = SourceType.TARBALL
    btype = BuildType.MAKEFILE
    url = 'http://zlib.net/zlib-1.2.8.tar.xz'
    licenses = [License.BSD_like]
    add_host_build_target = False
    can_use_configure_cache = False
    configure_tpl = "./configure --prefix %(prefix)s "\
                    "--libdir %(libdir)s %(options)s"
    patches = ['zlib/0001-win32-fix-dll-name.patch']

    files_libs = ['libz']
    files_devel = ['include/zlib.h', 'include/zconf.h', 'lib/pkgconfig/zlib.pc']


    def prepare(self):
        if self.config.target_platform == Platform.WINDOWS:
            self.make = 'make -f win32/Makefile.gcc PREFIX=%s- ' % self.config.host
            self.make_install = 'make install -f win32/Makefile.gcc '\
                                'INCLUDE_PATH=%(prefix)s/include '\
                                'LIBRARY_PATH=%(prefix)s/lib ' \
                                'BINARY_PATH=%(prefix)s/bin ' % {'prefix':self.config.prefix}
            self._remove_steps ([BuildSteps.CONFIGURE])
        elif self.config.target_platform == Platform.ANDROID:
            if self.config.target_arch == Architecture.X86:
                self.configure_options += " --uname=i686-linux-android "
            if self.config.target_arch == Architecture.X86_64:
                self.configure_options += " --uname=x86_64-linux-android "
            else:
                self.configure_options += " --uname=arm-linux-androideabi "

    def post_install(self):
        libtool_la = LibtoolLibrary('z', 1, 2, 8, self.config.libdir,
                self.config.target_platform)
        libtool_la.save()
        # FIXME This is to workaround a build issue trying to ld to libz.so
        if self.config.target_platform == Platform.IOS:
            try:
                os.symlink(os.path.join (self.config.prefix, 'lib', 'libz.dylib'),
                        os.path.join (self.config.prefix, 'lib', 'libz.so'))
            except OSError:
                pass