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
55
56
57
58
|
# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python
from cerbero.tools.libtool import LibtoolLibrary
class Recipe(recipe.Recipe):
name = 'bzip2'
version = '1.0.6'
licenses = [License.BSD_like]
stype = SourceType.TARBALL
url = 'https://bzip.org/%(version)s/bzip2-%(version)s.tar.gz'
patches = ['bzip2/0001-Fix-Makefiles-and-add-support-for-Windows-and-OS-X.patch']
files_libs = ['libbz2']
files_devel = ['include/bzlib.h']
def prepare (self):
self._remove_steps([BuildSteps.CONFIGURE])
extension = ''
if self.config.target_platform in [Platform.DARWIN, Platform.IOS]:
shared_makefile = 'Makefile-libbz2_dylib'
elif self.config.target_platform == Platform.WINDOWS:
shared_makefile = 'Makefile-libbz2_dll'
extension = '.exe'
else:
shared_makefile = 'Makefile-libbz2_so'
self.make = 'make -f %s; make EXT=%s' % (shared_makefile, extension)
self.make_install = 'make -f %s install PREFIX=%s; make install EXT=%s PREFIX=%s' % \
(shared_makefile, self.config.prefix, extension, self.config.prefix)
def post_install(self):
libtool_la = LibtoolLibrary('bz2', 1, 0, 6, self.config.libdir,
self.config.target_platform)
libtool_la.save()
src = None
dst = None
dst2 = None
libdir = os.path.join(self.config.prefix, 'lib')
if self.config.target_platform in [Platform.LINUX, Platform.ANDROID]:
src = 'libbz2.so.1.0.6'
dst = 'libbz2.so'
dst2 = 'libbz2.so.1.0'
elif self.config.target_platform == Platform.DARWIN:
src = 'libbz2.1.0.6.dylib'
dst = 'libbz2.dylib'
elif self.config.target_platform == Platform.IOS:
src = 'libbz2.dylib'
dst = 'libbz2.so'
if src and dst:
p = os.path.join(libdir, dst)
if os.path.exists(p) or os.path.islink(p):
os.remove(p)
shell.call('ln -s %s %s' % (src, dst), libdir)
if dst2:
p = os.path.join(libdir, dst2)
if os.path.exists(p) or os.path.islink(p):
os.remove(p)
shell.call('ln -s %s %s' % (src, dst2), libdir)
|