summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/dicom3tools/package.py
blob: 31a2bbe1a8382345b3b2897365ad920c5f4e47b9 (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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# Copyright 2013-2021 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 Dicom3tools(MakefilePackage):
    """Command line utilities for creating, modifying, dumping and validating
    files of DICOM attributes, and conversion of proprietary image formats to
    DICOM. Can handle older ACR/NEMA format data, and some proprietary versions
    of that such as SPI."""

    homepage = "https://www.dclunie.com/dicom3tools.html"
    url      = "https://www.dclunie.com/dicom3tools/workinprogress/dicom3tools_1.00.snapshot.20210306100017.tar.bz2"

    version('1.00.snapshot.20210306100017', sha256='3cc2d6056e349e0ac6a093d231d8f4dd7a77e26ed29c1ebaca945dd5e56c1520')

    variant(
        'uid_root',
        default='0.0.0.0',
        values=lambda x: True,
        description='default UID Root assignment'
    )

    depends_on('bzip2', type='build')
    depends_on('imake', type='build')
    depends_on('libx11')

    def edit(self, spec, prefix):
        defines = [
            '#define InstallBinDir "{0}"'.format(prefix.bin),
            '#define InstallIncDir "{0}"'.format(prefix.include),
            '#define InstallLibDir "{0}"'.format(prefix.lib),
            '#define InstallManDir "{0}"'.format(prefix.man),
            '#define X11LibraryPath "{0}"'.format(spec['libx11'].prefix.lib),
            '#define X11IncludePath "{0}"'.format(spec['libx11'].prefix.include),
        ]

        with working_dir('config'):
            with open('site.p-def', 'a') as inc:
                for define in defines:
                    inc.write('{0}\n'.format(define))

            configure = FileFilter('Configure')
            configure.filter('usegcc=.*', 'usegcc={0}'.format(spack_cc))
            configure.filter('usegpp=.*', 'usegpp={0}'.format(spack_cxx))

    def build(self, spec, prefix):
        uid_root = spec.variants['uid_root'].value
        configure = Executable(join_path('.', 'Configure'))
        configure()

        imake = which('imake')
        imake('-I./config', '-DDefaultUIDRoot={0}'.format(uid_root))
        make('World')

    def install(self, spec, prefix):
        make('install')
        make('install.man')