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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
# 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 *
import os
class Dmd(MakefilePackage):
"""DMD is the reference compiler for the D programming language."""
homepage = "https://github.com/dlang/dmd"
url = "https://github.com/dlang/dmd/archive/v2.081.1.tar.gz"
version('2.081.1', sha256='14f3aafe1c93c86646aaeb3ed7361a5fc5a24374cf25c8848c81942bfd9fae1a')
depends_on('openssl')
depends_on('curl')
# https://wiki.dlang.org/Building_under_Posix
resource(name='druntime',
url='https://github.com/dlang/druntime/archive/v2.081.1.tar.gz',
sha256='8313af32dce71f767fb0072cae699cbfe7196cf01b0ce1c5dd416a71d94f5fee',
placement='druntime')
resource(name='phobos',
url='https://github.com/dlang/phobos/archive/v2.081.1.tar.gz',
sha256='d945c6fd1be14dff5fcbf45c1e11302e12bebac56d55e4e97e48e150f2899e04',
placement='phobos')
resource(name='tools',
url='https://github.com/dlang/tools/archive/v2.081.1.tar.gz',
sha256='71fa249dbfd278eec2b95ce577af32e623e44caf0d993905ddc189e3beec21d0',
placement='tools')
def setup_run_environment(self, env):
env.prepend_path('PATH', self.prefix.linux.bin64)
env.prepend_path('LIBRARY_PATH', self.prefix.linux.lib64)
env.prepend_path('LD_LIBRARY_PATH', self.prefix.linux.lib64)
def setup_dependent_build_environment(self, env, dependent_spec):
self.setup_run_environment(env)
def edit(self, spec, prefix):
# Move contents to dmd/
mkdir = which('mkdir')
mkdir('dmd')
mv = which('mv')
dmd_files = [f for f in os.listdir('.')
if not f.startswith(('dmd',
'druntime',
'phobos',
'tools',
'spack-build'))]
for f in dmd_files:
mv(f, 'dmd')
# Edit
dmd_mak = FileFilter('dmd/posix.mak')
dmd_mak.filter('$(PWD)/../install', prefix, string=True)
dr_mak = FileFilter('druntime/posix.mak')
dr_mak.filter('INSTALL_DIR=.*', 'INSTALL_DIR={0}'.format(prefix))
pb_mak = FileFilter('phobos/posix.mak')
pb_mak.filter('INSTALL_DIR = .*', 'INSTALL_DIR = {0}'.format(prefix))
tl_mak = FileFilter('tools/posix.mak')
tl_mak.filter('INSTALL_DIR = .*', 'INSTALL_DIR = {0}'.format(prefix))
def build(self, spec, prefix):
with working_dir('dmd'):
make('-f', 'posix.mak', 'AUTO_BOOTSTRAP=1')
with working_dir('phobos'):
make('-f', 'posix.mak')
def install(self, spec, prefix):
with working_dir('dmd'):
make('-f', 'posix.mak', 'install', 'AUTO_BOOTSTRAP=1')
with working_dir('phobos'):
make('-f', 'posix.mak', 'install')
with working_dir('tools'):
make('-f', 'posix.mak', 'install')
with working_dir('druntime'):
make('-f', 'posix.mak', 'install')
|