Skip to content
Snippets Groups Projects
package.py 2.17 KiB
Newer Older
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
import os

class Oppulance(Package):
    """SDK for embedded processors on BrainScaleS-2"""

    homepage = "https://github.com/electronicvisions/oppulance"

    # PPU compiler dependencies
    depends_on('gettext')
    depends_on('zlib')
    depends_on('bison')
    depends_on('flex@2.6.4:')
    depends_on('m4')
    depends_on('texinfo')
    depends_on('wget')

    releases = [
        {
            'version': '2.0-rc5',
            'tag': 'ebrains-2.0-rc5'
        },
    ]

    for release in releases:
        version(
            release['version'],
            git='https://github.com/electronicvisions/oppulance',
            tag=release['tag'],
            expand=False,
        )

        for res in ['binutils-gdb', 'gcc', 'newlib']:
            resource(
                name=res,
                git='https://github.com/electronicvisions/{}'.format(res),
                tag=release['tag'],
                expand=False,
Eric Müller's avatar
Eric Müller committed
                placement=res
            )

    def do_fetch(self, mirror_only=False):
        super(Oppulance, self).do_fetch(mirror_only)
        mkdirp(self.stage.source_path)
        tar = which('tar')
Eric Müller's avatar
Eric Müller committed
        ln = which('ln')
        bash = which('bash')
        with working_dir(self.stage.source_path):
            for key in self.resources:
                for res in self.resources[key]:
Eric Müller's avatar
Eric Müller committed
                    if res.fetcher.stage.archive_file:
                        tar('xf', res.fetcher.stage.archive_file)
                    else:
                        # freshly download
                        ln('-sf', res.fetcher.stage.source_path, res.name)
            bash('gcc/ci/00_download_prerequisites.sh')

    def install(self, spec, prefix):
        bash = which('bash')
        bash('binutils-gdb/ci/00_build_install.sh')
        bash('gcc/ci/01_build_install_freestanding.sh')
        bash('newlib/ci/00_build_install.sh')
Eric Müller's avatar
Eric Müller committed
        bash('ci/00_build_install_libstdc++.sh')
        mkdirp(spec.prefix)
        install_tree('install/.', spec.prefix)