Mercurial > gub
changeset 3386:31c1afbd9de4
Update darwin to get_cross_build_dependencies, using split packages.
author | Jan Nieuwenhuizen <janneke@gnu.org> |
---|---|
date | Wed, 02 May 2007 13:53:51 +0200 |
parents | e8fd9a29c5eb |
children | c5c232eff40c |
files | gub/darwin.py gub/specs/darwin/cross/gcc.py gub/specs/darwin/darwin-sdk.py gub/specs/darwin/odcctools.py gub/specs/darwin/python.py |
diffstat | 5 files changed, 152 insertions(+), 151 deletions(-) [+] |
line wrap: on
line diff
--- a/gub/darwin.py Wed May 02 13:53:26 2007 +0200 +++ b/gub/darwin.py Wed May 02 13:53:51 2007 +0200 @@ -2,117 +2,10 @@ import re import os # -from gub import misc from gub import context -from gub import cross -from gub import mirrors -from gub import gubb -from gub import repository darwin_sdk_version = '0.4' -class Odcctools (cross.CrossToolSpec): - def configure (self): - cross.CrossToolSpec.configure (self) - ## remove LD64 support. - self.file_sub ([('ld64','')], - self.builddir () + '/Makefile') - -## change to sdk package -class Python (gubb.SdkBuildSpec): - def __init__ (self, settings): - gubb.NullBuildSpec.__init__ (self, settings) - self.version = (lambda: '2.3') - self.vc_branch = '' - self.format = '' - self.has_source = False - - def srcdir (self): - return '%(allsrcdir)s/python-darwin' - - def package (self): - gubb.BuildSpec.package (self) - - def install (self): - self.system ('mkdir -p %(install_root)s/usr/cross/bin/') - self.dump ('''#!/bin/sh -if test "$1" == "--cflags"; then - echo "-I%(system_root)s/System/Library/Frameworks/Python.framework/Versions/%(version)s/include/python%(version)s" -fi -if test "$1" == "--ldflags"; then - echo "" -fi -''', '%(install_root)s/usr/cross/bin/python-config') - self.system ('chmod +x %(install_root)s/usr/cross/bin/python-config') - -class Darwin_sdk (gubb.SdkBuildSpec): - def patch (self): - self.system (''' -rm %(srcdir)s/usr/lib/libgcc* -rm %(srcdir)s/usr/lib/libstdc\+\+* -rm %(srcdir)s/usr/lib/libltdl* -rm %(srcdir)s/usr/include/ltdl.h -rm -f %(srcdir)s/usr/lib/gcc/*-apple-darwin*/*/*dylib -rm -rf %(srcdir)s/usr/lib/gcc -''') - - ## ugh, need to have gcc/3.3/machine/limits.h - ### self.system ('rm -rf %(srcdir)s/usr/include/gcc') - ##self.system ('rm -rf %(srcdir)s/usr/include/machine/limits.h') - - ## limits.h symlinks into GCC. - - pat = self.expand ('%(srcdir)s/usr/lib/*.la') - for a in glob.glob (pat): - self.file_sub ([(r' (/usr/lib/.*\.la)', r'%(system_root)s\1')], a) - - -class Gcc (cross.Gcc): - def patch (self): - self.file_sub ([('/usr/bin/libtool', '%(cross_prefix)s/bin/%(target_architecture)s-libtool')], - '%(srcdir)s/gcc/config/darwin.h') - - self.file_sub ([('--strip-underscores', '--strip-underscore')], - "%(srcdir)s/libstdc++-v3/scripts/make_exports.pl") - - def configure_command (self): - c = cross.Gcc.configure_command (self) -# c = re.sub ('enable-shared', 'disable-shared', c) - return c - - - def configure (self): - cross.Gcc.configure (self) - - def rewire_gcc_libs (self): - skip_libs = ['libgcc_s'] - for l in self.locate_files ("%(install_root)s/usr/lib/", '*.dylib'): - found_skips = [s for s in skip_libs if l.find (s) >= 0] - if found_skips: - continue - - id = self.read_pipe ('%(tool_prefix)sotool -L %(l)s', locals ()).split()[1] - id = os.path.split (id)[1] - self.system ('%(tool_prefix)sinstall_name_tool -id /usr/lib/%(id)s %(l)s', locals ()) - - def install (self): - cross.Gcc.install (self) - self.rewire_gcc_libs () - - def get_build_dependencies (self): - return ['odcctools'] - -class Gcc__darwin (Gcc): - def configure (self): - cross.Gcc.configure (self) - - def install (self): - ## UGH ? - ## Gcc.install (self) - - cross.Gcc.install (self) - self.rewire_gcc_libs () - class Rewirer (context.Os_context_wrapper): def __init__ (self, settings): context.Os_context_wrapper.__init__ (self,settings) @@ -154,13 +47,13 @@ ## ignore self. print os.path.split (l)[1], os.path.split (name)[1] - + if os.path.split (l)[1] == os.path.split (name)[1]: continue - + for o in orig_libs: if re.search (o, l): - newpath = re.sub (o, '@executable_path/../lib/', l); + newpath = re.sub (o, '@executable_path/../lib/', l); subs.append ((l, newpath)) elif l.find (self.expand ('%(targetdir)s')) >= 0: print 'found targetdir in linkage', l @@ -189,7 +82,7 @@ file_str = self.read_pipe ('tar tzf %(tarball)s', locals()) files = file_str.split ('\n') self.set_ignore_libs_from_files (files) - + def set_ignore_libs_from_files (self, files): self.ignore_libs = dict ((k.strip()[1:], True) for k in files @@ -214,37 +107,11 @@ self.rewirer.rewire_root (self.package.install_root ()) def get_cross_packages (settings): - packages = [] - - sdk = Darwin_sdk (settings) - - os_version = 7 - if settings.platform == 'darwin-x86': - os_version = 8 - - sdk.vc_repository = repository.TarBall (settings.downloads, - url='http://lilypond.org/download/gub-sources/darwin%d-sdk-0.4.tar.gz' % os_version, - version='0.4') - + # obsolete + return [] - packages.append (sdk) - packages.append (Python (settings)) - - packages += [Odcctools (settings).with (version='20060413', -# packages += [Odcctools (settings).with (version='20060608', - mirror=mirrors.opendarwin, - format='bz2')] - - if settings.target_architecture.startswith ("powerpc"): - packages.append (Gcc (settings).with (version='4.1.1', - mirror=mirrors.gcc_41, - format='bz2')) - else: - packages.append (Gcc (settings).with (version='4.2-20070207', - mirror=mirrors.gcc_snap, - format='bz2')) - - return packages +def get_cross_build_dependencies (settings): + return ['cross/gcc'] def strip_build_dep (old_val, what): deps = old_val @@ -253,21 +120,25 @@ if w in deps: deps.remove (w) deps.sort() - return deps + return deps - + def strip_dependency_dict (old_val, what): d = dict((k,[p for p in deps if p not in what]) for (k, deps) in old_val.items ()) - return d def change_target_package (p): + from gub import misc + from gub import cross + from gub import gubb cross.change_target_package (p) p.get_build_dependencies = misc.MethodOverrider (p.get_build_dependencies, - strip_build_dep, (['zlib', 'zlib-devel'],)) + strip_build_dep, + (['zlib', 'zlib-devel'],)) p.get_dependency_dict = misc.MethodOverrider (p.get_dependency_dict, - strip_dependency_dict, (['zlib', 'zlib-devel'],)) + strip_dependency_dict, + (['zlib', 'zlib-devel'],)) gubb.change_target_dict (p, { ## We get a lot of /usr/lib/ -> @executable_path/../lib/ @@ -278,7 +149,6 @@ 'CPPFLAGS' : '-DSTDC_HEADERS', }) - def system (c): s = os.system (c) if s: @@ -289,23 +159,23 @@ print s if os.system (s): raise 'barf' - + host = 'maagd' version = '0.4' darwin_version = 8 dest = 'darwin%(darwin_version)d-sdk-%(version)s' % locals() - + system ('rm -rf %s' % dest) os.mkdir (dest) - + src = '/Developer/SDKs/' if darwin_version == 7: src += 'MacOSX10.3.9.sdk' else: src += 'MacOSX10.4u.sdk' - + cmd = ('rsync -a -v %s:%s/ %s/ ' % (host, src, dest)) system (cmd) system ('chmod -R +w %s ' % dest)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gub/specs/darwin/cross/gcc.py Wed May 02 13:53:51 2007 +0200 @@ -0,0 +1,57 @@ +from gub import cross +from gub import mirrors + +class Gcc (cross.Gcc): + def __init__ (self, settings): + #FIXME: separate-out: darwin-ppc/gcc.py / class Gcc__darwin__powerpc () + cross.Gcc.__init__ (self, settings) + if self.settings.target_architecture.startswith ("powerpc"): + self.with (version='4.1.1', mirror=mirrors.gcc_41, format='bz2') + else: + self.with (version='4.2-20070207', mirror=mirrors.gcc_snap, + format='bz2') + def patch (self): + self.file_sub ([('/usr/bin/libtool', '%(cross_prefix)s/bin/%(target_architecture)s-libtool')], + '%(srcdir)s/gcc/config/darwin.h') + + self.file_sub ([('--strip-underscores', '--strip-underscore')], + "%(srcdir)s/libstdc++-v3/scripts/make_exports.pl") + + def configure_command (self): + c = cross.Gcc.configure_command (self) +# c = re.sub ('enable-shared', 'disable-shared', c) + return c + + + def configure (self): + cross.Gcc.configure (self) + + def rewire_gcc_libs (self): + skip_libs = ['libgcc_s'] + for l in self.locate_files ("%(install_root)s/usr/lib/", '*.dylib'): + found_skips = [s for s in skip_libs if l.find (s) >= 0] + if found_skips: + continue + + id = self.read_pipe ('%(tool_prefix)sotool -L %(l)s', locals ()).split()[1] + id = os.path.split (id)[1] + self.system ('%(tool_prefix)sinstall_name_tool -id /usr/lib/%(id)s %(l)s', locals ()) + + def install (self): + cross.Gcc.install (self) + self.rewire_gcc_libs () + + def get_build_dependencies (self): + return ['odcctools', 'cross/binutils'] + +class Not_used__Gcc__darwin (Gcc): + def configure (self): + cross.Gcc.configure (self) + + def install (self): + ## UGH ? + ## Gcc.install (self) + + cross.Gcc.install (self) + self.rewire_gcc_libs () +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gub/specs/darwin/darwin-sdk.py Wed May 02 13:53:51 2007 +0200 @@ -0,0 +1,32 @@ +from gub import gubb + +class Darwin_sdk (gubb.SdkBuildSpec): + def __init__ (self, settings): + gubb.SdkBuildSpec.__init__ (self, settings) + os_version = 7 + if settings.platform == 'darwin-x86': + os_version = 8 + from gub import repository + self.with_vc (repository.TarBall (settings.downloads, + url='http://lilypond.org/download/gub-sources/darwin%d-sdk-0.4.tar.gz' % os_version, + version='0.4')) + def patch (self): + self.system (''' +rm %(srcdir)s/usr/lib/libgcc* +rm %(srcdir)s/usr/lib/libstdc\+\+* +rm %(srcdir)s/usr/lib/libltdl* +rm %(srcdir)s/usr/include/ltdl.h +rm -f %(srcdir)s/usr/lib/gcc/*-apple-darwin*/*/*dylib +rm -rf %(srcdir)s/usr/lib/gcc +''') + + ## ugh, need to have gcc/3.3/machine/limits.h + ### self.system ('rm -rf %(srcdir)s/usr/include/gcc') + ##self.system ('rm -rf %(srcdir)s/usr/include/machine/limits.h') + + ## limits.h symlinks into GCC. + + import glob + pat = self.expand ('%(srcdir)s/usr/lib/*.la') + for a in glob.glob (pat): + self.file_sub ([(r' (/usr/lib/.*\.la)', r'%(system_root)s\1')], a)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gub/specs/darwin/odcctools.py Wed May 02 13:53:51 2007 +0200 @@ -0,0 +1,16 @@ +from gub import cross +from gub import mirrors + +class Odcctools (cross.CrossToolSpec): + def __init__ (self, settings): + cross.CrossToolSpec.__init__ (self, settings) + self.with (version='20060413', + # version='20060608', + mirror=mirrors.opendarwin, + format='bz2') + def get_build_dependencies (self): + return ['darwin-sdk'] + def configure (self): + cross.CrossToolSpec.configure (self) + ## remove LD64 support. + self.file_sub ([('ld64','')], self.builddir () + '/Makefile')
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gub/specs/darwin/python.py Wed May 02 13:53:51 2007 +0200 @@ -0,0 +1,26 @@ +## change to sdk package +class Python (gubb.SdkBuildSpec): + def __init__ (self, settings): + gubb.NullBuildSpec.__init__ (self, settings) + self.version = (lambda: '2.3') + self.vc_branch = '' + self.format = '' + self.has_source = False + + def srcdir (self): + return '%(allsrcdir)s/python-darwin' + + def package (self): + gubb.BuildSpec.package (self) + + def install (self): + self.system ('mkdir -p %(install_root)s/usr/cross/bin/') + self.dump ('''#!/bin/sh +if test "$1" == "--cflags"; then + echo "-I%(system_root)s/System/Library/Frameworks/Python.framework/Versions/%(version)s/include/python%(version)s" +fi +if test "$1" == "--ldflags"; then + echo "" +fi +''', '%(install_root)s/usr/cross/bin/python-config') + self.system ('chmod +x %(install_root)s/usr/cross/bin/python-config')