Mercurial > gub
view gub/specs/cross/gcc.py @ 6218:2aaa8977b766 master
Patch gcc 4.7.2 so that it builds
author | Jordi Gutiérrez Hermoso <jordigh@octave.org> |
---|---|
date | Sat, 09 Mar 2013 22:50:22 -0500 |
parents | 0146243c7915 |
children |
line wrap: on
line source
import os # from gub import build from gub import context from gub import cross from gub import loggedos from gub import misc from gub.specs import gcc class Gcc (cross.AutoBuild): source = 'http://ftp.gnu.org/pub/gnu/gcc/gcc-4.7.2/gcc-4.7.2.tar.gz' patches = ['gcc-4.7.2-fix-libstdc++-debug-build.patch'] dependencies = ['cross/binutils'] configure_flags = (cross.AutoBuild.configure_flags + '%(enable_languages)s' + ' --enable-static' + ' --enable-shared' + ' --with-as=%(cross_prefix)s/bin/%(target_architecture)s-as' + ' --with-ld=%(cross_prefix)s/bin/%(target_architecture)s-ld' + ' --with-nm=%(cross_prefix)s/bin/%(target_architecture)s-nm' ) make_flags = misc.join_lines (''' tooldir='%(cross_prefix)s/%(target_architecture)s' gcc_tooldir='%(prefix_dir)s/%(target_architecture)s' ''') def patch (self): cross.AutoBuild.patch (self) gcc.do_not_look_in_slash_usr (self) @context.subst_method def NM_FOR_TARGET (self): return '%(toolchain_prefix)snm' # FIXME: why no -devel package? subpackage_names = ['doc', 'c++-runtime', 'runtime', ''] def get_subpackage_definitions (self): d = cross.AutoBuild.get_subpackage_definitions (self) prefix_dir = self.settings.prefix_dir d['c++-runtime'] = [prefix_dir + '/lib/libstdc++.so*'] return d def languages (self): return ['c', 'c++', 'fortran'] @context.subst_method def enable_languages (self): flags = ' --enable-languages=' + ','.join (self.languages ()) if 'c++' in self.languages (): flags += ' --enable-libstdcxx-debug' return flags def pre_install (self): cross.AutoBuild.pre_install (self) # Only id <PREFIX>/<TARGET-ARCH>/bin exists, gcc's install installs # the plain gcc drivers without <TOOLCHAIN-PREFIX>gcc # self.system ('mkdir -p %(install_root)s%(cross_prefix)s/%(target_architecture)s/bin') self.system ('mkdir -p %(install_root)s%(prefix_dir)s/%(target_architecture)s/bin') def install (self): cross.AutoBuild.install (self) gcc.move_target_libs (self, '%(install_prefix)s%(cross_dir)s/%(target_architecture)s') gcc.move_target_libs (self, '%(install_prefix)s%(cross_dir)s/lib') self.disable_libtool_la_files ('stdc[+][+]') class Gcc__from__source (Gcc): dependencies = (Gcc.dependencies + ['cross/gcc-core', 'glibc-core']) #FIXME: merge all configure_command settings with Gcc configure_flags = (Gcc.configure_flags + misc.join_lines (''' --with-local-prefix=%(system_prefix)s --disable-multilib --disable-nls --enable-threads=posix --enable-__cxa_atexit --enable-symvers=gnu --enable-c99 --enable-clocale=gnu --enable-long-long ''')) def get_conflict_dict (self): return {'': ['cross/gcc-core'], 'doc': ['cross/gcc-core'], 'runtime': ['cross/gcc-core']} Gcc__linux = Gcc__from__source class Gcc__mingw (Gcc): dependencies = (Gcc.dependencies + ['mingw-runtime', 'w32api'] + ['tools::libtool']) def patch (self): Gcc.patch (self) for f in ['%(srcdir)s/gcc/config/i386/mingw32.h', '%(srcdir)s/gcc/config/i386/t-mingw-w32']: self.file_sub ([('/mingw/include','%(prefix_dir)s/include'), ('/mingw/lib','%(prefix_dir)s/lib'), ], f) def STATIC_GXX_WIP_REMOVE_THIS_PREFIX_configure (self): # leave this for now. # lots of undefined refs. # possibly try static libstc++ with gcc > 4.1.1 '''.libs/bitmap_allocator.o: In function `__gthread_mutex_init_function': /home/janneke/vc/gub/target/mingw/build/cross/gcc-4.1.1/i686-mingw32/libstdc++-v3/include/i686-mingw32/bits/gthr-default.h:463: undefined reference to `___gthr_win32_mutex_init_function' .libs/bitmap_allocator.o: In function `_ZN9__gnu_cxx9free_list6_M_getEj': /home/janneke/vc/gub/target/mingw/src/cross/gcc-4.1.1/libstdc++-v3/src/bitmap_allocator.cc:53: undefined reference to `__Unwind_SjLj_Register' ''' Gcc.configure (self) # Configure all subpackages, makes # w32.libtool_fix_allow_undefined to find all libtool files self.system ('cd %(builddir)s && make %(compile_flags)s configure-host configure-target') # Must ONLY do target stuff, otherwise cross executables cannot find their libraries # self.map_locate (lambda logger,file: build.libtool_update (logger, self.expand ('%(tools_prefix)s/bin/libtool'), file), '%(builddir)s/', 'libtool') #self.map_locate (lambda logger, file: build.libtool_update (logger, self.expand ('%(tools_prefix)s/bin/libtool'), file), '%(builddir)s/i686-mingw32', 'libtool') vars = ['CC', 'CXX', 'LTCC', 'LD', 'sys_lib_search_path_spec', 'sys_lib_dlsearch_path_spec', 'predep_objects', 'postdep_objects', 'predeps', 'postdeps', 'old_striplib', 'striplib'] self.map_locate (lambda logger, file: build.libtool_update_preserve_vars (logger, self.expand ('%(tools_prefix)s/bin/libtool'), vars, file), '%(builddir)s/i686-mingw32', 'libtool') self.map_locate (lambda logger, file: build.libtool_force_infer_tag (logger, 'CXX', file), '%(builddir)s/i686-mingw32', 'libtool')