summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2018-06-28 14:14:09 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2018-08-08 00:53:48 +0530
commit5b841c2a9557da4bf44670206cc1126faa181233 (patch)
treeb311f08acd67a915529752ccc27092bab79e5f0d
parent2a440d1b593211c9532cfa60ecc163a5baeacc54 (diff)
gettext-tools.recipe: Don't use built msgmerge on Windows
It hangs randomly during configure, and makes unattended builds annoying. This is the workaround that people have been doing manually for years on Windows. Eventually, we will get rid of this entirely once we move to Meson.
-rw-r--r--cerbero/hacks.py2
-rw-r--r--recipes/build-tools/gettext-tools.recipe17
2 files changed, 19 insertions, 0 deletions
diff --git a/cerbero/hacks.py b/cerbero/hacks.py
index fa28145d..52ea2d3b 100644
--- a/cerbero/hacks.py
+++ b/cerbero/hacks.py
@@ -121,6 +121,8 @@ def realpath(path):
if sys.platform.startswith('win'):
os.environ = _Environ(os.environ)
+ # FIXME: replace all usage of os.path.join with pathlib.PurePath.as_posix()
+ # instead of doing this brittle monkey-patching.
os.path.join = join
os.path.expanduser = expanduser
os.path.abspath = abspath
diff --git a/recipes/build-tools/gettext-tools.recipe b/recipes/build-tools/gettext-tools.recipe
index fea240ec..41bb03c9 100644
--- a/recipes/build-tools/gettext-tools.recipe
+++ b/recipes/build-tools/gettext-tools.recipe
@@ -1,4 +1,7 @@
# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python
+import shutil
+from pathlib import Path
+
from cerbero.utils import shell
class Recipe(recipe.Recipe):
@@ -21,3 +24,17 @@ class Recipe(recipe.Recipe):
if self.config.target_platform == Platform.WINDOWS:
self.configure_options += ' --enable-threads=win32'
self.append_env['LDFLAGS'] = '-liconv'
+
+ 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))