# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python import shutil from cerbero.errors import FatalError class Recipe(recipe.Recipe): name = 'mingw' version = '0.1' licenses = [License.LGPL] btype = BuildType.CUSTOM stype = SourceType.CUSTOM files_libs = ['libgcc_s_sjlj'] files_satic = [] files_headers = ['include/GL'] def prepare(self): self.mingw_static_files = ['%(host)s/lib/libmingwex.a', '%(host)s/lib/libdxerr9.a', '%(host)s/lib/libmoldname.a'] if self.config.platform == Platform.WINDOWS: self.mingw_static_files += ['%(mingw)s/lib/gcc/%(host)s/4.6.2/libgcc.a'] # static build deps if self.config.platform == Platform.WINDOWS: # the native compiler install libraries in 'lib' and # not in the cross prefix mingw = '.' else: mingw = self.config.host self.mingw_static_files = [f % {'mingw':mingw, 'host':self.config.host} for f in self.mingw_static_files] self.files_static = [os.path.join('lib', os.path.basename(f)) for f in self.mingw_static_files] def install(self): if self.config.target_platform != Platform.WINDOWS: raise FatalError("%s can only be installed on Windows" % self.name) if self.config.platform == Platform.WINDOWS: binmingw = 'bin' else: binmingw = os.path.join(self.config.host, 'lib') # copy some dll's required at runtime for f in ['libgcc_s_sjlj-1']: shutil.copy( os.path.join(self.config.toolchain_prefix, binmingw, f + '.dll'), os.path.join(self.config.prefix, 'bin', f + '.dll')) for f in self.files_headers: src = os.path.join(self.config.toolchain_prefix, self.config.host, f) dest = os.path.join(self.config.prefix, f) if os.path.exists(dest): shutil.rmtree(dest) shutil.copytree(src, dest) for f in self.mingw_static_files: out_file = os.path.join('lib', os.path.basename(f)) self.files_static.append(out_file) shutil.copy(os.path.join(self.config.toolchain_prefix, f), os.path.join(self.config.prefix, out_file))