changeset 5661:9cc45009b221

Grand install_command () -> class.install_command hack.
author Jan Nieuwenhuizen <janneke@gnu.org>
date Sat, 26 Sep 2009 23:05:38 +0200
parents f1cc9e07d8a9
children 13f949bf6968
files gub/build.py gub/specs/boost-jam.py gub/specs/boost.py gub/specs/cygwin/ghostscript.py gub/specs/e2fsprogs.py gub/specs/ffmpeg.py gub/specs/ghostscript.py gub/specs/inkscape-installer.py gub/specs/libjpeg.py gub/specs/librestrict.py gub/specs/lilypond-installer.py gub/specs/lilypond-test.py gub/specs/lilypond.py gub/specs/make.py gub/specs/makedev.py gub/specs/noweb.py gub/specs/pjproject.py gub/specs/pthreads-w32.py gub/specs/python.py gub/specs/qtopia-core.py gub/specs/sysvinit.py gub/specs/tinylogin.py gub/system.py gub/target.py gub/tools.py
diffstat 25 files changed, 54 insertions(+), 91 deletions(-) [+]
line wrap: on
line diff
--- a/gub/build.py	Sat Sep 26 22:52:26 2009 +0200
+++ b/gub/build.py	Sat Sep 26 23:05:38 2009 +0200
@@ -49,12 +49,17 @@
 sysconfdir=%(install_prefix)s/etc
 tooldir=%(install_prefix)s
 ''')
+    configure_command = ' sh %(configure_binary)s%(configure_flags)s%(configure_variables)s'
+    compile_command = 'make %(job_spec)s %(make_flags)s %(compile_flags)s'
+    install_command = 'make %(make_flags)s %(install_flags_destdir_broken)s %(install_flags)s'
 
     def __init__ (self, settings, source):
         context.RunnableContext.__init__ (self, settings)
         self.source = source
         self.settings = settings
         self.source.connect_logger (logging.default_logger)
+        if self.destdir_install_broken:
+            self.install_command = 'make %(make_flags)s %(install_flags)s '
 
     def connect_command_runner (self, runner):
         if runner:
@@ -329,20 +334,10 @@
     def configure_binary (self):
         return '%(autodir)s/configure'
 
-    configure_command = ' sh %(configure_binary)s%(configure_flags)s%(configure_variables)s'
-
-    compile_command = 'make %(job_spec)s %(make_flags)s %(compile_flags)s'
-
     @context.subst_method
     def compile_command_native (self):
         return 'make %(job_spec)s %(make_flags)s %(compile_flags)s'
 
-    @context.subst_method
-    def install_command (self):
-        if self.destdir_install_broken:
-            return '''make %(make_flags)s %(install_flags_destdir_broken)s %(install_flags)s'''
-        return '''make %(make_flags)s %(install_flags)s '''
-
     def aclocal_path (self):
         return [
             '%(tools_prefix)s/share/aclocal',
--- a/gub/specs/boost-jam.py	Sat Sep 26 22:52:26 2009 +0200
+++ b/gub/specs/boost-jam.py	Sat Sep 26 23:05:38 2009 +0200
@@ -4,8 +4,7 @@
 class Boost_jam (tools.ShBuild):
     source = 'http://surfnet.dl.sourceforge.net/sourceforge/boost/boost-jam-3.1.11.tgz'
     make_flags = ' gcc --symbols'
-    def install_command (self):
-        return misc.join_lines ('''
+    install_command = misc.join_lines ('''
 install -d %(install_prefix)s/bin
 && install -m755 bin.*/bjam  %(install_prefix)s/bin
 ''')
--- a/gub/specs/boost.py	Sat Sep 26 22:52:26 2009 +0200
+++ b/gub/specs/boost.py	Sat Sep 26 23:05:38 2009 +0200
@@ -124,9 +124,9 @@
 --includedir=%(prefix_dir)s/include
 --verbose
 ''')
-    def install_command (self):
-        return (self.compile_command
-                + ' install').replace ('=%(prefix_dir)s', '=%(install_prefix)s')
+    install_command = (compile_command
+                       .replace ('=%(prefix_dir)s', '=%(install_prefix)s')
+                       + ' install')
 
 class Boost_v1 (BjamBuild_v1):
     source = 'http://surfnet.dl.sourceforge.net/sourceforge/boost/boost_1_33_1.tar.bz2'
--- a/gub/specs/cygwin/ghostscript.py	Sat Sep 26 22:52:26 2009 +0200
+++ b/gub/specs/cygwin/ghostscript.py	Sat Sep 26 23:05:38 2009 +0200
@@ -92,7 +92,7 @@
 ''')
     @context.subst_method
     def install_command_x11 (self):
-        return (ghostscript.Ghostscript.install_command (self)
+        return (ghostscript.Ghostscript.install_command
                 .replace (' install ', ' install-exec ')
                 + ' -f Makefile-x11 GS=gs-x11.exe prefix=/usr/X11R6')
     def install_x11 (self):
--- a/gub/specs/e2fsprogs.py	Sat Sep 26 22:52:26 2009 +0200
+++ b/gub/specs/e2fsprogs.py	Sat Sep 26 23:05:38 2009 +0200
@@ -6,6 +6,5 @@
     source = 'http://surfnet.dl.sourceforge.net/sourceforge/e2fsprogs/e2fsprogs-1.38.tar.gz'
     configure_flags = (target.AutoBuild.configure_flags
                        + '  --enable-elf-shlibs')
-    def install_command (self):
-        return (target.AutoBuild.install_command (self)
+    install_command = (target.AutoBuild.install_command
                 + ' install-libs')
--- a/gub/specs/ffmpeg.py	Sat Sep 26 22:52:26 2009 +0200
+++ b/gub/specs/ffmpeg.py	Sat Sep 26 23:05:38 2009 +0200
@@ -28,6 +28,5 @@
 --disable-debug
 --disable-opts
 ''')
-    def install_command (self):
-        return (target.AutoBuild.install_command (self)
+    install_command = (target.AutoBuild.install_command
                 + ' INSTALLSTRIP=')
--- a/gub/specs/ghostscript.py	Sat Sep 26 22:52:26 2009 +0200
+++ b/gub/specs/ghostscript.py	Sat Sep 26 23:05:38 2009 +0200
@@ -169,8 +169,7 @@
         self.fixup_arch ()
         target.AutoBuild.compile (self)
 
-    def install_command (self):
-        return (target.AutoBuild.install_command (self)
+    install_command = (target.AutoBuild.install_command
                 + ' install_prefix=%(install_root)s'
                 + ' mandir=%(prefix_dir)s/share/man/ '
                 + ' docdir=%(prefix_dir)s/share/doc/ghostscript/doc '
@@ -248,8 +247,7 @@
 ''')
 #        self.fixup_arch ()
         tools.AutoBuild.compile (self)
-    def install_command (self):
-        return (tools.AutoBuild.install_command (self)
+    install_command = (tools.AutoBuild.install_command
                 + ' install_prefix=%(install_root)s'
                 + ' mandir=%(prefix_dir)s/share/man/ '
                 + ' docdir=%(prefix_dir)s/share/doc/ghostscript/doc '
--- a/gub/specs/inkscape-installer.py	Sat Sep 26 22:52:26 2009 +0200
+++ b/gub/specs/inkscape-installer.py	Sat Sep 26 23:05:38 2009 +0200
@@ -30,5 +30,4 @@
 --branch=inkscape=%(inkscape_branch)s
 lilypond
 '''), locals ())
-    def install_command (self):
-        return 'true'
+    install_command = 'true'
--- a/gub/specs/libjpeg.py	Sat Sep 26 22:52:26 2009 +0200
+++ b/gub/specs/libjpeg.py	Sat Sep 26 23:05:38 2009 +0200
@@ -34,8 +34,7 @@
             r'\1 $(DESTDIR)\2'),
             ],
             '%(builddir)s/Makefile')
-    def install_command (self):
-        return misc.join_lines ('''
+    install_command = misc.join_lines ('''
 mkdir -p %(install_prefix)s/include %(install_prefix)s/lib
 && make DESTDIR=%(install_root)s install-headers install-lib
 ''')
@@ -76,8 +75,7 @@
                  r'\1 $(DESTDIR)\2'),
                 ],
             '%(builddir)s/Makefile')
-    def install_command (self):
-        return misc.join_lines ('''
+    install_command = misc.join_lines ('''
 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	Sat Sep 26 22:52:26 2009 +0200
+++ b/gub/specs/librestrict.py	Sat Sep 26 23:05:38 2009 +0200
@@ -64,8 +64,7 @@
                         + '\n')
         command += b + 'mv librestrict-all.so librestrict.so'
         return command
-    def install_command (self):
-        return (misc.join_lines ('''
+    install_command = (misc.join_lines ('''
 mkdir -p %(install_prefix)s/lib
 && cp -p librestrict*.so %(install_prefix)s/lib
 '''))
--- a/gub/specs/lilypond-installer.py	Sat Sep 26 22:52:26 2009 +0200
+++ b/gub/specs/lilypond-installer.py	Sat Sep 26 23:05:38 2009 +0200
@@ -28,8 +28,7 @@
 --branch=lilypond=%(lilypond_branch)s
 lilypond
 ''' % locals ()))
-    def install_command (self):
-        return 'true'
+    install_command = 'true'
 
 class LilyPond_installer__mingw (LilyPond_installer):
     dependencies = (LilyPond_installer.dependencies
--- a/gub/specs/lilypond-test.py	Sat Sep 26 22:52:26 2009 +0200
+++ b/gub/specs/lilypond-test.py	Sat Sep 26 23:05:38 2009 +0200
@@ -9,9 +9,8 @@
     def test_ball (self):
         return '%(uploads)s/lilypond-%(version)s-HEAD.test-output.tar.bz2'
     compile_flags = lilypond.LilyPond_base.compile_flags + ' test'
-    def install_command (self):
-        #return (lilypond.LilyPond_base.install_command (self)
-        return 'true'
+        #return (lilypond.LilyPond_base.install_command
+    install_command = 'true'
     def install (self):
         target.AutoBuild.install (self) 
         self.system ('''
--- a/gub/specs/lilypond.py	Sat Sep 26 22:52:26 2009 +0200
+++ b/gub/specs/lilypond.py	Sat Sep 26 23:05:38 2009 +0200
@@ -259,10 +259,9 @@
     compile_command = ('%(doc_limits)s '
                 '&& %(doc_relocation)s '
                 + target.AutoBuild.compile_command)
-    def install_command (self):
-        return ('%(doc_limits)s '
+    install_command = ('%(doc_limits)s '
                 '&& %(doc_relocation)s '
-                + target.AutoBuild.install_command (self))
+                + target.AutoBuild.install_command)
 
 Lilypond_base = LilyPond_base
 
--- a/gub/specs/make.py	Sat Sep 26 22:52:26 2009 +0200
+++ b/gub/specs/make.py	Sat Sep 26 23:05:38 2009 +0200
@@ -20,14 +20,12 @@
 
 class Make_build_sh__tools (Make_make__tools):
     compile_command = 'sh build.sh'
-    def install_command (self):
-        return ('mkdir -p %(install_prefix)s/bin'
+    install_command = ('mkdir -p %(install_prefix)s/bin'
                 ' && cp -p make %(install_prefix)s/bin')
 
 class Make_build_sh_newmake__tools (Make_make__tools):
     compile_command = ('sh build.sh && PATH=$(pwd):$PATH '
                 + Make_make__tools.compile_command)
-    def install_command (self):
-        return 'PATH=$(pwd):$PATH ' + Make_make__tools.install_command (self)
+    install_command = 'PATH=$(pwd):$PATH ' + Make_make__tools.install_command
 
 Make__tools = Make_build_sh_newmake__tools
--- a/gub/specs/makedev.py	Sat Sep 26 22:52:26 2009 +0200
+++ b/gub/specs/makedev.py	Sat Sep 26 23:05:38 2009 +0200
@@ -3,5 +3,4 @@
 class Makedev__tools (tools.MakeBuild):
     source = 'http://ftp.debian.nl/debian/pool/main/m/makedev/makedev_3.3.8.2.orig.tar.gz'
     patches = ['makedev-fno-stack-protector.patch']
-    def install_command (self):
-        return '''make %(compile_flags)s DESTDIR=%(install_root)s install'''
+    install_command = '''make %(compile_flags)s DESTDIR=%(install_root)s install'''
--- a/gub/specs/noweb.py	Sat Sep 26 22:52:26 2009 +0200
+++ b/gub/specs/noweb.py	Sat Sep 26 23:05:38 2009 +0200
@@ -19,9 +19,8 @@
     def configure (self):
         self.shadow_tree ('%(srcdir)s/src', '%(builddir)s')
     subpackage_names = ['']
-    def install_command (self):
         from gub import misc
-        return misc.join_lines ('''
+    install_command = misc.join_lines ('''
 mkdir -p %(install_prefix)s/bin %(install_prefix)s/lib %(install_prefix)s/share/man/man1 %(install_prefix)s/share/tex/inputs
 && make %(compile_flags)s DESTDIR=%(install_root)s install
 ''')
--- a/gub/specs/pjproject.py	Sat Sep 26 22:52:26 2009 +0200
+++ b/gub/specs/pjproject.py	Sat Sep 26 23:05:38 2009 +0200
@@ -10,6 +10,5 @@
                 + ' --disable-sound')
     def configure_binary (self):
         return './aconfigure'
-    def install_command (self):
-        return (target.AutoBuild.install_command (self)
+    install_command = (target.AutoBuild.install_command
                 + ' prefix=%(prefix_dir)s')
--- a/gub/specs/pthreads-w32.py	Sat Sep 26 22:52:26 2009 +0200
+++ b/gub/specs/pthreads-w32.py	Sat Sep 26 23:05:38 2009 +0200
@@ -4,8 +4,7 @@
 class Pthreads_w32 (target.MakeBuild):
     source = 'ftp://sourceware.org/pub/pthreads-win32/pthreads-w32-2-8-0-release.tar.gz'
     make_flags = 'GC CROSS=%(toolchain_prefix)s'
-    def install_command (self):
-        return misc.join_lines ('''
+    install_command = misc.join_lines ('''
 install -d %(install_prefix)s/bin
 install -d %(install_prefix)s/include
 install -d %(install_prefix)s/lib
--- a/gub/specs/python.py	Sat Sep 26 22:52:26 2009 +0200
+++ b/gub/specs/python.py	Sat Sep 26 23:05:38 2009 +0200
@@ -33,13 +33,14 @@
         ]
     dependencies = ['db-devel', 'expat-devel', 'zlib-devel', 'tools::python']
     force_autoupdate = True
+    subpackage_names = ['doc', 'devel', 'runtime', '']
 
     def __init__ (self, settings, source):
         target.AutoBuild.__init__ (self, settings, source)
         self.CROSS_ROOT = '%(targetdir)s'
-
-    subpackage_names = ['doc', 'devel', 'runtime', '']
-
+        if 'stat' in misc.librestrict ():
+            self.install_command = ('LIBRESTRICT_ALLOW=/usr/lib/python2.4/lib-dynload:${LIBRESTRICT_ALLOW-/foo} '
+                + target.AutoBuild.install_command)
 
     def patch (self):
         target.AutoBuild.patch (self)
@@ -54,12 +55,6 @@
     make_flags = misc.join_lines (r'''
 BLDLIBRARY='%(rpath)s -L. -lpython$(VERSION)'
 ''')
-    def install_command (self):
-        relax = ''
-        if 'stat' in misc.librestrict ():
-            relax = 'LIBRESTRICT_ALLOW=/usr/lib/python2.4/lib-dynload:${LIBRESTRICT_ALLOW-/foo} '
-        return (relax
-                + target.AutoBuild.install_command (self))
     def install (self):
         target.AutoBuild.install (self)
         misc.dump_python_config (self)
@@ -158,12 +153,11 @@
     dependencies = ['autoconf', 'libtool']
     force_autoupdate = True
     make_flags = Python.make_flags
-    def install_command (self):
-        relax = ''
+    def __init__ (self, settings, source):
+        Python.__init__ (self, settings, source)
         if 'stat' in misc.librestrict ():
-            relax = 'LIBRESTRICT_ALLOW=/usr/lib/python2.4/lib-dynload:${LIBRESTRICT_ALLOW-/foo} '
-        return (relax
-                + tools.AutoBuild.install_command (self))
+            self.install_command = ('LIBRESTRICT_ALLOW=/usr/lib/python2.4/lib-dynload:${LIBRESTRICT_ALLOW-/foo} '
+                                    + tools.AutoBuild.install_command)
     def patch (self):
         tools.AutoBuild.patch (self)
         Python.patch (self)
--- a/gub/specs/qtopia-core.py	Sat Sep 26 22:52:26 2009 +0200
+++ b/gub/specs/qtopia-core.py	Sat Sep 26 23:05:38 2009 +0200
@@ -60,8 +60,7 @@
                                [('-I/usr', self.expand ('-I%(system_prefix)s'))],
                                fname)
         self.map_locate (dosub, self.expand ('%(install_root)s'), 'Makefile')
-    def install_command (self):
-        return (target.AutoBuild.install_command (self)
+    install_command = (target.AutoBuild.install_command
                 + ' INSTALL_ROOT=%(install_root)s')
     def license_files (self):
         return ['%(srcdir)s/LICENSE.GPL']
--- a/gub/specs/sysvinit.py	Sat Sep 26 22:52:26 2009 +0200
+++ b/gub/specs/sysvinit.py	Sat Sep 26 23:05:38 2009 +0200
@@ -9,12 +9,11 @@
         fakeroot_cache = self.builddir () + '/fakeroot.cache'
         self.fakeroot (self.expand (self.settings.fakeroot, locals ()))
         target.AutoBuild.install (self)
-    def install_command (self):
         from gub import misc
         # FIXME: cannot do these as self.system () in install () as
         # install will rm -rf %(install_root)s as first command
         # install_clean/install_install?
-        return misc.join_lines ('''
+    install_command = misc.join_lines ('''
 mkdir -p %(install_root)s/bin &&
 mkdir -p %(install_root)s/sbin &&
 mkdir -p %(install_prefix)s/bin &&
--- a/gub/specs/tinylogin.py	Sat Sep 26 22:52:26 2009 +0200
+++ b/gub/specs/tinylogin.py	Sat Sep 26 23:05:38 2009 +0200
@@ -7,5 +7,4 @@
         fakeroot_cache = self.builddir () + '/fakeroot.cache'
         self.fakeroot (self.expand (self.settings.fakeroot, locals ()))
         target.AutoBuild.install (self)
-    def install_command (self):
-        return 'fakeroot make install %(compile_flags)s'
+    install_command = 'fakeroot make install %(compile_flags)s'
--- a/gub/system.py	Sat Sep 26 22:52:26 2009 +0200
+++ b/gub/system.py	Sat Sep 26 23:05:38 2009 +0200
@@ -20,6 +20,7 @@
     configure_command = ''
     install_prefix = ''
     install_root = ''
+    job_spec = ''
     def __init__ (self, settings, source):
         build.Build.__init__ (self, settings, source)
         self._name, self._version = (self._created_name + '-').split ('-')[:2]
--- a/gub/target.py	Sat Sep 26 22:52:26 2009 +0200
+++ b/gub/target.py	Sat Sep 26 23:05:38 2009 +0200
@@ -182,8 +182,7 @@
         return [s for s in AutoBuild.stages (self) if s not in ['autoupdate', 'configure']]
     def compile (self):
         self.system ('mkdir -p %(builddir)s')
-    def install_command (self):
-        return 'python %(srcdir)s/setup.py install --prefix=%(tools_prefix)s --root=%(install_root)s'
+    install_command = 'python %(srcdir)s/setup.py install --prefix=%(tools_prefix)s --root=%(install_root)s'
 
 class SConsBuild (AutoBuild):
     scons_flags = ''
@@ -194,8 +193,7 @@
                 ' PREFIX_DEST=%(install_root)s'
                 ' %(compile_flags)s'
                 ' %(scons_flags)s')
-    def install_command (self):
-        return self.compile_command + ' %(install_flags)s'
+    install_command = compile_command + ' %(install_flags)s'
 
 class WafBuild (AutoBuild):
     def stages (self):
@@ -205,8 +203,7 @@
         return '%(autodir)s/waf'
     configure_command = '%(configure_binary)s configure --prefix=%(install_prefix)s'
     compile_command = '%(configure_binary)s build'
-    def install_command (self):
-        return '%(configure_binary)s install'
+    install_command = '%(configure_binary)s install'
 
 class BjamBuild_v2 (MakeBuild):
     dependencies = ['tools::boost-jam']
@@ -246,9 +243,9 @@
 threading=multi
 release
 ''')
-    def install_command (self):
-        return (self.compile_command
-                + ' install').replace ('=%(prefix_dir)s', '=%(install_prefix)s')
+    install_command = (compile_command
+                       .replace ('=%(prefix_dir)s', '=%(install_prefix)s')
+                       + ' install')
 
 class NullBuild (AutoBuild):
     def stages (self):
--- a/gub/tools.py	Sat Sep 26 22:52:26 2009 +0200
+++ b/gub/tools.py	Sat Sep 26 23:05:38 2009 +0200
@@ -1,4 +1,5 @@
 import os
+import sys
 #
 from gub import build
 from gub import context
@@ -149,17 +150,14 @@
     def stages (self):
         return [s.replace ('configure', 'shadow') for s in AutoBuild.stages (self) if s not in ['autoupdate']]
     compile_command = 'bash build.sh %(make_flags)s %(compile_flags)s'
-    def install_command (self):
-        print ('Override me.')
-        assert False
+    install_command = '%%%override-me'
 
 class PythonBuild (AutoBuild):
     def stages (self):
         return [s for s in AutoBuild.stages (self) if s not in ['autoupdate', 'configure']]
     def compile (self):
         self.system ('mkdir -p %(builddir)s')
-    def install_command (self):
-        return 'python %(srcdir)s/setup.py install --prefix=%(tools_prefix)s --root=%(install_root)s'
+    install_command = sys.executable + ' %(srcdir)s/setup.py install --prefix=%(tools_prefix)s --root=%(install_root)s'
 
 class SConsBuild (AutoBuild):
     scons_flags = ''
@@ -170,8 +168,7 @@
                 ' PREFIX_DEST=%(install_root)s'
                 ' %(compile_flags)s'
                 ' %(scons_flags)s')
-    def install_command (self):
-        return self.compile_command + ' %(install_flags)s'
+    install_command = compile_command + ' %(install_flags)s'
 
 class BjamBuild_v2 (MakeBuild):
     dependencies = ['boost-jam']
@@ -195,9 +192,9 @@
 threading=multi
 release
 ''')
-    def install_command (self):
-        return (self.compile_command
-                + ' install').replace ('=%(system_prefix)s', '=%(install_prefix)s')
+    install_command = (compile_command
+                       .replace ('=%(system_prefix)s', '=%(install_prefix)s')
+                       + ' install')
 
 class NullBuild (AutoBuild):
     def stages (self):