changeset 5471:54153c716744

Cleanup: move target.Change_target* to build.Change. This code has nothing to do with TARGET_dict whatsoever.
author Jan Nieuwenhuizen <janneke@gnu.org>
date Wed, 19 Aug 2009 10:23:14 +0200
parents d2d22f00f8a2
children e1ceedf77679
files gub/build.py gub/darwin.py gub/specs/fontconfig.py gub/specs/freetype.py gub/specs/inkscape.py gub/specs/libtool.py gub/specs/qtopia-core.py gub/specs/xerces-c.py gub/target.py gub/w32.py
diffstat 10 files changed, 84 insertions(+), 59 deletions(-) [+]
line wrap: on
line diff
--- a/gub/build.py	Tue Aug 18 22:15:56 2009 +0200
+++ b/gub/build.py	Wed Aug 19 10:23:14 2009 +0200
@@ -765,3 +765,52 @@
     n2 = subst_vars (old[old.find (marker):], new[new.find (marker):])
     open (file, 'w').write (n1 + n2)
     loggedos.chmod (logger, file, octal.o755)
+
+class Change_dict:
+    def __init__ (self, package, override):
+        self._dict_method = package.get_substitution_dict
+        self._add_dict = override
+
+    def get_dict (self, env={}):
+        env_copy = env.copy ()
+        env_copy.update (self._add_dict)
+        d = self._dict_method (env_copy)
+        return d
+
+    def append_dict (self, env={}):
+        d = self._dict_method ()
+        for (k, v) in list (self._add_dict.items ()):
+            d[k] += v
+        d.update (env)
+        d = context.recurse_substitutions (d)
+        return d
+
+    def add_dict (self, env={}):
+        d = self._dict_method ()
+        for (k, v) in list (self._add_dict.items ()):
+            d[k] = v
+        d.update (env)
+        d = context.recurse_substitutions (d)
+        return d
+
+def change_dict (package, add_dict):
+    """Override the get_substitution_dict () method of PACKAGE."""
+    try:
+        package.get_substitution_dict = Change_dict (package, add_dict).get_dict
+    except AttributeError:
+        pass
+
+def add_dict (package, add_dict):
+    """Override the get_substitution_dict () method of PACKAGE."""
+    try:
+        package.get_substitution_dict = Change_dict (package, add_dict).add_dict
+    except AttributeError:
+        pass
+
+def append_dict (package, add_dict):
+    """Override the get_substitution_dict () method of PACKAGE."""
+    try:
+        package.get_substitution_dict = Change_dict (package, add_dict).append_dict
+    except AttributeError:
+        pass
+
--- a/gub/darwin.py	Tue Aug 18 22:15:56 2009 +0200
+++ b/gub/darwin.py	Wed Aug 19 10:23:14 2009 +0200
@@ -4,6 +4,7 @@
 #
 from gub.syntax import printf, next
 from gub import context
+from gub import build
 from gub import target
 from gub import loggedos
 
@@ -142,7 +143,7 @@
         return ''
     package.rpath = misc.MethodOverrider (package.nop, rpath)
 
-    target.change_target_dict (package, {
+    build.change_dict (package, {
 
             ## We get a lot of /usr/lib/ -> @executable_path/../lib/
             ## we need enough space in the header to do these relocs.
--- a/gub/specs/fontconfig.py	Tue Aug 18 22:15:56 2009 +0200
+++ b/gub/specs/fontconfig.py	Wed Aug 19 10:23:14 2009 +0200
@@ -1,3 +1,4 @@
+from gub import build
 from gub import context
 from gub import logging
 from gub import misc
@@ -23,8 +24,8 @@
     def __init__ (self, settings, source):
         target.AutoBuild.__init__ (self, settings, source)
         if 'stat' in misc.librestrict ():
-            target.add_target_dict (self, {'LIBRESTRICT_IGNORE': '%(tools_prefix)s/bin/bash:%(tools_prefix)s/bin/make'})
-            #target.add_target_dict (self, {'LIBRESTRICT_VERBOSE': '1'})
+            build.add_dict (self, {'LIBRESTRICT_IGNORE': '%(tools_prefix)s/bin/bash:%(tools_prefix)s/bin/make'})
+            #build.add_dict (self, {'LIBRESTRICT_VERBOSE': '1'})
     def patch (self):
         self.dump ('\nAC_SUBST(LT_AGE)', '%(srcdir)s/configure.in', mode='a', permissions=octal.o755)
         target.AutoBuild.patch (self)
--- a/gub/specs/freetype.py	Tue Aug 18 22:15:56 2009 +0200
+++ b/gub/specs/freetype.py	Wed Aug 19 10:23:14 2009 +0200
@@ -15,9 +15,9 @@
         target.AutoBuild.__init__ (self, settings, source)
         # Freetype stats /sbin, /usr/sbin and /hurd to determine if
         # build system is unix??
-        # target.append_target_dict (self, {'LIBRESTRICT_ALLOW': '/sbin:/usr/sbin:/hurd'})
+        # build.append_dict (self, {'LIBRESTRICT_ALLOW': '/sbin:/usr/sbin:/hurd'})
         if 'stat' in misc.librestrict ():
-            target.add_target_dict (self, {'LIBRESTRICT_ALLOW': '/sbin:/usr/sbin:/hurd:${LIBRESTRICT_ALLOW-/foo}'})
+            build.add_dict (self, {'LIBRESTRICT_ALLOW': '/sbin:/usr/sbin:/hurd:${LIBRESTRICT_ALLOW-/foo}'})
     def license_files (self):
         return ['%(srcdir)s/docs/LICENSE.TXT']
     def _get_build_dependencies (self):
--- a/gub/specs/inkscape.py	Tue Aug 18 22:15:56 2009 +0200
+++ b/gub/specs/inkscape.py	Wed Aug 19 10:23:14 2009 +0200
@@ -1,3 +1,4 @@
+from gub import build
 from gub import context
 from gub import misc
 from gub import target
@@ -7,8 +8,8 @@
     branch = 'trunk'
     def __init__ (self, settings, source):
         target.AutoBuild.__init__ (self, settings, source)
-        target.add_target_dict (self,
-                                {'ACLOCAL_FLAGS': ' -I '.join ([''] + self.aclocal_path ()), })
+        build.add_dict (self,
+                        {'ACLOCAL_FLAGS': ' -I '.join ([''] + self.aclocal_path ()), })
         source.is_tracking = misc.bind_method (lambda x: True, source)
     def patch (self):
         target.AutoBuild.patch (self)
--- a/gub/specs/libtool.py	Tue Aug 18 22:15:56 2009 +0200
+++ b/gub/specs/libtool.py	Wed Aug 19 10:23:14 2009 +0200
@@ -1,4 +1,5 @@
 #
+from gub import build
 from gub import context
 from gub import misc
 from gub import repository
@@ -90,7 +91,7 @@
         tools.AutoBuild.__init__ (self, settings, source)
         Libtool.set_sover (self)
         # Uncommenting removes IGNORE lifting from make and breaks build.
-        # target.add_target_dict (self, {'LIBRESTRICT_IGNORE': ''})
+        # build.add_dict (self, {'LIBRESTRICT_IGNORE': ''})
         '''
         /home/janneke/tmp/gub/target/tools/root/usr/bin/make: tried to xstat () file /usr/include/stdio.h
 allowed:
--- a/gub/specs/qtopia-core.py	Tue Aug 18 22:15:56 2009 +0200
+++ b/gub/specs/qtopia-core.py	Wed Aug 19 10:23:14 2009 +0200
@@ -1,3 +1,4 @@
+from gub import build
 from gub import context
 from gub import misc
 from gub import target
@@ -12,7 +13,7 @@
         'CXX': 'g++',
         #'LINK': '%(toolchain_prefix)sg++',
         }
-    build.change_target_dict (self, dict)
+    build.change_dict (self, dict)
     def _get_build_dependencies (self):
         return ['freetype-devel', 'tslib-devel']
     def patch (self):
--- a/gub/specs/xerces-c.py	Tue Aug 18 22:15:56 2009 +0200
+++ b/gub/specs/xerces-c.py	Wed Aug 19 10:23:14 2009 +0200
@@ -1,3 +1,4 @@
+from gub import build
 from gub import misc
 from gub import target
 
@@ -19,7 +20,7 @@
             'CFLAGS': ' -DPROJ_XMLPARSER -DPROJ_XMLUTIL -DPROJ_PARSERS -DPROJ_SAX4C -DPROJ_SAX2 -DPROJ_DOM -DPROJ_DEPRECATED_DOM -DPROJ_VALIDATORS -DXML_USE_NATIVE_TRANSCODER -DXML_USE_INMEM_MESSAGELOADER -DXML_USE_PTHREADS -DXML_USE_NETACCESSOR_SOCKET ',
             'CXXFLAGS': ' -DPROJ_XMLPARSER -DPROJ_XMLUTIL -DPROJ_PARSERS -DPROJ_SAX4C -DPROJ_SAX2 -DPROJ_DOM -DPROJ_DEPRECATED_DOM -DPROJ_VALIDATORS -DXML_USE_NATIVE_TRANSCODER -DXML_USE_INMEM_MESSAGELOADER -DXML_USE_PTHREADS -DXML_USE_NETACCESSOR_SOCKET ',
             }
-        target.change_target_dict (self, self.compile_dict)
+        build.change_dict (self, self.compile_dict)
     def force_sequential_build (self):
         return True
     def autodir (self):
@@ -63,4 +64,4 @@
             'THREADS' : 'mthreads',
             'LIBS': '',
             })
-        target.change_target_dict (self, self.compile_dict)
+        build.change_dict (self, self.compile_dict)
--- a/gub/target.py	Tue Aug 18 22:15:56 2009 +0200
+++ b/gub/target.py	Wed Aug 19 10:23:14 2009 +0200
@@ -262,53 +262,23 @@
     def install (self):
         self.system ('mkdir -p %(install_prefix)s')
 
-class Change_target_dict:
-    def __init__ (self, package, override):
-        self._target_dict_method = package.get_substitution_dict
-        self._add_dict = override
-
-    def target_dict (self, env={}):
-        env_copy = env.copy ()
-        env_copy.update (self._add_dict)
-        d = self._target_dict_method (env_copy)
-        return d
-
-    def append_dict (self, env={}):
-        d = self._target_dict_method ()
-        for (k, v) in list (self._add_dict.items ()):
-            d[k] += v
-        d.update (env)
-        d = context.recurse_substitutions (d)
-        return d
-
-    def add_dict (self, env={}):
-        d = self._target_dict_method ()
-        for (k, v) in list (self._add_dict.items ()):
-            d[k] = v
-        d.update (env)
-        d = context.recurse_substitutions (d)
-        return d
-
-def change_target_dict (package, add_dict):
-    """Override the get_substitution_dict () method of PACKAGE."""
-    try:
-        package.get_substitution_dict = Change_target_dict (package, add_dict).target_dict
-    except AttributeError:
-        pass
-
-def add_target_dict (package, add_dict):
-    """Override the get_substitution_dict () method of PACKAGE."""
-    try:
-        package.get_substitution_dict = Change_target_dict (package, add_dict).add_dict
-    except AttributeError:
-        pass
-
-def append_target_dict (package, add_dict):
-    """Override the get_substitution_dict () method of PACKAGE."""
-    try:
-        package.get_substitution_dict = Change_target_dict (package, add_dict).append_dict
-    except AttributeError:
-        pass
+class BinaryBuild (AutoBuild):
+    def stages (self):
+        return ['untar', 'install', 'package', 'clean']
+    def install (self):
+        self.system ('mkdir -p %(install_root)s')
+        _v = '' #self.os_interface.verbose_flag ()
+        self.system ('tar -C %(srcdir)s -cf- . | tar -C %(install_root)s%(_v)s -p -xf-', env=locals ())
+        self.libtool_installed_la_fixups ()
+    def get_subpackage_names (self):
+        return ['']
+        
+class CpanBuild (AutoBuild):
+    def stages (self):
+        return [s for s in AutoBuild.stages (self) if s not in ['autoupdate']]
+    def configure (self):
+        self.shadow ()
+        self.system ('cd %(builddir)s && perl Makefile.PL PREFIX=%(system_prefix)s')
 
 def libtool_disable_rpath (logger, libtool, rpath, file):
     # Must also keep -rpath $libdir, because when build_arch ==
--- a/gub/w32.py	Tue Aug 18 22:15:56 2009 +0200
+++ b/gub/w32.py	Wed Aug 19 10:23:14 2009 +0200
@@ -25,7 +25,7 @@
     if isinstance (package, cross.AutoBuild):
         return
 
-    target.change_target_dict (package, {
+    build.change_dict (package, {
             'DLLTOOL': '%(toolchain_prefix)sdlltool',
             'DLLWRAP': '%(toolchain_prefix)sdllwrap',
             # note: this was cygwin only: ...