Exemple #1
0
def change_target_package(package):
    def update_libtool(self):
        package.map_locate(libtool_fix_allow_undefined, '%(builddir)s',
                           'libtool')
        package.map_locate(libtool_disable_relink, '%(builddir)s', 'libtool')

    package.update_libtool = misc.MethodOverrider(package.update_libtool,
                                                  update_libtool)

    def install(whatsthis):
        package.post_install_smurf_exe()

    package.install = misc.MethodOverrider(package.install, install)

    @context.subst_method
    def so_extension(foo):
        return '.dll'

    package.so_extension = misc.MethodOverrider(package.nop, so_extension)

    # FIXME (cygwin): [why] do cross packages get here too?
    if isinstance(package, cross.AutoBuild):
        return

    build.change_dict(
        package,
        {
            'DLLTOOL':
            '%(toolchain_prefix)sdlltool',
            'DLLWRAP':
            '%(toolchain_prefix)sdllwrap',
            # note: this was cygwin only: ...
            'LDFLAGS':
            '-L%(system_prefix)s/lib -L%(system_prefix)s/bin -L%(system_prefix)s/lib/w32api',
        })
Exemple #2
0
def change_target_package(package):
    from gub import misc
    from gub import cross
    from gub import build
    cross.change_target_package(package)
    package.get_build_dependencies = misc.MethodOverrider(
        package.get_build_dependencies, strip_build_dep,
        (['zlib', 'zlib-devel'], ))
    package.get_dependency_dict = misc.MethodOverrider(
        package.get_dependency_dict, strip_dependency_dict,
        (['zlib', 'zlib-devel'], ))

    @context.subst_method
    def rpath(foo):
        return ''

    if not isinstance(package, cross.AutoBuild):
        package.rpath = misc.MethodOverrider(package.nop, rpath)

    @context.subst_method
    def so_extension(foo):
        return '.dylib'

    package.so_extension = misc.MethodOverrider(package.nop, so_extension)

    def autoupdate(foo):
        # somehow retriggers autoconf?!?
        # for i in ['configure.ac', 'configure']:
        for i in ['configure']:
            package.file_sub([
                ('-fpascal-strings ', ''),
                ('-I(/Developer/Headers/FlatCarbon)', r'-I%(system_root)s\1'),
            ], '%(srcdir)s/' + i)

    package.autoupdate = misc.MethodOverrider(package.autoupdate, autoupdate)

    build.change_dict(
        package,
        {

            ## We get a lot of /usr/lib/ -> @executable_path/../lib/
            ## we need enough space in the header to do these relocs.
            'LDFLAGS': '-Wl,-headerpad_max_install_names ',

            ## UGH: gettext fix for ptrdiff_t
            'CPPFLAGS': '-DSTDC_HEADERS',
        })
Exemple #3
0
def change_target_package(package):
    cross.change_target_package(package)

    @context.subst_method
    def rpath(foo):
        return ''

    if not isinstance(package, cross.AutoBuild):
        package.rpath = misc.MethodOverrider(package.nop, rpath)
Exemple #4
0
def change_target_package_x86(package, env={'PATH': os.environ['PATH']}):

    x86_dir = package.settings.alltargetdir + '/linux-x86'
    x86_cross = (x86_dir + package.settings.root_dir +
                 package.settings.prefix_dir + 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++'
    # FIXME: should only remove any %(tools_prefix)s elements from these...
    env['C_INCLUDE_PATH'] = ''
    env['CPLUS_INCLUDE_PATH'] = ''
    env['LIBRARY_PATH'] = ''
    env['LIBRESTRICT_ALLOW'] = package.settings.targetdir
    env['PATH'] = x86_cross_bin + ':' + env['PATH']

    def build_environment(e):
        return env

    def patch(foo):
        package.func(setup_linux_x86, package.__class__.__name__, x86_cross)

    # FIXME: we could also add [, build_environment ()] by default
    # to build.py's compile [and install?] functions
    def configure(foo):
        package.system('mkdir -p %(builddir)s')
        package.system('cd %(builddir)s && %(configure_command)s', env)

    def compile(foo):
        package.system('cd %(builddir)s && %(compile_command)s', env)

    package.build_environment \
        = misc.MethodOverrider (package.nop, build_environment)
    package.patch \
        = misc.MethodOverrider (package.patch, patch)
    package.configure \
            = misc.MethodOverrider (package.nop, configure)
    package.compile \
        = misc.MethodOverrider (package.nop, compile)
Exemple #5
0
    def package_fixups(self, package):
        if package.name() == 'libqt4-dev':

            def untar(whatsthis):
                build.BinaryBuild.untar(package)
                for i in ('QtCore.pc', 'QtGui.pc', 'QtNetwork.pc'):
                    package.file_sub([
                        ('includedir', 'deepqtincludedir'),
                        ('(-I|-L) */usr',
                         '''\\1%(system_prefix)s''' % locals()),
                    ],
                                     '%(srcdir)s/usr/lib/pkgconfig/%(i)s',
                                     env=locals())

            package.untar = misc.MethodOverrider(package.untar, untar)
Exemple #6
0
def package_auto_dependency_dict(package):
    '''Generate get_build_dependencies () and get_dependency_dict ({'':})
    from _get_build_dependencies ().
    
    For most packages, this either removes the need of having both,
    or adds the dict where it was missing.
    '''
    if (not package.get_dependency_dict().get('', None)
            and not package.get_dependency_dict().get('devel', None)):

        def get_build_dependencies(foo):
            # If a package depends on tools::libtool, ie not on
            # libltdl, we still also need <target-arch>::libtool,
            # because of our update_libtool ().  We fix this here,
            # because it's not a package's real dependency but rather
            # a detail of our libtool breakage fixup.
            if (not 'cross/' in package.name()
                    and not 'system::' in package.platform_name()):
                package.dependencies = [
                    name.replace('tools::libtool', 'libtool')
                    for name in package.dependencies
                ]
            if (package.name() in tools_archmatch):
                # on linux-x86, refuse to build linux-x64::guile
                if (package.settings.target_bits == '64'
                        and package.settings.build_bits == '32'):
                    raise Exception('cannot build %s for 64 bits' +
                                    package.platform_name())
                # on linux-64, build linux-x86::guile with tools32::guile
                if (package.settings.target_bits == '32'
                        and package.settings.build_bits == '64'):
                    package.dependencies = [
                        (misc.strip_platform(name) in libs_archmatch
                         and 'system::' not in name and
                         ('cross/' not in name or 'runtime' in name))
                        and name.replace('tools::', 'tools32::') or name
                        for name in package.dependencies
                    ]
            # only keep tools32:: for libraries linked against,
            # do not build tools32::autotools etc
            if (package.settings.target_bits == '32'
                    and package.settings.build_bits == '64'):
                package.dependencies = [
                    (misc.strip_platform(name) not in libs_archmatch
                     and misc.strip_name(name, package.platform()) == 'tools32'
                     and 'system::' not in name and
                     ('cross/' not in name or 'runtime' in name))
                    and 'tools::' + misc.strip_platform(name) or name
                    for name in package.dependencies
                ]
            return package.dependencies
        package.get_build_dependencies \
                = misc.MethodOverrider (package.nop, get_build_dependencies)

        def get_dependency_dict(foo):
            d = {
                '': [
                    x.replace('-devel', '') for x in package.dependencies
                    if ('system::' not in x and 'tools::' not in x
                        and 'tools32::' not in x and (
                            'cross/' not in x or 'runtime' in x))
                ]
            }
            if 'runtime' in package.subpackage_names:
                d[''] += [package.name() + '-runtime']
            if package.platform_name() not in ['system', 'tools']:
                d['devel'] = ([
                    x for x in package.dependencies if
                    ('system::' not in x and 'tools::' not in x and 'tools32::'
                     not in x and ('cross/' not in x or 'runtime' in x))
                ] + [package.name()])
            return d
        package.get_dependency_dict \
                = misc.MethodOverrider (package.nop, get_dependency_dict)
Exemple #7
0
def set_cross_dependencies(package_object_dict):
    packs = list(package_object_dict.values())

    cross_packs = [p for p in packs if isinstance(p, AutoBuild)]
    sdk_packs = [p for p in packs if isinstance(p, build.SdkBuild)]
    tools_packs = [p for p in packs if isinstance(p, tools.AutoBuild)]
    other_packs = [
        p for p in packs
        if (not isinstance(p, AutoBuild) and not isinstance(p, build.SdkBuild)
            and not isinstance(p, build.BinaryBuild)
            and not isinstance(p, tools.AutoBuild)
            and not p.platform_name() in bootstrap_names)
    ]

    pack_names = [p.platform_name() for p in packs]
    extra_cross_names = []
    sets = dict()
    for p in packs:
        sets[p.settings.platform] = p.settings
    for p in list(sets.keys()):
        extra_cross_names += [
            n for n in get_build_dependencies(sets[p]) if n not in pack_names
        ]

    # Run something like lilypond/SConscript's configure
    # to figure-out if we need a new, Git, Make, Patch, Python, etc?
    # Building make & patch is cheap and dependable.
    bazaar_packs = [
        p for p in packs if isinstance(p.source, repository.Bazaar)
    ]
    cvs_packs = [p for p in packs if isinstance(p.source, repository.CVS)]
    git_packs = [p for p in packs if isinstance(p.source, repository.Git)]
    patch_packs = [p for p in packs if p.patches]
    perl_packs = [
        p for p in packs
        if (isinstance(p, tools.CpanBuild) or isinstance(p, target.CpanBuild))
    ]
    python_packs = [
        p for p in packs if (isinstance(p, tools.PythonBuild)
                             or isinstance(p, target.PythonBuild))
    ]
    scons_packs = [
        p for p in packs if (isinstance(p, tools.SConsBuild)
                             or isinstance(p, target.SConsBuild))
    ]

    subversion_packs = [
        p for p in packs if isinstance(p.source, repository.Subversion)
    ]
    tar_packs = [
        p for p in packs
        if (isinstance(p.source, repository.TarBall)
            and p.platform_name() not in (bootstrap_names + ['tools::tar']))
    ]
    bzip2_packs = [p for p in tar_packs if p.source.source.endswith('bz2')]

    sdk_names = [s.platform_name() for s in sdk_packs]
    cross_names = [s.platform_name() for s in cross_packs]

    # No implicit dependencies on other platform's cross_names or sdk_names
    # try:
    # bin/gub -p tools linux-x86::cross/gcc mingw::cross/gcc
    # bin/gub -p tools linux-x86::cross/gcc
    def update_packs(packs=[], add=[]):
        for p in packs:
            if not misc.list_in(add, p.get_platform_build_dependencies()):
                old_callback = p.get_build_dependencies
                p.get_build_dependencies = misc.MethodOverrider(
                    old_callback, lambda x, y: x + y, (add, ))


# OOPS
#    update_packs (other_packs,
#                  [n for n in cross_names if p.settings.platform in n])
#    update_packs (other_packs + cross_packs,
#                  [n for n in sdk_names if p.settings.platform in n])
#    update_packs (other_packs + cross_packs + tools_packs, bootstrap_names)

    for p in other_packs:
        add = [n for n in cross_names if p.settings.platform in n]
        if not misc.list_in(add, p.get_platform_build_dependencies()):
            old_callback = p.get_build_dependencies
            p.get_build_dependencies = misc.MethodOverrider(
                old_callback, lambda x, y: x + y, (add, ))
    for p in other_packs + cross_packs:
        add = [n for n in sdk_names if p.settings.platform in n]
        if not misc.list_in(add, p.get_platform_build_dependencies()):
            old_callback = p.get_build_dependencies
            p.get_build_dependencies = misc.MethodOverrider(
                old_callback, lambda x, y: x + y, (add, ))
    for p in other_packs + cross_packs + tools_packs:
        add = bootstrap_names
        if (p.platform_name() not in bootstrap_names and
                not misc.list_in(add, p.get_platform_build_dependencies())):
            old_callback = p.get_build_dependencies
            p.get_build_dependencies = misc.MethodOverrider(
                old_callback, lambda x, y: x + y, (add, ))

    extra_names = []
    rsync_packs = bazaar_packs or cvs_packs or subversion_packs
    for packs, names in (
        (bzip2_packs, ['tools::bzip2']),
        (git_packs, ['tools::git']),
        (patch_packs, ['tools::patch']),
        (perl_packs, ['tools::perl']),
        (rsync_packs, ['tools::rsync']),
        (scons_packs, ['tools::scons']),
        (subversion_packs, ['tools::subversion']),
        (tar_packs, ['tools::tar']),
    ):
        if packs:
            extra_names += names
            update_packs(packs, names)

    if python_packs or scons_packs:
        extra_names += ['tools::python']
        update_packs(python_packs, ['tools::python'])

    return extra_cross_names + extra_names
Exemple #8
0
 def update_packs(packs=[], add=[]):
     for p in packs:
         if not misc.list_in(add, p.get_platform_build_dependencies()):
             old_callback = p.get_build_dependencies
             p.get_build_dependencies = misc.MethodOverrider(
                 old_callback, lambda x, y: x + y, (add, ))
Exemple #9
0
def change_target_package(package):
    cross.change_target_package(package)
    w32.change_target_package(package)

    # Hmm, why not in mingw? -> w32.py?
    @context.subst_method
    def rpath(foo):
        return ''

    package.rpath = misc.MethodOverrider(package.nop, rpath)

    package.get_build_dependencies \
            = misc.MethodOverrider (package.get_build_dependencies,
                                    lambda d, extra: d + extra, (['cygwin'],))

    def cyg_defs(d):
        k = 'runtime'
        if k not in d:
            k = ''
        d[k].append('/usr/bin/cyg*dll')
        d[k].append('/etc/postinstall')
        return d

    package.get_subpackage_definitions \
        = misc.MethodOverrider (package.get_subpackage_definitions, cyg_defs)

    package.configure_command = (package.configure_command.replace(
        '--disable-static', '--enable-static'))

    def install(whatsthis):
        package.install_readmes()

    package.install = misc.MethodOverrider(package.install, install)

    def category_dict(d):
        default = {
            '': 'Utils',
            'devel': 'Devel',
            'doc': 'Doc',
            'runtime': 'Libs',
            'x11': 'X11',
        }
        full = default.copy()
        full.update(d)
        for i in package.subpackage_names:
            if not full.get(i):
                full[i] = full['']
        return full

    package.category_dict = misc.MethodOverrider(package.category_dict,
                                                 category_dict)

    def description_dict(d):
        # FIXME: fairly uninformative description for packages,
        # unlike, eg, guile-devel.  This is easier, though.
        def get_subpackage_doc(split):
            flavor = package.category_dict()[split]
            doc = package.__class__.__doc__
            if not doc:
                doc = misc.get_from_parents(package.__class__, '__doc__')
            if not doc:
                doc = '\n'
            return (doc.replace('\n', ' - %(flavor)s\n', 1) % locals())

        for i in package.subpackage_names:
            if not d.get(i):
                d[i] = get_subpackage_doc(i)
        return d

    package.description_dict = misc.MethodOverrider(package.description_dict,
                                                    description_dict)