# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python from pathlib import Path from cerbero.build.build import modify_environment class Recipe(recipe.Recipe): name = 'windows-default-manifest' version = '6.4' stype = SourceType.GIT remotes = {'origin': 'https://sourceware.org/git/cygwin-apps/%(name)s.git'} commit = 'release-6_4' licenses = [{License.BSD_like: ['COPYING']}] deps = ['gcc-bootstrap'] override_libtool = False def prepare(self): if self.config.target_arch == Architecture.X86: raise InvalidRecipeError(self) # Since we are cross-compiling we have to reset all the env # variables set by cerbero (eg: we don't want -m64 overriding # a i386 build or gcc being used instead of x86_64-mingw32-w64-gcc) for v in ['CC', 'LD', 'CPP', 'AS', 'RC', 'CXX', 'CFLAGS', 'LDFLAGS', 'CXXFLAGS', 'CCASFLAGS', 'CPPFLAGS', 'RCFLAGS']: self.set_env(v) self.host = 'x86_64-w64-mingw32' self.sysroot = f'{self.config.prefix}/{self.host}/sysroot' self.make_install += [f'DESTDIR={self.sysroot}'] self.configure_tpl = "%%(config-sh)s --prefix /usr/%(host)s "\ "--libdir /usr/%(host)s %%(options)s" % {'host': self.host} self.build_dir_32 = os.path.join(self.make_dir, 'cerbero-build-dir-32') self.build_dir_64 = os.path.join(self.make_dir, 'cerbero-build-dir-64') @modify_environment async def configure(self): # Since the toolchain is built with multilib support # this recipe builds winpthreads for both x86_64 and x86 Path(self.build_dir_32).mkdir(exist_ok=True) flags = "WINDRES=x86_64-w64-mingw32-windres " target = 'i386-w64-mingw32' libdir = "/usr/%s/lib32" % self.host self.configure_options += ' --build=%s' % self.host # i686 is always a cross build shell.new_call('%s ../configure --bindir=%s --libdir=%s --prefix=/usr/%s --host=%s %s' %\ (flags, libdir, libdir, target, target, self.configure_options), self.build_dir_32, logfile=self.logfile, env=self.env) Path(self.build_dir_64).mkdir(exist_ok=True) flags = "WINDRES=x86_64-w64-mingw32-windres " target = 'x86_64-w64-mingw32' libdir = "/usr/%s/lib" % self.host shell.new_call('%s ../configure --bindir=%s --libdir=%s --prefix=/usr/%s --host=%s %s' %\ (flags, libdir, libdir, target, target, self.configure_options), self.build_dir_64, logfile=self.logfile, env=self.env) async def compile(self): shell.new_call(self.make, self.build_dir_32, logfile=self.logfile, env=self.env) shell.new_call(self.make, self.build_dir_64, logfile=self.logfile, env=self.env) async def install(self): shell.new_call(self.make_install, self.build_dir_32, logfile=self.logfile, env=self.env) shell.new_call(self.make_install, self.build_dir_64, logfile=self.logfile, env=self.env)