changeset 5408:95b3a706b813

/GUB: install_root/system_prefix -> install_prefix and BOOTSTRAP for tools.
author Jan Nieuwenhuizen <janneke@gnu.org>
date Fri, 24 Jul 2009 17:03:23 +0200
parents ec5c230fb04e
children 9d72caba5c7f
files gub/build.py gub/cross.py gub/settings.py gub/specs/boost-jam.py gub/specs/boost.py gub/specs/busybox.py gub/specs/bzip2.py gub/specs/coreutils.py gub/specs/db.py gub/specs/findutils.py gub/specs/libjpeg.py gub/specs/librestrict.py gub/specs/libtool.py gub/specs/make.py gub/specs/ncurses.py gub/specs/netpbm.py gub/specs/nsis.py gub/specs/sed.py gub/specs/tar.py gub/specs/test-23.py gub/target.py gub/tools.py
diffstat 22 files changed, 108 insertions(+), 77 deletions(-) [+]
line wrap: on
line diff
--- a/gub/build.py	Fri Jul 24 17:02:07 2009 +0200
+++ b/gub/build.py	Fri Jul 24 17:03:23 2009 +0200
@@ -112,9 +112,15 @@
         return []
 
     def with_platform (self, name):
-        if 'tools::' in name:
-            return misc.with_platform (name.replace ('tools::', ''),
-                                       self.settings.platform)
+        if 'BOOTSTRAP' in os.environ.keys ():
+            if 'tools::' in name:
+                return misc.with_platform (name.replace ('tools::', ''),
+                                           self.settings.platform)
+        elif 0:
+            print 'NEEM:', name
+            if not 'tools::' in name and not 'cross' in name and name not in ['bintuils', 'gcc']:
+                return misc.with_platform (name.replace (self.settings.platform, ''),
+                                           'tools')
         return misc.with_platform (name, self.settings.platform)
 
     def get_platform_build_dependencies (self):
--- a/gub/cross.py	Fri Jul 24 17:02:07 2009 +0200
+++ b/gub/cross.py	Fri Jul 24 17:03:23 2009 +0200
@@ -23,7 +23,7 @@
             'LIBRARY_PATH': '%(tools_prefix)s/lib'
             + misc.append_path (os.environ.get ('LIBRARY_PATH', '')),
             'LIBRESTRICT_IGNORE': '%(tools_prefix)s/bin/make',
-            'PATH': '%(cross_prefix)s/bin:%(tools_prefix)s/bin:' + os.environ['PATH'],
+            'PATH': '%(cross_prefix)s/bin:%(tools_prefix)s/bin:%(tools_cross_prefix)s/bin:' + os.environ['PATH'],
         }
         dict.update (env)
         d = build.AutoBuild.get_substitution_dict (self, dict).copy ()
--- a/gub/settings.py	Fri Jul 24 17:02:07 2009 +0200
+++ b/gub/settings.py	Fri Jul 24 17:03:23 2009 +0200
@@ -271,8 +271,8 @@
 #cd %(alltargetdir)s && mkdir -p proc
 cd %(alltargetdir)s && mkdir %(system_root)s/etc
 ''' % self.__dict__)
-                loggedos.dump_file ('''
-PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/%(build_architecture)s/bin:/gbin"
+                loggedos.dump_file (logging.default_logger, '''
+PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/%(build_architecture)s/bin:/usr/%(build_architecture)s/%(build_architecture)s/bin:/gbin"
 alias l='ls -ltrF'
 alias p='less -nMiX'
 ''', '%(alltargetdir)s/etc/profile' % self.__dict__)
@@ -318,21 +318,24 @@
     
 def clean_environment ():
     return dict ([(x, os.environ[x]) for x in 
-                  ('DISPLAY', # Ugh, mingw::openoffice install complains about this...
-                   'EMAIL',
-                   'GUB_TOOLS_PREFIX',
-                   'HOME',
-                   'HOSTNAME',
-                   #'IFS',
-                   'LIBRESTRICT',
-                   'OOO_TOOLS_DIR',
-                   'PATH',
-                   'PKG_CONFIG_PATH',
-                   'PWD',
-                   'SHELL',
-                   'UID',
-                   'USER',
-                   'USERNAME',)
+                  (
+                'BOOTSTRAP',
+                'DISPLAY', # Ugh, mingw::openoffice install complains about this...
+                # 'EMAIL',
+                'GUB_TOOLS_PREFIX',
+                'HOME',
+                # 'HOSTNAME',
+                # 'IFS',
+                'LIBRESTRICT',
+                'OOO_TOOLS_DIR',
+                'PATH',
+                # 'PKG_CONFIG_PATH',
+                # 'PWD',
+                # 'SHELL',
+                # 'UID',
+                # 'USER',
+                # 'USERNAME',
+                )
                   if os.environ.get (x) != None])
 
 def main ():
--- a/gub/specs/boost-jam.py	Fri Jul 24 17:02:07 2009 +0200
+++ b/gub/specs/boost-jam.py	Fri Jul 24 17:03:23 2009 +0200
@@ -9,6 +9,6 @@
         return tools.ShBuild.compile_command (self) + ' gcc --symbols'
     def install_command (self):
         return misc.join_lines ('''
-install -d %(install_root)s/%(system_prefix)s/bin
-&& install -m755 bin.*/bjam  %(install_root)s/%(system_prefix)s/bin
+install -d %(install_prefix)s/bin
+&& install -m755 bin.*/bjam  %(install_prefix)s/bin
 ''')
--- a/gub/specs/boost.py	Fri Jul 24 17:02:07 2009 +0200
+++ b/gub/specs/boost.py	Fri Jul 24 17:03:23 2009 +0200
@@ -207,8 +207,8 @@
     def install (self):
         tools.BjamBuild_v2.install (self)
         # Bjam `installs' header files by using symlinks to the source dir?
-        self.map_locate (add_plain_lib_names, '%(install_root)s%(system_prefix)s/lib', 'libboost_*-mt.a')
-        self.map_locate (add_plain_lib_names, '%(install_root)s%(system_prefix)s/lib', 'libboost_*-mt.so')
-        self.map_locate (add_plain_lib_names, '%(install_root)s%(system_prefix)s/lib', 'libboost_*-s.a')
-        self.map_locate (add_plain_lib_names, '%(install_root)s%(system_prefix)s/lib', 'libboost_*-s.so')
-        self.map_locate (replace_links, '%(install_root)s%(system_prefix)s/include/boost', '*')
+        self.map_locate (add_plain_lib_names, '%(install_prefix)s/lib', 'libboost_*-mt.a')
+        self.map_locate (add_plain_lib_names, '%(install_prefix)s/lib', 'libboost_*-mt.so')
+        self.map_locate (add_plain_lib_names, '%(install_prefix)s/lib', 'libboost_*-s.a')
+        self.map_locate (add_plain_lib_names, '%(install_prefix)s/lib', 'libboost_*-s.so')
+        self.map_locate (replace_links, '%(install_prefix)s/include/boost', '*')
--- a/gub/specs/busybox.py	Fri Jul 24 17:02:07 2009 +0200
+++ b/gub/specs/busybox.py	Fri Jul 24 17:03:23 2009 +0200
@@ -74,9 +74,9 @@
         self.system ('''rm -f %(builddir)s/include/%(autoconf_h)s
 cd %(builddir)s && make include/%(autoconf_h)s > /dev/null 2>&1''')
     def makeflags (self):
-        return ' CONFIG_PREFIX=%(install_root)s%(system_prefix)s'
+        return ' CONFIG_PREFIX=%(install_prefix)s'
     def install (self):
         tools.AutoBuild.install (self)
         self.system ('''
-cd %(install_root)s%(system_prefix)s && mv sbin/init sbin/init.busybox
+cd %(install_prefix)s && mv sbin/init sbin/init.busybox
 ''')
--- a/gub/specs/bzip2.py	Fri Jul 24 17:02:07 2009 +0200
+++ b/gub/specs/bzip2.py	Fri Jul 24 17:03:23 2009 +0200
@@ -8,10 +8,10 @@
         return tools.MakeBuild.compile_command (self) + self.compile_flags ()
     def install_command (self):
         return (tools.MakeBuild.install_command (self)
-                + ' PREFIX=%(install_root)s%(system_prefix)s')
+                + ' PREFIX=%(install_prefix)s')
     def install (self):
         tools.MakeBuild.install (self)
-        self.system ('cp -pv %(builddir)s/libbz2.so* %(install_root)s%(system_prefix)s/lib')
+        self.system ('cp -pv %(builddir)s/libbz2.so* %(install_prefix)s/lib')
     def wrap_executables (self):
         # no dynamic executables
         pass
--- a/gub/specs/coreutils.py	Fri Jul 24 17:02:07 2009 +0200
+++ b/gub/specs/coreutils.py	Fri Jul 24 17:03:23 2009 +0200
@@ -1,4 +1,4 @@
-from gub import target as tools
+from gub import tools
 
 '''
 Build shared libcoreutils.so without using libtool
--- a/gub/specs/db.py	Fri Jul 24 17:02:07 2009 +0200
+++ b/gub/specs/db.py	Fri Jul 24 17:03:23 2009 +0200
@@ -1,6 +1,8 @@
 from gub import misc
 from gub import target
 from gub import tools
+import os
+if 'BOOTSTRAP' in os.environ.keys (): from gub import target as tools
 
 class Db (target.AutoBuild):
     source = 'http://download.oracle.com/berkeley-db/db-4.7.25.tar.gz'
@@ -85,6 +87,6 @@
         pass
     def install (self):
         tools.AutoBuild.install (self)
-        self.system ('cd %(install_root)s%(system_prefix)s/lib && ln -s libdb-*.la libdb.la')
+        self.system ('cd %(install_prefix)s/lib && ln -s libdb-*.la libdb.la')
     def wrap_executables (self):
         pass
--- a/gub/specs/findutils.py	Fri Jul 24 17:02:07 2009 +0200
+++ b/gub/specs/findutils.py	Fri Jul 24 17:03:23 2009 +0200
@@ -1,4 +1,6 @@
-from gub import target as tools
+from gub import tools
+import os
+if 'BOOTSTRAP' in os.environ.keys (): from gub import target as tools
 
 class Findutils__tools (tools.AutoBuild):
     source = 'http://ftp.gnu.org/pub/gnu/findutils/findutils-4.4.2.tar.gz'
--- a/gub/specs/libjpeg.py	Fri Jul 24 17:02:07 2009 +0200
+++ b/gub/specs/libjpeg.py	Fri Jul 24 17:03:23 2009 +0200
@@ -84,6 +84,6 @@
             '%(builddir)s/Makefile')
     def install_command (self):
         return misc.join_lines ('''
-mkdir -p %(install_root)s/%(system_prefix)s/bin %(install_root)s/%(system_prefix)s/include %(install_root)s/%(system_prefix)s/lib 
+mkdir -p %(install_prefix)s/bin %(install_prefix)s/include %(install_prefix)s/lib 
 && make DESTDIR=%(install_root)s install-headers install-lib
 ''')
--- a/gub/specs/librestrict.py	Fri Jul 24 17:02:07 2009 +0200
+++ b/gub/specs/librestrict.py	Fri Jul 24 17:03:23 2009 +0200
@@ -19,8 +19,7 @@
         relax_restrictions = ['coreutils', 'dash']
         if 'stat' in self.librestrict_flavours ():
             relax_restrictions = []
-        return {'': ['coreutils',
-                     'dash',
+        return {'': [
                      'librestrict',
                      'librestrict-exec',
                      'librestrict-exec-open',
@@ -64,8 +63,8 @@
         return command
     def install_command (self):
         return (misc.join_lines ('''
-mkdir -p %(install_root)s/%(system_prefix)s/lib
-&& cp -p librestrict*.so %(install_root)s/%(system_prefix)s/lib
+mkdir -p %(install_prefix)s/lib
+&& cp -p librestrict*.so %(install_prefix)s/lib
 '''))
 
 Librestrict__tools = Librestrict_nomake__tools
--- a/gub/specs/libtool.py	Fri Jul 24 17:02:07 2009 +0200
+++ b/gub/specs/libtool.py	Fri Jul 24 17:03:23 2009 +0200
@@ -108,7 +108,7 @@
         # ignore [have /usr prevail over] --prefix ?
         self.file_sub ([(' (/usr/lib/*[" ])', r' %(system_prefix)s/lib \1'),
                         ('((-L| )/usr/lib/../lib/* )', r'\2%(system_prefix)s/lib \1')],
-                       '%(install_root)s/%(system_prefix)s/bin/libtool')
+                       '%(install_prefix)s/bin/libtool')
     def wrap_executables (self):
         # The libtool script calls the cross compilers, and moreover,
         # it is copied.  Two reasons why it cannot be wrapped.
--- a/gub/specs/make.py	Fri Jul 24 17:02:07 2009 +0200
+++ b/gub/specs/make.py	Fri Jul 24 17:03:23 2009 +0200
@@ -1,6 +1,7 @@
 from gub import misc
-#from gub import tools
-from gub import target as tools
+from gub import tools
+import os
+if 'BOOTSTRAP' in os.environ.keys (): from gub import target as tools
 
 class Make_make__tools (tools.AutoBuild):
     source = 'ftp://ftp.gnu.org/pub/gnu/make/make-3.81.tar.gz'
@@ -25,8 +26,8 @@
     def compile_command (self):
         return 'sh build.sh'
     def install_command (self):
-        return ('mkdir -p %(install_root)s/%(system_prefix)s/bin'
-                ' && cp -p make %(install_root)s/%(system_prefix)s/bin')
+        return ('mkdir -p %(install_prefix)s/bin'
+                ' && cp -p make %(install_prefix)s/bin')
 
 class Make_build_sh_newmake__tools (Make_make__tools):
     def compile_command (self):
--- a/gub/specs/ncurses.py	Fri Jul 24 17:02:07 2009 +0200
+++ b/gub/specs/ncurses.py	Fri Jul 24 17:03:23 2009 +0200
@@ -22,7 +22,7 @@
                 + ' --with-normal'
                 + ' --with-shared'
                 + ' --without-cxx'
-                + ' --without-cxx-binding'
+                + ' --without--cxx-binding'
                 )
     def _get_build_dependencies (self):
         return [
--- a/gub/specs/netpbm.py	Fri Jul 24 17:02:07 2009 +0200
+++ b/gub/specs/netpbm.py	Fri Jul 24 17:03:23 2009 +0200
@@ -30,21 +30,21 @@
 ''')
     def install (self):
         # Great.  netpmb's install will not create any parent directories
-        self.system ('mkdir -p %(install_root)s%(system_prefix)s')
+        self.system ('mkdir -p %(install_prefix)s')
         # but demands that the toplevel install directory does not yet exist.
         # It's a feature! :-)
-        self.system ('rmdir %(install_root)s%(system_prefix)s')
+        self.system ('rmdir %(install_prefix)s')
 
-        self.system ('cd %(builddir)s && make package pkgdir=%(install_root)s%(system_prefix)s %(makeflags)s')
+        self.system ('cd %(builddir)s && make package pkgdir=%(install_prefix)s %(makeflags)s')
         # Huh, we strip stuff in installer.py, no?  Hmm.
         self.system ('''rm -rf %(install_prefix)s/misc 
-rm -rf %(install_root)s%(system_prefix)s/README
-rm -rf %(install_root)s%(system_prefix)s/VERSION
-rm -rf %(install_root)s%(system_prefix)s/link
-rm -rf %(install_root)s%(system_prefix)s/misc
-rm -rf %(install_root)s%(system_prefix)s/man
-rm -rf %(install_root)s%(system_prefix)s/pkginfo
-rm -rf %(install_root)s%(system_prefix)s/config_template
+rm -rf %(install_prefix)s/README
+rm -rf %(install_prefix)s/VERSION
+rm -rf %(install_prefix)s/link
+rm -rf %(install_prefix)s/misc
+rm -rf %(install_prefix)s/man
+rm -rf %(install_prefix)s/pkginfo
+rm -rf %(install_prefix)s/config_template
 ''')
     def license_files (self):
         return '%(srcdir)s/README'
--- a/gub/specs/nsis.py	Fri Jul 24 17:02:07 2009 +0200
+++ b/gub/specs/nsis.py	Fri Jul 24 17:03:23 2009 +0200
@@ -66,4 +66,4 @@
     def install (self):
         self.system ('cd %(builddir)s && %(install_command)s ',
                      self.build_environment ())
-        self.system ('cp -p %(nsisdir)s/FontName.dll %(install_root)s%(system_prefix)s/share/nsis/Plugins')
+        self.system ('cp -p %(nsisdir)s/FontName.dll %(install_prefix)s/share/nsis/Plugins')
--- a/gub/specs/sed.py	Fri Jul 24 17:02:07 2009 +0200
+++ b/gub/specs/sed.py	Fri Jul 24 17:03:23 2009 +0200
@@ -1,4 +1,6 @@
-from gub import target as tools
+from gub import tools
+import os
+if 'BOOTSTRAP' in os.environ.keys (): from gub import target as tools
 
 class Sed__tools (tools.AutoBuild):
     source = 'ftp://ftp.gnu.org/pub/gnu/sed/sed-4.1.5.tar.gz'
--- a/gub/specs/tar.py	Fri Jul 24 17:02:07 2009 +0200
+++ b/gub/specs/tar.py	Fri Jul 24 17:03:23 2009 +0200
@@ -1,4 +1,6 @@
-from gub import target as tools
+from gub import tools
+import os
+if 'BOOTSTRAP' in os.environ.keys (): from gub import target as tools
 
 class Tar__tools (tools.AutoBuild):
     source = 'ftp://ftp.gnu.org/pub/gnu/tar/tar-1.20.tar.gz'
--- a/gub/specs/test-23.py	Fri Jul 24 17:02:07 2009 +0200
+++ b/gub/specs/test-23.py	Fri Jul 24 17:03:23 2009 +0200
@@ -29,7 +29,7 @@
     def untar (self):
         pass
     def install (self):
-        self.system ('mkdir -p %(install_root)s%(system_prefix)s')
+        self.system ('mkdir -p %(install_prefix)s')
 
 sys.stdout.write ('''\nEXPECT: <class 'test-23.Test_23'>''')
 sys.stdout.write ('\n>>>')
--- a/gub/target.py	Fri Jul 24 17:02:07 2009 +0200
+++ b/gub/target.py	Fri Jul 24 17:03:23 2009 +0200
@@ -133,6 +133,7 @@
         dict = {
             'AR': '%(toolchain_prefix)sar',
             'AS': '%(toolchain_prefix)sas',
+            'BUILD_CC': 'C_INCLUDE_PATH= CPATH= CPPFLAGS= LIBRARY_PATH= cc',
             'CC': '%(toolchain_prefix)sgcc %(target_gcc_flags)s',
             'CC_FOR_BUILD': 'C_INCLUDE_PATH= CPATH= CPPFLAGS= LIBRARY_PATH= cc',
             'CCLD_FOR_BUILD': 'C_INCLUDE_PATH= CPATH= CPPFLAGS= LIBRARY_PATH= cc',
@@ -146,7 +147,7 @@
             'LD': '%(toolchain_prefix)sld',
             'NM': '%(toolchain_prefix)snm',
             'PKG_CONFIG_PATH': '%(system_prefix)s/lib/pkgconfig',
-            'PATH': '%(cross_prefix)s/bin:%(tools_prefix)s/bin:' + os.environ['PATH'],
+            'PATH': '%(cross_prefix)s/bin:%(tools_prefix)s/bin:%(tools_cross_prefix)s/bin:' + os.environ['PATH'],
             'PKG_CONFIG': '''pkg-config \
 --define-variable prefix=%(system_prefix)s \
 --define-variable includedir=%(system_prefix)s/include \
--- a/gub/tools.py	Fri Jul 24 17:02:07 2009 +0200
+++ b/gub/tools.py	Fri Jul 24 17:03:23 2009 +0200
@@ -63,13 +63,18 @@
         return (build.AutoBuild.configure_command (self)
                 + self.configure_flags ()
                 + self.configure_variables ())
+    @context.subst_method
+    def configure_prefix (self):
+        if 'BOOTSTRAP' in os.environ.keys ():
+            return '%(prefix_dir)s'
+        return '%(system_prefix)s'
     # FIXME: promoteme to build.py?  Most Fragile operation...
     def configure_flags (self):
         config_cache = ''
         if self.config_cache_settings ():
             config_cache = '\n--config-cache'
         return misc.join_lines ('''
---prefix=%(system_prefix)s
+--prefix=%(configure_prefix)s
 --enable-shared
 --enable-static
 ''' + config_cache)
@@ -88,19 +93,19 @@
         # FIXME: use sysconfdir=%(install_PREFIX)s/etc?  If
         # so, must also ./configure that way
         return misc.join_lines ('''make %(makeflags)s install
-bindir=%(install_root)s/%(system_prefix)s/bin
-aclocaldir=%(install_root)s/%(system_prefix)s/share/aclocal
-datadir=%(install_root)s/%(system_prefix)s/share
-exec_prefix=%(install_root)s/%(system_prefix)s
-gcc_tooldir=%(install_root)s/%(system_prefix)s
-includedir=%(install_root)s/%(system_prefix)s/include
-infodir=%(install_root)s/%(system_prefix)s/share/info
-libdir=%(install_root)s/%(system_prefix)s/lib
-libexecdir=%(install_root)s/%(system_prefix)s/lib
-mandir=%(install_root)s/%(system_prefix)s/share/man
-prefix=%(install_root)s/%(system_prefix)s
-sysconfdir=%(install_root)s/%(system_prefix)s/etc
-tooldir=%(install_root)s/%(system_prefix)s
+bindir=%(install_prefix)s/bin
+aclocaldir=%(install_prefix)s/share/aclocal
+datadir=%(install_prefix)s/share
+exec_prefix=%(install_prefix)s
+gcc_tooldir=%(install_prefix)s
+includedir=%(install_prefix)s/include
+infodir=%(install_prefix)s/share/info
+libdir=%(install_prefix)s/lib
+libexecdir=%(install_prefix)s/lib
+mandir=%(install_prefix)s/share/man
+prefix=%(install_prefix)s
+sysconfdir=%(install_prefix)s/etc
+tooldir=%(install_prefix)s
 ''')
 
     def install (self):
@@ -109,6 +114,12 @@
         if 0:
             self.wrap_executables ()
 
+    @context.subst_method
+    def install_prefix (self):
+        if 'BOOTSTRAP' in os.environ.keys ():
+            return '%(install_root)s%(prefix_dir)s'
+        return '%(install_prefix)s'
+
     def wrap_executables (self):
         def wrap (logger, file):
             dir = os.path.dirname (file)
@@ -128,6 +139,8 @@
 
     ## we need to tar up %(install_root)/%(prefix)
     def packaging_suffix_dir (self):
+        if 'BOOTSTRAP' in os.environ.keys ():
+            return ''
         return '%(system_root)s'
 
     def get_subpackage_names (self):
@@ -219,7 +232,7 @@
 ''')
     def install_command (self):
         return (self.compile_command ()
-                + ' install').replace ('=%(system_prefix)s', '=%(install_root)s%(system_prefix)s')
+                + ' install').replace ('=%(system_prefix)s', '=%(install_prefix)s')
 
 class NullBuild (AutoBuild):
     def stages (self):
@@ -227,4 +240,4 @@
     def get_subpackage_names (self):
         return ['']
     def install (self):
-        self.system ('mkdir -p %(install_root)s%(system_prefix)s')
+        self.system ('mkdir -p %(install_prefix)s')