view gub/specs/coreutils.py @ 6487:9bf9726dad38

schikkers-list: install updates.
author Jan Nieuwenhuizen <janneke@gnu.org>
date Thu, 03 Feb 2011 23:57:59 +0100
parents 73f6558ffdda
children
line wrap: on
line source

import os
#
from gub import misc
from gub import tools

'''
Build shared libcoreutils.so without using libtool
for GUB's librestrict(2) to kick-in.
'''

no_patch = True # let's not use patch in a bootstrap package
class Coreutils__tools (tools.AutoBuild):
#    source = 'http://ftp.gnu.org/pub/gnu/coreutils/coreutils-6.12.tar.gz'
    source = 'http://ftp.gnu.org/pub/gnu/coreutils/coreutils-7.4.tar.gz'
    patches = ['coreutils-6.12-shared-automake.patch']
    dependencies = ['tools::autoconf', 'tools::automake']
    force_autoupdate = True
    if no_patch:
        patches = []
        dependencies = []
        force_autoupdate = False
    def patch (self):
        if no_patch:
            self.file_sub ([('noinst_LIBRARIES', 'lib_LIBRARIES')],
                           '%(srcdir)s/lib/gnulib.mk')
            self.file_sub ([
                    (r'libcoreutils[.]a', 'libcoreutils.so'),
                    ('[.][.]/lib/libcoreutils.so ([$][(]LIBINTL[)]) [.][.]/lib/libcoreutils.so', r'-L../lib -lcoreutils \1'),
                    ], '%(srcdir)s/src/Makefile.in')
        else:
            tools.AutoBuild.patch (self)
    def autoupdate (self):
        if no_patch:
            return
        self.system ('''
cd %(srcdir)s && autoreconf
''')
    configure_variables = (tools.AutoBuild.configure_variables
                           + ' CFLAGS=-fPIC')
    make_flags = misc.join_lines ('''
V=1
LDFLAGS='%(rpath)s'
LIBS='$(cp_LDADD) $(ls_LDADD) -lm'
RANLIB='mvaso () { test $$(basename $$1) == libcoreutils.a && mv $$1 $$(dirname $$1)/$$(basename $$1 .a).so || : ; }; mvaso '
libcoreutils_a_AR='gcc -shared -o'
''')
    def install (self):
        # The RANLIB/mvaso trick needs libcoreutils.a to exist at install time.
        self.system ('cd %(builddir)s/lib && ln -f libcoreutils.so libcoreutils.a')
        tools.AutoBuild.install (self)
        self.system ('cd %(builddir)s/lib && rm -f libcoreutils.a')
        if no_patch:
            self.system ('mkdir -p %(install_prefix)s/lib')
            self.system ('cp -pv %(builddir)s/lib/libcoreutils* %(install_prefix)s/lib')