gettext-tools.recipe 2.04 KB
Newer Older
1
# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python
2
3
4
import shutil
from pathlib import Path

5
6
7
8
from cerbero.utils import shell

class Recipe(recipe.Recipe):
    name = 'gettext-tools'
Sebastian Dröge's avatar
Sebastian Dröge committed
9
    version = '0.19.8.1'
10
11
    licenses = [License.GPLv3]
    srcdir = 'gettext-tools'
12
    stype = SourceType.TARBALL
13
    url = 'https://ftp.gnu.org/pub/gnu/gettext/gettext-%(version)s.tar.gz'
14
15
16
    tarball_dirname = 'gettext-%(version)s'
    tarball_checksum = 'ff942af0e438ced4a8b0ea4b0b6e0d6d657157c5e2364de57baa279c1c125c43'

17
    platform_deps = {
18
            Platform.DARWIN:  ['sed'],
19
            Platform.WINDOWS: ['libiconv', 'mingw-runtime', 'automake'],}
20
    configure_options = ' --disable-java --disable-csharp --disable-native-java --without-csv'
21
    patches = ['../gettext/0001-Fix-linker-error-redefinition-of-vasprintf.patch',
22
               '../gettext/0001-Undefine-__USE_MINGW_ANSI_STDIO-as-otherwise-stdio.h.patch',
23
24
               '../gettext/0001-Fix-build-invalid-instruction-on-macOS-10.13.patch',
               '../gettext/0001-Fix-linker-error-Cannot-export-rpl_printf.patch' ]
25
26
27

    def prepare(self):
        if self.config.target_platform == Platform.WINDOWS:
28
            self.configure_options += ' --enable-threads=win32'
29
            self.append_env('LDFLAGS', '-liconv')
30
31
32
33
34
35
36
37
38
39
40
41
42
43

    def post_install(self):
        if self.config.platform == Platform.WINDOWS:
            # The msgmerge built by us randomly hangs on Windows when called
            # during configure, so replace it with the msgmerge from MSYS-MinGW
            # which works fine.
            build_tools_bin = Path(self.config.build_tools_prefix) / 'bin'
            msys_mingw_bindir = Path(shutil.which('mingw-get')).parent
            msys_msgmerge = msys_mingw_bindir / 'msgmerge.exe'
            if msys_msgmerge.is_file():
                if (build_tools_bin / 'msgmerge.exe').is_file():
                    os.replace(str(build_tools_bin / 'msgmerge.exe'),
                               str(build_tools_bin / 'msgmerge.exe.bck'))
                shutil.copy(str(msys_msgmerge), str(build_tools_bin))