summaryrefslogtreecommitdiff
path: root/recipes/zlib.recipe
blob: 437b61b1ccccec9a6ff366875307565fed713269 (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
# -*- 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
    url = 'http://zlib.net/zlib-1.2.8.tar.xz'
    licenses = [License.BSD_like]
    add_host_build_target = False
    can_use_configure_cache = False
    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 "
            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