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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
|
{
fetchFromGitHub,
lib,
stdenv,
unzip,
libxml2,
gmp,
m4,
uthash,
which,
pkg-config,
perl,
perlPackages,
fetchurl,
}:
let
# Perl packages used by this project.
# TODO: put these into global perl-packages.nix once this is submitted.
ObjectTinyRW = perlPackages.buildPerlPackage {
pname = "Object-Tiny-RW";
version = "1.07";
src = fetchurl {
url = "mirror://cpan/authors/id/S/SC/SCHWIGON/object-tiny-rw/Object-Tiny-RW-1.07.tar.gz";
hash = "sha256-NbQIy9d4ZcMnRJJApPBSej+W6e/aJ8rkb5E7rD7GVgs=";
};
meta = {
description = "Date object with as little code as possible (and rw accessors)";
license = with lib.licenses; [
artistic1
gpl1Plus
];
};
};
IteratorSimpleLookahead = perlPackages.buildPerlPackage {
pname = "Iterator-Simple-Lookahead";
version = "0.09";
src = fetchurl {
url = "mirror://cpan/authors/id/P/PS/PSCUST/Iterator-Simple-Lookahead-0.09.tar.gz";
hash = "sha256-FmPE1xdU8LAXS21+H4DJaQ87qDi4Q4UkLawsUAqseZw=";
};
propagatedBuildInputs = with perlPackages; [
ClassAccessor
IteratorSimple
];
meta = {
description = "Simple iterator with lookahead and unget";
license = with lib.licenses; [
artistic1
gpl2Only
];
};
};
AsmPreproc = perlPackages.buildPerlPackage {
pname = "Asm-Preproc";
version = "1.03";
src = fetchurl {
url = "mirror://cpan/authors/id/P/PS/PSCUST/Asm-Preproc-1.03.tar.gz";
hash = "sha256-pVTpIqGxZpBxZlAbXuGDapuOxsp3uM/AM5dKUxlej1M=";
};
propagatedBuildInputs = [
IteratorSimpleLookahead
]
++ (with perlPackages; [
IteratorSimple
TextTemplate
DataDump
FileSlurp
]);
meta = {
description = "Preprocessor to be called from an assembler";
license = with lib.licenses; [
artistic1
gpl2Only
];
};
};
CPUZ80Assembler = perlPackages.buildPerlPackage {
pname = "CPU-Z80-Assembler";
version = "2.25";
src = fetchurl {
url = "mirror://cpan/authors/id/P/PS/PSCUST/CPU-Z80-Assembler-2.25.tar.gz";
hash = "sha256-cJ8Fl2KZw9/bnBDUzFuwwdw9x23OUvcftk78kw7abdU=";
};
buildInputs = [
AsmPreproc
]
++ (with perlPackages; [
CaptureTiny
RegexpTrie
PathTiny
ClassAccessor
]);
meta = {
description = "Functions to assemble a set of Z80 assembly instructions";
license = with lib.licenses; [
artistic1
gpl2Only
];
};
};
in
stdenv.mkDerivation (finalAttrs: {
pname = "z88dk";
version = "2.4";
src = fetchFromGitHub {
owner = "z88dk";
repo = "z88dk";
rev = "v${finalAttrs.version}";
hash = "sha256-RrPu1UcTyin/aiGrV87PZI8f6dazuojJLalyEaFT/kY=";
fetchSubmodules = true;
};
postPatch = ''
# we dont rely on build.sh :
export PATH="$PWD/bin:$PATH" # needed to have zcc in testsuite
export ZCCCFG=$PWD/lib/config/
# we don't want to build zsdcc since it required network (svn)
# we test in checkPhase
substituteInPlace Makefile \
--replace 'testsuite bin/z88dk-lib$(EXESUFFIX)' 'bin/z88dk-lib$(EXESUFFIX)'\
--replace 'ALL_EXT = bin/zsdcc$(EXESUFFIX)' 'ALL_EXT ='
# rc2014.lib not created, making corresponding tests fail. Comment out.
substituteInPlace test/suites/make.config \
--replace 'zcc +rc2014' '#zcc +rc2014' \
--replace '@$(MACHINE) -pc 0x9000' '#@$(MACHINE) -pc 0x9000'
# The following tests don't pass.
rm src/z80asm/t/issue_0341.t
rm src/z80asm/t/z80asm_lib.t
'';
# z88dk-z80asm triggers buffer overflow detection with FORTIFY_SOURCE=3.
# Upstream bug: https://github.com/z88dk/z88dk/issues/3042
hardeningDisable = [ "fortify" ];
# Parallel building is not working yet with the upstream Makefiles.
# Explicitly switch this off for now.
enableParallelBuilding = false;
doCheck = true;
checkPhase = ''
# Need to build libs first, Makefile deps not fully defined
make libs $makeFlags
make testsuite $makeFlags
make -k test $makeFlags
'';
short_rev = builtins.substring 0 7 finalAttrs.src.rev;
makeFlags = [
"git_rev=${finalAttrs.short_rev}"
"version=${finalAttrs.version}"
"PREFIX=$(out)"
"git_count=0"
];
nativeBuildInputs = [
which
unzip
m4
perl
pkg-config
# Local perl packages
AsmPreproc
CPUZ80Assembler
ObjectTinyRW
]
++ (with perlPackages; [
CaptureTiny
DataHexDump
ModernPerl
PathTiny
RegexpCommon
TestHexDifferences
TextDiff
RegexpTrie
]);
buildInputs = [
libxml2
uthash
gmp
];
preInstall = ''
mkdir -p $out/{bin,share}
'';
installTargets = [
"libs"
"install"
];
meta = {
homepage = "https://www.z88dk.org";
description = "z80 Development Kit";
license = lib.licenses.clArtistic;
maintainers = with lib.maintainers; [
siraben
hzeller
];
platforms = lib.platforms.unix;
};
})
|