summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/goshimmer/package.py
blob: 3177f28ccd494c6bfbec2b5693b41cfb51ddf8b5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# 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.package import *


class Goshimmer(Package):
    """GoShimmer is a prototype node for exploring the implementation of IOTA 2.0"""
    homepage = 'https://github.com/iotaledger/goshimmer'
    url      = 'https://github.com/iotaledger/goshimmer/archive/refs/tags/v0.8.0.tar.gz'

    maintainers = ['bernhardkaindl']

    version('0.8.0', 'ec515deebf0dd35ff76cd98addae9cfcbf4758ab9eb72eb0f6ff4654f2658980')

    depends_on('go@1.16:', type='build')
    depends_on('snappy')
    depends_on('rocksdb')
    depends_on('zstd')
    depends_on('zlib')
    depends_on('lz4')

    @property
    def snapbin(self):
        return join_path(self.prefix.bin, 'snapshot.bin')

    def patch(self):
        for file in ['tools/genesis-snapshot/main', 'plugins/messagelayer/parameters']:
            filter_file('./snapshot.bin', self.snapbin, file + '.go')

    def install(self, spec, prefix):
        which('go')('build', '-modcacherw', '-tags', 'rocksdb,netgo')
        mkdir(prefix.bin)
        install('config.default.json', prefix.bin)
        install('goshimmer',           prefix.bin)
        which('wget')('-O', self.snapbin,
                      'https://dbfiles-goshimmer.s3.eu-central-1.amazonaws.com/snapshots/nectar/snapshot-latest.bin')
        remove_linked_tree(prefix.pkg)