summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/go-md2man/package.py
blob: 0986d41661748a55983b24fb5832ff32f8437c32 (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
41
42
43
44
45
46
# Copyright 2013-2019 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 *


class GoMd2man(Package):
    """go-md2man converts markdown into roff (man pages)"""

    homepage = "https://github.com/cpuguy83/go-md2man"
    url      = "https://github.com/cpuguy83/go-md2man/archive/v1.0.10.tar.gz"

    version('1.0.10', sha256='76aa56849123b99b95fcea2b15502fd886dead9a5c35be7f78bdc2bad6be8d99')

    depends_on('go')

    resource(name='blackfriday',
             url='https://github.com/russross/blackfriday/archive/v1.5.2.tar.gz',
             sha256='626138a08abb8579474a555e9d45cb5260629a2c07e8834428620a650dc9f195',
             placement='blackfriday',
             destination=join_path('src', 'github.com', 'russross'))

    def patch(self):
        mkdirp(join_path(self.stage.source_path,
               'src', 'github.com', 'russross'))

        mkdirp(join_path(self.stage.source_path,
               'src', 'github.com', 'cpuguy83'))

        ln = which('ln')
        ln('-s', self.stage.source_path, join_path(
           'src', 'github.com', 'cpuguy83', 'go-md2man'))

    def install(self, spec, prefix):

        with working_dir('src'):
            env['GOPATH'] = self.stage.source_path
            env['GO111MODULE'] = 'off'
            go = which('go')
            go('build', '-v', join_path(
               'github.com', 'cpuguy83', 'go-md2man'))

            mkdir(prefix.bin)
            install('go-md2man', prefix.bin)