changeset 5393:a9e728eddb12

/GUB: Get cross/gcc to build. for i in librestrict cross/binutils dash cross/gcc-core linux-headers glibc-core cross/gcc bash coreutils; do gub -x --fresh $i || break; done fakechroot chroot x86_64-linux /usr/bin/bash fakeroot -s fakeroot.save fakechroot chroot x86_64-linux /usr/bin/bash fakechroot chroot . /x86_64-linux/usr/bin/bash bash-3.2$ bash -x ldd /bin/x86_64-linux-gcc bash: /home/janneke/vc/gub/GUB/./lib/libc.so.6: version `GLIBC_2.4' not found (required by /usr/lib/fakechroot/libfakechroot.so)
author Jan Nieuwenhuizen <janneke@gnu.org>
date Thu, 23 Jul 2009 10:40:30 +0200
parents 7d5eb614d4c3
children d6ed36e3702c
files gub/cross.py gub/gup.py gub/locker.py gub/settings.py gub/specs/coreutils.py gub/specs/cross/gcc-core.py gub/specs/cross/gcc.py gub/specs/linux-headers.py gub/tools.py
diffstat 9 files changed, 44 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/gub/cross.py	Wed Jul 22 15:26:55 2009 +0200
+++ b/gub/cross.py	Thu Jul 23 10:40:30 2009 +0200
@@ -29,7 +29,9 @@
         d = build.AutoBuild.get_substitution_dict (self, dict).copy ()
         return d
     def configure_command (self):
-        return (build.AutoBuild.configure_command (self)
+        return (
+            '''LDFLAGS='-L%(system_prefix)s/lib -Wl,--as-needed' '''
+            + build.AutoBuild.configure_command (self)
             + misc.join_lines ('''
 --program-prefix=%(target_architecture)s-
 --prefix=%(cross_prefix)s
--- a/gub/gup.py	Wed Jul 22 15:26:55 2009 +0200
+++ b/gub/gup.py	Thu Jul 23 10:40:30 2009 +0200
@@ -45,9 +45,8 @@
         self.is_distro = False
 
         ## lock must be outside of root, otherwise we can't rm -rf root
-        ## self.lock_file = self.root + '.lock'
-        ## Well, stuff it: /GUB.lock: permission denied
-        self.lock_file = self.root + '/.lock2'
+        # UGH, /GUB
+        self.lock_file = self.root + '.lock'
         if self.root == os.environ['HOME']:
             self.lock_file = self.root + '/.gub.lock'
         self.lock = locker.Locker (self.lock_file)
--- a/gub/locker.py	Wed Jul 22 15:26:55 2009 +0200
+++ b/gub/locker.py	Thu Jul 23 10:40:30 2009 +0200
@@ -36,7 +36,7 @@
             fcntl.flock (lock_file.fileno (),
                          fcntl.LOCK_EX | fcntl.LOCK_NB)
         except IOError:
-            os.system ('ls -ltrF ' + os.path.dirname (lock_file_name) + '/')
+            os.system ('ls -altrF ' + os.path.dirname (lock_file_name) + '/')
             raise LockedError ('''Can't acquire lock: ''' + lock_file_name)
 
         self.lock_file_name = lock_file_name
--- a/gub/settings.py	Wed Jul 22 15:26:55 2009 +0200
+++ b/gub/settings.py	Thu Jul 23 10:40:30 2009 +0200
@@ -55,9 +55,6 @@
     def __init__ (self, platform=None):
         context.Context.__init__ (self)
 
-        self.root_dir = '' # '/GUB'
-        self.prefix_dir = '' # '/usr'
-
         self.build_platform = build_platform.machine ().strip ()
         if not self.build_platform:
             build_platform.plain_machine ().strip ()
@@ -96,8 +93,10 @@
             self.target_cpu = self.build_cpu
             self.target_bits = self.build_bits
 
-        self.cross_dir = '/' + self.target_architecture
         # config dirs
+        self.root_dir = '/' + self.target_architecture
+        self.prefix_dir = '/usr'
+        self.cross_dir = ''
 
         # Support GUB tools building directly in $HOME/{bin,lib,share},
         # use GUB_TOOLS_PREFIX=$HOME
@@ -122,13 +121,14 @@
         # workdir based; may be changed
         self.downloads = self.workdir + '/downloads'
         self.alltargetdir = '/GUB'
-        self.targetdir = self.alltargetdir + self.cross_dir
-        self.logdir = self.targetdir + '/log'
 
-        self.system_root = self.alltargetdir #self.targetdir + self.root_dir
+        self.system_root = self.alltargetdir + self.root_dir
         if self.platform == 'tools' and GUB_TOOLS_PREFIX:
             self.system_root = GUB_TOOLS_PREFIX
-        self.system_prefix = self.targetdir + self.root_dir #self.system_root + self.prefix_dir
+        self.system_prefix = self.system_root + self.prefix_dir
+
+        self.targetdir = self.system_root
+        self.logdir = self.targetdir + '/log'
 
         ## Patches are architecture dependent, 
         ## so to ensure reproducibility, we unpack for each
@@ -142,11 +142,15 @@
         self.platform_uploads = self.uploads + '/' + self.platform
 
         # FIXME: rename to cross_root?
-        ##self.cross_prefix = self.system_prefix + self.cross_dir
-        self.cross_prefix = self.targetdir
+        self.cross_prefix = self.system_prefix
         self.installdir = self.targetdir + '/install'
-        self.tools_root = self.targetdir # self.alltargetdir + '/tools' + self.root_dir
-        self.tools_prefix = self.tools_root + self.prefix_dir
+        self.tools_root = self.alltargetdir
+        self.tools_prefix = self.system_prefix
+
+        print 'SYSTEM_ROOT', self.system_root
+        print 'CROSS_PREFIX', self.cross_prefix
+        print 'SYSTEM_PREFIX', self.system_prefix
+
         if GUB_TOOLS_PREFIX:
             self.tools_root = GUB_TOOLS_PREFIX
             self.tools_prefix = GUB_TOOLS_PREFIX
--- a/gub/specs/coreutils.py	Wed Jul 22 15:26:55 2009 +0200
+++ b/gub/specs/coreutils.py	Thu Jul 23 10:40:30 2009 +0200
@@ -1,4 +1,4 @@
-from gub import tools
+from gub import target as tools
 
 '''
 Build shared libcoreutils.so without using libtool
@@ -18,7 +18,7 @@
         return (tools.AutoBuild.configure_command (self)
                 + ' CFLAGS=-fPIC')
     def makeflags (self):
-        return ''' LDFLAGS='%(rpath)s' LIBS='$(cp_LDADD) $(ls_LDADD)' RANLIB='function mvaso () { mv $$1 $$(dirname $$1)/$$(basename $$1 .a).so; }; mvaso ' libcoreutils_a_AR='gcc -shared -o' '''
+        return ''' LDFLAGS='%(rpath)s' LIBS='$(cp_LDADD) $(ls_LDADD)' RANLIB='mvaso () { mv $$1 $$(dirname $$1)/$$(basename $$1 .a).so; }; mvaso ' libcoreutils_a_AR='gcc -shared -o' '''
     def wrap_executables (self):
         return False
     def install (self):
--- a/gub/specs/cross/gcc-core.py	Wed Jul 22 15:26:55 2009 +0200
+++ b/gub/specs/cross/gcc-core.py	Thu Jul 23 10:40:30 2009 +0200
@@ -6,6 +6,11 @@
     source = 'ftp://ftp.gnu.org/pub/gnu/gcc/gcc-4.1.1/gcc-4.1.1.tar.bz2'
     def _get_build_dependencies (self):
         return gcc.Gcc._get_build_dependencies (self)
+    # Ugh, hope to keep checksum
+    def patch (self):
+        gcc.Gcc__from__source.patch (self)
+        self.file_sub ([('(NATIVE_SYSTEM_HEADER_DIR = )/usr/include', r'\1%(system_prefix)s/include')],
+                       '%(srcdir)s/gcc/Makefile.in')
     def get_subpackage_names (self):
         return ['']
     def name (self):
@@ -15,10 +20,10 @@
     def get_conflict_dict (self):
         return {'': ['cross/gcc', 'cross/gcc-devel', 'cross/gcc-doc', 'cross/gcc-runtime']}
     def configure_command (self):
+#--prefix=%(cross_prefix)s
+#--prefix=%(prefix_dir)s
         return (misc.join_lines (gcc.Gcc__from__source.configure_command (self)
                                  + '''
---prefix=%(cross_prefix)s
---prefix=%(prefix_dir)s
 --with-newlib
 --enable-threads=no
 --without-headers
--- a/gub/specs/cross/gcc.py	Wed Jul 22 15:26:55 2009 +0200
+++ b/gub/specs/cross/gcc.py	Thu Jul 23 10:40:30 2009 +0200
@@ -41,6 +41,7 @@
                            '%(srcdir)s/gcc/config/i386/linux.h')
             self.file_sub ([('-dynamic-linker /lib64', '-dynamic-linker %(system_prefix)s/lib')],
                            '%(srcdir)s/gcc/config/i386/linux64.h')
+    if 0:
         self.file_sub ([('(NATIVE_SYSTEM_HEADER_DIR = )/usr/include', r'\1%(system_prefix)s/include')],
                        '%(srcdir)s/gcc/Makefile.in')
     @context.subst_method
--- a/gub/specs/linux-headers.py	Wed Jul 22 15:26:55 2009 +0200
+++ b/gub/specs/linux-headers.py	Thu Jul 23 10:40:30 2009 +0200
@@ -23,16 +23,16 @@
 cd %(srcdir)s && rm -rfv include/asm-*
 cd %(srcdir)s && mv include .include
 cd %(srcdir)s && rm -rf *
-cd %(srcdir)s && mkdir -p ./%(system_prefix)s
-cd %(srcdir)s && mv .include ./%(system_prefix)s/include
+cd %(srcdir)s && mkdir -p ./%(prefix_dir)s
+cd %(srcdir)s && mv .include ./%(prefix_dir)s/include
 ''')
         # Duplicated in libc, remove here.
         self.system ('''
 cd %(srcdir)s && rm -f\
- ./%(system_prefix)s/include/scsi/sg.h\
- ./%(system_prefix)s/include/scsi/scsi.h\
- ./%(system_prefix)s/include/scsi/scsi_ioctl.h\
- ./%(system_prefix)s/include/net/route.h
+ ./%(prefix_dir)s/include/scsi/sg.h\
+ ./%(prefix_dir)s/include/scsi/scsi.h\
+ ./%(prefix_dir)s/include/scsi/scsi_ioctl.h\
+ ./%(prefix_dir)s/include/net/route.h
 ''')
 
 from gub import misc
--- a/gub/tools.py	Wed Jul 22 15:26:55 2009 +0200
+++ b/gub/tools.py	Thu Jul 23 10:40:30 2009 +0200
@@ -55,6 +55,9 @@
         package.get_dependency_dict \
                 = misc.MethodOverrider (package.nop, get_dependency_dict)
 
+#from gub import target
+#AutoBuild = target.AutoBuild
+
 class AutoBuild (build.AutoBuild):
     def configure_command (self):
         return (build.AutoBuild.configure_command (self)
@@ -74,7 +77,7 @@
     def configure_variables (self):
         return misc.join_lines ('''
 CFLAGS=-I%(system_prefix)s/include
-LDFLAGS=-L%(system_prefix)s/lib
+LDFLAGS='-L%(system_prefix)s/lib -Wl,--as-needed'
 ''')
 
     ## ugh: prefix= will trigger libtool relinks.
@@ -103,7 +106,8 @@
     def install (self):
         build.AutoBuild.install (self)
         # conditional on use of rpath, depending on shared libs?
-        self.wrap_executables ()
+        if 0:
+            self.wrap_executables ()
 
     def wrap_executables (self):
         def wrap (logger, file):