changeset 6359:d02df78f9193

Merge pull request #9 from trueroad/gcc-4.9 make lilypond by gcc-4.9.2
author PhilHolmes <PhilEHolmes@gmail.com>
date Mon, 02 Mar 2015 14:34:54 +0000
parents c98d8d7eb559 (current diff) 320da60cd586 (diff)
children 62a9fcf680dd 0140e01f745f
files gub/specs/mingw-runtime.py
diffstat 81 files changed, 2414 insertions(+), 256 deletions(-) [+]
line wrap: on
line diff
--- a/README	Tue Oct 21 12:37:18 2014 +0100
+++ b/README	Mon Mar 02 14:34:54 2015 +0000
@@ -70,7 +70,7 @@
    shar archive for Linux/PowerPC
 
 freebsd-x86
-   shar archive for FreeBSD 4/x86
+   shar archive for FreeBSD 6/x86
 
 freebsd-64
    shar archive for FreeBSD 6/x86_64
--- a/gub/cross.py	Tue Oct 21 12:37:18 2014 +0100
+++ b/gub/cross.py	Mon Mar 02 14:34:54 2015 +0000
@@ -254,8 +254,8 @@
                  + package.settings.cross_dir)
     x86_bindir = x86_cross + '/bin'
     x86_cross_bin = x86_cross + '/i686-linux' + '/bin'
-    env['CC'] = x86_cross_bin + '/gcc'
-    env['CXX'] = x86_cross_bin + '/g++'
+    env['CC'] = x86_bindir + '/i686-linux-gcc'
+    env['CXX'] = x86_bindir + '/i686-linux-g++'
     # FIXME: should only remove any %(tools_prefix)s elements from these...
     env['C_INCLUDE_PATH'] = ''
     env['CPLUS_INCLUDE_PATH'] = ''
--- a/gub/darwin.py	Tue Oct 21 12:37:18 2014 +0100
+++ b/gub/darwin.py	Mon Mar 02 14:34:54 2015 +0000
@@ -14,7 +14,11 @@
     def __init__ (self, settings):
         context.RunnableContext.__init__ (self,settings)
         self.ignore_libs = None
-        self.skip = ['libgcc_s']
+        self.skip = [
+            'libgcc_s.10.',
+            'libgcc_s_',
+            'libgcc_ext.10.',
+        ]
 
     def get_libaries (self, name):
         lib_str = loggedos.read_pipe (
@@ -58,12 +62,16 @@
 
             for o in orig_libs:
                 if o in f:
-                    newpath = re.sub (o, '@executable_path/../lib/', f);
+                    newpath = re.sub (o, '@executable_path/../lib', f);
                     subs.append ((f, newpath))
                 elif self.expand ('%(targetdir)s') in f:
                     must_skip = [s for s in self.skip if s in f]
                     if not must_skip:
-                        raise Exception ('found targetdir in linkage[%(name)s]: %(f)s' % locals ())
+                        if 'libgcc_s.1.dylib' in f:
+                            newpath = '@executable_path/../lib/libgcc_s.1.dylib'
+                            subs.append ((f, newpath))
+                        else:
+                            raise Exception ('found targetdir in linkage[%(name)s]: %(f)s' % locals ())
                     printf ('FIXME: skipping[%(name)s]: %(f)s, hope this is ok' % locals ())
 
         self.rewire_mach_o_object (name, subs)
--- a/gub/freebsd.py	Tue Oct 21 12:37:18 2014 +0100
+++ b/gub/freebsd.py	Mon Mar 02 14:34:54 2015 +0000
@@ -18,15 +18,15 @@
 # headers and build full toolchain from source?
 def get_sdk ():
     '''
-#! /bin/sh
+#! /bin/bash
 
 if test $# != '3'; then
     cat <<EOF
 Usage: get-freebsd ARCH VERSION BUILD
 
 Example:
-  get-freebsd i386 4.11 1
-  get-freebsd amd64 6.2 2
+  bash get-freebsd i386 6.2 1
+  bash get-freebsd amd64 6.2 2
 EOF
     exit 2
 fi
@@ -37,11 +37,10 @@
 
 tmp=tmp-freebsd-$arch-$version-$build
 mkdir -p $tmp && cd $tmp
-wget ftp://ftp.surfnet.nl/pub/os/FreeBSD/releases/$arch/$version-RELEASE/base/base.??
-wget ftp://ftp-archive.freebsd.org/pub/FreeBSD-Archive/old-releases/$arch/$version-RELEASE/bin/bin.??
+wget ftp://ftp-archive.freebsd.org/pub/FreeBSD-Archive/old-releases/$arch/$version-RELEASE/base/base.??
 rm -rf root
 mkdir -p root
-cat base.?? bin.?? | tar --unlink -xpzf - -C root
+cat base.?? | tar --unlink -xpzf - -C root
 cd root && tar --exclude=zlib.h --exclude=zconf.h --exclude=gmp.h --exclude=curses.h --exclude=ncurses.h --exclude=c++ --exclude=g++ -czf ../../downloads/freebsd-runtime/freebsd-runtime-$version-$build.$arch.tar.gz {,usr/}lib/{lib{c,c_r,m,pthread}{.a,.so{,.*}},crt{i,n,1}.o} usr/include
 #rm -rf $tmp
 '''
--- a/gub/gup.py	Tue Oct 21 12:37:18 2014 +0100
+++ b/gub/gup.py	Mon Mar 02 14:34:54 2015 +0000
@@ -427,15 +427,17 @@
     # FIXME: rename packages, fragile
     if [True for x in [
             'freebsd-runtime',
-            'mingw-runtime',
             'lilypond-doc',
             'cygwin::',
             ] if x in name]:
         return name
+    if re.search('mingw-w64-runtime$', name):
+        return name
     name = re.sub ('(gcc(-.*)?)-c[+][+]-runtime', r'\1', name)
     name = re.sub ('-devel$', '', name)
     name = re.sub ('-runtime$', '', name)
     name = re.sub ('-doc$', '', name)
+    name = re.sub ('(mingw-w64-runtime(-.*)?)-winpthread-dll', r'\1', name)
     return name
 
 def get_source_packages (settings, const_todo):
--- a/gub/misc.py	Tue Oct 21 12:37:18 2014 +0100
+++ b/gub/misc.py	Mon Mar 02 14:34:54 2015 +0000
@@ -215,12 +215,18 @@
         return ' -z'
     elif ball.endswith ('bz2'):
         return ' -j'
+    elif (ball.endswith ('xz')
+        or ball.endswith ('lzma')
+        or ball.endswith ('txz')
+        or ball.endswith ('tlz')):
+        return ' -J'
     return ''
 
 def unzip_command (ball):
     return {
         '-z' : 'gzip -dc',
         '-j' : 'bzip2 -dc',
+        '-J' : 'xz -dc',
         '': 'cat'
         }[compression_flag (ball).strip ()]
         
--- a/gub/repository.py	Tue Oct 21 12:37:18 2014 +0100
+++ b/gub/repository.py	Mon Mar 02 14:34:54 2015 +0000
@@ -417,7 +417,11 @@
          return url and (url.endswith (rety.vc_system)
                          or url.endswith (rety.vc_system + '.gz')
                          or url.endswith ('.tgz')
-                         or url.endswith (rety.vc_system + '.bz2'))
+                         or url.endswith (rety.vc_system + '.bz2')
+                         or url.endswith (rety.vc_system + '.xz')
+                         or url.endswith ('.txz')
+                         or url.endswith (rety.vc_system + '.lzma')
+                         or url.endswith ('.tlz'))
 
     def migrate (self, dir, dir_slash_vcs):
         pass
@@ -540,6 +544,31 @@
 
 RepositoryProxy.register (ZipFile)
 
+class SevenZFile (TarBall):
+    vc_system = '.7z'
+
+    @staticmethod
+    def create (rety, dir, source, branch='', module='', revision='', parameters=list ()):
+        return SevenZFile (dir, source)
+
+    @staticmethod
+    def check_suffix (rety, url):
+         return url and url.endswith (rety.vc_system)
+
+    # TODO: s/url/source
+    def __init__ (self, dir, url, version=None, strip_components=0):
+        TarBall.__init__ (self, dir, url, version, strip_components)
+
+    def _unpack (self, destdir, tarball):
+        strip_components = self.strip_components
+        # fixme
+        #if self.oslog:  #urg, will be fixed when .source is mandatory
+        #    _v = self.oslog.verbose_flag ()
+        _v = ''   #     self.oslog.verbose_flag ()
+        self.system ('7za x %(_v)s %(tarball)s -o%(destdir)s' % locals ())
+
+RepositoryProxy.register (SevenZFile)
+
 class Git (Repository):
     vc_system = '.git'
 
--- a/gub/settings.py	Tue Oct 21 12:37:18 2014 +0100
+++ b/gub/settings.py	Mon Mar 02 14:34:54 2015 +0000
@@ -17,13 +17,13 @@
     'debian-mipsel': 'mipsel-linux',
     'debian-x86': 'i686-linux',
     'cygwin': 'i686-cygwin',
-    'darwin-ppc': 'powerpc-apple-darwin7',
+    'darwin-ppc': 'powerpc-apple-darwin8',
     'darwin-x86': 'i686-apple-darwin8',
 
     'freebsd4-x86': 'i686-freebsd4',
     'freebsd6-x86': 'i686-freebsd6',
 
-    'freebsd-x86': 'i686-freebsd4',
+    'freebsd-x86': 'i686-freebsd6',
     'freebsd-64': 'x86_64-freebsd6',
 
     'linux-arm': 'arm-linux',
--- a/gub/specs/cross/binutils.py	Tue Oct 21 12:37:18 2014 +0100
+++ b/gub/specs/cross/binutils.py	Mon Mar 02 14:34:54 2015 +0000
@@ -4,10 +4,11 @@
 from gub.specs import binutils
 
 class Binutils (cross.AutoBuild):
-    source = 'http://ftp.gnu.org/pub/gnu/binutils/binutils-2.19.1.tar.bz2'
+    source = 'http://ftp.gnu.org/pub/gnu/binutils/binutils-2.25.tar.bz2'
     patches = []
     dependencies = [
         'tools::zlib',
+        'tools::texinfo',
             ]
     # Block usage of libz.so during configure, which may not be
     # available in the library path.
@@ -42,14 +43,10 @@
     self.system ('rm -f %(install_prefix)s%(cross_dir)s/lib/libiberty.a')
     self.system ('rm -f %(install_prefix)s%(cross_dir)s/lib64/libiberty.a')
 
-class Binutils__linux__ppc (Binutils):
-    patches = Binutils.patches + [
-        'binutils-2.18-werror-ppc.patch'
-        ]
-
 class Binutils__mingw (Binutils):
     dependencies = Binutils.dependencies + [
             'tools::libtool',
+            'system::iconv',
             ]
     def configure (self):
         Binutils.configure (self)
--- a/gub/specs/cross/gcc-core.py	Tue Oct 21 12:37:18 2014 +0100
+++ b/gub/specs/cross/gcc-core.py	Mon Mar 02 14:34:54 2015 +0000
@@ -3,7 +3,6 @@
 from gub import misc
         
 class Gcc_core (gcc.Gcc__from__source):
-    source = 'http://ftp.gnu.org/pub/gnu/gcc/gcc-4.8.2/gcc-4.8.2.tar.bz2'
     dependencies = [x for x in gcc.Gcc__from__source.dependencies
                     if x != 'glibc-core']
     subpackage_names = ['']
@@ -24,12 +23,19 @@
 --enable-threads=no
 --without-headers
 --disable-shared
+--disable-decimal-float
 '''))
-    make_flags = gcc.Gcc.make_flags + ' all-gcc'
+    make_flags = gcc.Gcc.make_flags + ' all-gcc all-target-libgcc'
     install_flags = (gcc.Gcc.install_flags
-                     .replace (' install', ' install-gcc'))
+                     .replace (' install',
+                               ' install-gcc install-target-libgcc'))
     # Gcc moves libs into system lib places, which will
     # make gcc-core conflict with gcc.
-    install = cross.AutoBuild.install
+    def install (self):
+        cross.AutoBuild.install (self)
+        self.system('''
+mkdir -p %(install_prefix)s%(cross_dir)s/lib/gcc/%(target_architecture)s/%(full_version)s/include/
+ln -s ../include-fixed/limits.h %(install_prefix)s%(cross_dir)s/lib/gcc/%(target_architecture)s/%(full_version)s/include/limits.h
+''')
     def languages (self):
         return  ['c']
--- a/gub/specs/cross/gcc.py	Tue Oct 21 12:37:18 2014 +0100
+++ b/gub/specs/cross/gcc.py	Mon Mar 02 14:34:54 2015 +0000
@@ -8,8 +8,19 @@
 from gub.specs import gcc
 
 class Gcc (cross.AutoBuild):
-    source = 'http://ftp.gnu.org/pub/gnu/gcc/gcc-4.8.2/gcc-4.8.2.tar.bz2'
-    dependencies = ['cross/binutils']
+    source = 'http://ftp.gnu.org/pub/gnu/gcc/gcc-4.9.2/gcc-4.9.2.tar.bz2'
+    dependencies = [
+        'cross/binutils',
+        'system::gcc',
+        'system::g++',
+        'tools::gmp',
+        'tools::mpfr',
+        'tools::mpc',
+        'tools::gawk',
+    ]
+    patches = ['gcc-4.8.2-libstdc++-debug-path.patch']
+    configure_command = (''' LDFLAGS='-L%(tools_prefix)s/lib %(rpath)s' '''
+                         + cross.AutoBuild.configure_command)
     configure_flags = (cross.AutoBuild.configure_flags
                 + '%(enable_languages)s'
                 + ' --enable-static'
@@ -33,7 +44,10 @@
     def get_subpackage_definitions (self):
         d = cross.AutoBuild.get_subpackage_definitions (self)
         prefix_dir = self.settings.prefix_dir
-        d['c++-runtime'] = [prefix_dir + '/lib/libstdc++.so*']
+        d['c++-runtime'] = [
+            prefix_dir + '/lib/libstdc++.so*',
+            prefix_dir + '/lib/libgcc_s.so*',
+        ]
         return d
     def languages (self):
         return ['c', 'c++']
@@ -58,12 +72,20 @@
 class Gcc__from__source (Gcc):
     dependencies = (Gcc.dependencies
                     + ['cross/gcc-core', 'glibc-core'])
+    def __init__ (self, settings, source):
+        Gcc.__init__ (self, settings, source)
+        if 'i686-linux' in self.settings.build_architecture:
+            if 'i686-linux' in self.settings.target_architecture:
+                self.configure_flags += ' --build=i686-unknown-linux-gnu '
     #FIXME: merge all configure_command settings with Gcc
     configure_flags = (Gcc.configure_flags
                 + misc.join_lines ('''
 --with-local-prefix=%(system_prefix)s
 --disable-multilib
 --disable-nls
+--disable-libitm
+--disable-libsanitizer
+--disable-libcilkrts
 --enable-threads=posix
 --enable-__cxa_atexit
 --enable-symvers=gnu
@@ -73,39 +95,43 @@
 '''))
     def get_conflict_dict (self):
         return {'': ['cross/gcc-core'], 'doc': ['cross/gcc-core'], 'runtime': ['cross/gcc-core']}
+    def install (self):
+        Gcc.install (self)
+        self.system('''
+mkdir -p %(install_prefix)s%(cross_dir)s/lib/gcc/%(target_architecture)s/%(full_version)s/include/
+ln -s ../include-fixed/limits.h %(install_prefix)s%(cross_dir)s/lib/gcc/%(target_architecture)s/%(full_version)s/include/limits.h
+''')
 
 Gcc__linux = Gcc__from__source
 
+class Gcc__linux__ppc (Gcc__linux):
+    configure_flags = (Gcc__linux.configure_flags
+                + misc.join_lines ('''
+--disable-libatomic
+--disable-libgomp
+'''))
+
 class Gcc__mingw (Gcc):
-    source = 'http://ftp.gnu.org/pub/gnu/gcc/gcc-4.8.2/gcc-4.8.2.tar.bz2'
     dependencies = (Gcc.dependencies
-                + ['mingw-runtime', 'w32api']
+                + ['mingw-w64-runtime']
                 + ['tools::libtool'])
-    def patch (self):
-        Gcc.patch (self)
-        for f in ['%(srcdir)s/gcc/config/i386/mingw32.h',
-                  '%(srcdir)s/gcc/config/i386/t-mingw32']:
-            self.file_sub ([('/mingw/include','%(prefix_dir)s/include'),
-                            ('/mingw/lib','%(prefix_dir)s/lib'),
-                            ], f)
-    def STATIC_GXX_WIP_REMOVE_THIS_PREFIX_configure (self):
-        # leave this for now.
-        # lots of undefined refs.
-        # possibly try static libstc++ with gcc > 4.1.1
-        '''.libs/bitmap_allocator.o: In function `__gthread_mutex_init_function':
-/home/janneke/vc/gub/target/mingw/build/cross/gcc-4.1.1/i686-mingw32/libstdc++-v3/include/i686-mingw32/bits/gthr-default.h:463: undefined reference to `___gthr_win32_mutex_init_function'
-.libs/bitmap_allocator.o: In function `_ZN9__gnu_cxx9free_list6_M_getEj':
-/home/janneke/vc/gub/target/mingw/src/cross/gcc-4.1.1/libstdc++-v3/src/bitmap_allocator.cc:53: undefined reference to `__Unwind_SjLj_Register'
-
+    configure_flags = (Gcc.configure_flags
+                + misc.join_lines ('''
+--enable-threads=posix
+'''))
+    def get_subpackage_definitions (self):
+        d = cross.AutoBuild.get_subpackage_definitions (self)
+        prefix_dir = self.settings.prefix_dir
+        d['c++-runtime'] = [
+            prefix_dir + '/bin/libstdc++-*.dll',
+            prefix_dir + '/bin/libgcc_s_*.dll',
+        ]
+        return d
+    def install (self):
+        Gcc.install (self)
+        self.system('''
+mkdir -p %(install_prefix)s/bin/
+cp %(install_prefix)s/lib/libgcc_s_*.dll %(install_prefix)s/bin/
+cp %(install_prefix)s%(cross_dir)s/%(target_architecture)s/lib/libstdc++-*.dll %(install_prefix)s/bin/
 '''
-        Gcc.configure (self)
-        # Configure all subpackages, makes
-        # w32.libtool_fix_allow_undefined to find all libtool files
-        self.system ('cd %(builddir)s && make %(compile_flags)s configure-host configure-target')
-        # Must ONLY do target stuff, otherwise cross executables cannot find their libraries
-        # self.map_locate (lambda logger,file: build.libtool_update (logger, self.expand ('%(tools_prefix)s/bin/libtool'), file), '%(builddir)s/', 'libtool')
-        #self.map_locate (lambda logger, file: build.libtool_update (logger, self.expand ('%(tools_prefix)s/bin/libtool'), file), '%(builddir)s/i686-mingw32', 'libtool')
-        vars = ['CC', 'CXX', 'LTCC', 'LD', 'sys_lib_search_path_spec', 'sys_lib_dlsearch_path_spec', 'predep_objects', 'postdep_objects', 'predeps', 'postdeps', 'old_striplib', 'striplib']
-        self.map_locate (lambda logger, file: build.libtool_update_preserve_vars (logger, self.expand ('%(tools_prefix)s/bin/libtool'), vars, file), '%(builddir)s/i686-mingw32', 'libtool')
-        self.map_locate (lambda logger, file: build.libtool_force_infer_tag (logger, 'CXX', file), '%(builddir)s/i686-mingw32', 'libtool')
-
+        )
--- a/gub/specs/cygwin/cross/gcc.py	Tue Oct 21 12:37:18 2014 +0100
+++ b/gub/specs/cygwin/cross/gcc.py	Mon Mar 02 14:34:54 2015 +0000
@@ -6,7 +6,6 @@
 # http://gcc.gnu.org/PR24196
 #class this_works_but_has_string_exception_across_dll_bug_Gcc__cygwin (cross_gcc.Gcc__mingw):
 class Gcc__cygwin (cross_gcc.Gcc__mingw):
-    source = 'http://ftp.gnu.org/pub/gnu/gcc/gcc-4.8.2/gcc-4.8.2.tar.bz2'
     patches = []
     dependencies = (cross_gcc.Gcc__mingw.dependencies
                     + ['cygwin',
@@ -26,7 +25,6 @@
 
 #class okGcc__cygwin (cross_gcc.Gcc):
 class above_is_okay_now_cygwin_has_switched_Gcc__cygwin (cross_gcc.Gcc):
-    source = 'http://ftp.gnu.org/pub/gnu/gcc/gcc-4.8.2/gcc-4.8.2.tar.bz2'
     patches = []
     dependencies = (cross_gcc.Gcc.dependencies
                     + ['cygwin', 'w32api-in-usr-lib'])
--- a/gub/specs/darwin/cross/gcc.py	Tue Oct 21 12:37:18 2014 +0100
+++ b/gub/specs/darwin/cross/gcc.py	Mon Mar 02 14:34:54 2015 +0000
@@ -5,15 +5,14 @@
 from gub import cross
 
 class Gcc__darwin (cross_gcc.Gcc):
-    source = 'http://ftp.gnu.org/pub/gnu/gcc/gcc-4.8.2/gcc-4.8.2.tar.bz2'
     dependencies = ['odcctools']
-    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')
-        cross.AutoBuild.patch (self)
+    patches = cross_gcc.Gcc.patches + [
+        'gcc-4.8.2-darwin-fixinc.patch',
+        'gcc-4.8.2-darwin-libgcc.patch',
+    ]
+    configure_flags = (cross_gcc.Gcc.configure_flags
+                       + ' --disable-libcilkrts'
+    )
     def languages (self):
         # objective-c is used for quartz's Carbon/Carbon.h in pango, gtk+
         return cross_gcc.Gcc.languages (self) + ['objc', 'obj-c++']
@@ -24,7 +23,11 @@
 /home/janneke/vc/gub/target/darwin-x86/root/usr/cross/bin/i686-apple-darwin8-ld: warning can't open dynamic library: /home/janneke/vc/gub/target/darwin-x86/root/home/janneke/vc/gub/target/darwin-x86/root/usr/cross/i686-apple-darwin8/lib/libgcc_s.1.dylib referenced from: /home/janneke/vc/gub/target/darwin-x86/root/usr/lib/libstdc++.dylib (checking for undefined symbols may be affected) (No such file or directory, errno = 2)
 '''
         # let's try adding libstdc++.dylib?, nah, let's not
-        skip_libs = ['libgcc_s'] #, 'libstdc++']
+        skip_libs = [
+            'libgcc_s.10.',
+            'libgcc_s_',
+            'libgcc_ext.10.'
+        ] #, 'libstdc++']
 
         def rewire_one (logger, file):
             found_skips = [s for s in skip_libs if file.find (s) >= 0]
@@ -42,25 +45,24 @@
         self.map_locate (rewire_one,
                          self.expand ('%(install_prefix)s/lib/'),
                          '*.dylib')
+    def get_subpackage_definitions (self):
+        d = cross.AutoBuild.get_subpackage_definitions (self)
+        prefix_dir = self.settings.prefix_dir
+        d['c++-runtime'] = [
+            prefix_dir + '/lib/libstdc++.6.dylib',
+            prefix_dir + '/lib/libgcc_s.1.dylib',
+        ]
+        return d
     def install (self):
         cross_gcc.Gcc.install (self)
         # conflicts with darwin-SDK
         self.system ('mv %(install_prefix)s/lib/libsupc++.a %(install_prefix)s/lib/libsupc++.a-')
         self.rewire_gcc_libs ()
-    
-class Gcc__darwin__x86 (Gcc__darwin):
-    source = 'http://ftp.gnu.org/pub/gnu/gcc/gcc-4.8.2/gcc-4.8.2.tar.bz2'
-    patches = []
-    dependencies = Gcc__darwin.dependencies + ['tools::mpfr']
-    configure_command = (''' LDFLAGS='-L%(tools_prefix)s/lib %(rpath)s' '''
-                         + Gcc__darwin.configure_command)
 
-class Version_bump_builds_but_needs_a_test_Gcc__darwin__ppc (Gcc__darwin__x86):
-    pass
-
-class Not_used__Gcc__darwin (Gcc__darwin):
-    def configure (self):
-        cross_gcc.Gcc.configure (self)
-    def install (self):
-        cross_gcc.Gcc.install (self)
-        self.rewire_gcc_libs ()
+class Gcc__darwin__ppc (Gcc__darwin):
+    patches = Gcc__darwin.patches + [
+        'gcc-4.9.2-darwin-powerpc.patch', # This patch will not be needed from gcc 4.9.3.
+    ]
+    configure_flags = (Gcc__darwin.configure_flags
+                       + ' --disable-libitm'
+    )
--- a/gub/specs/darwin/darwin-sdk.py	Tue Oct 21 12:37:18 2014 +0100
+++ b/gub/specs/darwin/darwin-sdk.py	Mon Mar 02 14:34:54 2015 +0000
@@ -1,7 +1,7 @@
 from gub import build
 
 class Darwin_sdk (build.SdkBuild):
-    source = 'http://lilypond.org/download/gub-sources/darwin7-sdk-0.4.tar.gz'
+    source = 'http://lilypond.org/download/gub-sources/darwin8-sdk/darwin8-sdk-0.4.tar.gz'
     def patch (self):
         self.system ('''
 rm %(srcdir)s/usr/lib/libgcc*
@@ -26,6 +26,3 @@
         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 Darwin_sdk__darwin__x86 (Darwin_sdk):
-    source = 'http://lilypond.org/download/gub-sources/darwin8-sdk-0.4.tar.gz'
--- a/gub/specs/darwin/odcctools.py	Tue Oct 21 12:37:18 2014 +0100
+++ b/gub/specs/darwin/odcctools.py	Mon Mar 02 14:34:54 2015 +0000
@@ -9,7 +9,7 @@
               '&branch=odcctools'
               '&revision=278')
     # let's use cached tarball
-    source = 'http://lilypond.org/download/gub-sources/odcctools-iphone-dev-278.tar.gz'
+    source = 'http://lilypond.org/gub/download/odcctools-iphone-dev/odcctools-iphone-dev-278.tar.gz'
     patches = ['odcctools-r211-word.patch',
                'odcctools-config-Wno-long-double.patch']
     dependencies = ['darwin-sdk', 'tools::flex', 'tools::automake']
--- a/gub/specs/debian/cross/gcc.py	Tue Oct 21 12:37:18 2014 +0100
+++ b/gub/specs/debian/cross/gcc.py	Mon Mar 02 14:34:54 2015 +0000
@@ -2,10 +2,6 @@
 from gub import debian
 
 class Gcc__debian (cross_gcc.Gcc):
-    source = 'http://ftp.gnu.org/pub/gnu/gcc/gcc-4.8.2/gcc-4.8.2.tar.bz2'
     dependencies = ['cross/binutils', 'libc6', 'libc6-dev', 'linux-kernel-headers']
     ## TODO: should detect whether libc supports TLS 
     configure_flags = cross_gcc.Gcc.configure_flags + ' --disable-tls '
-
-class Gcc__debian__arm (Gcc__debian):
-    source = 'http://ftp.gnu.org/pub/gnu/gcc/gcc-4.8.2/gcc-4.8.2.tar.bz2'
--- a/gub/specs/expat.py	Tue Oct 21 12:37:18 2014 +0100
+++ b/gub/specs/expat.py	Mon Mar 02 14:34:54 2015 +0000
@@ -4,30 +4,12 @@
 from gub import tools
 
 class Expat (target.AutoBuild):
-    source = 'http://surfnet.dl.sourceforge.net/sourceforge/expat/expat-2.0.1.tar.gz'
-    patches = ['expat-2.0.1-mingw.patch']
+    source = 'http://sourceforge.net/projects/expat/files/expat/2.1.0/expat-2.1.0.tar.gz'
     dependencies = ['libtool', 'tools::expat']
-    make_flags = misc.join_lines ('''
-CFLAGS='-O2 -DHAVE_EXPAT_CONFIG_H'
-EXEEXT=
-RUN_FC_CACHE_TEST=false
-''')
-    if 'stat' in misc.librestrict (): # 40 lines of sh code from 1993 implementing `mkdir -p', statting components of DESTDIR: /home, ...
-        make_flags = make_flags + ''' 'mkinstalldirs=mkdir -p' '''
-    def patch (self):
-        target.AutoBuild.patch (self)
-        #FIXME: should have configure.ac/in vs configure timestamp test
-        self.system ('rm %(srcdir)s/configure')
-        self.system ('touch %(srcdir)s/tests/xmltest.sh.in')
-
-class Expat__mingw (Expat):
-    # mingw's expat libtool build breaks with DASH
-    configure_variables = (Expat.configure_variables
-                .replace ('SHELL=', 'XSHELL='))
 
 class Expat__linux__arm__vfp (Expat):
     patches = []
-    source = 'http://surfnet.dl.sourceforge.net/sourceforge/expat/expat-2.0.0.tar.gz'
+    source = 'http://sourceforge.net/projects/expat/files/expat/2.0.0/expat-2.0.0.tar.gz'
     def patch (self):
         self.system ('touch %(srcdir)s/tests/xmltest.sh.in')
         target.AutoBuild.patch (self)
--- a/gub/specs/flex.py	Tue Oct 21 12:37:18 2014 +0100
+++ b/gub/specs/flex.py	Mon Mar 02 14:34:54 2015 +0000
@@ -4,7 +4,7 @@
 from gub import tools
 
 class Flex (target.AutoBuild):
-    source = 'http://surfnet.dl.sourceforge.net/sourceforge/flex/flex-2.5.35.tar.gz'
+    source = 'http://sourceforge.net/projects/flex/files/flex/flex-2.5.35/flex-2.5.35.tar.gz'
 #    if 'stat' in misc.librestrict (): # too broken to fix
 #        # configure [gettext, flex] blindly look for /USR/include/libi*
 #        configure_variables = (target.configure_variables
--- a/gub/specs/freebsd-runtime.py	Tue Oct 21 12:37:18 2014 +0100
+++ b/gub/specs/freebsd-runtime.py	Mon Mar 02 14:34:54 2015 +0000
@@ -1,7 +1,7 @@
 from gub import build
 
 class Freebsd_runtime (build.BinaryBuild, build.SdkBuild):
-    source = 'http://lilypond.org/download/gub-sources/freebsd-runtime-4.11-1.%(package_arch)s.tar.gz&strip=0'
+    source = 'http://lilypond.org/download/gub-sources/freebsd-runtime/freebsd-runtime-6.2-1.%(package_arch)s.tar.gz&strip=0'
     def untar (self):
         build.BinaryBuild.untar (self)
         self.system ('''
@@ -11,17 +11,5 @@
 rm -f %(srcdir)s%(prefix_dir)s/include/FlexLexer.h
 ''')
 
-class Freebsd_runtime__freebsd__x86 (Freebsd_runtime):
-    patches = ['freebsd4-runtime.patch']
-    def untar (self):
-        Freebsd_runtime.untar (self)
-        self.patch ()
-        # FIXME: check if empty? (on freebsds4 it is...)
-        # cpp -P ~/vc/gub/target/freebsd-x86/root/usr/include/wctype.h
-        self.system ('''
-#breaks boost#rm %(srcdir)s%(prefix_dir)s/include/wctype.h
-cp %(sourcefiledir)s/stdint-32.h %(srcdir)s%(prefix_dir)s/include/stdint.h
-''')
-
 class Freebsd_runtime__freebsd__64 (Freebsd_runtime):
-    source = 'http://lilypond.org/download/gub-sources/freebsd-runtime-6.2-2.%(package_arch)s.tar.gz&strip=0'
+    source = 'http://lilypond.org/download/gub-sources/freebsd-runtime/freebsd-runtime-6.2-2.%(package_arch)s.tar.gz&strip=0'
--- a/gub/specs/freebsd/cross/gcc.py	Tue Oct 21 12:37:18 2014 +0100
+++ b/gub/specs/freebsd/cross/gcc.py	Mon Mar 02 14:34:54 2015 +0000
@@ -2,11 +2,9 @@
 from gub import misc
 
 class Gcc__freebsd (cross_gcc.Gcc):
-    source = 'http://ftp.gnu.org/pub/gnu/gcc/gcc-4.8.2/gcc-4.8.2.tar.bz2'
-    dependencies = cross_gcc.Gcc.dependencies + ['tools::mpfr']
-    configure_command = (''' LDFLAGS='-L%(tools_prefix)s/lib %(rpath)s' '''
-                         + cross_gcc.Gcc.configure_command)
     configure_flags = (cross_gcc.Gcc.configure_flags
                 + misc.join_lines ('''
 --program-prefix=%(toolchain_prefix)s
+--disable-libcilkrts
+--disable-__cxa_atexit
 '''))
--- a/gub/specs/freetype.py	Tue Oct 21 12:37:18 2014 +0100
+++ b/gub/specs/freetype.py	Mon Mar 02 14:34:54 2015 +0000
@@ -11,7 +11,7 @@
 libraries, display servers, font conversion tools, text image generation
 tools, and many other products as well.'''
 
-    source = 'http://download.savannah.nongnu.org/releases/freetype/freetype-2.3.11.tar.gz&name=freetype'
+    source = 'http://download.savannah.nongnu.org/releases/freetype/freetype-old/freetype-2.3.11.tar.gz&name=freetype'
     def __init__ (self, settings, source):
         target.AutoBuild.__init__ (self, settings, source)
         # Freetype stats /sbin, /usr/sbin and /hurd to determine if
--- a/gub/specs/gcc.py	Tue Oct 21 12:37:18 2014 +0100
+++ b/gub/specs/gcc.py	Mon Mar 02 14:34:54 2015 +0000
@@ -11,7 +11,6 @@
         return 'GNU C compiler; 4.x is strongly recommended'
 
 class Gcc__tools (tools.AutoBuild):
-    source = 'http://ftp.gnu.org/pub/gnu/gcc/gcc-4.8.2/gcc-4.8.2.tar.bz2'
     dependencies = [
             'binutils',
             ]
--- a/gub/specs/gettext.py	Tue Oct 21 12:37:18 2014 +0100
+++ b/gub/specs/gettext.py	Mon Mar 02 14:34:54 2015 +0000
@@ -53,9 +53,6 @@
                 ],
                        '%(builddir)s/gettext-tools/Makefile')
 
-class Gettext__freebsd__x86 (Gettext):
-    dependencies = (Gettext.dependencies + ['libgnugetopt'])
-
 class Gettext__mingw (Gettext):
     patches = ['gettext-0.15-mingw.patch']
     config_cache_overrides = (Gettext.config_cache_overrides
--- a/gub/specs/ghostscript.py	Tue Oct 21 12:37:18 2014 +0100
+++ b/gub/specs/ghostscript.py	Mon Mar 02 14:34:54 2015 +0000
@@ -22,7 +22,7 @@
     exe = ''
     revision = 'b35333cf3579e85725bd7d8d39eacc9640515eb8'
     #source = 'git://git.infradead.org/ghostscript.git?branch=refs/remotes/git-svn&revision=' + revision
-    source = 'http://mirror2.cs.wisc.edu/pub/mirrors/ghost/GPL/gs870/ghostscript-8.70.tar.gz'
+    source = 'http://sourceforge.net/projects/ghostscript/files/GPL%%20Ghostscript/8.70/ghostscript-8.70.tar.gz'
     patches = [
         'ghostscript-8.70-make.patch',
         ]
@@ -215,6 +215,7 @@
         'ghostscript-8.70-windows-wb.patch',
         'ghostscript-8.70-windows-make.patch',
         'ghostscript-8.70-gs_dll.patch',
+        'ghostscript-8.70-mingw-w64-snprintf.patch',
         ]
     def __init__ (self, settings, source):
         Ghostscript.__init__ (self, settings, source)
@@ -284,6 +285,13 @@
                             ('^(EXTRALIBS *=.*)(-shared )', r'\1 -dynamic'),
                             ('^(CC_SHARED *=.*)( -shared)', r'\1 -dynamic')],
                            '%(builddir)s/Makefile')
+    def install (self):
+        Ghostscript.install (self)
+        if shared:
+            self.system ('''
+%(cross_prefix)s/bin/%(target_architecture)s-install_name_tool -id /usr/lib/libgs.8.70.dylib %(install_prefix)s/lib/libgs.8.70.dylib
+%(cross_prefix)s/bin/%(target_architecture)s-install_name_tool -change ./bin/../sobin/libgs.8.70.dylib /usr/lib/libgs.8.70.dylib %(install_prefix)s/bin/gs
+''')
 
 class Ghostscript__tools (tools.AutoBuild, Ghostscript_static):
     parallel_build_broken = True
--- a/gub/specs/glibc-core.py	Tue Oct 21 12:37:18 2014 +0100
+++ b/gub/specs/glibc-core.py	Mon Mar 02 14:34:54 2015 +0000
@@ -5,8 +5,11 @@
 # Hmm? TARGET_CFLAGS=-O --> target.py
 
 class Glibc_core (glibc.Glibc):
-    source = 'http://lilypond.org/download/gub-sources/glibc-2.3-20070416.tar.bz2'
-    patches = glibc.Glibc.patches + ['glibc-2.3-core-install.patch']
+    source = 'http://lilypond.org/download/gub-sources/glibc/glibc-2.3-20070416.tar.bz2'
+    patches = glibc.Glibc.patches + [
+        'glibc-2.3-core-install.patch',
+        'glibc-2.3-core-libgcc.patch',
+    ]
     dependencies = ['cross/gcc-core', 'linux-headers', 'tools::bison']
     configure_flags = (glibc.Glibc.configure_flags
                        + misc.join_lines ('''
@@ -32,9 +35,15 @@
 cp %(srcdir)s/include/features.h %(install_prefix)s/include
 mkdir -p %(install_prefix)s/include/bits
 cp %(builddir)s/bits/stdio_lim.h %(install_prefix)s/include/bits
+touch %(install_prefix)s/include/bits/syscall.h
 ''')
 
 class Glibc_core__linux__ppc (Glibc_core):
+    patches = Glibc_core.patches + [
+        'glibc-2.3-linux-ppc-sysdeps-generic-strtol_l.patch',
+        'glibc-2.3-powerpc-unwind-find-fde.patch',
+        'glibc-2.3-powerpc-linuxthreads-librt_multiple_threads.patch',
+        ]
         # ugh, but the gnulib=-lgcc hack does something else on ppc...
         # it (huh?) drops *-lgcc* (instead of -lgcc_eh) from libc.so
         # linkage, which then fails.
--- a/gub/specs/glibc.py	Tue Oct 21 12:37:18 2014 +0100
+++ b/gub/specs/glibc.py	Mon Mar 02 14:34:54 2015 +0000
@@ -40,7 +40,7 @@
 # automagically depend on it, which is nice.
 # See cross.py:set_cross_dependencies ()
 class Glibc (target.AutoBuild, cross.AutoBuild):
-    source = 'http://lilypond.org/download/gub-sources/glibc-2.3-20070416.tar.bz2'
+    source = 'http://lilypond.org/download/gub-sources/glibc/glibc-2.3-20070416.tar.bz2'
     patches = [
         'glibc-2.3-powerpc-initfini.patch',
         'glibc-2.3-powerpc-socket-weakalias.patch',
@@ -49,6 +49,14 @@
         'glibc-2.3-slibdir.patch',
         'glibc-2.3-assert-dl_next_tls_modid.patch',
         'glibc-2.3-binutils-2.19-i386.patch',
+        'glibc-2.3-binutils-version-check.patch',
+        'glibc-2.3-sysdeps-general-initfini.patch',
+        'glibc-2.3-sysdeps-i386-Makefile.patch',
+        'glibc-2.3-i386-crti-crtn.patch',
+        'glibc-2.3-misc-sys-cdefs-inline.patch',
+        'glibc-2.3-elf-Makefile.patch',
+        'glibc-2.3-linuxthreads-crti-crtn.patch',
+        'glibc-2.3-powerpc-sysdeps-Makefile.patch',
         ]
     dependencies = ['cross/gcc', 'glibc-core', 'tools::bison', 'tools::gzip', 'tools::perl', 'linux-headers']
     configure_flags = (target.AutoBuild.configure_flags + misc.join_lines ('''
@@ -81,6 +89,9 @@
         return {'': ['glibc-core'], 'devel': ['glibc-core'], 'doc': ['glibc-core'], 'runtime': ['glibc-core']}
     def patch (self):
         target.AutoBuild.patch (self)
+        self.system('''
+rm %(srcdir)s/sysdeps/i386/i686/memcmp.S
+''')
     def get_add_ons (self):
         return ('linuxthreads', 'nptl')
     @context.subst_method
@@ -105,6 +116,11 @@
     def LD_PRELOAD (self):
         return ''
 
+class Glibc__linux__ppc (Glibc):
+    patches = Glibc.patches + [
+        'glibc-2.3-linux-ppc-sysdeps-generic-strtol_l.patch',
+        ]
+
 class Glibc__linux__mipsel (Glibc):
     patches = Glibc.patches + [
         'glibc-2.3-mips-syscall.patch',
--- a/gub/specs/gmp.py	Tue Oct 21 12:37:18 2014 +0100
+++ b/gub/specs/gmp.py	Mon Mar 02 14:34:54 2015 +0000
@@ -6,14 +6,14 @@
 from gub import tools
 
 class Gmp (target.AutoBuild):
-    source = 'http://ftp.gnu.org/pub/gnu/gmp/gmp-4.2.4.tar.gz'
+    source = 'http://ftp.gnu.org/pub/gnu/gmp/gmp-6.0.0a.tar.xz'
     def __init__ (self, settings, source):
         target.AutoBuild.__init__ (self, settings, source)
         if not self.settings.platform.startswith ('darwin'):
             self.target_architecture = re.sub ('i[0-9]86-', 'i386-', settings.target_architecture)
         if 'stat' in misc.librestrict ():
             build.add_dict (self, {'LIBRESTRICT_IGNORE': '%(tools_prefix)s/bin/bash'})
-    dependencies = ['libtool', 'tools::autoconf', 'tools::automake', 'tools::bison', 'tools::flex', 'tools::libtool']
+    dependencies = ['libtool', 'tools::autoconf', 'tools::automake', 'tools::bison', 'tools::flex', 'tools::libtool', 'tools::xzutils']
     configure_flags = (target.AutoBuild.configure_flags
                        + ' --disable-cxx ')
     def configure (self):
@@ -40,9 +40,6 @@
         self.file_sub ([('using std::FILE;','')],
                        '%(install_prefix)s/include/gmp.h')
 
-class Gmp__darwin__x86 (Gmp__darwin):
-    source = 'http://ftp.gnu.org/pub/gnu/gmp/gmp-4.2.4.tar.gz'
-
 class Gmp__mingw (Gmp):
     patches = []
     def __init__ (self, settings, source):
@@ -55,12 +52,8 @@
 mv %(install_prefix)s/lib/*dll %(install_prefix)s/bin || true
 ''')
 
-class Gmp__freebsd (Gmp):
-    source = 'http://ftp.gnu.org/pub/gnu/gmp/gmp-4.2.4.tar.gz'
-
 class Gmp__tools (tools.AutoBuild, Gmp):
-    dependencies = ['bison', 'flex', 'libtool']
-    patches = ['gmp-4.2.1-no-stack-protector.patch']
+    dependencies = ['bison', 'flex', 'libtool', 'xzutils']
     configure_variables = (tools.AutoBuild.configure_variables
                            # avoid __isoc99_fscanf@@GLIBC_2.7 etc
                            + ' CPPFLAGS=-D_GNU_SOURCE')
--- a/gub/specs/guile.py	Tue Oct 21 12:37:18 2014 +0100
+++ b/gub/specs/guile.py	Mon Mar 02 14:34:54 2015 +0000
@@ -187,12 +187,10 @@
         self.map_locate (dylib_link,
                          self.expand ('%(install_prefix)s/lib/'),
                          'libguile-srfi*.dylib')
- 
-class Guile__darwin__x86 (Guile__darwin):
     def configure (self):
         self.file_sub ([('guile-readline', '')],
                        '%(srcdir)s/Makefile.in')
-        Guile__darwin.configure (self)
+        Guile.configure (self)
 
 class Guile__linux__x86 (Guile):
     patches = Guile.patches + ['guile-1.8.6-pthreads-cross.patch']
--- a/gub/specs/hello.py	Tue Oct 21 12:37:18 2014 +0100
+++ b/gub/specs/hello.py	Mon Mar 02 14:34:54 2015 +0000
@@ -1,4 +1,4 @@
 from gub import target
 
 class Hello (target.AutoBuild):
-    source = 'http://lilypond.org/download/gub-sources/hello-1.0.tar.gz'
+    source = 'http://lilypond.org/download/gub-sources/hello/hello-1.0.tar.gz'
--- a/gub/specs/libjpeg.py	Tue Oct 21 12:37:18 2014 +0100
+++ b/gub/specs/libjpeg.py	Mon Mar 02 14:34:54 2015 +0000
@@ -7,7 +7,7 @@
 from gub import tools
 
 class Libjpeg (target.AutoBuild):
-    source = 'ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v6b.tar.gz'
+    source = 'http://www.ijg.org/files/jpegsrc.v6b.tar.gz'
     config_cache_flag_broken = True
     def __init__ (self, settings, source):
         target.AutoBuild.__init__ (self, settings, source)
--- a/gub/specs/libpng.py	Tue Oct 21 12:37:18 2014 +0100
+++ b/gub/specs/libpng.py	Mon Mar 02 14:34:54 2015 +0000
@@ -2,7 +2,7 @@
 from gub import tools 
 
 class Libpng (target.AutoBuild):
-    source = 'http://surfnet.dl.sourceforge.net/sourceforge/libpng/libpng-1.2.8-config.tar.gz'
+    source = 'http://sourceforge.net/projects/libpng/files/libpng12/older-releases/1.2.8/libpng-1.2.8-config.tar.gz'
     patches = ['libpng-pngconf.h-setjmp.patch']
     dependencies = ['zlib-devel', 'tools::autoconf', 'tools::automake', 'tools::libtool']
     def name (self):
--- a/gub/specs/lilypad.py	Tue Oct 21 12:37:18 2014 +0100
+++ b/gub/specs/lilypad.py	Mon Mar 02 14:34:54 2015 +0000
@@ -3,6 +3,7 @@
 
 class LilyPad (target.AutoBuild):
     source = 'http://lilypond.org/download/gub-sources/lilypad/lilypad-0.1.1.0-src.tar.bz2'
+    dependencies = [ 'tools::automake' ]
     destdir_install_broken = True
     license_files = ['']
 
--- a/gub/specs/lilypond.py	Tue Oct 21 12:37:18 2014 +0100
+++ b/gub/specs/lilypond.py	Mon Mar 02 14:34:54 2015 +0000
@@ -171,6 +171,7 @@
     dependencies = LilyPond.dependencies + [
             'tools::imagemagick',
             'tools::icoutils',
+            'mingw-w64-runtime-winpthread-dll',
             ]
     python_lib = '%(system_prefix)s/bin/libpython*.dll'
     make_flags = (LilyPond.make_flags
@@ -252,7 +253,7 @@
 class LilyPond__darwin__ppc (LilyPond__darwin):
     def configure (self):
         LilyPond__darwin.configure (self)
-        self.dump ('CXXFLAGS += -DGUILE_ELLIPSIS=...',
+        self.dump ('CXXFLAGS += -fpermissive -DGUILE_ELLIPSIS=...',
                    '%(builddir)s/local.make')
 
 class LilyPond_base (target.AutoBuild):
--- a/gub/specs/linux-arm-softfloat/cross/gcc-core.py	Tue Oct 21 12:37:18 2014 +0100
+++ b/gub/specs/linux-arm-softfloat/cross/gcc-core.py	Mon Mar 02 14:34:54 2015 +0000
@@ -2,7 +2,6 @@
 gcc = misc.load_spec ('cross/gcc-core')
 
 class Gcc_core (gcc.Gcc_core):
-    source = 'http://ftp.gnu.org/pub/gnu/gcc/gcc-4.8.2/gcc-4.8.2.tar.bz2'
     def patch (self):
         gcc.Gcc_core.patch (self)
         self.system ('''
--- a/gub/specs/linux-arm-softfloat/cross/gcc.py	Tue Oct 21 12:37:18 2014 +0100
+++ b/gub/specs/linux-arm-softfloat/cross/gcc.py	Mon Mar 02 14:34:54 2015 +0000
@@ -3,7 +3,6 @@
 from gub import misc
 
 class Gcc (cross_gcc.Gcc_from_source):
-    source = 'http://ftp.gnu.org/pub/gnu/gcc/gcc-4.8.2/gcc-4.8.2.tar.bz2'
     def patch (self):
         cross_gcc.Gcc_from_source.patch (self)
         self.system ('''
--- a/gub/specs/mingw-runtime.py	Tue Oct 21 12:37:18 2014 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-from gub import build
-
-class Mingw_runtime (build.BinaryBuild, build.SdkBuild):
-    source = 'http://surfnet.dl.sourceforge.net/sourceforge/mingw/mingw-runtime-3.14.tar.gz&strip=0'
-    def install (self):
-        self.system ('''
-mkdir -p %(install_prefix)s/share
-cd %(srcdir)s && tar -C %(srcdir)s/ -cf - . | tar -C %(install_prefix)s -xf -
-mkdir -p %(install_prefix)s/include/sys
-#cp -p %(sourcefiledir)s/mingw-headers/wait.h %(install_prefix)s/include/sys
-mv %(install_prefix)s/doc %(install_root)s/share
-''', locals ())
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/mingw-w64-runtime.py	Mon Mar 02 14:34:54 2015 +0000
@@ -0,0 +1,36 @@
+from gub import build
+
+class Mingw_w64_runtime (build.BinaryBuild, build.SdkBuild):
+    source = 'http://sourceforge.net/projects/mingw-w64/files/Toolchains%%20targetting%%20Win32/Personal%%20Builds/mingw-builds/4.9.2/threads-posix/sjlj/i686-4.9.2-release-posix-sjlj-rt_v3-rev1.7z'
+    dependencies = [ 'tools::p7zip' ]
+    subpackage_names = ['winpthread-dll', '']
+    def get_subpackage_definitions (self):
+        d = build.BinaryBuild.get_subpackage_definitions (self)
+        prefix_dir = self.settings.prefix_dir
+        d['winpthread-dll'] = [
+            prefix_dir + '/bin/libwinpthread-*.dll',
+        ]
+        return d
+    def install (self):
+        self.system ('''
+mkdir -p %(install_prefix)s/include
+mkdir -p %(install_prefix)s/lib
+mkdir -p %(install_prefix)s/bin
+cd %(srcdir)s/mingw32/i686-w64-mingw32/include/ && tar -C %(srcdir)s/mingw32/i686-w64-mingw32/include/ -cf - . | tar -C %(install_prefix)s/include/ -xf -
+cd %(srcdir)s/mingw32/i686-w64-mingw32/lib/ && tar -C %(srcdir)s/mingw32/i686-w64-mingw32/lib/ -cf - . | tar -C %(install_prefix)s/lib/ -xf -
+cp %(srcdir)s/mingw32/bin/libwinpthread-*.dll %(install_prefix)s/bin/
+rm -f %(install_prefix)s/lib/libgcc_s.a # for cross/gcc conflict
+rm -f %(install_prefix)s/lib/libquadmath-0.dll # for cross/gcc conflict
+rm -f %(install_prefix)s/lib/libssp-0.dll # for cross/gcc conflict
+rm -f %(install_prefix)s/lib/libgcc_s_sjlj-1.dll # for cross/gcc conflict
+rm -f %(install_prefix)s/include/zlib.h # for zlib conflict
+rm -f %(install_prefix)s/include/zconf.h # for zlib conflict
+rm -f %(install_prefix)s/lib/libz.a # for zlib conflict
+rm -f %(install_prefix)s/include/localcharset.h # for libiconv conflict
+rm -f %(install_prefix)s/include/libcharset.h # for libiconv conflict
+rm -f %(install_prefix)s/include/error.h # for regex failure
+rm -f %(install_prefix)s/include/iconv.h # for fontconfig failure
+rm -f %(install_prefix)s/lib/libiconv.a # for ghostscript failure
+rm -fr %(srcdir)s/mingw32/
+ln -s usr/ %(install_root)s/mingw
+''', locals ())
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/mingwrt-dev.py	Mon Mar 02 14:34:54 2015 +0000
@@ -0,0 +1,18 @@
+from gub import build
+
+class Mingwrt_dev (build.BinaryBuild, build.SdkBuild):
+    source = 'http://downloads.sourceforge.net/project/mingw/MinGW/Base/mingw-rt/mingwrt-3.20/mingwrt-3.20-2-mingw32-dev.tar.lzma&strip=0'
+    dependencies = [ 'tools::xzutils' ]
+    def install (self):
+        self.system ('''
+mkdir -p %(install_prefix)s/include
+mkdir -p %(install_prefix)s/lib
+mkdir -p %(install_prefix)s/share/doc
+cd %(srcdir)s/include/ && tar -C %(srcdir)s/include/ -cf - . | tar -C %(install_prefix)s/include/ -xf -
+cd %(srcdir)s/lib/ && tar -C %(srcdir)s/lib/ -cf - . | tar -C %(install_prefix)s/lib/ -xf -
+cd %(srcdir)s/share/ && tar -C %(srcdir)s/share/ -cf - . | tar -C %(install_prefix)s/share/ -xf -
+cd %(srcdir)s/doc/ && tar -C %(srcdir)s/doc/ -cf - . | tar -C %(install_prefix)s/share/doc/ -xf -
+mkdir -p %(install_prefix)s/include/sys
+#cp -p %(sourcefiledir)s/mingw-headers/wait.h %(install_prefix)s/include/sys
+rm -fr %(srcdir)s/include/ %(srcdir)s/lib/ %(srcdir)s/share/ %(srcdir)s/doc/
+''', locals ())
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/mingwrt-dll.py	Mon Mar 02 14:34:54 2015 +0000
@@ -0,0 +1,12 @@
+from gub import build
+
+class Mingwrt_dll (build.BinaryBuild, build.SdkBuild):
+    source = 'http://downloads.sourceforge.net/project/mingw/MinGW/Base/mingw-rt/mingwrt-3.20/mingwrt-3.20-2-mingw32-dll.tar.lzma&strip=0'
+    dependencies = [ 'tools::xzutils' ]
+    def install (self):
+        self.system ('''
+rm -fr %(srcdir)s/doc/
+mkdir -p %(install_prefix)s/bin/
+cd %(srcdir)s/bin/ && tar -C %(srcdir)s/bin/ -cf - . | tar -C %(install_prefix)s/bin/ -xf -
+rm -fr %(srcdir)s/bin/
+''', locals ())
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/mpc.py	Mon Mar 02 14:34:54 2015 +0000
@@ -0,0 +1,5 @@
+from gub import tools
+
+class Mpc__tools (tools.AutoBuild):
+    source = 'http://ftp.gnu.org/gnu/mpc/mpc-1.0.2.tar.gz'
+    dependencies = ['gmp', 'mpfr']
--- a/gub/specs/mpfr.py	Tue Oct 21 12:37:18 2014 +0100
+++ b/gub/specs/mpfr.py	Mon Mar 02 14:34:54 2015 +0000
@@ -1,5 +1,5 @@
 from gub import tools
 
 class Mpfr__tools (tools.AutoBuild):
-    source = 'http://www.mpfr.org/mpfr-2.4.2/mpfr-2.4.2.tar.gz'
+    source = 'http://www.mpfr.org/mpfr-3.1.2/mpfr-3.1.2.tar.gz'
     dependencies = ['libtool', 'gmp']
--- a/gub/specs/nsis.py	Tue Oct 21 12:37:18 2014 +0100
+++ b/gub/specs/nsis.py	Mon Mar 02 14:34:54 2015 +0000
@@ -5,9 +5,16 @@
 from gub import tools
 
 class Nsis (tools.SConsBuild):
-    source = 'http://surfnet.dl.sourceforge.net/sourceforge/nsis/nsis-2.46-src.tar.bz2'
+    source = 'http://sourceforge.net/projects/nsis/files/NSIS%%202/2.46/nsis-2.46-src.tar.bz2'
     #source = ':pserver:anonymous@nsis.cvs.sourceforge.net:/cvsroot/nsis&module=NSIS&tag=HEAD'
     dependencies = ['mingw::cross/gcc']
+    patches = [
+        'nsis-2.46-crossmingw.patch',
+        'nsis-2.46-util.patch',
+        'nsis-2.46-linker_script-default.patch',
+        'nsis-2.46-linker_script-ndata.patch',
+	'nsis-2.46-InstallOptions.patch',
+    ]
     scons_flags = misc.join_lines ('''
 DEBUG=yes
 NSIS_CONFIG_LOG=yes
@@ -37,6 +44,7 @@
                      + '/bin')
         return {'PATH': mingw_bin + ':' + tools_bin + ':' + os.environ['PATH'] }
     def patch (self):
+        tools.SConsBuild.patch (self)
         self.system ('mkdir -p %(allbuilddir)s', ignore_errors=True)
         self.system ('ln -s %(srcdir)s %(builddir)s')
         if 'x86_64-linux' in self.settings.build_architecture:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/p7zip.py	Mon Mar 02 14:34:54 2015 +0000
@@ -0,0 +1,11 @@
+from gub import tools
+
+class P7zip__tools (tools.MakeBuild):
+    source = 'http://sourceforge.net/projects/p7zip/files/p7zip/9.20.1/p7zip_9.20.1_src_all.tar.bz2'
+    dependencies = [ 'bzip2', 'system::g++' ]
+    install_flags = ' DEST_HOME=%(install_prefix)s install'
+    def patch (self):
+        tools.MakeBuild.patch (self)
+        self.system('''
+sed -i -e 's/chmod 555/chmod 755/' -e 's/chmod 444/chmod 644/' %(srcdir)s/install.sh
+''')
--- a/gub/specs/pango.py	Tue Oct 21 12:37:18 2014 +0100
+++ b/gub/specs/pango.py	Mon Mar 02 14:34:54 2015 +0000
@@ -91,10 +91,6 @@
 ''', '%(install_prefix)s/etc/relocate/pango.reloc', env=locals (), mode='a')
 
 class Pango__mingw (Pango):
-        # FIXME: need -lpthread now?
-        # /home/janneke/vc/gub/target/mingw/root/usr/cross/bin/i686-mingw32-ld: cannot find -lpthread
-    dependencies = (Pango.dependencies
-                + ['pthreads-w32-devel'])
     def create_config_files (self, prefix='/usr'):
         Pango.create_config_files (self, prefix)
         etc = self.expand ('%(install_root)s/%(prefix)s/etc/pango', locals ())
--- a/gub/specs/patch.py	Tue Oct 21 12:37:18 2014 +0100
+++ b/gub/specs/patch.py	Mon Mar 02 14:34:54 2015 +0000
@@ -6,7 +6,7 @@
 # ugh, openoffice the ooo-build flavour needs the latest patch with
 # additional [SUSE] patches to not barf on all CRLF problems.
 # Taken from the Ibex: apt-get --download source patch
-    source = 'http://lilypond.org/download/gub-sources/patch-2.5.9-5.tar.gz'
+    source = 'http://lilypond.org/download/gub-sources/patch/patch-2.5.9-5.tar.gz'
     configure_variables = ''
     destdir_install_broken = True
     def configure (self):
--- a/gub/specs/python.py	Tue Oct 21 12:37:18 2014 +0100
+++ b/gub/specs/python.py	Mon Mar 02 14:34:54 2015 +0000
@@ -119,7 +119,7 @@
     def __init__ (self, settings, source):
         Python.__init__ (self, settings, source)
         self.target_gcc_flags = '-DMS_WINDOWS -DPy_WIN_WIDE_FILENAMES -I%(system_prefix)s/include' % self.settings.__dict__
-    dependencies = Python.dependencies + ['pthreads-w32-devel']
+    dependencies = Python.dependencies + ['mingw-w64-runtime-winpthread-dll']
     # FIXME: first is cross compile + mingw patch, backported to
     # 2.4.2 and combined in one patch; move to cross-Python?
     def patch (self):
--- a/gub/specs/regex.py	Tue Oct 21 12:37:18 2014 +0100
+++ b/gub/specs/regex.py	Mon Mar 02 14:34:54 2015 +0000
@@ -1,5 +1,5 @@
 from gub import target
 
 class Regex (target.AutoBuild):
-    source = 'http://lilypond.org/download/gub-sources/regex-2.3.90-1.tar.bz2'
+    source = 'http://lilypond.org/download/gub-sources/regex/regex-2.3.90-1.tar.bz2'
     dependencies = ['tools::libtool']
--- a/gub/specs/rsync.py	Tue Oct 21 12:37:18 2014 +0100
+++ b/gub/specs/rsync.py	Mon Mar 02 14:34:54 2015 +0000
@@ -1,7 +1,7 @@
 from gub import tools
 
 class Rsync__tools (tools.AutoBuild):
-    source = 'ftp://ftp.samba.org/pub/rsync/src/rsync-3.0.4.tar.gz'
+    source = 'http://rsync.samba.org/ftp/rsync/src/rsync-3.0.4.tar.gz'
     patches = ['rsync-popt-add-prefix.patch']
     # adding libpopt build depependency not really necessary, as rsync
     # bundles it.
--- a/gub/specs/tar.py	Tue Oct 21 12:37:18 2014 +0100
+++ b/gub/specs/tar.py	Mon Mar 02 14:34:54 2015 +0000
@@ -3,7 +3,7 @@
 from gub import tools
 
 class Tar__tools (tools.AutoBuild):
-    source = 'http://ftp.gnu.org/pub/gnu/tar/tar-1.20.tar.gz'
+    source = 'http://ftp.gnu.org/pub/gnu/tar/tar-1.28.tar.gz'
     def __init__ (self, settings, source):
         tools.AutoBuild.__init__ (self, settings, source)
         if isinstance (self.source, repository.TarBall):
--- a/gub/specs/texinfo.py	Tue Oct 21 12:37:18 2014 +0100
+++ b/gub/specs/texinfo.py	Mon Mar 02 14:34:54 2015 +0000
@@ -2,7 +2,14 @@
 
 class Texinfo__tools (tools.AutoBuild):
     source = 'http://ftp.gnu.org/pub/gnu/texinfo/texinfo-4.13a.tar.gz'
+    patches = ['texinfo-4.13a-fix-bashism.patch']
     def patch (self):
         tools.AutoBuild.patch (self)
         # Drop ncurses dependency
         self.file_sub ([(' info ',' ')], '%(srcdir)s/Makefile.in')
+        # Avoid man rebuild
+        self.system('''
+touch %(srcdir)s/doc/texi2dvi.1
+touch %(srcdir)s/doc/texi2pdf.1
+touch %(srcdir)s/doc/pdftexi2dvi.1
+''')
--- a/gub/specs/urw-fonts.py	Tue Oct 21 12:37:18 2014 +0100
+++ b/gub/specs/urw-fonts.py	Mon Mar 02 14:34:54 2015 +0000
@@ -1,7 +1,7 @@
 from gub import build
 
 class Urw_fonts (build.BinaryBuild):
-    source = 'ftp://ftp.gnome.ru/fonts/urw/release/urw-fonts-1.0.7pre41.tar.bz2&strip=0'
+    source = 'http://lilypond.org/gub/download/urw-fonts/urw-fonts-1.0.7pre41.tar.bz2&strip=0'
     def compile (self):
         self.system ('cd %(srcdir)s && rm README* COPYING ChangeLog TODO')
     def install (self):
--- a/gub/specs/w32api.py	Tue Oct 21 12:37:18 2014 +0100
+++ b/gub/specs/w32api.py	Mon Mar 02 14:34:54 2015 +0000
@@ -1,10 +1,13 @@
 from gub import build
 
 class W32api (build.BinaryBuild, build.SdkBuild):
-    #source = 'http://surfnet.dl.sourceforge.net/sourceforge/mingw/mingw-3.12.tar.gz&strip=0'
-    source = 'http://surfnet.dl.sourceforge.net/sourceforge/mingw/w32api-3.12-mingw32-dev.tar.gz&strip=0'
-    def untar (self):
-        build.BinaryBuild.untar (self)
+    source = 'http://sourceforge.net/projects/mingw/files/MinGW/Base/w32api/w32api-3.17/w32api-3.17-2-mingw32-dev.tar.lzma&strip=0'
+    dependencies = [ 'tools::xzutils' ]
+    def install (self):
         self.system ('''
-cd  %(srcdir)s/ && mkdir usr && mv include lib usr/
-''')
+mkdir -p %(install_prefix)s/include
+mkdir -p %(install_prefix)s/lib
+cd %(srcdir)s/include/ && tar -C %(srcdir)s/include/ -cf - . | tar -C %(install_prefix)s/include/ -xf -
+cd %(srcdir)s/lib/ && tar -C %(srcdir)s/lib/ -cf - . | tar -C %(install_prefix)s/lib/ -xf -
+rm -fr %(srcdir)s/include/ %(srcdir)s/lib/
+''', locals ())
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/xzutils.py	Mon Mar 02 14:34:54 2015 +0000
@@ -0,0 +1,6 @@
+#
+from gub import tools
+
+class Xzutils__tools (tools.AutoBuild):
+    source = 'http://tukaani.org/xz/xz-5.0.7.tar.bz2'
+    dependencies = ['tools::bzip2']
--- a/gub/specs/zlib.py	Tue Oct 21 12:37:18 2014 +0100
+++ b/gub/specs/zlib.py	Mon Mar 02 14:34:54 2015 +0000
@@ -5,7 +5,7 @@
 from gub import tools
 
 class Zlib (target.AutoBuild):
-    source = 'http://surfnet.dl.sourceforge.net/sourceforge/libpng/zlib-1.2.3.tar.gz'
+    source = 'http://sourceforge.net/projects/libpng/files/zlib/1.2.3/zlib-1.2.3.tar.gz'
     patches = ['zlib-1.2.3.patch']
     srcdir_build_broken = True
     dependencies = ['tools::autoconf']
--- a/librestrict/xstatconv.c	Tue Oct 21 12:37:18 2014 +0100
+++ b/librestrict/xstatconv.c	Mon Mar 02 14:34:54 2015 +0000
@@ -48,20 +48,16 @@
       {
 	struct stat *buf = ubuf;
 
+	/* zero clear */
+	memset(buf, 0, sizeof(*buf));
 	/* Convert to current kernel version of `struct stat'.  */
 	buf->st_dev = kbuf->st_dev;
-#ifdef _HAVE_STAT___PAD1
-	buf->__pad1 = 0;
-#endif
 	buf->st_ino = kbuf->st_ino;
 	buf->st_mode = kbuf->st_mode;
 	buf->st_nlink = kbuf->st_nlink;
 	buf->st_uid = kbuf->st_uid;
 	buf->st_gid = kbuf->st_gid;
 	buf->st_rdev = kbuf->st_rdev;
-#ifdef _HAVE_STAT___PAD2
-	buf->__pad2 = 0;
-#endif
 	buf->st_size = kbuf->st_size;
 	buf->st_blksize = kbuf->st_blksize;
 	buf->st_blocks = kbuf->st_blocks;
@@ -77,21 +73,6 @@
 	buf->st_mtime = kbuf->st_mtime;
 	buf->st_ctime = kbuf->st_ctime;
 #endif
-#ifdef _HAVE_STAT___UNUSED1
-	buf->__unused1 = 0;
-#endif
-#ifdef _HAVE_STAT___UNUSED2
-	buf->__unused2 = 0;
-#endif
-#ifdef _HAVE_STAT___UNUSED3
-	buf->__unused3 = 0;
-#endif
-#ifdef _HAVE_STAT___UNUSED4
-	buf->__unused4 = 0;
-#endif
-#ifdef _HAVE_STAT___UNUSED5
-	buf->__unused5 = 0;
-#endif
       }
       break;
 
@@ -116,11 +97,10 @@
       {
 	struct stat64 *buf = ubuf;
 
+	/* zero clear */
+	memset(buf, 0, sizeof(*buf));
 	/* Convert to current kernel version of `struct stat64'.  */
 	buf->st_dev = kbuf->st_dev;
-#ifdef _HAVE_STAT64___PAD1
-	buf->__pad1 = 0;
-#endif
 	buf->st_ino = kbuf->st_ino;
 #ifdef _HAVE_STAT64___ST_INO
 	buf->__st_ino = kbuf->st_ino;
@@ -130,9 +110,6 @@
 	buf->st_uid = kbuf->st_uid;
 	buf->st_gid = kbuf->st_gid;
 	buf->st_rdev = kbuf->st_rdev;
-#ifdef _HAVE_STAT64___PAD2
-	buf->__pad2 = 0;
-#endif
 	buf->st_size = kbuf->st_size;
 	buf->st_blksize = kbuf->st_blksize;
 	buf->st_blocks = kbuf->st_blocks;
@@ -148,21 +125,6 @@
 	buf->st_mtime = kbuf->st_mtime;
 	buf->st_ctime = kbuf->st_ctime;
 #endif
-#ifdef _HAVE_STAT64___UNUSED1
-	buf->__unused1 = 0;
-#endif
-#ifdef _HAVE_STAT64___UNUSED2
-	buf->__unused2 = 0;
-#endif
-#ifdef _HAVE_STAT64___UNUSED3
-	buf->__unused3 = 0;
-#endif
-#ifdef _HAVE_STAT64___UNUSED4
-	buf->__unused4 = 0;
-#endif
-#ifdef _HAVE_STAT64___UNUSED5
-	buf->__unused5 = 0;
-#endif
       }
       break;
 
@@ -185,12 +147,11 @@
     {
     case _STAT_VER_LINUX:
       {
+	/* zero clear */
+	memset(buf, 0, sizeof(*buf));
 	/* Convert current kernel version of `struct stat64' to
            `struct stat'.  */
 	buf->st_dev = kbuf->st_dev;
-#ifdef _HAVE_STAT___PAD1
-	buf->__pad1 = 0;
-#endif
 #ifdef _HAVE_STAT64___ST_INO
 # if __ASSUME_ST_INO_64_BIT == 0
 	if (kbuf->st_ino == 0)
@@ -220,9 +181,6 @@
 	buf->st_uid = kbuf->st_uid;
 	buf->st_gid = kbuf->st_gid;
 	buf->st_rdev = kbuf->st_rdev;
-#ifdef _HAVE_STAT___PAD2
-	buf->__pad2 = 0;
-#endif
 	buf->st_size = kbuf->st_size;
 	/* Check for overflow.  */
 	if (sizeof (buf->st_size) != sizeof (kbuf->st_size)
@@ -253,21 +211,6 @@
 	buf->st_ctime = kbuf->st_ctime;
 #endif
 
-#ifdef _HAVE_STAT___UNUSED1
-	buf->__unused1 = 0;
-#endif
-#ifdef _HAVE_STAT___UNUSED2
-	buf->__unused2 = 0;
-#endif
-#ifdef _HAVE_STAT___UNUSED3
-	buf->__unused3 = 0;
-#endif
-#ifdef _HAVE_STAT___UNUSED4
-	buf->__unused4 = 0;
-#endif
-#ifdef _HAVE_STAT___UNUSED5
-	buf->__unused5 = 0;
-#endif
       }
       break;
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/binutils-2.24-freebsd4.patch	Mon Mar 02 14:34:54 2015 +0000
@@ -0,0 +1,30 @@
+From: H.J. Lu <hjl.tools@gmail.com>
+Date: Mon, 29 Sep 2014 15:35:49 +0000 (-0700)
+Subject: Fix build for OLD_FREEBSD_ABI_LABEL
+X-Git-Url: http://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commitdiff_plain;h=cf7363b42b2fdc9fd108bed8d53b35adf4d52ad5
+
+Fix build for OLD_FREEBSD_ABI_LABEL
+
+	PR ld/17440
+	* elf32-i386.c (elf_i386_fbsd_post_process_headers): Fix build
+	for OLD_FREEBSD_ABI_LABEL.
+---
+
+diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
+index a00d47c..afa21b5 100644
+--- a/bfd/elf32-i386.c
++++ b/bfd/elf32-i386.c
+@@ -5120,8 +5120,11 @@ elf_i386_fbsd_post_process_headers (bfd *abfd, struct bfd_link_info *info)
+   _bfd_elf_post_process_headers (abfd, info);
+ 
+ #ifdef OLD_FREEBSD_ABI_LABEL
+-  /* The ABI label supported by FreeBSD <= 4.0 is quite nonstandard.  */
+-  memcpy (&i_ehdrp->e_ident[EI_ABIVERSION], "FreeBSD", 8);
++  {
++    /* The ABI label supported by FreeBSD <= 4.0 is quite nonstandard.  */
++    Elf_Internal_Ehdr *i_ehdrp = elf_elfheader (abfd);
++    memcpy (&i_ehdrp->e_ident[EI_ABIVERSION], "FreeBSD", 8);
++  }
+ #endif
+ }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/freebsd4-runtime-gcc-4.8.2.patch	Mon Mar 02 14:34:54 2015 +0000
@@ -0,0 +1,10 @@
+--- a/usr/include/sys/mman.h
++++ b/usr/include/sys/mman.h
+@@ -133,6 +133,7 @@
+ #ifndef _KERNEL
+ 
+ #include <sys/cdefs.h>
++#include <sys/types.h>
+ 
+ __BEGIN_DECLS
+ #ifdef _P1003_1B_VISIBLE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/gcc-4.8.2-darwin-fixinc.patch	Mon Mar 02 14:34:54 2015 +0000
@@ -0,0 +1,11 @@
+--- gcc-4.8.2/gcc/Makefile.in.org	2015-01-12 19:53:31.179327200 +0900
++++ gcc-4.8.2/gcc/Makefile.in	2015-01-12 19:53:52.471327200 +0900
+@@ -4214,7 +4214,7 @@
+ 	      export TARGET_MACHINE srcdir SHELL MACRO_LIST && \
+ 	      cd $(build_objdir)/fixincludes && \
+ 	      $(SHELL) ./fixinc.sh "$${gcc_dir}/$${fix_dir}" \
+-	        $(SYSTEM_HEADER_DIR) $(OTHER_FIXINCLUDES_DIRS) ); \
++	        $(SYSTEM_HEADER_DIR) $(OTHER_FIXINCLUDES_DIRS) || true ); \
+ 	    rm -f $${fix_dir}/syslimits.h; \
+ 	    if [ -f $${fix_dir}/limits.h ]; then \
+ 	      mv $${fix_dir}/limits.h $${fix_dir}/syslimits.h; \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/gcc-4.8.2-darwin-libgcc.patch	Mon Mar 02 14:34:54 2015 +0000
@@ -0,0 +1,18 @@
+--- gcc-4.8.2/libgcc/config/t-slibgcc-darwin.org	2015-01-12 23:49:10.689670300 +0900
++++ gcc-4.8.2/libgcc/config/t-slibgcc-darwin	2015-01-12 23:49:40.989670300 +0900
+@@ -29,11 +29,11 @@
+ 
+ # we're only going to build the stubs if the target slib is /usr/lib
+ # there is no other case in which they're useful in a live system.
+-ifeq (/usr/lib,$(shlib_slibdir))
++#ifeq (/usr/lib,$(shlib_slibdir))
+ LGCC_STUBS = libgcc_s.10.4.dylib libgcc_s.10.5.dylib
+-else
+-LGCC_STUBS =
+-endif
++#else
++#LGCC_STUBS =
++#endif
+ 
+ LGCC_FILES = libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)
+ LGCC_FILES += $(LGCC_STUBS)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/gcc-4.8.2-libstdc++-debug-path.patch	Mon Mar 02 14:34:54 2015 +0000
@@ -0,0 +1,27 @@
+Fix libstdc++-v3 debug version path replacement
+
+gub uses path like target/(arch)/src/cross/gcc-4.8.2/.
+A wrong replacement happened like target/(arch)/src/debug/cross/gcc-4.8.2/.
+
+--- a/libstdc++-v3/src/Makefile.am	2014-10-23 16:15:59.385935000 +0900
++++ b/libstdc++-v3/src/Makefile.am	2014-10-23 16:17:24.925935000 +0900
+@@ -311,7 +311,7 @@
+ 	  mv Makefile Makefile.tmp; \
+ 	  sed -e 's,all-local: all-once,all-local:,' \
+ 	      -e 's,install-data-local: install-data-once,install-data-local:,' \
+-	      -e '/vpath/!s,src/c,src/debug/c,' \
++	      -e '/vpath/!s,src/c++,src/debug/c++,' \
+ 	  < Makefile.tmp > Makefile ; \
+ 	  rm -f Makefile.tmp ; \
+ 	  $(MAKE) CXXFLAGS='$(DEBUG_FLAGS)' \
+--- a/libstdc++-v3/src/Makefile.in	2014-10-23 17:58:17.801935000 +0900
++++ b/libstdc++-v3/src/Makefile.in	2014-10-23 18:00:57.253935000 +0900
+@@ -939,7 +939,7 @@
+ 	  mv Makefile Makefile.tmp; \
+ 	  sed -e 's,all-local: all-once,all-local:,' \
+ 	      -e 's,install-data-local: install-data-once,install-data-local:,' \
+-	      -e '/vpath/!s,src/c,src/debug/c,' \
++	      -e '/vpath/!s,src/c++,src/debug/c++,' \
+ 	  < Makefile.tmp > Makefile ; \
+ 	  rm -f Makefile.tmp ; \
+ 	  $(MAKE) CXXFLAGS='$(DEBUG_FLAGS)' \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/gcc-4.9.2-darwin-powerpc.patch	Mon Mar 02 14:34:54 2015 +0000
@@ -0,0 +1,22 @@
+Bug 63703 - [4.9.2/5 Regression] Bootstrap broken on powerpc-apple-darwin, cc1: internal compiler error: in init_reg_sets
+
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63703
+https://gcc.gnu.org/viewcvs?rev=218064&root=gcc&view=rev
+
+This patch will not be needed from gcc 4.9.3.
+
+--- a/gcc/config/rs6000/darwin.h	2014/11/25 21:27:17	218063
++++ b/gcc/config/rs6000/darwin.h	2014/11/25 21:41:44	218064
+@@ -206,7 +206,11 @@
+     "vrsave", "vscr",							\
+     "spe_acc", "spefscr",                                               \
+     "sfp",								\
+-    "tfhar", "tfiar", "texasr"						\
++    "tfhar", "tfiar", "texasr",						\
++    "rh0",  "rh1",  "rh2",  "rh3",  "rh4",  "rh5",  "rh6",  "rh7",	\
++    "rh8",  "rh9",  "rh10", "rh11", "rh12", "rh13", "rh14", "rh15",	\
++    "rh16", "rh17", "rh18", "rh19", "rh20", "rh21", "rh22", "rh23",	\
++    "rh24", "rh25", "rh26", "rh27", "rh28", "rh29", "rh30", "rh31"	\
+ }
+ 
+ /* This outputs NAME to FILE.  */
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/ghostscript-8.70-mingw-w64-snprintf.patch	Mon Mar 02 14:34:54 2015 +0000
@@ -0,0 +1,25 @@
+--- a/base/gp_mswin.c	2014-11-29 16:00:46.394874900 +0900
++++ b/base/gp_mswin.c	2014-11-29 16:01:09.262874900 +0900
+@@ -716,22 +716,3 @@
+ #endif
+ }
+ 
+-/* -------------------------  _snprintf -----------------------------*/
+-
+-/* Microsoft Visual C++ 2005  doesn't properly define snprintf,
+-   which is defined in the C standard ISO/IEC 9899:1999 (E) */
+-
+-int snprintf(char *buffer, size_t count, const char *format, ...)
+-{
+-    if (count > 0) {
+-	va_list args;
+-	int n; 
+-
+-	va_start(args, format);
+-	n = _vsnprintf(buffer, count, format, args);
+-	buffer[count - 1] = 0;
+-	va_end(args);
+-	return n;
+-    } else
+-	return 0;
+-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/glibc-2.3-binutils-version-check.patch	Mon Mar 02 14:34:54 2015 +0000
@@ -0,0 +1,44 @@
+Handle future binutils versions correctly.
+http://sourceware.org/git/?p=glibc.git;a=commit;h=f450806e22be467a8d613f9a811508ccb87a5d1a
+
+Support binutils 2.100 and 3.0.
+http://sourceware.org/git/?p=glibc.git;a=commit;h=0549ce8ec1f66a41c59815e50dd48ffd74fabb52
+
+Support binutils 2.20.
+http://sourceware.org/git/?p=glibc.git;a=commit;h=4c14c8c348ee3e9a5fea3608cabcabdb275b6141
+
+--- a/configure	2014-10-23 21:02:32.093935000 +0900
++++ b/configure	2014-10-23 21:04:27.385935000 +0900
+@@ -3917,7 +3917,7 @@
+   ac_prog_version=`$AS --version 2>&1 | sed -n 's/^.*GNU assembler.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
+   case $ac_prog_version in
+     '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
+-    2.1[3-9]*)
++    2.1[3-9]*|2.1[0-9][0-9]*|2.[2-9][0-9]*|[3-9].*|[1-9][0-9]*)
+        ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
+     *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
+ 
+@@ -3978,7 +3978,7 @@
+   ac_prog_version=`$LD --version 2>&1 | sed -n 's/^.*GNU ld.* \([0-9][0-9]*\.[0-9.]*\).*$/\1/p'`
+   case $ac_prog_version in
+     '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
+-    2.1[3-9]*)
++    2.1[3-9]*|2.1[0-9][0-9]*|2.[2-9][0-9]*|[3-9].*|[1-9][0-9]*)
+        ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
+     *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
+ 
+--- a/configure.in	2014-10-23 21:05:36.165935000 +0900
++++ b/configure.in	2014-10-23 21:07:27.729935000 +0900
+@@ -734,10 +734,10 @@
+ # Accept binutils 2.13 or newer.
+ AC_CHECK_PROG_VER(AS, $AS, --version,
+ 		  [GNU assembler.* \([0-9]*\.[0-9.]*\)],
+-		  [2.1[3-9]*], AS=: critic_missing="$critic_missing as")
++		  [2.1[3-9]*|2.1[0-9][0-9]*|2.[2-9][0-9]*|[3-9].*|[1-9][0-9]*], AS=: critic_missing="$critic_missing as")
+ AC_CHECK_PROG_VER(LD, $LD, --version,
+ 		  [GNU ld.* \([0-9][0-9]*\.[0-9.]*\)],
+-		  [2.1[3-9]*], LD=: critic_missing="$critic_missing ld")
++		  [2.1[3-9]*|2.1[0-9][0-9]*|2.[2-9][0-9]*|[3-9].*|[1-9][0-9]*], LD=: critic_missing="$critic_missing ld")
+ 
+ # We need the physical current working directory.  We cannot use the
+ # "pwd -P" shell builtin since that's not portable.  Instead we try to
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/glibc-2.3-core-libgcc.patch	Mon Mar 02 14:34:54 2015 +0000
@@ -0,0 +1,31 @@
+--- a/Makerules	2004-12-16 03:52:39.000000000 +0900
++++ b/Makerules	2014-11-10 22:13:31.532959500 +0900
+@@ -604,7 +604,7 @@
+ 			 $(elfobjdir)/sofini.os \
+ 			 $(elfobjdir)/interp.os $(elfobjdir)/ld.so \
+ 			 $(common-objpfx)shlib.lds
+-	$(build-shlib)
++	$(build-shlib) -Wl,--allow-multiple-definition -Wl,-lgcc
+ ifeq ($(versioning),yes)
+ $(common-objpfx)libc.so: $(common-objpfx)libc.map
+ endif
+--- a/elf/Makefile	2005-07-18 10:19:48.000000000 +0900
++++ b/elf/Makefile	2014-11-02 20:25:51.969531800 +0900
+@@ -243,7 +243,7 @@
+ 
+ $(objpfx)librtld.map: $(objpfx)dl-allobjs.os $(common-objpfx)libc_pic.a
+ 	@-rm -f $@T
+-	$(reloc-link) -o $@.o '-Wl,-(' $^ -lgcc '-Wl,-)' -Wl,-Map,$@T
++	$(reloc-link) -o $@.o '-Wl,-(' $^ '-Wl,-)' -Wl,-Map,$@T
+ 	rm -f $@.o
+ 	mv -f $@T $@
+ 
+@@ -272,7 +272,7 @@
+ 	$(MAKE) -f $< -f rtld-Rules
+ 
+ $(objpfx)librtld.os: $(objpfx)dl-allobjs.os $(objpfx)rtld-libc.a
+-	$(LINK.o) -nostdlib -nostartfiles -r -o $@ '-Wl,-(' $^ -lgcc '-Wl,-)' \
++	$(LINK.o) -nostdlib -nostartfiles -r -o $@ '-Wl,-(' $^ '-Wl,-)' \
+ 		  -Wl,-Map,$@.map
+ 
+ generated += librtld.map librtld.mk rtld-libc.a librtld.os.map
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/glibc-2.3-elf-Makefile.patch	Mon Mar 02 14:34:54 2015 +0000
@@ -0,0 +1,57 @@
+
+http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=f4a29fba078c48f9d4c78d06d2ed4bbdf95b3763
+
+http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=800938a1268309932c20dc523bb226bcab4bfe18
+
+http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=4e34ac6a1e256f40ab0d8eeed37aa1ea83440e76
+
+http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=cb84d1e403cf2295307b398ab54cedc6bf9f8973
+
+http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=2f978feb67c29ce3eb866aa719ed75ebdaabf4d1
+
+--- a/elf/Makefile	2005-07-18 10:19:48.000000000 +0900
++++ b/elf/Makefile	2014-11-08 22:33:53.923818700 +0900
+@@ -280,18 +280,16 @@
+ z-now-yes = -Wl,-z,now
+ 
+ $(objpfx)ld.so: $(objpfx)librtld.os $(ld-map)
+-	@rm -f $@.lds
+-	$(LINK.o) -nostdlib -nostartfiles -shared $(z-now-$(bind-now))	\
+-		  $(LDFLAGS-rtld) -Wl,-z,defs -Wl,--verbose 2>&1 |	\
+-		  LC_ALL=C \
+-		  sed -e '/^=========/,/^=========/!d;/^=========/d'	\
+-		      -e 's/\. = 0 + SIZEOF_HEADERS;/& _begin = . - SIZEOF_HEADERS;/' \
+-		  > $@.lds
+-	$(LINK.o) -nostdlib -nostartfiles -shared -o $@			\
++# Link into a temporary file so that we don't touch $@ at all
++# if the sanity check below fails.
++	$(LINK.o) -nostdlib -nostartfiles -shared -o $@.new		\
+ 		  $(LDFLAGS-rtld) -Wl,-z,defs $(z-now-$(bind-now))	\
+ 		  $(filter-out $(map-file),$^) $(load-map-file)		\
+-		  -Wl,-soname=$(rtld-installed-name) -T $@.lds
+-	rm -f $@.lds
++		  -Wl,-soname=$(rtld-installed-name)			\
++		  -Wl,-defsym=_begin=0
++	$(READELF) -s $@.new \
++	  | $(AWK) '($$7 ~ /^UND(|EF)$$/ && $$1 != "0:" && $$4 != "REGISTER") { print; p=1 } END { exit p != 0 }'
++	mv -f $@.new $@
+ 
+ # interp.c exists just to get this string into the libraries.
+ CFLAGS-interp.c = -D'RUNTIME_LINKER="$(slibdir)/$(rtld-installed-name)"' \
+--- a/elf/rtld.c	2005-04-06 11:49:51.000000000 +0900
++++ b/elf/rtld.c	2014-11-08 22:44:21.595910400 +0900
+@@ -343,10 +343,11 @@
+ #endif
+ 
+   /* This #define produces dynamic linking inline functions for
+-     bootstrap relocation instead of general-purpose relocation.  */
++     bootstrap relocation instead of general-purpose relocation.
++     Since ld.so must not have any undefined symbols the result
++     is trivial: always the map of ld.so itself.  */
+ #define RTLD_BOOTSTRAP
+-#define RESOLVE_MAP(sym, version, flags) \
+-  ((*(sym))->st_shndx == SHN_UNDEF ? 0 : &bootstrap_map)
++#define RESOLVE_MAP(sym, version, flags) (&bootstrap_map)
+ #define RESOLVE(sym, version, flags) \
+   ((*(sym))->st_shndx == SHN_UNDEF ? 0 : bootstrap_map.l_addr)
+ #include "dynamic-link.h"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/glibc-2.3-i386-crti-crtn.patch	Mon Mar 02 14:34:54 2015 +0000
@@ -0,0 +1,351 @@
+Support crti.S and crtn.S provided directly by architectures.
+
+http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=3add8e1353d62d77fdd9b4ca363cdfe7006b0efb
+
+http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=d8e0ca509a83e832123f6ab508fce620159fb2dc
+
+--- a/csu/Makefile	2005-02-16 18:34:09.000000000 +0900
++++ b/csu/Makefile	2014-10-25 23:29:25.064874700 +0900
+@@ -99,6 +99,13 @@
+ 
+ install-lib += $(crtstuff:=.o)
+ extra-objs += $(crtstuff:=.o)
++
++# Conditionals on the existence of a sysdeps version of crti.S are
++# temporary until all targets either have such a file or have been
++# removed, after which the old approach of postprocessing compiler
++# output will be removed.
++ifeq (,$(wildcard $(full_config_sysdirs:%=%/crti.S)))
++
+ generated += $(crtstuff:=.S) initfini.s defs.h
+ omit-deps += $(crtstuff)
+ 
+@@ -137,6 +144,8 @@
+ 
+ endif
+ 
++endif
++
+ ifeq (yes,$(elf))
+ extra-objs += abi-note.o init.o
+ asm-CPPFLAGS += -I$(objpfx).
+--- a/nptl/Makefile	2005-07-18 12:20:10.000000000 +0900
++++ b/nptl/Makefile	2014-10-25 23:38:07.674430000 +0900
+@@ -319,15 +319,23 @@
+ generated-dirs := $(firstword $(subst /, , $(multidir)))
+ crti-objs += $(multidir)/crti.o
+ crtn-objs += $(multidir)/crtn.o
++# Conditionals on the existence of a sysdeps version of crti.S are
++# temporary until all targets either have such a file or have been
++# removed, after which the old approach of postprocessing compiler
++# output will be removed.
++ifeq (,$(wildcard $(full_config_sysdirs:%=%/crti.S)))
+ omit-deps += $(multidir)/crti $(multidir)/crtn
++endif
+ $(objpfx)$(multidir):
+ 	mkdir $@
+ endif
+ extra-objs += $(crti-objs) $(crtn-objs)
++ifeq (,$(wildcard $(full_config_sysdirs:%=%/crti.S)))
+ omit-deps += crti crtn
+ 
+ CFLAGS-pt-initfini.s = -g0 -fPIC -fno-inline-functions $(fno-unit-at-a-time)
+ endif
++endif
+ 
+ CFLAGS-flockfile.c = -D_IO_MTSAFE_IO
+ CFLAGS-ftrylockfile.c = -D_IO_MTSAFE_IO
+@@ -514,15 +522,24 @@
+ endif
+ 
+ ifeq ($(build-shared),yes)
++ifeq (,$(wildcard $(full_config_sysdirs:%=%/crti.S)))
+ vpath pt-initfini.c $(full_config_sysdirs)
+ 
+ $(objpfx)pt-initfini.s: pt-initfini.c
+ 	$(compile.c) -S $(CFLAGS-pt-initfini.s) -finhibit-size-directive \
+ 		$(patsubst -f%,-fno-%,$(exceptions)) -o $@
++endif
+ 
+ $(objpfx)tst-cleanup0.out: /dev/null $(objpfx)tst-cleanup0
+ 	$(make-test-out) 2>&1 | cmp - tst-cleanup0.expect >& $@
+ 
++ifneq (,$(wildcard $(full_config_sysdirs:%=%/crti.S)))
++
++$(objpfx)crti.o: $(objpfx)pt-crti.o
++	ln -f $< $@
++
++else
++
+ # We only have one kind of startup code files.  Static binaries and
+ # shared libraries are build using the PIC version.
+ $(objpfx)crti.S: $(objpfx)pt-initfini.s
+@@ -544,6 +561,8 @@
+ $(objpfx)crtn.o: $(objpfx)crtn.S $(objpfx)defs.h
+ 	$(compile.S) -g0 $(ASFLAGS-.os) -o $@
+ 
++endif
++
+ ifneq ($(multidir),.)
+ $(objpfx)$(multidir)/crti.o: $(objpfx)crti.o $(objpfx)$(multidir)/
+ 	ln -f $< $@
+--- /dev/null	2014-10-25 23:44:22.000000000 +0900
++++ glibc-2.3-20070416/nptl/pt-crti.S	2014-10-25 23:43:18.445954300 +0900
+@@ -0,0 +1,44 @@
++/* Special .init and .fini section support for libpthread.
++   Copyright (C) 2012 Free Software Foundation, Inc.
++   This file is part of the GNU C Library.
++
++   The GNU C Library is free software; you can redistribute it and/or
++   modify it under the terms of the GNU Lesser General Public
++   License as published by the Free Software Foundation; either
++   version 2.1 of the License, or (at your option) any later version.
++
++   In addition to the permissions in the GNU Lesser General Public
++   License, the Free Software Foundation gives you unlimited
++   permission to link the compiled version of this file with other
++   programs, and to distribute those programs without any restriction
++   coming from the use of this file. (The GNU Lesser General Public
++   License restrictions do apply in other respects; for example, they
++   cover modification of the file, and distribution when not linked
++   into another program.)
++
++   Note that people who make modified versions of this file are not
++   obligated to grant this special exception for their modified
++   versions; it is their choice whether to do so. The GNU Lesser
++   General Public License gives permission to release a modified
++   version without this exception; this exception also makes it
++   possible to release a modified version which carries forward this
++   exception.
++
++   The GNU C Library is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++   Lesser General Public License for more details.
++
++   You should have received a copy of the GNU Lesser General Public
++   License along with the GNU C Library; if not, write to the Free
++   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
++   02111-1307 USA.  */
++
++/* Arrange for __pthread_initialize_minimal_internal to be called at
++   libpthread startup, instead of conditionally calling
++   __gmon_start__.  */
++
++#define PREINIT_FUNCTION __pthread_initialize_minimal_internal
++#define PREINIT_FUNCTION_WEAK 0
++
++#include <crti.S>
+--- a/sysdeps/i386/Makefile	2014-10-25 23:48:17.508557000 +0900
++++ b/sysdeps/i386/Makefile	2014-10-25 23:48:48.242942200 +0900
+@@ -5,12 +5,6 @@
+ # The i386 `long double' is a distinct type we support.
+ long-double-fcts = yes
+ 
+-ifeq ($(subdir),csu)
+-# On i686 we must avoid generating the trampoline functions generated
+-# to get the GOT pointer.
+-CFLAGS-initfini.s += -march=i386 -mtune=i386
+-endif
+-
+ ifeq ($(subdir),gmon)
+ sysdep_routines += i386-mcount
+ endif
+--- /dev/null	2014-10-25 23:52:40.000000000 +0900
++++ glibc-2.3-20070416/sysdeps/i386/crti.S	2014-10-25 23:51:39.255562800 +0900
+@@ -0,0 +1,85 @@
++/* Special .init and .fini section support for x86.
++   Copyright (C) 1995-2012 Free Software Foundation, Inc.
++   This file is part of the GNU C Library.
++
++   The GNU C Library is free software; you can redistribute it and/or
++   modify it under the terms of the GNU Lesser General Public
++   License as published by the Free Software Foundation; either
++   version 2.1 of the License, or (at your option) any later version.
++
++   In addition to the permissions in the GNU Lesser General Public
++   License, the Free Software Foundation gives you unlimited
++   permission to link the compiled version of this file with other
++   programs, and to distribute those programs without any restriction
++   coming from the use of this file. (The GNU Lesser General Public
++   License restrictions do apply in other respects; for example, they
++   cover modification of the file, and distribution when not linked
++   into another program.)
++
++   Note that people who make modified versions of this file are not
++   obligated to grant this special exception for their modified
++   versions; it is their choice whether to do so. The GNU Lesser
++   General Public License gives permission to release a modified
++   version without this exception; this exception also makes it
++   possible to release a modified version which carries forward this
++   exception.
++
++   The GNU C Library is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++   Lesser General Public License for more details.
++
++   You should have received a copy of the GNU Lesser General Public
++   License along with the GNU C Library; if not, write to the Free
++   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
++   02111-1307 USA.  */
++
++/* crti.S puts a function prologue at the beginning of the .init and
++   .fini sections and defines global symbols for those addresses, so
++   they can be called as functions.  The symbols _init and _fini are
++   magic and cause the linker to emit DT_INIT and DT_FINI.  */
++
++#include <libc-symbols.h>
++#include <sysdep.h>
++
++#ifndef PREINIT_FUNCTION
++# define PREINIT_FUNCTION __gmon_start__
++#endif
++
++#ifndef PREINIT_FUNCTION_WEAK
++# define PREINIT_FUNCTION_WEAK 1
++#endif
++
++#if PREINIT_FUNCTION_WEAK
++	weak_extern (PREINIT_FUNCTION)
++#else
++	.hidden PREINIT_FUNCTION
++#endif
++
++	.section .init,"ax",@progbits
++	.p2align 2
++	.globl _init
++	.type _init, @function
++_init:
++	pushl %ebx
++	/* Maintain 16-byte stack alignment for called functions.  */
++	subl $8, %esp
++	LOAD_PIC_REG (bx)
++#if PREINIT_FUNCTION_WEAK
++	movl PREINIT_FUNCTION@GOT(%ebx), %eax
++	testl %eax, %eax
++	je .Lno_weak_fn
++	call PREINIT_FUNCTION@PLT
++.Lno_weak_fn:
++#else
++	call PREINIT_FUNCTION
++#endif
++
++	.section .fini,"ax",@progbits
++	.p2align 2
++	.globl _fini
++	.type _fini, @function
++_fini:
++	pushl %ebx
++	subl $8, %esp
++	LOAD_PIC_REG (bx)
+--- /dev/null	2014-10-25 23:53:42.000000000 +0900
++++ glibc-2.3-20070416/sysdeps/i386/crtn.S	2014-10-25 23:53:12.068095000 +0900
+@@ -0,0 +1,48 @@
++/* Special .init and .fini section support for x86.
++   Copyright (C) 1995-2012 Free Software Foundation, Inc.
++   This file is part of the GNU C Library.
++
++   The GNU C Library is free software; you can redistribute it and/or
++   modify it under the terms of the GNU Lesser General Public
++   License as published by the Free Software Foundation; either
++   version 2.1 of the License, or (at your option) any later version.
++
++   In addition to the permissions in the GNU Lesser General Public
++   License, the Free Software Foundation gives you unlimited
++   permission to link the compiled version of this file with other
++   programs, and to distribute those programs without any restriction
++   coming from the use of this file. (The GNU Lesser General Public
++   License restrictions do apply in other respects; for example, they
++   cover modification of the file, and distribution when not linked
++   into another program.)
++
++   Note that people who make modified versions of this file are not
++   obligated to grant this special exception for their modified
++   versions; it is their choice whether to do so. The GNU Lesser
++   General Public License gives permission to release a modified
++   version without this exception; this exception also makes it
++   possible to release a modified version which carries forward this
++   exception.
++
++   The GNU C Library is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++   Lesser General Public License for more details.
++
++   You should have received a copy of the GNU Lesser General Public
++   License along with the GNU C Library; if not, write to the Free
++   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
++   02111-1307 USA.  */
++
++/* crtn.S puts function epilogues in the .init and .fini sections
++   corresponding to the prologues in crti.S. */
++
++	.section .init,"ax",@progbits
++	addl $8, %esp
++	popl %ebx
++	ret
++
++	.section .fini,"ax",@progbits
++	addl $8, %esp
++	popl %ebx
++	ret
+--- a/sysdeps/i386/sysdep.h	2003-03-10 18:10:46.000000000 +0900
++++ b/sysdeps/i386/sysdep.h	2014-10-29 21:50:27.195372500 +0900
+@@ -19,6 +19,31 @@
+ 
+ #include <sysdeps/generic/sysdep.h>
+ 
++#include <features.h> /* For __GNUC_PREREQ.  */
++
++/* It is desirable that the names of PIC thunks match those used by
++   GCC so that multiple copies are eliminated by the linker.  Because
++   GCC 4.6 and earlier use __i686 in the names, it is necessary to
++   override that predefined macro.  */
++#if defined __i686 && defined __ASSEMBLER__
++#undef __i686
++#define __i686 __i686
++#endif
++
++#ifdef	__ASSEMBLER__
++# if __GNUC_PREREQ (4, 7)
++#  define GET_PC_THUNK(reg) __x86.get_pc_thunk.reg
++# else
++#  define GET_PC_THUNK(reg) __i686.get_pc_thunk.reg
++# endif
++#else
++# if __GNUC_PREREQ (4, 7)
++#  define GET_PC_THUNK_STR(reg) "__x86.get_pc_thunk." #reg
++# else
++#  define GET_PC_THUNK_STR(reg) "__i686.get_pc_thunk." #reg
++# endif
++#endif
++
+ #ifdef	__ASSEMBLER__
+ 
+ /* Syntactic details of assembler.  */
+@@ -117,6 +142,24 @@
+ #define	PSEUDO_END(name)						      \
+   END (name)
+ 
++# define SETUP_PIC_REG(reg) \
++  .ifndef GET_PC_THUNK(reg);						      \
++  .section .gnu.linkonce.t.GET_PC_THUNK(reg),"ax",@progbits;		      \
++  .globl GET_PC_THUNK(reg);						      \
++  .hidden GET_PC_THUNK(reg);						      \
++  .p2align 4;								      \
++  .type GET_PC_THUNK(reg),@function;					      \
++GET_PC_THUNK(reg):							      \
++  movl (%esp), %e##reg;							      \
++  ret;									      \
++  .size GET_PC_THUNK(reg), . - GET_PC_THUNK(reg);			      \
++  .previous;								      \
++  .endif;								      \
++  call GET_PC_THUNK(reg)
++
++# define LOAD_PIC_REG(reg) \
++  SETUP_PIC_REG(reg); addl $_GLOBAL_OFFSET_TABLE_, %e##reg
++
+ #undef JUMPTARGET
+ #ifdef PIC
+ #define JUMPTARGET(name)	name##@PLT
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/glibc-2.3-linux-ppc-sysdeps-generic-strtol_l.patch	Mon Mar 02 14:34:54 2015 +0000
@@ -0,0 +1,52 @@
+http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=2d1e6277e92bd907578cd01d017b1d6aa34485be
+
+--- a/sysdeps/generic/strtol_l.c	2004-06-16 04:54:57.000000000 +0900
++++ b/sysdeps/generic/strtol_l.c	2015-01-28 20:05:02.461060800 +0900
+@@ -168,10 +168,15 @@
+ /* Define tables of maximum values and remainders in order to detect
+    overflow.  Do this at compile-time in order to avoid the runtime
+    overhead of the division.  */
++extern const unsigned long __strtol_ul_max_tab[] attribute_hidden;
++extern const unsigned char __strtol_ul_rem_tab[] attribute_hidden;
++#if defined(QUAD) && __WORDSIZE == 32
++extern const unsigned long long __strtol_ull_max_tab[] attribute_hidden;
++extern const unsigned char __strtol_ull_rem_tab[] attribute_hidden;
++#endif
+ 
+ #define DEF(TYPE, NAME)							   \
+-  const TYPE NAME[] attribute_hidden					   \
+-	__attribute__((section(".gnu.linkonce.r." #NAME))) =		   \
++  const TYPE NAME[] attribute_hidden =					   \
+   {									   \
+     F(2), F(3), F(4), F(5), F(6), F(7), F(8), F(9), F(10), 		   \
+     F(11), F(12), F(13), F(14), F(15), F(16), F(17), F(18), F(19), F(20),  \
+@@ -179,20 +184,22 @@
+     F(31), F(32), F(33), F(34), F(35), F(36)				   \
+   }
+ 
+-#define F(X)	ULONG_MAX / X
++#if !UNSIGNED && !defined (USE_WIDE_CHAR) && !defined (QUAD)
++# define F(X)	ULONG_MAX / X
+   DEF (unsigned long, __strtol_ul_max_tab);
+-#undef F
+-#if defined(QUAD) && __WORDSIZE == 32
++# undef F
++# define F(X)	ULONG_MAX % X
++  DEF (unsigned char, __strtol_ul_rem_tab);
++# undef F
++#endif
++#if !UNSIGNED && !defined (USE_WIDE_CHAR) && defined (QUAD) \
++    && __WORDSIZE == 32
+ # define F(X)	ULONG_LONG_MAX / X
+   DEF (unsigned long long, __strtol_ull_max_tab);
+ # undef F
+ # define F(X)	ULONG_LONG_MAX % X
+   DEF (unsigned char, __strtol_ull_rem_tab);
+ # undef F
+-#else
+-# define F(X)	ULONG_MAX % X
+-  DEF (unsigned char, __strtol_ul_rem_tab);
+-# undef F
+ #endif
+ #undef DEF
+ 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/glibc-2.3-linuxthreads-crti-crtn.patch	Mon Mar 02 14:34:54 2015 +0000
@@ -0,0 +1,105 @@
+This linuxthreads patch was created based on the following nptl patch.
+
+http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=3add8e1353d62d77fdd9b4ca363cdfe7006b0efb
+
+--- a/linuxthreads/Makefile	2005-02-16 20:26:38.000000000 +0900
++++ b/linuxthreads/Makefile	2014-11-12 18:47:29.238567100 +0900
+@@ -97,13 +97,21 @@
+ generated-dirs := $(firstword $(subst /, , $(multidir)))
+ crti-objs += $(multidir)/crti.o
+ crtn-objs += $(multidir)/crtn.o
++# Conditionals on the existence of a sysdeps version of crti.S are
++# temporary until all targets either have such a file or have been
++# removed, after which the old approach of postprocessing compiler
++# output will be removed.
++ifeq (,$(wildcard $(sysdirs:%=%/crti.S)))
+ omit-deps += $(multidir)/crti $(multidir)/crtn
+ endif
++endif
+ extra-objs += $(crti-objs) $(crtn-objs)
++ifeq (,$(wildcard $(sysdirs:%=%/crti.S)))
+ omit-deps += crti crtn
+ 
+ CFLAGS-pt-initfini.s = -g0 -fPIC -fno-inline-functions $(fno-unit-at-a-time)
+ endif
++endif
+ 
+ librt-tests = ex10 ex11 tst-clock1
+ tests = ex1 ex2 ex3 ex4 ex5 ex6 ex7 ex8 ex9 $(librt-tests) ex12 ex13 joinrace \
+@@ -268,11 +276,20 @@
+ endif
+ 
+ ifeq ($(build-shared),yes)
++ifeq (,$(wildcard $(sysdirs:%=%/crti.S)))
+ vpath pt-initfini.c $(full_config_sysdirs)
+ 
+ $(objpfx)pt-initfini.s: pt-initfini.c
+ 	$(compile.c) -S $(CFLAGS-pt-initfini.s) -finhibit-size-directive \
+ 		$(patsubst -f%,-fno-%,$(exceptions)) -o $@
++endif
++
++ifneq (,$(wildcard $(sysdirs:%=%/crti.S)))
++
++$(objpfx)crti.o: $(objpfx)pt-crti.o
++	ln -f $< $@
++
++else
+ 
+ # We only have one kind of startup code files.  Static binaries and
+ # shared libraries are build using the PIC version.
+@@ -295,6 +312,8 @@
+ $(objpfx)crtn.o: $(objpfx)crtn.S $(objpfx)defs.h
+ 	$(compile.S) -g0 $(ASFLAGS-.os) -o $@
+ 
++endif
++
+ ifneq ($(multidir),.)
+ $(objpfx)$(multidir):
+ 	@mkdir -p $(objpfx)$(multidir)
+--- /dev/null	2014-10-25 23:44:22.000000000 +0900
++++ b/linuxthreads/pt-crti.S	2014-10-25 23:43:18.445954300 +0900
+@@ -0,0 +1,44 @@
++/* Special .init and .fini section support for libpthread.
++   Copyright (C) 2012 Free Software Foundation, Inc.
++   This file is part of the GNU C Library.
++
++   The GNU C Library is free software; you can redistribute it and/or
++   modify it under the terms of the GNU Lesser General Public
++   License as published by the Free Software Foundation; either
++   version 2.1 of the License, or (at your option) any later version.
++
++   In addition to the permissions in the GNU Lesser General Public
++   License, the Free Software Foundation gives you unlimited
++   permission to link the compiled version of this file with other
++   programs, and to distribute those programs without any restriction
++   coming from the use of this file. (The GNU Lesser General Public
++   License restrictions do apply in other respects; for example, they
++   cover modification of the file, and distribution when not linked
++   into another program.)
++
++   Note that people who make modified versions of this file are not
++   obligated to grant this special exception for their modified
++   versions; it is their choice whether to do so. The GNU Lesser
++   General Public License gives permission to release a modified
++   version without this exception; this exception also makes it
++   possible to release a modified version which carries forward this
++   exception.
++
++   The GNU C Library is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++   Lesser General Public License for more details.
++
++   You should have received a copy of the GNU Lesser General Public
++   License along with the GNU C Library; if not, write to the Free
++   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
++   02111-1307 USA.  */
++
++/* Arrange for __pthread_initialize_minimal_internal to be called at
++   libpthread startup, instead of conditionally calling
++   __gmon_start__.  */
++
++#define PREINIT_FUNCTION __pthread_initialize_minimal
++#define PREINIT_FUNCTION_WEAK 0
++
++#include <crti.S>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/glibc-2.3-misc-sys-cdefs-inline.patch	Mon Mar 02 14:34:54 2015 +0000
@@ -0,0 +1,816 @@
+
+http://sourceware.org/ml/glibc-bugs/2006-12/msg00001.html
+http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=de1c3ebb59c9e9f7caaf5a71920fe613e3e7cfaa
+http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=b037a293a48718af30d706c2e18c929d0e69a621
+
+--- a/sysdeps/i386/fpu/bits/mathinline.h	2004-09-08 07:23:42.000000000 +0900
++++ b/sysdeps/i386/fpu/bits/mathinline.h	2014-10-31 21:51:30.528409400 +0900
+@@ -23,10 +23,10 @@
+ # error "Never use <bits/mathinline.h> directly; include <math.h> instead."
+ #endif
+ 
+-#ifdef __cplusplus
++#ifndef __extern_inline
+ # define __MATH_INLINE __inline
+ #else
+-# define __MATH_INLINE extern __inline
++# define __MATH_INLINE __extern_inline
+ #endif
+ 
+ 
+--- a/misc/sys/cdefs.h	2004-10-18 13:17:13.000000000 +0900
++++ b/misc/sys/cdefs.h	2014-10-31 22:02:58.733429500 +0900
+@@ -255,6 +255,32 @@
+ # define __nonnull(params)
+ #endif
+ 
++/* GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99
++   inline semantics, unless -fgnu89-inline is used.  Using __GNUC_STDC_INLINE__
++   or __GNUC_GNU_INLINE is not a good enough check for gcc because gcc versions
++   older than 4.3 may define these macros and still not guarantee GNU inlining
++   semantics.
++
++   clang++ identifies itself as gcc-4.2, but has support for GNU inlining
++   semantics, that can be checked fot by using the __GNUC_STDC_INLINE_ and
++   __GNUC_GNU_INLINE__ macro definitions.  */
++#if (!defined __cplusplus || __GNUC_PREREQ (4,3) \
++     || (defined __clang__ && (defined __GNUC_STDC_INLINE__ \
++			       || defined __GNUC_GNU_INLINE__)))
++# if defined __GNUC_STDC_INLINE__ || defined __cplusplus
++#  define __extern_inline extern __inline __attribute__ ((__gnu_inline__))
++#  define __extern_always_inline \
++  extern __always_inline __attribute__ ((__gnu_inline__))
++# else
++#  define __extern_inline extern __inline
++#  define __extern_always_inline extern __always_inline
++# endif
++#endif
++
++#ifdef __extern_always_inline
++# define __fortify_function __extern_always_inline __attribute_artificial__
++#endif
++
+ /* It is possible to compile containing GCC extensions even if GCC is
+    run in pedantic mode if the uses are carefully marked using the
+    `__extension__' keyword.  But this is not generally available before
+--- a/stdlib/stdlib.h	2005-07-18 10:15:30.000000000 +0900
++++ b/stdlib/stdlib.h	2014-10-31 23:40:25.492451800 +0900
+@@ -321,18 +321,18 @@
+ /* Define inline functions which call the internal entry points.  */
+ 
+ __BEGIN_NAMESPACE_STD
+-extern __inline double
++__extern_inline double
+ __NTH (strtod (__const char *__restrict __nptr, char **__restrict __endptr))
+ {
+   return __strtod_internal (__nptr, __endptr, 0);
+ }
+-extern __inline long int
++__extern_inline long int
+ __NTH (strtol (__const char *__restrict __nptr, char **__restrict __endptr,
+ 	       int __base))
+ {
+   return __strtol_internal (__nptr, __endptr, __base, 0);
+ }
+-extern __inline unsigned long int
++__extern_inline unsigned long int
+ __NTH (strtoul (__const char *__restrict __nptr, char **__restrict __endptr,
+ 		int __base))
+ {
+@@ -342,12 +342,12 @@
+ 
+ # ifdef __USE_ISOC99
+ __BEGIN_NAMESPACE_C99
+-extern __inline float
++__extern_inline float
+ __NTH (strtof (__const char *__restrict __nptr, char **__restrict __endptr))
+ {
+   return __strtof_internal (__nptr, __endptr, 0);
+ }
+-extern __inline long double
++__extern_inline long double
+ __NTH (strtold (__const char *__restrict __nptr, char **__restrict __endptr))
+ {
+   return __strtold_internal (__nptr, __endptr, 0);
+@@ -356,13 +356,13 @@
+ # endif
+ 
+ # ifdef __USE_BSD
+-__extension__ extern __inline long long int
++__extension__ __extern_inline long long int
+ __NTH (strtoq (__const char *__restrict __nptr, char **__restrict __endptr,
+ 	       int __base))
+ {
+   return __strtoll_internal (__nptr, __endptr, __base, 0);
+ }
+-__extension__ extern __inline unsigned long long int
++__extension__ __extern_inline unsigned long long int
+ __NTH (strtouq (__const char *__restrict __nptr, char **__restrict __endptr,
+ 		int __base))
+ {
+@@ -372,13 +372,13 @@
+ 
+ # if defined __USE_MISC || defined __USE_ISOC99
+ __BEGIN_NAMESPACE_C99
+-__extension__ extern __inline long long int
++__extension__ __extern_inline long long int
+ __NTH (strtoll (__const char *__restrict __nptr, char **__restrict __endptr,
+ 		int __base))
+ {
+   return __strtoll_internal (__nptr, __endptr, __base, 0);
+ }
+-__extension__ extern __inline unsigned long long int
++__extension__ __extern_inline unsigned long long int
+ __NTH (strtoull (__const char * __restrict __nptr, char **__restrict __endptr,
+ 		 int __base))
+ {
+@@ -388,17 +388,17 @@
+ # endif
+ 
+ __BEGIN_NAMESPACE_STD
+-extern __inline double
++__extern_inline double
+ __NTH (atof (__const char *__nptr))
+ {
+   return strtod (__nptr, (char **) NULL);
+ }
+-extern __inline int
++__extern_inline int
+ __NTH (atoi (__const char *__nptr))
+ {
+   return (int) strtol (__nptr, (char **) NULL, 10);
+ }
+-extern __inline long int
++__extern_inline long int
+ __NTH (atol (__const char *__nptr))
+ {
+   return strtol (__nptr, (char **) NULL, 10);
+@@ -407,7 +407,7 @@
+ 
+ # if defined __USE_MISC || defined __USE_ISOC99
+ __BEGIN_NAMESPACE_C99
+-__extension__ extern __inline long long int
++__extension__ __extern_inline long long int
+ __NTH (atoll (__const char *__nptr))
+ {
+   return strtoll (__nptr, (char **) NULL, 10);
+--- a/include/stdlib.h	2005-07-18 10:15:31.000000000 +0900
++++ b/include/stdlib.h	2014-10-31 23:51:07.830765300 +0900
+@@ -141,43 +141,43 @@
+ libc_hidden_proto (____strtoul_l_internal)
+ libc_hidden_proto (____strtoull_l_internal)
+ 
+-extern __inline double
++__extern_inline double
+ __strtod_l (__const char *__restrict __nptr, char **__restrict __endptr,
+ 	    __locale_t __loc)
+ {
+   return ____strtod_l_internal (__nptr, __endptr, 0, __loc);
+ }
+-extern __inline long int
++__extern_inline long int
+ __strtol_l (__const char *__restrict __nptr, char **__restrict __endptr,
+ 	    int __base, __locale_t __loc)
+ {
+   return ____strtol_l_internal (__nptr, __endptr, __base, 0, __loc);
+ }
+-extern __inline unsigned long int
++__extern_inline unsigned long int
+ __strtoul_l (__const char *__restrict __nptr, char **__restrict __endptr,
+ 	     int __base, __locale_t __loc)
+ {
+   return ____strtoul_l_internal (__nptr, __endptr, __base, 0, __loc);
+ }
+-extern __inline float
++__extern_inline float
+ __strtof_l (__const char *__restrict __nptr, char **__restrict __endptr,
+ 	    __locale_t __loc)
+ {
+   return ____strtof_l_internal (__nptr, __endptr, 0, __loc);
+ }
+-extern __inline long double
++__extern_inline long double
+ __strtold_l (__const char *__restrict __nptr, char **__restrict __endptr,
+ 	     __locale_t __loc)
+ {
+   return ____strtold_l_internal (__nptr, __endptr, 0, __loc);
+ }
+-__extension__ extern __inline long long int
++__extension__ __extern_inline long long int
+ __strtoll_l (__const char *__restrict __nptr, char **__restrict __endptr,
+ 	     int __base, __locale_t __loc)
+ {
+   return ____strtoll_l_internal (__nptr, __endptr, __base, 0, __loc);
+ }
+-__extension__ extern __inline unsigned long long int
++__extension__ __extern_inline unsigned long long int
+ __strtoull_l (__const char * __restrict __nptr, char **__restrict __endptr,
+ 	      int __base, __locale_t __loc)
+ {
+--- a/sysdeps/generic/inttypes.h	2004-09-08 07:23:42.000000000 +0900
++++ b/sysdeps/generic/inttypes.h	2014-11-20 20:09:25.486639100 +0900
+@@ -330,7 +330,7 @@
+ 				   int __base, int __group) __THROW;
+ #   define __strtol_internal_defined	1
+ #  endif
+-extern __inline intmax_t
++__extern_inline intmax_t
+ __NTH (strtoimax (__const char *__restrict nptr, char **__restrict endptr,
+ 		  int base))
+ {
+@@ -345,7 +345,7 @@
+ 					     int __base, int __group) __THROW;
+ #   define __strtoul_internal_defined	1
+ #  endif
+-extern __inline uintmax_t
++__extern_inline uintmax_t
+ __NTH (strtoumax (__const char *__restrict nptr, char **__restrict endptr,
+ 		  int base))
+ {
+@@ -359,7 +359,7 @@
+ 				   int __base, int __group) __THROW;
+ #   define __wcstol_internal_defined	1
+ #  endif
+-extern __inline intmax_t
++__extern_inline intmax_t
+ __NTH (wcstoimax (__const __gwchar_t *__restrict nptr,
+ 		  __gwchar_t **__restrict endptr, int base))
+ {
+@@ -376,7 +376,7 @@
+ 					     int __base, int __group) __THROW;
+ #   define __wcstoul_internal_defined	1
+ #  endif
+-extern __inline uintmax_t
++__extern_inline uintmax_t
+ __NTH (wcstoumax (__const __gwchar_t *__restrict nptr,
+ 		  __gwchar_t **__restrict endptr, int base))
+ {
+@@ -393,7 +393,7 @@
+ 					 int __base, int __group) __THROW;
+ #   define __strtoll_internal_defined	1
+ #  endif
+-extern __inline intmax_t
++__extern_inline intmax_t
+ __NTH (strtoimax (__const char *__restrict nptr, char **__restrict endptr,
+ 		  int base))
+ {
+@@ -411,7 +411,7 @@
+ 						   int __group) __THROW;
+ #   define __strtoull_internal_defined	1
+ #  endif
+-extern __inline uintmax_t
++__extern_inline uintmax_t
+ __NTH (strtoumax (__const char *__restrict nptr, char **__restrict endptr,
+ 		  int base))
+ {
+@@ -427,7 +427,7 @@
+ 					 int __base, int __group) __THROW;
+ #   define __wcstoll_internal_defined	1
+ #  endif
+-extern __inline intmax_t
++__extern_inline intmax_t
+ __NTH (wcstoimax (__const __gwchar_t *__restrict nptr,
+ 		  __gwchar_t **__restrict endptr, int base))
+ {
+@@ -446,7 +446,7 @@
+ 						   int __group) __THROW;
+ #   define __wcstoull_internal_defined	1
+ #  endif
+-extern __inline uintmax_t
++__extern_inline uintmax_t
+ __NTH (wcstoumax (__const __gwchar_t *__restrict nptr,
+ 		  __gwchar_t **__restrict endptr, int base))
+ {
+--- a/libio/bits/stdio.h	2004-09-08 07:23:44.000000000 +0900
++++ b/libio/bits/stdio.h	2014-11-01 00:23:54.329331000 +0900
+@@ -24,7 +24,7 @@
+ #ifdef __cplusplus
+ # define __STDIO_INLINE inline
+ #else
+-# define __STDIO_INLINE extern __inline
++# define __STDIO_INLINE __extern_inline
+ #endif
+ 
+ 
+--- a/string/argz.h	2004-09-08 07:23:43.000000000 +0900
++++ b/string/argz.h	2014-11-01 22:35:46.405658900 +0900
+@@ -160,7 +160,7 @@
+ 			__const char *__restrict __entry) __THROW;
+ 
+ #ifdef __USE_EXTERN_INLINES
+-extern inline char *
++__extern_inline char *
+ __NTH (__argz_next (__const char *__argz, size_t __argz_len,
+ 		    __const char *__entry))
+ {
+@@ -174,7 +174,7 @@
+   else
+     return __argz_len > 0 ? (char *) __argz : 0;
+ }
+-extern inline char *
++__extern_inline char *
+ __NTH (argz_next (__const char *__argz, size_t __argz_len,
+ 		  __const char *__entry))
+ {
+--- a/wcsmbs/wchar.h	2004-09-08 07:18:58.000000000 +0900
++++ b/wcsmbs/wchar.h	2014-11-02 10:13:04.769030700 +0900
+@@ -320,7 +320,7 @@
+ 
+ #ifdef __USE_EXTERN_INLINES
+ /* Define inline function as optimization.  */
+-extern __inline size_t
++__extern_inline size_t
+ __NTH (mbrlen (__const char *__restrict __s, size_t __n,
+ 	       mbstate_t *__restrict __ps))
+ { return (__ps != NULL
+@@ -526,38 +526,38 @@
+ /* Define inline functions which call the internal entry points.  */
+ __BEGIN_NAMESPACE_C99
+ 
+-extern __inline double
++__extern_inline double
+ __NTH (wcstod (__const wchar_t *__restrict __nptr,
+ 	       wchar_t **__restrict __endptr))
+ { return __wcstod_internal (__nptr, __endptr, 0); }
+-extern __inline long int
++__extern_inline long int
+ __NTH (wcstol (__const wchar_t *__restrict __nptr,
+ 	       wchar_t **__restrict __endptr, int __base))
+ { return __wcstol_internal (__nptr, __endptr, __base, 0); }
+-extern __inline unsigned long int
++__extern_inline unsigned long int
+ __NTH (wcstoul (__const wchar_t *__restrict __nptr,
+ 		wchar_t **__restrict __endptr, int __base))
+ { return __wcstoul_internal (__nptr, __endptr, __base, 0); }
+ __END_NAMESPACE_C99
+ 
+ # ifdef __USE_GNU
+-extern __inline float
++__extern_inline float
+ __NTH (wcstof (__const wchar_t *__restrict __nptr,
+ 	       wchar_t **__restrict __endptr))
+ { return __wcstof_internal (__nptr, __endptr, 0); }
+-extern __inline long double
++__extern_inline long double
+ __NTH (wcstold (__const wchar_t *__restrict __nptr,
+ 		wchar_t **__restrict __endptr))
+ { return __wcstold_internal (__nptr, __endptr, 0); }
+ 
+ 
+ __extension__
+-extern __inline long long int
++__extern_inline long long int
+ __NTH (wcstoq (__const wchar_t *__restrict __nptr,
+ 	       wchar_t **__restrict __endptr, int __base))
+ { return __wcstoll_internal (__nptr, __endptr, __base, 0); }
+ __extension__
+-extern __inline unsigned long long int
++__extern_inline unsigned long long int
+ __NTH (wcstouq (__const wchar_t *__restrict __nptr,
+ 		wchar_t **__restrict __endptr, int __base))
+ { return __wcstoull_internal (__nptr, __endptr, __base, 0); }
+--- a/include/sys/stat.h	2002-08-13 09:23:12.000000000 +0900
++++ b/include/sys/stat.h	2014-11-02 10:42:42.262380300 +0900
+@@ -19,12 +19,12 @@
+ hidden_proto (__xstat)
+ hidden_proto (__xstat64)
+ #endif
+-extern __inline__ int __stat (__const char *__path, struct stat *__statbuf)
++__extern_inline int __stat (__const char *__path, struct stat *__statbuf)
+ {
+   return __xstat (_STAT_VER, __path, __statbuf);
+ }
+ libc_hidden_proto (__xmknod)
+-extern __inline__ int __mknod (__const char *__path, __mode_t __mode,
++__extern_inline int __mknod (__const char *__path, __mode_t __mode,
+ 			       __dev_t __dev)
+ {
+   return __xmknod (_MKNOD_VER, __path, __mode, &__dev);
+--- a/io/sys/stat.h	2004-09-17 17:22:21.000000000 +0900
++++ b/io/sys/stat.h	2014-11-02 10:44:23.137417700 +0900
+@@ -360,28 +360,28 @@
+ #if defined __GNUC__ && __GNUC__ >= 2
+ /* Inlined versions of the real stat and mknod functions.  */
+ 
+-extern __inline__ int
++__extern_inline int
+ __NTH (stat (__const char *__path, struct stat *__statbuf))
+ {
+   return __xstat (_STAT_VER, __path, __statbuf);
+ }
+ 
+ # if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
+-extern __inline__ int
++__extern_inline int
+ __NTH (lstat (__const char *__path, struct stat *__statbuf))
+ {
+   return __lxstat (_STAT_VER, __path, __statbuf);
+ }
+ # endif
+ 
+-extern __inline__ int
++__extern_inline int
+ __NTH (fstat (int __fd, struct stat *__statbuf))
+ {
+   return __fxstat (_STAT_VER, __fd, __statbuf);
+ }
+ 
+ # if defined __USE_MISC || defined __USE_BSD
+-extern __inline__ int
++__extern_inline int
+ __NTH (mknod (__const char *__path, __mode_t __mode, __dev_t __dev))
+ {
+   return __xmknod (_MKNOD_VER, __path, __mode, &__dev);
+@@ -391,21 +391,21 @@
+ # if defined __USE_LARGEFILE64 \
+   && (! defined __USE_FILE_OFFSET64 \
+       || (defined __REDIRECT_NTH && defined __OPTIMIZE__))
+-extern __inline__ int
++__extern_inline int
+ __NTH (stat64 (__const char *__path, struct stat64 *__statbuf))
+ {
+   return __xstat64 (_STAT_VER, __path, __statbuf);
+ }
+ 
+ #  if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
+-extern __inline__ int
++__extern_inline int
+ __NTH (lstat64 (__const char *__path, struct stat64 *__statbuf))
+ {
+   return __lxstat64 (_STAT_VER, __path, __statbuf);
+ }
+ #  endif
+ 
+-extern __inline__ int
++__extern_inline int
+ __NTH (fstat64 (int __fd, struct stat64 *__statbuf))
+ {
+   return __fxstat64 (_STAT_VER, __fd, __statbuf);
+--- a/sysdeps/unix/sysv/linux/sys/sysmacros.h	2004-09-08 07:18:59.000000000 +0900
++++ b/sysdeps/unix/sysv/linux/sys/sysmacros.h	2014-11-02 11:24:13.174161500 +0900
+@@ -27,30 +27,30 @@
+    they need.  */
+ #ifdef __GLIBC_HAVE_LONG_LONG
+ __extension__
+-extern __inline unsigned int gnu_dev_major (unsigned long long int __dev)
++__extern_inline unsigned int gnu_dev_major (unsigned long long int __dev)
+      __THROW;
+ __extension__
+-extern __inline unsigned int gnu_dev_minor (unsigned long long int __dev)
++__extern_inline unsigned int gnu_dev_minor (unsigned long long int __dev)
+      __THROW;
+ __extension__
+-extern __inline unsigned long long int gnu_dev_makedev (unsigned int __major,
++__extern_inline unsigned long long int gnu_dev_makedev (unsigned int __major,
+ 							unsigned int __minor)
+      __THROW;
+ 
+ # if defined __GNUC__ && __GNUC__ >= 2
+-__extension__ extern __inline unsigned int
++__extension__ __extern_inline unsigned int
+ __NTH (gnu_dev_major (unsigned long long int __dev))
+ {
+   return ((__dev >> 8) & 0xfff) | ((unsigned int) (__dev >> 32) & ~0xfff);
+ }
+ 
+-__extension__ extern __inline unsigned int
++__extension__ __extern_inline unsigned int
+ __NTH (gnu_dev_minor (unsigned long long int __dev))
+ {
+   return (__dev & 0xff) | ((unsigned int) (__dev >> 12) & ~0xff);
+ }
+ 
+-__extension__ extern __inline unsigned long long int
++__extension__ __extern_inline unsigned long long int
+ __NTH (gnu_dev_makedev (unsigned int __major, unsigned int __minor))
+ {
+   return ((__minor & 0xff) | ((__major & 0xfff) << 8)
+--- a/sysdeps/unix/sysv/linux/bits/socket.h	2004-11-20 16:04:23.000000000 +0900
++++ b/sysdeps/unix/sysv/linux/bits/socket.h	2014-11-02 11:39:09.524973000 +0900
+@@ -258,7 +258,7 @@
+ 				      struct cmsghdr *__cmsg) __THROW;
+ #ifdef __USE_EXTERN_INLINES
+ # ifndef _EXTERN_INLINE
+-#  define _EXTERN_INLINE extern __inline
++#  define _EXTERN_INLINE __extern_inline
+ # endif
+ _EXTERN_INLINE struct cmsghdr *
+ __NTH (__cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg))
+--- a/linuxthreads/sysdeps/unix/sysv/linux/allocalim.h	2002-10-09 18:14:24.000000000 +0900
++++ b/linuxthreads/sysdeps/unix/sysv/linux/allocalim.h	2014-11-02 12:03:43.486035000 +0900
+@@ -19,7 +19,7 @@
+ 
+ #include <limits.h>
+ 
+-extern inline int __libc_use_alloca (size_t size)
++__extern_inline int __libc_use_alloca (size_t size)
+ {
+   return (__builtin_expect (size <= PTHREAD_STACK_MIN / 4, 1)
+ 	  || __libc_alloca_cutoff (size));
+--- a/string/bits/string2.h	2004-05-28 15:39:13.000000000 +0900
++++ b/string/bits/string2.h	2014-11-02 12:14:07.078595200 +0900
+@@ -43,7 +43,7 @@
+ # ifdef __cplusplus
+ #  define __STRING_INLINE inline
+ # else
+-#  define __STRING_INLINE extern __inline
++#  define __STRING_INLINE __extern_inline
+ # endif
+ #endif
+ 
+--- a/linuxthreads/sysdeps/i386/i686/pt-machine.h	2004-10-19 14:12:59.000000000 +0900
++++ b/linuxthreads/sysdeps/i386/i686/pt-machine.h	2014-11-02 19:42:51.754608200 +0900
+@@ -22,14 +22,14 @@
+ #ifndef _PT_MACHINE_H
+ #define _PT_MACHINE_H	1
+ 
++#include<misc/sys/cdefs.h>
++
+ #ifndef PT_EI
+-# define PT_EI extern inline __attribute__ ((always_inline))
++# define PT_EI __extern_inline
+ #endif
+ #include "kernel-features.h"
+ 
+ #ifndef __ASSEMBLER__
+-extern long int testandset (int *spinlock);
+-extern int __compare_and_swap (long int *p, long int oldval, long int newval);
+ 
+ /* Get some notion of the current stack.  Need not be exactly the top
+    of the stack, just something somewhere in the current frame.  */
+--- a/sysdeps/unix/sysv/linux/bits/sigset.h	2001-07-06 13:56:14.000000000 +0900
++++ b/sysdeps/unix/sysv/linux/bits/sigset.h	2014-11-02 19:54:45.956657100 +0900
+@@ -43,7 +43,7 @@
+ # define _SIGSET_H_fns 1
+ 
+ # ifndef _EXTERN_INLINE
+-#  define _EXTERN_INLINE extern __inline
++#  define _EXTERN_INLINE __extern_inline
+ # endif
+ 
+ /* Return a mask that includes the bit for SIG only.  */
+--- a/linuxthreads/internals.h	2004-12-13 06:05:54.000000000 +0900
++++ b/linuxthreads/internals.h	2014-11-02 20:01:00.133395400 +0900
+@@ -527,7 +527,7 @@
+ # define __manager_thread __pthread_manager_threadp
+ #endif
+ 
+-extern inline __attribute__((always_inline)) pthread_descr
++__extern_inline pthread_descr
+ check_thread_self (void)
+ {
+   pthread_descr self = thread_self ();
+--- a/include/ctype.h	2004-03-16 19:09:04.000000000 +0900
++++ b/include/ctype.h	2014-11-08 23:04:23.515284300 +0900
+@@ -15,7 +15,7 @@
+ #  include <bits/libc-tsd.h>
+ 
+ #  ifndef CTYPE_EXTERN_INLINE	/* Used by ctype/ctype-info.c, which see.  */
+-#   define CTYPE_EXTERN_INLINE extern inline
++#   define CTYPE_EXTERN_INLINE __extern_inline
+ #  endif
+ 
+ __libc_tsd_define (extern, CTYPE_B)
+--- a/ctype/ctype.h	2004-09-08 07:23:45.000000000 +0900
++++ b/ctype/ctype.h	2014-11-08 23:08:15.796613900 +0900
+@@ -187,13 +187,13 @@
+ # endif
+ 
+ # ifdef __USE_EXTERN_INLINES
+-extern __inline int
++__extern_inline int
+ __NTH (tolower (int __c))
+ {
+   return __c >= -128 && __c < 256 ? (*__ctype_tolower_loc ())[__c] : __c;
+ }
+ 
+-extern __inline int
++__extern_inline int
+ __NTH (toupper (int __c))
+ {
+   return __c >= -128 && __c < 256 ? (*__ctype_toupper_loc ())[__c] : __c;
+--- a/math/math_private.h	2005-10-17 13:52:32.000000000 +0900
++++ b/math/math_private.h	2014-11-08 23:21:07.614208900 +0900
+@@ -193,7 +193,7 @@
+ extern double __copysign (double x, double __y);
+ 
+ #if __GNUC_PREREQ (4, 0)
+-extern inline double __copysign (double x, double y)
++__extern_inline double __copysign (double x, double y)
+ { return __builtin_copysign (x, y); }
+ #endif
+ 
+@@ -240,7 +240,7 @@
+ extern float __copysignf (float x, float __y);
+ 
+ #if __GNUC_PREREQ (4, 0)
+-extern inline float __copysignf (float x, float y)
++__extern_inline float __copysignf (float x, float y)
+ { return __builtin_copysignf (x, y); }
+ #endif
+ 
+@@ -308,7 +308,7 @@
+ extern long double __significandl (long double x);
+ 
+ #if __GNUC_PREREQ (4, 0)
+-extern inline long double __copysignl (long double x, long double y)
++__extern_inline long double __copysignl (long double x, long double y)
+ { return __builtin_copysignl (x, y); }
+ #endif
+ 
+--- a/stdlib/gmp.h	2002-08-27 07:39:44.000000000 +0900
++++ b/stdlib/gmp.h	2014-11-08 23:33:47.667574800 +0900
+@@ -21,6 +21,8 @@
+ 
+ #ifndef __GMP_H__
+ 
++#include <features.h>
++
+ #ifndef __GNU_MP__
+ #define __GNU_MP__ 2
+ #define __need_size_t
+@@ -41,7 +43,7 @@
+ 
+ #ifndef _EXTERN_INLINE
+ #ifdef __GNUC__
+-#define _EXTERN_INLINE extern __inline__
++#define _EXTERN_INLINE __extern_inline
+ #else
+ #define _EXTERN_INLINE static
+ #endif
+--- a/argp/argp-fmtstream.h	2003-10-03 07:52:50.000000000 +0900
++++ b/argp/argp-fmtstream.h	2014-11-08 23:38:03.835319800 +0900
+@@ -207,7 +207,7 @@
+ #endif
+ 
+ #ifndef ARGP_FS_EI
+-#define ARGP_FS_EI extern inline
++#define ARGP_FS_EI __extern_inline
+ #endif
+ 
+ ARGP_FS_EI size_t
+--- a/argp/argp.h.org	2004-09-08 07:23:45.000000000 +0900
++++ b/argp/argp.h	2014-11-08 23:42:17.095136400 +0900
+@@ -557,7 +557,7 @@
+ # endif
+ 
+ # ifndef ARGP_EI
+-#  define ARGP_EI extern __inline__
++#  define ARGP_EI __extern_inline
+ # endif
+ 
+ ARGP_EI void
+--- a/nis/nss-nis.h	2004-04-02 18:15:04.000000000 +0900
++++ b/nis/nss-nis.h	2014-11-12 22:48:04.776850700 +0900
+@@ -42,7 +42,7 @@
+ extern int _nis_default_nss_flags attribute_hidden;
+ extern int _nis_check_default_nss (void) attribute_hidden;
+ 
+-extern inline __attribute__((always_inline)) int
++__extern_inline __attribute__((always_inline)) int
+ _nis_default_nss (void)
+ {
+   return _nis_default_nss_flags ?: _nis_check_default_nss ();
+--- a/nptl/sysdeps/pthread/bits/libc-lock.h	2005-07-18 12:21:59.000000000 +0900
++++ b/nptl/sysdeps/pthread/bits/libc-lock.h	2014-11-15 17:01:53.719263900 +0900
+@@ -408,7 +408,7 @@
+ 
+ 
+ /* Normal cleanup handling, based on C cleanup attribute.  */
+-extern __inline void
++__extern_inline void
+ __libc_cleanup_routine (struct __pthread_cleanup_frame *f)
+ {
+   if (f->__do_it)
+--- a/nptl/sysdeps/pthread/allocalim.h	2005-02-26 10:38:45.000000000 +0900
++++ b/nptl/sysdeps/pthread/allocalim.h	2014-11-15 17:22:43.159354700 +0900
+@@ -21,7 +21,7 @@
+ #include <limits.h>
+ 
+ 
+-extern inline int
++__extern_inline int
+ __libc_use_alloca (size_t size)
+ {
+   return (__builtin_expect (size <= PTHREAD_STACK_MIN / 4, 1)
+--- a/nptl/sysdeps/pthread/pthread.h	2005-07-18 12:21:59.000000000 +0900
++++ b/nptl/sysdeps/pthread/pthread.h	2014-11-15 17:24:38.472224700 +0900
+@@ -532,7 +532,7 @@
+    function the compiler is free to decide inlining the change when
+    needed or fall back on the copy which must exist somewhere
+    else.  */
+-extern __inline void
++__extern_inline void
+ __pthread_cleanup_routine (struct __pthread_cleanup_frame *__frame)
+ {
+   if (__frame->__do_it)
+--- a/locale/programs/charmap-kw.h	2001-07-06 14:28:41.000000000 +0900
++++ b/locale/programs/charmap-kw.h	2014-11-15 18:09:57.525279600 +0900
+@@ -95,6 +95,9 @@
+ 
+ #ifdef __GNUC__
+ __inline
++#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
++__attribute__ ((__gnu_inline__))
++#endif
+ #endif
+ const struct keyword_t *
+ charmap_hash (register const char *str, register unsigned int len)
+--- a/locale/programs/locfile-kw.h	2001-07-06 14:28:41.000000000 +0900
++++ b/locale/programs/locfile-kw.h	2014-11-15 18:15:59.306819600 +0900
+@@ -95,6 +95,9 @@
+ 
+ #ifdef __GNUC__
+ __inline
++#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
++__attribute__ ((__gnu_inline__))
++#endif
+ #endif
+ const struct keyword_t *
+ locfile_hash (register const char *str, register unsigned int len)
+--- a/nptl/sysdeps/unix/sysv/linux/aio_misc.h	2004-05-26 13:26:48.000000000 +0900
++++ b/nptl/sysdeps/unix/sysv/linux/aio_misc.h	2014-11-15 18:21:12.427297700 +0900
+@@ -26,7 +26,7 @@
+ # define aio_start_notify_thread __aio_start_notify_thread
+ # define aio_create_helper_thread __aio_create_helper_thread
+ 
+-extern inline void
++__extern_inline void
+ __aio_start_notify_thread (void)
+ {
+   sigset_t ss;
+@@ -35,7 +35,7 @@
+   INTERNAL_SYSCALL (rt_sigprocmask, err, 4, SIG_SETMASK, &ss, NULL, _NSIG / 8);
+ }
+ 
+-extern inline int
++__extern_inline int
+ __aio_create_helper_thread (pthread_t *threadp, void *(*tf) (void *), void *arg)
+ {
+   pthread_attr_t attr;
+--- a/sysdeps/x86_64/fpu/bits/mathinline.h	2004-09-08 07:18:59.000000000 +0900
++++ b/sysdeps/x86_64/fpu/bits/mathinline.h	2014-11-20 20:00:20.907790200 +0900
+@@ -22,10 +22,10 @@
+ # error "Never use <bits/mathinline.h> directly; include <math.h> instead."
+ #endif
+ 
+-#ifdef __cplusplus
++#ifndef __extern_inline
+ # define __MATH_INLINE __inline
+ #else
+-# define __MATH_INLINE extern __inline
++# define __MATH_INLINE __extern_inline
+ #endif
+ 
+ 
+--- a/linuxthreads/sysdeps/x86_64/pt-machine.h	2004-04-11 15:13:09.000000000 +0900
++++ b/linuxthreads/sysdeps/x86_64/pt-machine.h	2014-11-20 20:19:23.150928900 +0900
+@@ -27,12 +27,12 @@
+ # include <asm/prctl.h>
+ 
+ 
++#include<misc/sys/cdefs.h>
++
+ # ifndef PT_EI
+-#  define PT_EI extern inline __attribute__ ((always_inline))
++#  define PT_EI __extern_inline
+ # endif
+ 
+-extern long int testandset (int *spinlock);
+-extern int __compare_and_swap (long int *p, long int oldval, long int newval);
+ 
+ /* Get some notion of the current stack.  Need not be exactly the top
+    of the stack, just something somewhere in the current frame.  */
+--- a/sysdeps/powerpc/fpu/bits/mathinline.h	2004-09-30 15:16:28.000000000 +0900
++++ b/sysdeps/powerpc/fpu/bits/mathinline.h	2015-01-20 22:27:55.277405000 +0900
+@@ -22,10 +22,10 @@
+ # error "Never use <bits/mathinline.h> directly; include <math.h> instead."
+ #endif
+ 
+-#ifdef __cplusplus
++#ifndef __extern_inline
+ # define __MATH_INLINE __inline
+ #else
+-# define __MATH_INLINE extern __inline
++# define __MATH_INLINE __extern_inline
+ #endif  /* __cplusplus */
+ 
+ #if defined __GNUC__ && !defined _SOFT_FLOAT
+--- a/linuxthreads/sysdeps/powerpc/powerpc32/pt-machine.h	2003-08-01 04:15:43.000000000 +0900
++++ b/linuxthreads/sysdeps/powerpc/powerpc32/pt-machine.h	2015-01-20 22:37:34.182419800 +0900
+@@ -25,12 +25,12 @@
+ #ifndef _PT_MACHINE_H
+ #define _PT_MACHINE_H   1
+ 
++#include<misc/sys/cdefs.h>
++
+ #ifndef PT_EI
+-# define PT_EI extern inline __attribute__ ((always_inline))
++# define PT_EI __extern_inline
+ #endif
+ 
+-extern long int testandset (int *spinlock);
+-extern int __compare_and_swap (long int *p, long int oldval, long int newval);
+ 
+ /* For multiprocessor systems, we want to ensure all memory accesses
+    are completed before we reset a lock.  On other systems, we still
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/glibc-2.3-powerpc-linuxthreads-librt_multiple_threads.patch	Mon Mar 02 14:34:54 2015 +0000
@@ -0,0 +1,15 @@
+--- a/linuxthreads/Makefile	2014-11-12 18:47:29.238567100 +0900
++++ b/linuxthreads/Makefile	2015-02-01 22:28:42.566756900 +0900
+@@ -186,6 +186,8 @@
+ $(objpfx)libpthread.so: +preinit += $(addprefix $(objpfx),$(crti-objs))
+ $(objpfx)libpthread.so: +postinit += $(addprefix $(objpfx),$(crtn-objs))
+ 
++$(objpfx)libpthread_pic.a: $(objpfx)dummy_symbol.os
++
+ znodelete-yes = -DHAVE_Z_NODELETE
+ CFLAGS-mutex.c += -D__NO_WEAK_PTHREAD_ALIASES
+ CFLAGS-specific.c += -D__NO_WEAK_PTHREAD_ALIASES
+--- /dev/null	2015-02-01 22:32:29.000000000 +0900
++++ b/linuxthreads/dummy_symbol.c	2015-02-01 22:30:53.158812200 +0900
+@@ -0,0 +1 @@
++int __librt_multiple_threads;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/glibc-2.3-powerpc-sysdeps-Makefile.patch	Mon Mar 02 14:34:54 2015 +0000
@@ -0,0 +1,14 @@
+PowerPC: Remove unnecessary -mnew-mnemonics.
+
+http://sourceware.org/git/?p=glibc.git;a=commit;h=b3563932f85d60bb0d38b0a5f3b8f4abc133f890
+
+--- a/sysdeps/powerpc/Makefile	2004-02-14 12:24:52.000000000 +0900
++++ b/sysdeps/powerpc/Makefile	2015-01-20 21:18:22.894478200 +0900
+@@ -1,7 +1,3 @@
+-# We always want to use the new mnemonic syntax even if we are on a RS6000
+-# machine.
+-+cflags += -mnew-mnemonics
+-
+ ifeq ($(subdir),gmon)
+ sysdep_routines += ppc-mcount
+ endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/glibc-2.3-powerpc-unwind-find-fde.patch	Mon Mar 02 14:34:54 2015 +0000
@@ -0,0 +1,20 @@
+--- a/sysdeps/unix/sysv/linux/configure.in	2004-07-06 13:11:40.000000000 +0900
++++ b/sysdeps/unix/sysv/linux/configure.in	2015-01-31 16:09:20.614292300 +0900
+@@ -80,7 +80,6 @@
+     libc_cv_gcc_unwind_find_fde=yes
+     ;;
+   powerpc/powerpc32)
+-    libc_cv_gcc_unwind_find_fde=yes
+     arch_minimum_kernel=2.0.10
+     ;;
+   powerpc/powerpc64)
+--- a/sysdeps/unix/sysv/linux/configure	2004-07-06 13:13:42.000000000 +0900
++++ b/sysdeps/unix/sysv/linux/configure	2015-01-31 16:08:47.004884100 +0900
+@@ -120,7 +120,6 @@
+     libc_cv_gcc_unwind_find_fde=yes
+     ;;
+   powerpc/powerpc32)
+-    libc_cv_gcc_unwind_find_fde=yes
+     arch_minimum_kernel=2.0.10
+     ;;
+   powerpc/powerpc64)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/glibc-2.3-sysdeps-general-initfini.patch	Mon Mar 02 14:34:54 2015 +0000
@@ -0,0 +1,24 @@
+X-Git-Url: http://sourceware.org/git/?p=glibc.git;a=blobdiff_plain;f=sysdeps%2Fgeneric%2Finitfini.c;h=d5ef778367f567bd4814ac956794ddc17095f141;hp=2b8412a42815c15dc2b27999ccb11f7008a3b556;hb=c4243ff43f097b4ac4cd1b81c59a5bbb33558194;hpb=b26e274db237c8e8f076ac80e2aa3afc51028f1e
+
+diff --git a/sysdeps/generic/initfini.c b/sysdeps/generic/initfini.c
+index 2b8412a..d5ef778 100644
+--- a/sysdeps/generic/initfini.c
++++ b/sysdeps/generic/initfini.c
+@@ -81,7 +81,7 @@ call_gmon_start(void)
+ }
+ 
+ SECTION (".init");
+-extern void _init (void);
++extern void __attribute__ ((section (".init"))) _init (void);
+ void
+ _init (void)
+ {
+@@ -107,7 +107,7 @@ asm ("\n/*@_init_EPILOG_ENDS*/");
+ asm ("\n/*@_fini_PROLOG_BEGINS*/");
+ 
+ SECTION (".fini");
+-extern void _fini (void);
++extern void __attribute__ ((section (".fini"))) _fini (void);
+ void
+ _fini (void)
+ {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/glibc-2.3-sysdeps-i386-Makefile.patch	Mon Mar 02 14:34:54 2015 +0000
@@ -0,0 +1,15 @@
+Fix linux-x86::glibc-core (glibc-2.3) build by gcc-4.8.2
+
+suppress warning
+
+--- glibc-core-2.3/sysdeps/i386/Makefile.org	2014-10-25 20:09:47.046611800 +0900
++++ glibc-core-2.3/sysdeps/i386/Makefile	2014-10-25 20:10:27.670611800 +0900
+@@ -8,7 +8,7 @@
+ ifeq ($(subdir),csu)
+ # On i686 we must avoid generating the trampoline functions generated
+ # to get the GOT pointer.
+-CFLAGS-initfini.s += -march=i386 -mcpu=i386
++CFLAGS-initfini.s += -march=i386 -mtune=i386
+ endif
+ 
+ ifeq ($(subdir),gmon)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/nsis-2.46-InstallOptions.patch	Mon Mar 02 14:34:54 2015 +0000
@@ -0,0 +1,14 @@
+--- a/Contrib/InstallOptions/InstallerOptions.cpp	2014-12-28 01:11:11.671260400 +0900
++++ b/Contrib/InstallOptions/InstallerOptions.cpp	2014-12-28 01:13:29.411260400 +0900
+@@ -16,6 +16,11 @@
+ 
+ #include <nsis/pluginapi.h> // nsis plugin
+ 
++// for mingw-w64 headers
++#ifndef min
++#define min(a, b) (((a) < (b)) ? (a) : (b))
++#endif
++
+ // Use for functions only called from one place to possibly reduce some code
+ // size.  Allows the source code to remain readable by leaving the function
+ // intact.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/nsis-2.46-crossmingw.patch	Mon Mar 02 14:34:54 2015 +0000
@@ -0,0 +1,40 @@
+--- a/SCons/Tools/crossmingw.py	2009-01-11 18:48:07.000000000 +0900
++++ b/SCons/Tools/crossmingw.py	2014-12-29 09:26:50.204202000 +0900
+@@ -149,7 +149,7 @@
+     env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS -shared')
+     env['SHLINKCOM']   = shlib_action
+     env.Append(SHLIBEMITTER = [shlib_emitter])
+-    env['LINK'] = mingw_prefix + 'g++'
++    env['LINK'] = mingw_prefix + 'g++ -static'
+     env['AS'] = mingw_prefix + 'as'
+     env['AR'] = mingw_prefix + 'ar'
+     env['RANLIB'] = mingw_prefix + 'ranlib'
+--- a/SCons/Config/gnu	2009-02-05 09:52:28.000000000 +0900
++++ b/SCons/Config/gnu	2014-11-16 21:13:24.803686400 +0900
+@@ -19,12 +19,12 @@
+ 		x = '_WinMain@16'
+ 	elif x == 'DllMain':
+ 		x = '_DllMain@12'
+-	return '-Wl,-e%s' % x
++	return ''
+ 
+ defenv['ENTRY_FLAG'] = entry
+ defenv['MAP_FLAG'] = '-Wl,-Map,${TARGET.base}.map'
+ defenv['EXCEPTION_FLAG'] = ''
+-defenv['NODEFLIBS_FLAG'] = '-nostdlib -Wl,--exclude-libs,msvcrt.a'
++defenv['NODEFLIBS_FLAG'] = ''
+ defenv['C_FLAG'] = '-xc'
+ defenv['CPP_FLAG'] = '-xc++'
+ defenv['ALIGN_FLAG'] = '-Wl,--file-alignment,512'
+@@ -77,9 +77,9 @@
+ if not defenv['DEBUG'] and defenv['STRIP'] and defenv['STRIP_W32']:
+ 	stub_env.Append(LINKFLAGS = ['-s'])               # strip
+ stub_env.Append(LINKFLAGS = ['-mwindows'])          # build windows executables
+-stub_env.Append(LINKFLAGS = ['$NODEFLIBS_FLAG'])    # no standard libraries
++#stub_env.Append(LINKFLAGS = ['$NODEFLIBS_FLAG'])    # no standard libraries
+ stub_env.Append(LINKFLAGS = ['$ALIGN_FLAG'])        # 512 bytes align
+-stub_env.Append(LINKFLAGS = ['-Wl,-e,_WinMain@16']) # entry point
++#stub_env.Append(LINKFLAGS = ['-Wl,-e,_WinMain@16']) # entry point
+ stub_env.Append(LINKFLAGS = ['$MAP_FLAG'])          # generate map file
+ 
+ ### makensis environment
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/nsis-2.46-linker_script-default.patch	Mon Mar 02 14:34:54 2015 +0000
@@ -0,0 +1,286 @@
+The deafult linker script is acquirable by the following command.
+
+i686-mingw32-ld --verbose
+
+--- a/SCons/Config/linker_script	2005-08-06 00:27:58.000000000 +0900
++++ b/SCons/Config/linker_script	2014-11-16 15:15:01.302783500 +0900
+@@ -1,57 +1,63 @@
++/* Default linker script, for normal executables */
+ OUTPUT_FORMAT(pei-i386)
++SEARCH_DIR("=/usr/local/lib"); SEARCH_DIR("=/lib"); SEARCH_DIR("=/usr/lib");
+ SECTIONS
+ {
+-  .text  __image_base__ + __section_alignment__  :
++  /* Make the virtual address and file offset synced if the alignment is
++     lower than the target page size. */
++  . = SIZEOF_HEADERS;
++  . = ALIGN(__section_alignment__);
++  .text  __image_base__ + ( __section_alignment__ < 0x1000 ? . : __section_alignment__ ) :
+   {
+      *(.init)
+     *(.text)
+     *(SORT(.text$*))
++     *(.text.*)
++     *(.gnu.linkonce.t.*)
+     *(.glue_7t)
+     *(.glue_7)
+-   	___CTOR_LIST__ = .; __CTOR_LIST__ = . ;
+-			LONG (-1);
+-			*(EXCLUDE_FILE (*crtend.o) .ctors);
+-			*(.ctor);
+-			*(SORT(.ctors.*));
+-			*crtend.o (.ctors);
+-			LONG (0);
+-    	___DTOR_LIST__ = .; __DTOR_LIST__ = . ;
+-			LONG (-1);
+-			*(EXCLUDE_FILE (*crtend.o) .dtors);
+-			*(.dtor);
+-			*(SORT(.dtors.*));
+-			*crtend.o (.dtors);
+-			LONG (0);
++     ___CTOR_LIST__ = .; __CTOR_LIST__ = . ;
++			LONG (-1);*(.ctors); *(.ctor); *(SORT(.ctors.*));  LONG (0);
++     ___DTOR_LIST__ = .; __DTOR_LIST__ = . ;
++			LONG (-1); *(.dtors); *(.dtor); *(SORT(.dtors.*));  LONG (0);
+      *(.fini)
+     /* ??? Why is .gcc_exc here?  */
+      *(.gcc_exc)
+     PROVIDE (etext = .);
+-    *(.gcc_except_table)
++    PROVIDE (_etext = .);
++     *(.gcc_except_table)
+   }
+   /* The Cygwin32 library uses a section to avoid copying certain data
+      on fork.  This used to be named ".data".  The linker used
+      to include this between __data_start__ and __data_end__, but that
+      breaks building the cygwin32 dll.  Instead, we name the section
+-     ".data_cygwin_nocopy" and explictly include it after __data_end__. */
++     ".data_cygwin_nocopy" and explicitly include it after __data_end__. */
+   .data BLOCK(__section_alignment__) :
+   {
+     __data_start__ = . ;
+     *(.data)
+     *(.data2)
+     *(SORT(.data$*))
++    *(.jcr)
+     __data_end__ = . ;
+     *(.data_cygwin_nocopy)
+   }
+   .rdata BLOCK(__section_alignment__) :
+   {
+     *(.rdata)
+-    *(SORT(.rdata$*))
+-    *(.eh_frame)
+-    ___RUNTIME_PSEUDO_RELOC_LIST__ = .;
+-    __RUNTIME_PSEUDO_RELOC_LIST__ = .;
++             *(SORT(.rdata$*))
++    __rt_psrelocs_start = .;
+     *(.rdata_runtime_pseudo_reloc)
+-    ___RUNTIME_PSEUDO_RELOC_LIST_END__ = .;
+-    __RUNTIME_PSEUDO_RELOC_LIST_END__ = .;
++    __rt_psrelocs_end = .;
++  }
++  __rt_psrelocs_size = __rt_psrelocs_end - __rt_psrelocs_start;
++  ___RUNTIME_PSEUDO_RELOC_LIST_END__ = .;
++  __RUNTIME_PSEUDO_RELOC_LIST_END__ = .;
++  ___RUNTIME_PSEUDO_RELOC_LIST__ = . - __rt_psrelocs_size;
++  __RUNTIME_PSEUDO_RELOC_LIST__ = . - __rt_psrelocs_size;
++  .eh_frame BLOCK(__section_alignment__) :
++  {
++    *(.eh_frame*)
+   }
+   .pdata BLOCK(__section_alignment__) :
+   {
+@@ -74,6 +80,8 @@
+     *(.debug$T)
+     *(.debug$F)
+     *(.drectve)
++     *(.note.GNU-stack)
++     *(.gnu.lto_*)
+   }
+   .idata BLOCK(__section_alignment__) :
+   {
+@@ -84,7 +92,9 @@
+     /* These zeroes mark the end of the import list.  */
+     LONG (0); LONG (0); LONG (0); LONG (0); LONG (0);
+     SORT(*)(.idata$4)
++    __IAT_start__ = .;
+     SORT(*)(.idata$5)
++    __IAT_end__ = .;
+     SORT(*)(.idata$6)
+     SORT(*)(.idata$7)
+   }
+@@ -106,12 +116,18 @@
+     *(SORT(.CRT$XT*))  /* Termination */
+     ___crt_xt_end__ = . ;
+   }
++  /* Windows TLS expects .tls$AAA to be at the start and .tls$ZZZ to be
++     at the end of section.  This is important because _tls_start MUST
++     be at the beginning of the section to enable SECREL32 relocations with TLS
++     data.  */
+   .tls BLOCK(__section_alignment__) :
+   {
+     ___tls_start__ = . ;
++    *(.tls$AAA)
+     *(.tls)
+     *(.tls$)
+     *(SORT(.tls$*))
++    *(.tls$ZZZ)
+     ___tls_end__ = . ;
+   }
+   .endjunk BLOCK(__section_alignment__) :
+@@ -121,10 +137,6 @@
+     PROVIDE ( _end = .);
+      __end__ = .;
+   }
+-  .ndata BLOCK(__section_alignment__) :
+-  {
+-    *(.ndata)
+-  }
+   .rsrc BLOCK(__section_alignment__) :
+   {
+     *(.rsrc)
+@@ -151,60 +163,141 @@
+   {
+     *(.debug_aranges)
+   }
++  .zdebug_aranges BLOCK(__section_alignment__) (NOLOAD) :
++  {
++    *(.zdebug_aranges)
++  }
+   .debug_pubnames BLOCK(__section_alignment__) (NOLOAD) :
+   {
+     *(.debug_pubnames)
+   }
++  .zdebug_pubnames BLOCK(__section_alignment__) (NOLOAD) :
++  {
++    *(.zdebug_pubnames)
++  }
++  .debug_pubtypes BLOCK(__section_alignment__) (NOLOAD) :
++  {
++    *(.debug_pubtypes)
++  }
++  .zdebug_pubtypes BLOCK(__section_alignment__) (NOLOAD) :
++  {
++    *(.zdebug_pubtypes)
++  }
+   /* DWARF 2.  */
+   .debug_info BLOCK(__section_alignment__) (NOLOAD) :
+   {
+-    *(.debug_info) *(.gnu.linkonce.wi.*)
++    *(.debug_info .gnu.linkonce.wi.*)
++  }
++  .zdebug_info BLOCK(__section_alignment__) (NOLOAD) :
++  {
++    *(.zdebug_info .zdebug.gnu.linkonce.wi.*)
+   }
+   .debug_abbrev BLOCK(__section_alignment__) (NOLOAD) :
+   {
+     *(.debug_abbrev)
+   }
++  .zdebug_abbrev BLOCK(__section_alignment__) (NOLOAD) :
++  {
++    *(.zdebug_abbrev)
++  }
+   .debug_line BLOCK(__section_alignment__) (NOLOAD) :
+   {
+     *(.debug_line)
+   }
++  .zdebug_line BLOCK(__section_alignment__) (NOLOAD) :
++  {
++    *(.zdebug_line)
++  }
+   .debug_frame BLOCK(__section_alignment__) (NOLOAD) :
+   {
+-    *(.debug_frame)
++    *(.debug_frame*)
++  }
++  .zdebug_frame BLOCK(__section_alignment__) (NOLOAD) :
++  {
++    *(.zdebug_frame*)
+   }
+   .debug_str BLOCK(__section_alignment__) (NOLOAD) :
+   {
+     *(.debug_str)
+   }
++  .zdebug_str BLOCK(__section_alignment__) (NOLOAD) :
++  {
++    *(.zdebug_str)
++  }
+   .debug_loc BLOCK(__section_alignment__) (NOLOAD) :
+   {
+     *(.debug_loc)
+   }
++  .zdebug_loc BLOCK(__section_alignment__) (NOLOAD) :
++  {
++    *(.zdebug_loc)
++  }
+   .debug_macinfo BLOCK(__section_alignment__) (NOLOAD) :
+   {
+     *(.debug_macinfo)
+   }
++  .zdebug_macinfo BLOCK(__section_alignment__) (NOLOAD) :
++  {
++    *(.zdebug_macinfo)
++  }
+   /* SGI/MIPS DWARF 2 extensions.  */
+   .debug_weaknames BLOCK(__section_alignment__) (NOLOAD) :
+   {
+     *(.debug_weaknames)
+   }
++  .zdebug_weaknames BLOCK(__section_alignment__) (NOLOAD) :
++  {
++    *(.zdebug_weaknames)
++  }
+   .debug_funcnames BLOCK(__section_alignment__) (NOLOAD) :
+   {
+     *(.debug_funcnames)
+   }
++  .zdebug_funcnames BLOCK(__section_alignment__) (NOLOAD) :
++  {
++    *(.zdebug_funcnames)
++  }
+   .debug_typenames BLOCK(__section_alignment__) (NOLOAD) :
+   {
+     *(.debug_typenames)
+   }
++  .zdebug_typenames BLOCK(__section_alignment__) (NOLOAD) :
++  {
++    *(.zdebug_typenames)
++  }
+   .debug_varnames BLOCK(__section_alignment__) (NOLOAD) :
+   {
+     *(.debug_varnames)
+   }
++  .zdebug_varnames BLOCK(__section_alignment__) (NOLOAD) :
++  {
++    *(.zdebug_varnames)
++  }
++  .debug_macro BLOCK(__section_alignment__) (NOLOAD) :
++  {
++    *(.debug_macro)
++  }
++  .zdebug_macro BLOCK(__section_alignment__) (NOLOAD) :
++  {
++    *(.zdebug_macro)
++  }
+   /* DWARF 3.  */
+   .debug_ranges BLOCK(__section_alignment__) (NOLOAD) :
+   {
+     *(.debug_ranges)
+   }
++  .zdebug_ranges BLOCK(__section_alignment__) (NOLOAD) :
++  {
++    *(.zdebug_ranges)
++  }
++  /* DWARF 4.  */
++  .debug_types BLOCK(__section_alignment__) (NOLOAD) :
++  {
++    *(.debug_types .gnu.linkonce.wt.*)
++  }
++  .zdebug_types BLOCK(__section_alignment__) (NOLOAD) :
++  {
++    *(.zdebug_types .gnu.linkonce.wt.*)
++  }
+ }
+ 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/nsis-2.46-linker_script-ndata.patch	Mon Mar 02 14:34:54 2015 +0000
@@ -0,0 +1,15 @@
+.ndata section is added to the default linker script.
+
+--- a/SCons/Config/linker_script	2014-11-16 15:15:01.302783500 +0900
++++ b/SCons/Config/linker_script	2014-11-16 20:57:45.209797100 +0900
+@@ -137,6 +137,10 @@
+     PROVIDE ( _end = .);
+      __end__ = .;
+   }
++  .ndata BLOCK(__section_alignment__) :
++  {
++    *(.ndata)
++  }
+   .rsrc BLOCK(__section_alignment__) :
+   {
+     *(.rsrc)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/nsis-2.46-util.patch	Mon Mar 02 14:34:54 2015 +0000
@@ -0,0 +1,10 @@
+--- a/Source/util.h	2009-03-28 18:47:26.000000000 +0900
++++ b/Source/util.h	2014-11-16 01:08:19.464124600 +0900
+@@ -27,6 +27,7 @@
+ #  include <stdio.h>
+ #endif
+ 
++#include<unistd.h>
+ 
+ // these are the standard pause-before-quit shit.
+ extern int g_dopause;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/texinfo-4.13a-fix-bashism.patch	Mon Mar 02 14:34:54 2015 +0000
@@ -0,0 +1,19 @@
+http://svn.savannah.gnu.org/viewvc?view=rev&root=texinfo&revision=3868
+
+--- a/util/texi2dvi	2008-09-19 03:46:01.000000000 +0900
++++ b/util/texi2dvi	2015-02-22 00:27:36.042918200 +0900
+@@ -129,11 +129,13 @@
+   }
+   test_local
+   test $foo = bar
+-) || local () {
++) || eval '
++local () {
+   case $1 in
+     *=*) eval "$1";;
+   esac
+ }
++'
+ 
+ 
+ # cd_orig
--- a/sourcefiles/lilypond-sharhead.sh	Tue Oct 21 12:37:18 2014 +0100
+++ b/sourcefiles/lilypond-sharhead.sh	Mon Mar 02 14:34:54 2015 +0000
@@ -77,7 +77,7 @@
 Press C to install the program anyway (not recommended),
 E to only extract the program files, or any other key to exit.
 EOF
-    read -sn1 input
+    read -sn1 input 2> /dev/null || read input
     case "$input" in
 	C)
 	  echo "Ignoring architecture incompatibility."