Mercurial > gub
changeset 3441:66992c82c423
Merge cross.gcc into specs/cross/gcc.
author | Jan Nieuwenhuizen <janneke@gnu.org> |
---|---|
date | Sat, 05 May 2007 13:40:43 +0200 |
parents | 5e013063eeaf |
children | 0db91097fcb0 |
files | TODO gub/cross.py gub/specs/cross/gcc-core.py gub/specs/cross/gcc.py gub/specs/darwin/cross/gcc.py gub/specs/debian/cross/gcc-34.py gub/specs/debian/cross/gcc.py gub/specs/linux-arm-softfloat/cross/gcc.py |
diffstat | 8 files changed, 128 insertions(+), 120 deletions(-) [+] |
line wrap: on
line diff
--- a/TODO Sat May 05 13:10:23 2007 +0200 +++ b/TODO Sat May 05 13:40:43 2007 +0200 @@ -1,5 +1,3 @@ -* move and merge cross.Gcc into cross/gcc - * Softcode stages. * move Scons, Bjam recipes to gub lib. @@ -22,6 +20,8 @@ LOWER PRIORITY +- replace os. calls with os.context wrapper ones + - better name for gubb.py - Split gub/*py into packager, builder, platform
--- a/gub/cross.py Sat May 05 13:10:23 2007 +0200 +++ b/gub/cross.py Sat May 05 13:40:43 2007 +0200 @@ -1,5 +1,3 @@ -import os -# from gub import gubb from gub import misc @@ -34,74 +32,6 @@ def license_file (self): return '' -#FIXME: merge fully with specs/gcc -class Gcc (CrossToolSpec): - def get_build_dependencies (self): - return ['cross/binutils'] - - @subst_method - def NM_FOR_TARGET(self): - return '%(tool_prefix)snm' - - def get_subpackage_names (self): - # FIXME: why no -devel package? - return ['doc', 'runtime', ''] - - def languages (self): - return ['c', 'c++'] - - def configure_command (self): - cmd = CrossToolSpec.configure_command (self) - # FIXME: using --prefix=%(tooldir)s makes this - # uninstallable as a normal system package in - # /usr/i686-mingw/ - # Probably --prefix=/usr is fine too - - language_opt = (' --enable-languages=%s ' - % ','.join (self.languages ())) - cxx_opt = '--enable-libstdcxx-debug ' - - cmd += ''' ---with-as=%(cross_prefix)s/bin/%(target_architecture)s-as ---with-ld=%(cross_prefix)s/bin/%(target_architecture)s-ld ---enable-static ---enable-shared ''' - - cmd += language_opt - if 'c++' in self.languages (): - cmd += ' ' + cxx_opt - - return misc.join_lines (cmd) - - def move_target_libs (self, libdir): - if not os.path.isdir (libdir): - return - - files = [] - - ## .so* because version numbers trail .so extension. - for suf in ['.la', '.so*', '.dylib']: - files += self.locate_files (libdir, 'lib*' + suf) - - for f in files: - (dir, file) = os.path.split (f) - target = self.expand ('%(install_prefix)s/%(dir)s', locals ()) - if not os.path.isdir (target): - os.makedirs (target) - self.system ('mv %(f)s %(install_prefix)s/lib', locals ()) - - def install (self): - CrossToolSpec.install (self) - old_libs = self.expand ('%(install_root)s/usr/cross/%(target_architecture)s') - - self.move_target_libs (old_libs) - self.move_target_libs (self.expand ('%(install_root)s/usr/cross/lib')) - if os.path.exists (self.expand ('cd %(install_root)s/usr/lib/libgcc_s.so.1')): - # FIXME: .so senseless for darwin. - self.system (''' -cd %(install_root)s/usr/lib && ln -fs libgcc_s.so.1 libgcc_s.so -''') - def change_target_package (package): pass @@ -138,6 +68,7 @@ base = re.sub ('[-0-9].*', '', platform) for name in platform, base: file_name = 'gub/%(name)s.py' % locals () + import os if os.path.exists (file_name): break settings.os_interface.info ('module-name: ' + file_name + '\n')
--- a/gub/specs/cross/gcc-core.py Sat May 05 13:10:23 2007 +0200 +++ b/gub/specs/cross/gcc-core.py Sat May 05 13:40:43 2007 +0200 @@ -3,14 +3,13 @@ from gub import mirrors from gub import misc -class Gcc_core (gcc.Gcc): +class Gcc_core (gcc.Gcc_from_source): def __init__ (self, settings): - gcc.Gcc.__init__ (self, settings) + gcc.Gcc_from_source.__init__ (self, settings) self.with_tarball (mirror=mirrors.gnu, version='4.1.1', format='bz2', name='gcc') def get_build_dependencies (self): - return filter (lambda x: x != 'cross/gcc-core' and x != 'glibc-core', - gcc.Gcc.get_build_dependencies (self)) + return gcc.Gcc.get_build_dependencies (self) def get_subpackage_names (self): return [''] def name (self): @@ -20,7 +19,8 @@ def get_conflict_dict (self): return {'': ['cross/gcc', 'cross/gcc-devel', 'cross/gcc-doc', 'cross/gcc-runtime']} def configure_command (self): - return (misc.join_lines (gcc.Gcc.configure_command (self) + ''' + return (misc.join_lines (gcc.Gcc_from_source.configure_command (self) + + ''' --prefix=%(cross_prefix)s --prefix=/usr --with-newlib @@ -32,16 +32,16 @@ .replace ('disable-static', 'enable-static') .replace ('enable-threads=posix', 'enable-threads=no')) def compile_command (self): - return (cross.Gcc.compile_command (self) + ' all-gcc') + return (gcc.Gcc.compile_command (self) + ' all-gcc') def compile (self): - cross.Gcc.compile (self) + gcc.Gcc.compile (self) def install_command (self): return (gcc.Gcc.install_command (self) .replace (' install', ' install-gcc') #+ ' prefix=/usr/cross/core' ) def install (self): - # cross.Gcc moves libs into system lib places, which will + # Gcc moves libs into system lib places, which will # make gcc-core conflict with gcc. cross.CrossToolSpec.install (self) def languages (self):
--- a/gub/specs/cross/gcc.py Sat May 05 13:10:23 2007 +0200 +++ b/gub/specs/cross/gcc.py Sat May 05 13:40:43 2007 +0200 @@ -1,24 +1,91 @@ from gub import cross from gub import misc from gub import mirrors +from gub import context -class Gcc (cross.Gcc): +#FIXME: merge fully with specs/gcc +class Gcc (cross.CrossToolSpec): def __init__ (self, settings): - cross.Gcc.__init__ (self, settings) + cross.CrossToolSpec.__init__ (self, settings) self.with_tarball (mirror=mirrors.gnu, version='4.1.1', format='bz2') + def get_build_dependencies (self): - return (cross.Gcc.get_build_dependencies (self) + return ['cross/binutils'] + + @context.subst_method + def NM_FOR_TARGET(self): + return '%(tool_prefix)snm' + + def get_subpackage_names (self): + # FIXME: why no -devel package? + return ['doc', 'runtime', ''] + + def languages (self): + return ['c', 'c++'] + + def configure_command (self): + cmd = cross.CrossToolSpec.configure_command (self) + # FIXME: using --prefix=%(tooldir)s makes this + # uninstallable as a normal system package in + # /usr/i686-mingw/ + # Probably --prefix=/usr is fine too + + language_opt = (' --enable-languages=%s ' + % ','.join (self.languages ())) + cxx_opt = '--enable-libstdcxx-debug ' + + cmd += ''' +--with-as=%(cross_prefix)s/bin/%(target_architecture)s-as +--with-ld=%(cross_prefix)s/bin/%(target_architecture)s-ld +--enable-static +--enable-shared ''' + + cmd += language_opt + if 'c++' in self.languages (): + cmd += ' ' + cxx_opt + + return misc.join_lines (cmd) + + def move_target_libs (self, libdir): + import os + if not os.path.isdir (libdir): + return + + files = [] + + ## .so* because version numbers trail .so extension. + for suf in ['.la', '.so*', '.dylib']: + files += self.locate_files (libdir, 'lib*' + suf) + + for f in files: + (dir, file) = os.path.split (f) + target = self.expand ('%(install_prefix)s/%(dir)s', locals ()) + if not os.path.isdir (target): + os.makedirs (target) + self.system ('mv %(f)s %(install_prefix)s/lib', locals ()) + + def install (self): + cross.CrossToolSpec.install (self) + old_libs = self.expand ('%(install_root)s/usr/cross/%(target_architecture)s') + + self.move_target_libs (old_libs) + self.move_target_libs (self.expand ('%(install_root)s/usr/cross/lib')) + import os + if os.path.exists (self.expand ('cd %(install_root)s/usr/lib/libgcc_s.so.1')): + # FIXME: .so senseless for darwin. + self.system (''' +cd %(install_root)s/usr/lib && ln -fs libgcc_s.so.1 libgcc_s.so +''') + +class Gcc_from_source (Gcc): + def get_build_dependencies (self): + return (Gcc.get_build_dependencies (self) + ['cross/gcc-core', 'glibc-core']) - #FIXME: what about apply_all (%(patchdir)s/%(version)s)? - def patch (self): - if self.vc_repository._version == '4.1.1': - self.system (''' -cd %(srcdir)s && patch -p1 < %(patchdir)s/gcc-4.1.1-ppc-unwind.patch -''') def get_conflict_dict (self): return {'': ['cross/gcc-core'], 'doc': ['cross/gcc-core'], 'runtime': ['cross/gcc-core']} + #FIXME: merge all configure_command settings with Gcc def configure_command (self): - return (cross.Gcc.configure_command (self) + return (Gcc.configure_command (self) + misc.join_lines (''' --with-local-prefix=%(system_root)s/usr --disable-multilib @@ -31,18 +98,20 @@ --enable-long-long ''')) def install (self): - cross.Gcc.install (self) + Gcc.install (self) self.system (''' mv %(install_root)s/usr/cross/lib/gcc/%(target_architecture)s/%(version)s/libgcc_eh.a %(install_root)s/usr/lib ''') -class Gcc__mingw (cross.Gcc): +Gcc__linux = Gcc_from_source + +class Gcc__mingw (Gcc): #REMOVEME def __init__ (self, settings): - cross.Gcc.__init__ (self, settings) + Gcc.__init__ (self, settings) self.with_tarball (mirror=mirrors.gnu, version='4.1.1', format='bz2') def get_build_dependencies (self): - return (cross.Gcc.get_build_dependencies (self) + return (Gcc.get_build_dependencies (self) + ['mingw-runtime', 'w32api']) def patch (self): for f in ['%(srcdir)s/gcc/config/i386/mingw32.h', @@ -70,18 +139,26 @@ --enable-threads ''')) -class Gcc__freebsd (cross.Gcc): +class Gcc__darwin (Gcc): + #FIXME: what about apply_all (%(patchdir)s/%(version)s)? + def patch (self): + if self.vc_repository._version == '4.1.1': + self.system (''' +cd %(srcdir)s && patch -p1 < %(patchdir)s/gcc-4.1.1-ppc-unwind.patch +''') + +class Gcc__freebsd (Gcc): #REMOVEME def __init__ (self, settings): - cross.Gcc.__init__ (self, settings) + Gcc.__init__ (self, settings) self.with_tarball (mirror=mirrors.gnu, version='4.1.1', format='bz2') def get_build_dependencies (self): - return (cross.Gcc.get_build_dependencies (self) + return (Gcc.get_build_dependencies (self) + ['freebsd-runtime']) def configure_command (self): # Add --program-prefix, otherwise we get # i686-freebsd-FOO iso i686-freebsd4-FOO. - return (cross.Gcc.configure_command (self) + return (Gcc.configure_command (self) + misc.join_lines (''' --program-prefix=%(tool_prefix)s '''))
--- a/gub/specs/darwin/cross/gcc.py Sat May 05 13:10:23 2007 +0200 +++ b/gub/specs/darwin/cross/gcc.py Sat May 05 13:40:43 2007 +0200 @@ -1,10 +1,10 @@ -from gub import cross +from gub.specs.cross import gcc from gub import mirrors -class Gcc (cross.Gcc): +class Gcc (gcc.Gcc): def __init__ (self, settings): #FIXME: separate-out: darwin-ppc/gcc.py / class Gcc__darwin__powerpc () - cross.Gcc.__init__ (self, settings) + gcc.Gcc.__init__ (self, settings) if self.settings.target_architecture.startswith ("powerpc"): self.with (version='4.1.1', mirror=mirrors.gcc_41, format='bz2') else: @@ -18,13 +18,13 @@ "%(srcdir)s/libstdc++-v3/scripts/make_exports.pl") def configure_command (self): - c = cross.Gcc.configure_command (self) + c = gcc.Gcc.configure_command (self) # c = re.sub ('enable-shared', 'disable-shared', c) return c def configure (self): - cross.Gcc.configure (self) + gcc.Gcc.configure (self) def rewire_gcc_libs (self): import os @@ -42,7 +42,7 @@ ''', locals ()) def install (self): - cross.Gcc.install (self) + gcc.Gcc.install (self) self.rewire_gcc_libs () def get_build_dependencies (self): @@ -50,12 +50,12 @@ class Not_used__Gcc__darwin (Gcc): def configure (self): - cross.Gcc.configure (self) + gcc.Gcc.configure (self) def install (self): ## UGH ? ## Gcc.install (self) - cross.Gcc.install (self) + gcc.Gcc.install (self) self.rewire_gcc_libs ()
--- a/gub/specs/debian/cross/gcc-34.py Sat May 05 13:10:23 2007 +0200 +++ b/gub/specs/debian/cross/gcc-34.py Sat May 05 13:40:43 2007 +0200 @@ -1,11 +1,11 @@ -from gub import cross +from gub.specs.cross import gcc -class Gcc_34__debian__mipsel (cross.Gcc): +class Gcc_34__debian__mipsel (gcc.Gcc): def languages (self): return ['c'] def configure_command (self): - return misc.join_lines (cross.Gcc.configure_command (self) + return misc.join_lines (gcc.Gcc.configure_command (self) + ''' --program-suffix=-3.4 --with-ar=%(cross_prefix)s/bin/%(target_architecture)s-ar @@ -13,13 +13,13 @@ ''') def configure (self): - cross.Gcc.configure (self) + gcc.Gcc.configure (self) #FIXME: --with-ar, --with-nm does not work? for i in ('ar', 'nm', 'ranlib'): self.system ('cd %(cross_prefix)s/bin && ln -sf %(target_architecture)s-%(i)s %(target_architecture)s-%(i)s-3.4', env=locals ()) def install (self): - cross.Gcc.install (self) + gcc.Gcc.install (self) # get rid of duplicates self.system (''' rm -f %(install_root)s/usr/lib/libgcc_s.so
--- a/gub/specs/debian/cross/gcc.py Sat May 05 13:10:23 2007 +0200 +++ b/gub/specs/debian/cross/gcc.py Sat May 05 13:40:43 2007 +0200 @@ -1,21 +1,21 @@ -from gub import cross +from gub.specs.cross import gcc from gub import debian from gub import mirrors -class Gcc (cross.Gcc): +class Gcc (gcc.Gcc): def __init__ (self, settings): - cross.Gcc.__init__ (self, settings) + gcc.Gcc.__init__ (self, settings) self.with_tarball (mirror=mirrors.gnu, version=debian.gcc_version, format='bz2') def get_build_dependencies (self): return ['cross/binutils', 'libc6', 'libc6-dev', 'linux-kernel-headers'] ## TODO: should detect whether libc supports TLS def configure_command (self): - return cross.Gcc.configure_command (self) + ' --disable-tls ' + return gcc.Gcc.configure_command (self) + ' --disable-tls ' class Gcc__debian__arm (Gcc): def __init__ (self, settings): - cross.Gcc.__init__ (self, settings) + gcc.Gcc.__init__ (self, settings) self.with_tarball (mirror=mirrors.gnu, version='3.4.6', format='bz2')
--- a/gub/specs/linux-arm-softfloat/cross/gcc.py Sat May 05 13:10:23 2007 +0200 +++ b/gub/specs/linux-arm-softfloat/cross/gcc.py Sat May 05 13:40:43 2007 +0200 @@ -2,18 +2,18 @@ from gub.specs.cross import gcc from gub import misc -class Gcc (gcc.Gcc): +class Gcc (gcc.Gcc_from_source): def __init__ (self, settings): - gcc.Gcc.__init__ (self, settings) + gcc.Gcc_from_source.__init__ (self, settings) self.with_tarball (mirror=mirrors.gnu, version='3.4.6', format='bz2') def patch (self): - gcc.Gcc.patch (self) + gcc.Gcc_from_source.patch (self) self.system (''' cd %(srcdir)s && patch -p1 < %(patchdir)s/gcc-3.4.0-arm-lib1asm.patch cd %(srcdir)s && patch -p1 < %(patchdir)s/gcc-3.4.0-arm-nolibfloat.patch ''') def configure_command (self): - return (gcc.Gcc.configure_command (self) + return (gcc.Gcc_from_source.configure_command (self) + misc.join_lines (''' --with-float=soft #--with-fpu=vfp