summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cerbero/bootstrap/build_tools.py4
-rw-r--r--cerbero/bootstrap/linux.py19
-rw-r--r--cerbero/config.py6
-rw-r--r--cerbero/packages/packager.py2
-rw-r--r--cerbero/packages/wix_packager.py29
-rw-r--r--cerbero/utils/__init__.py6
-rw-r--r--config/windows.config6
-rw-r--r--packages/gstreamer-1.0/gstreamer-1.0.package1
-rw-r--r--recipes/build-tools/wine-mono.recipe25
-rw-r--r--recipes/build-tools/winetricks.recipe18
-rw-r--r--recipes/build-tools/wix.recipe23
11 files changed, 101 insertions, 38 deletions
diff --git a/cerbero/bootstrap/build_tools.py b/cerbero/bootstrap/build_tools.py
index 9bcd95e3..389d0734 100644
--- a/cerbero/bootstrap/build_tools.py
+++ b/cerbero/bootstrap/build_tools.py
@@ -76,6 +76,10 @@ class BuildTools (BootstrapperBase, Fetch):
self.config.prefix_is_executable():
# For glib-mkenums and glib-genmarshal
self.BUILD_TOOLS.append('glib-tools')
+ if self.config.target_platform == Platform.WINDOWS and \
+ self.config.platform == Platform.LINUX:
+ self.BUILD_TOOLS.append('wix')
+
self.BUILD_TOOLS += self.config.extra_build_tools
self._setup_env()
diff --git a/cerbero/bootstrap/linux.py b/cerbero/bootstrap/linux.py
index c5b72f05..f3bb6e7b 100644
--- a/cerbero/bootstrap/linux.py
+++ b/cerbero/bootstrap/linux.py
@@ -82,6 +82,8 @@ class DebianBootstrapper (UnixBootstrapper):
if self.config.arch == Architecture.X86_64:
self.packages.append('libc6:i386')
self.checks.append(self.create_debian_arch_check('i386'))
+ if self.config.arch in [Architecture.X86_64, Architecture.X86]:
+ self.packages.append('wine')
def create_debian_arch_check(self, arch):
def check_arch():
@@ -129,6 +131,8 @@ class RedHatBootstrapper (UnixBootstrapper):
self.packages.append('glibc.i686')
if self.config.distro_version in [DistroVersion.FEDORA_24, DistroVersion.FEDORA_25]:
self.packages.append('libncurses-compat-libs.i686')
+ if self.config.arch in [Architecture.X86_64, Architecture.X86]:
+ self.packages.append('wine')
if user_is_root():
return
self.tool = ['sudo'] + self.tool
@@ -148,6 +152,12 @@ class OpenSuseBootstrapper (UnixBootstrapper):
'gperf', 'wget', 'git', 'ccache', 'openssl-devel'
]
+ def __init__(self, config, offline, assume_yes):
+ UnixBootstrapper.__init__(self, config, offline, assume_yes)
+ if self.config.target_platform == Platform.WINDOWS:
+ if self.config.arch in [Architecture.X86_64, Architecture.X86]:
+ self.packages.append('wine')
+
class ArchBootstrapper (UnixBootstrapper):
tool = ['sudo', 'pacman']
@@ -173,6 +183,9 @@ class ArchBootstrapper (UnixBootstrapper):
self.packages.append('gcc-multilib')
else:
self.packages.append('gcc')
+ if self.config.target_platform == Platform.WINDOWS:
+ if self.config.arch in [Architecture.X86_64, Architecture.X86]:
+ self.packages.append('wine')
class GentooBootstrapper (UnixBootstrapper):
@@ -188,6 +201,12 @@ class GentooBootstrapper (UnixBootstrapper):
'net-misc/wget', 'dev-libs/openssl', 'media-libs/alsa-lib'
]
+ def __init__(self, config, offline, assume_yes):
+ UnixBootstrapper.__init__(self, config, offline, assume_yes)
+ if self.config.target_platform == Platform.WINDOWS:
+ if self.config.arch in [Architecture.X86_64, Architecture.X86]:
+ self.packages.append('virtual/wine')
+
class NoneBootstrapper (BootstrapperBase):
async def start(self):
diff --git a/cerbero/config.py b/cerbero/config.py
index db69c79a..f2e08cae 100644
--- a/cerbero/config.py
+++ b/cerbero/config.py
@@ -392,7 +392,12 @@ class Config (object):
)
for each in runtime_env:
env[each] = to_winepath(env[each])
+ env['WIX'] = os.path.join(self.build_tools_prefix, 'lib', 'wix')
+ # NOTE: Ensure that whatever directory this goes into is ignored by the
+ # .cerbero deps CI job otherwise we will tar up ~1GB of generated data.
+ env['WINEPREFIX'] = os.path.join(self.build_tools_prefix, 'var', 'tmp', 'wine')
env['WINEPATH'] = to_winepath(os.path.join(prefix, 'bin'))
+ env['WINEDEBUG'] = 'fixme-all'
return env
def _merge_env(self, old_env, new_env, override_env=()):
@@ -490,7 +495,6 @@ class Config (object):
os.path.join(self.toolchain_prefix, 'lib'))
includedir = self._join_path(includedir,
os.path.join(self.toolchain_prefix, 'include'))
-
# Most of these variables are extracted from jhbuild
env = {'LD_LIBRARY_PATH': ld_library_path,
'LDFLAGS': ldflags,
diff --git a/cerbero/packages/packager.py b/cerbero/packages/packager.py
index c1f34247..c49ccaca 100644
--- a/cerbero/packages/packager.py
+++ b/cerbero/packages/packager.py
@@ -55,7 +55,7 @@ class Packager (object):
if d == Distro.WINDOWS and config.cross_compiling():
try:
- get_wix_prefix()
+ get_wix_prefix(config)
except:
m.warning("Cross-compiling for Windows and WIX not found, overriding Packager")
d = Distro.NONE
diff --git a/cerbero/packages/wix_packager.py b/cerbero/packages/wix_packager.py
index ce136545..2522081f 100644
--- a/cerbero/packages/wix_packager.py
+++ b/cerbero/packages/wix_packager.py
@@ -37,7 +37,7 @@ class MergeModulePackager(PackagerBase):
def __init__(self, config, package, store):
PackagerBase.__init__(self, config, package, store)
self._with_wine = config.platform != Platform.WINDOWS
- self.wix_prefix = get_wix_prefix()
+ self.wix_prefix = get_wix_prefix(config)
def pack(self, output_dir, devel=False, force=False, keep_temp=False):
PackagerBase.pack(self, output_dir, devel, force, keep_temp)
@@ -97,22 +97,21 @@ class MergeModulePackager(PackagerBase):
wixobjs.append(os.path.join(output_dir, "%s.wixobj" % x))
sources.append(os.path.join(os.path.abspath(self.config.data_dir),
'wix/%s.wxs' % x))
-
if self._with_wine:
- final_wixobjs = [to_winepath(x) for x in wixobjs]
- final_sources = [to_winepath(x) for x in sources]
+ final_wixobjs = ['"{}"'.format(to_winepath(x)) for x in wixobjs]
+ final_sources = ['"{}"'.format(to_winepath(x)) for x in sources]
else:
final_wixobjs = wixobjs
final_sources = sources
candle = Candle(self.wix_prefix, self._with_wine)
- candle.compile(' '.join(final_sources), output_dir)
+ candle.compile(' '.join(final_sources), output_dir, env=self.config.env)
if self.package.wix_use_fragment:
path = wixobjs[0]
else:
light = Light(self.wix_prefix, self._with_wine)
- path = light.compile(final_wixobjs, package_name, output_dir, True)
+ path = light.compile(final_wixobjs, package_name, output_dir, env=self.config.env, merge_module=True)
# Clean up
if not keep_temp:
@@ -153,7 +152,7 @@ class MSIPackager(PackagerBase):
def __init__(self, config, package, store):
PackagerBase.__init__(self, config, package, store)
self._with_wine = config.platform != Platform.WINDOWS
- self.wix_prefix = get_wix_prefix()
+ self.wix_prefix = get_wix_prefix(config)
def pack(self, output_dir, devel=False, force=False, keep_temp=False):
self.output_dir = os.path.realpath(output_dir)
@@ -255,17 +254,17 @@ class MSIPackager(PackagerBase):
'wix/%s.wxs' % x))
if self._with_wine:
- final_wixobjs = [to_winepath(x) for x in wixobjs]
- final_sources = [to_winepath(x) for x in sources]
+ final_wixobjs = ['"{}"'.format(to_winepath(x)) for x in wixobjs]
+ final_sources = ['"{}"'.format(to_winepath(x)) for x in sources]
else:
final_wixobjs = wixobjs
final_sources = sources
candle = Candle(self.wix_prefix, self._with_wine)
- candle.compile(' '.join(final_sources), self.output_dir)
+ candle.compile(' '.join(final_sources), self.output_dir, env=self.config.env)
light = Light(self.wix_prefix, self._with_wine,
"%s %s" % (self.UI_EXT, self.UTIL_EXT))
- path = light.compile(final_wixobjs, self._package_name(), self.output_dir)
+ path = light.compile(final_wixobjs, self._package_name(), self.output_dir, env=self.config.env)
# Clean up
if not self.keep_temp:
@@ -308,9 +307,9 @@ class Candle(object):
self.options['wine'] = ''
self.options['q'] = ''
- def compile(self, source, output_dir):
+ def compile(self, source, output_dir, env):
self.options['source'] = source
- shell.new_call(self.cmd % self.options, output_dir)
+ shell.new_call(self.cmd % self.options, output_dir, env=env)
return os.path.join(output_dir, source, '.msm')
@@ -331,14 +330,14 @@ class Light(object):
self.options['wine'] = ''
self.options['q'] = ''
- def compile(self, objects, msi_file, output_dir, merge_module=False):
+ def compile(self, objects, msi_file, output_dir, env, merge_module=False):
self.options['objects'] = ' '.join(objects)
self.options['msi'] = msi_file
if merge_module:
self.options['ext'] = 'msm'
else:
self.options['ext'] = 'msi'
- shell.new_call(self.cmd % self.options, output_dir)
+ shell.new_call(self.cmd % self.options, output_dir, env=env)
msi_file_path = os.path.join(output_dir,
'%(msi)s.%(ext)s' % self.options)
if self.options['wine'] == 'wine':
diff --git a/cerbero/utils/__init__.py b/cerbero/utils/__init__.py
index 77af5e9a..13d90e85 100644
--- a/cerbero/utils/__init__.py
+++ b/cerbero/utils/__init__.py
@@ -443,9 +443,9 @@ def escape_path(path):
return path
-def get_wix_prefix():
- if 'WIX' in os.environ:
- wix_prefix = os.path.join(os.environ['WIX'], 'bin')
+def get_wix_prefix(config):
+ if 'WIX' in config.env:
+ wix_prefix = os.path.join(config.env['WIX'], 'bin')
else:
wix_prefix = 'C:/Program Files%s/Windows Installer XML v3.5/bin'
if not os.path.exists(wix_prefix):
diff --git a/config/windows.config b/config/windows.config
index 645b49be..e86e8c06 100644
--- a/config/windows.config
+++ b/config/windows.config
@@ -45,12 +45,6 @@ if platform == Platform.WINDOWS:
build = 'i686-w64-mingw32'
if target_arch == Architecture.X86_64:
build = 'x86_64-w64-mingw32'
-else:
- env['WIX'] = os.path.join(build_tools_prefix, 'lib', 'wix')
- # NOTE: Ensure that whatever directory this goes into is ignored by the
- # .cerbero deps CI job otherwise we will tar up ~1GB of generated data.
- env['WINEPREFIX'] = os.path.join(build_tools_prefix, 'var', 'tmp', 'wine')
- env['WINEDEBUG'] = 'fixme-all'
if target_arch == Architecture.X86:
buildname = 'windows_x86'
diff --git a/packages/gstreamer-1.0/gstreamer-1.0.package b/packages/gstreamer-1.0/gstreamer-1.0.package
index a6d26abb..7f784871 100644
--- a/packages/gstreamer-1.0/gstreamer-1.0.package
+++ b/packages/gstreamer-1.0/gstreamer-1.0.package
@@ -10,6 +10,7 @@ class SDKPackage(custom.GStreamer, package.SDKPackage):
sdk_version = '1.0'
uuid = 'b1b4b712-0d09-4a34-8117-8a69b6deecc2'
ignore_package_prefix = True
+ wix_use_fragment = True
packages =[
# (name, required, selected)
('gstreamer-1.0-core', True, True),
diff --git a/recipes/build-tools/wine-mono.recipe b/recipes/build-tools/wine-mono.recipe
new file mode 100644
index 00000000..3638b492
--- /dev/null
+++ b/recipes/build-tools/wine-mono.recipe
@@ -0,0 +1,25 @@
+# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python
+import os
+import shutil
+from cerbero.utils import shell
+
+
+class Recipe(recipe.Recipe):
+ name = 'wine-mono'
+ version = '7.1.1'
+ stype = SourceType.TARBALL
+ url = 'https://dl.winehq.org/wine/wine-mono/%(version)s/wine-mono-%(version)s-x86.msi'
+ tarball_checksum = '9dc8e5603b7bc64354eb94ae4ea0f6821424767a3ff44ff0d19e346a490c11ea'
+ btype = BuildType.CUSTOM
+
+ async def extract(self):
+ pass
+
+ async def install(self):
+ wine_path = os.path.join(self.config.prefix, 'share', 'wine')
+ if not os.path.exists(wine_path):
+ os.makedirs(wine_path)
+ self.env['WINEPREFIX'] = os.path.join(self.config.prefix, 'var', 'tmp', 'wine')
+ self.env['WINEDEBUG'] = 'fixme-all'
+ await shell.async_call(['wine', 'msiexec', '/i', os.path.join(self.download_dir, self.tarball_name)],
+ cmd_dir=wine_path, env=self.env)
diff --git a/recipes/build-tools/winetricks.recipe b/recipes/build-tools/winetricks.recipe
new file mode 100644
index 00000000..23f1b832
--- /dev/null
+++ b/recipes/build-tools/winetricks.recipe
@@ -0,0 +1,18 @@
+# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python
+import os
+import shutil
+from cerbero.utils import shell
+
+
+class Recipe(recipe.Recipe):
+ name = 'winetricks'
+ version = '20210825'
+ stype = SourceType.TARBALL
+ url = 'https://github.com/Winetricks/winetricks/archive/refs/tags/%(version)s.tar.gz'
+ tarball_checksum = 'bac77918ef4d58c6465a1043fd996d09c3ee2c5a07f56ed089c4c65a71881277'
+ btype = BuildType.CUSTOM
+
+ async def install(self):
+ winetricks_tool = os.path.join(self.config.prefix, 'bin', self.name)
+ shutil.copy(os.path.join(self.build_dir, 'src', self.name), winetricks_tool)
+ await shell.async_call(['chmod', '+x', winetricks_tool])
diff --git a/recipes/build-tools/wix.recipe b/recipes/build-tools/wix.recipe
index 93a146be..a28c7bb6 100644
--- a/recipes/build-tools/wix.recipe
+++ b/recipes/build-tools/wix.recipe
@@ -10,24 +10,23 @@ class Recipe(recipe.Recipe):
stype = SourceType.TARBALL
url = 'https://github.com/wixtoolset/wix3/releases/download/wix3111rtm/wix311-binaries.zip'
tarball_checksum = '37f0a533b0978a454efb5dc3bd3598becf9660aaf4287e55bf68ca6b527d051d'
+ deps = ['winetricks', 'wine-mono']
btype = BuildType.CUSTOM
- winetricks_url = 'https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks'
async def extract(self):
if os.path.exists(self.build_dir):
shutil.rmtree(self.build_dir)
os.makedirs(self.build_dir)
- await shell.unpack(self.download_path, self.build_dir)
+ await shell.unpack(os.path.join(self.download_dir, self.tarball_name), self.build_dir)
async def install(self):
shell.copy_dir(self.build_dir, os.path.join(self.config.prefix, 'lib', 'wix', 'bin'))
- if self.config.platform == Platform.LINUX:
- wine_path = os.path.join(self.config.prefix, 'share', 'wine')
- shell.download(self.winetricks_url, os.path.join(wine_path, 'winetricks'), True, True)
- env = {
- 'DISPLAY': '',
- 'HOME': wine_path,
- 'WINEPREFIX': wine_path
- }
- await shell.async_call(['sh', './winetricks', '-q', 'dotnet40'],
- cmd_dir=wine_path, env=env)
+ # wineconsole fails trying to get env var in a VT with DISPLAY.
+ # This is working on docker buildbot and on a real terminal.
+ winetricks_tool = os.path.join(self.config.prefix, 'bin', 'winetricks')
+ if not 'DISPLAY' in self.env:
+ self.env['WINE'] = "wineconsole"
+ if self.config.target_platform == Platform.WINDOWS and \
+ self.config.platform == Platform.LINUX:
+ await shell.async_call([winetricks_tool, '-q', 'dotnet40'], env=self.env)
+