nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at devShellTools-shell 207 lines 4.9 kB view raw
1{ 2 fetchFromGitHub, 3 lib, 4 stdenv, 5 unzip, 6 libxml2, 7 gmp, 8 m4, 9 uthash, 10 which, 11 pkg-config, 12 perl, 13 perlPackages, 14 fetchurl, 15}: 16 17let 18 # Perl packages used by this project. 19 # TODO: put these into global perl-packages.nix once this is submitted. 20 ObjectTinyRW = perlPackages.buildPerlPackage { 21 pname = "Object-Tiny-RW"; 22 version = "1.07"; 23 src = fetchurl { 24 url = "mirror://cpan/authors/id/S/SC/SCHWIGON/object-tiny-rw/Object-Tiny-RW-1.07.tar.gz"; 25 hash = "sha256-NbQIy9d4ZcMnRJJApPBSej+W6e/aJ8rkb5E7rD7GVgs="; 26 }; 27 meta = { 28 description = "Date object with as little code as possible (and rw accessors)"; 29 license = with lib.licenses; [ 30 artistic1 31 gpl1Plus 32 ]; 33 }; 34 }; 35 36 IteratorSimpleLookahead = perlPackages.buildPerlPackage { 37 pname = "Iterator-Simple-Lookahead"; 38 version = "0.09"; 39 src = fetchurl { 40 url = "mirror://cpan/authors/id/P/PS/PSCUST/Iterator-Simple-Lookahead-0.09.tar.gz"; 41 hash = "sha256-FmPE1xdU8LAXS21+H4DJaQ87qDi4Q4UkLawsUAqseZw="; 42 }; 43 propagatedBuildInputs = with perlPackages; [ 44 ClassAccessor 45 IteratorSimple 46 ]; 47 meta = { 48 description = "Simple iterator with lookahead and unget"; 49 license = with lib.licenses; [ 50 artistic1 51 gpl2Only 52 ]; 53 }; 54 }; 55 56 AsmPreproc = perlPackages.buildPerlPackage { 57 pname = "Asm-Preproc"; 58 version = "1.03"; 59 src = fetchurl { 60 url = "mirror://cpan/authors/id/P/PS/PSCUST/Asm-Preproc-1.03.tar.gz"; 61 hash = "sha256-pVTpIqGxZpBxZlAbXuGDapuOxsp3uM/AM5dKUxlej1M="; 62 }; 63 propagatedBuildInputs = [ 64 IteratorSimpleLookahead 65 ] 66 ++ (with perlPackages; [ 67 IteratorSimple 68 TextTemplate 69 DataDump 70 FileSlurp 71 ]); 72 meta = { 73 description = "Preprocessor to be called from an assembler"; 74 license = with lib.licenses; [ 75 artistic1 76 gpl2Only 77 ]; 78 }; 79 }; 80 81 CPUZ80Assembler = perlPackages.buildPerlPackage { 82 pname = "CPU-Z80-Assembler"; 83 version = "2.25"; 84 src = fetchurl { 85 url = "mirror://cpan/authors/id/P/PS/PSCUST/CPU-Z80-Assembler-2.25.tar.gz"; 86 hash = "sha256-cJ8Fl2KZw9/bnBDUzFuwwdw9x23OUvcftk78kw7abdU="; 87 }; 88 buildInputs = [ 89 AsmPreproc 90 ] 91 ++ (with perlPackages; [ 92 CaptureTiny 93 RegexpTrie 94 PathTiny 95 ClassAccessor 96 ]); 97 meta = { 98 description = "Functions to assemble a set of Z80 assembly instructions"; 99 license = with lib.licenses; [ 100 artistic1 101 gpl2Only 102 ]; 103 }; 104 }; 105in 106stdenv.mkDerivation (finalAttrs: { 107 pname = "z88dk"; 108 version = "2.3-unstable-2025-01-08"; 109 110 src = fetchFromGitHub { 111 owner = "z88dk"; 112 repo = "z88dk"; 113 rev = "e223137af42ed0332b11fa6185268246293245c4"; 114 hash = "sha256-m0ZEAfKISEqzsh4VNXwRSceBC4uWmIIdi5cw+7lEC9o="; 115 fetchSubmodules = true; 116 }; 117 118 postPatch = '' 119 # we dont rely on build.sh : 120 export PATH="$PWD/bin:$PATH" # needed to have zcc in testsuite 121 export ZCCCFG=$PWD/lib/config/ 122 123 # we don't want to build zsdcc since it required network (svn) 124 # we test in checkPhase 125 substituteInPlace Makefile \ 126 --replace 'testsuite bin/z88dk-lib$(EXESUFFIX)' 'bin/z88dk-lib$(EXESUFFIX)'\ 127 --replace 'ALL_EXT = bin/zsdcc$(EXESUFFIX)' 'ALL_EXT =' 128 129 # rc2014.lib not created, making corresponding tests fail. Comment out. 130 substituteInPlace test/suites/make.config \ 131 --replace 'zcc +rc2014' '#zcc +rc2014' \ 132 --replace '@$(MACHINE) -pc 0x9000' '#@$(MACHINE) -pc 0x9000' 133 134 # The following tests don't pass. 135 rm src/z80asm/t/issue_0341.t 136 rm src/z80asm/t/z80asm_lib.t 137 ''; 138 139 # Parallel building is not working yet with the upstream Makefiles. 140 # Explicitly switch this off for now. 141 enableParallelBuilding = false; 142 143 doCheck = true; 144 checkPhase = '' 145 # Need to build libs first, Makefile deps not fully defined 146 make libs $makeFlags 147 make testsuite $makeFlags 148 make -k test $makeFlags 149 ''; 150 151 short_rev = builtins.substring 0 7 finalAttrs.src.rev; 152 makeFlags = [ 153 "git_rev=${finalAttrs.short_rev}" 154 "version=${finalAttrs.version}" 155 "PREFIX=$(out)" 156 "git_count=0" 157 ]; 158 159 nativeBuildInputs = [ 160 which 161 unzip 162 m4 163 perl 164 pkg-config 165 166 # Local perl packages 167 AsmPreproc 168 CPUZ80Assembler 169 ObjectTinyRW 170 ] 171 ++ (with perlPackages; [ 172 CaptureTiny 173 DataHexDump 174 ModernPerl 175 PathTiny 176 RegexpCommon 177 TestHexDifferences 178 TextDiff 179 RegexpTrie 180 ]); 181 182 buildInputs = [ 183 libxml2 184 uthash 185 gmp 186 ]; 187 188 preInstall = '' 189 mkdir -p $out/{bin,share} 190 ''; 191 192 installTargets = [ 193 "libs" 194 "install" 195 ]; 196 197 meta = with lib; { 198 homepage = "https://www.z88dk.org"; 199 description = "z80 Development Kit"; 200 license = licenses.clArtistic; 201 maintainers = with maintainers; [ 202 siraben 203 hzeller 204 ]; 205 platforms = platforms.unix; 206 }; 207})