1{ lib, stdenv, fetchFromGitLab, tetex }:
2
3stdenv.mkDerivation {
4 pname = "mmixware";
5 version = "unstable-2021-06-18";
6
7 src = fetchFromGitLab {
8 domain = "gitlab.lrz.de";
9 owner = "mmix";
10 repo = "mmixware";
11 rev = "7c790176d50d13ae2422fa7457ccc4c2d29eba9b";
12 sha256 = "sha256-eSwHiJ5SP/Nennalv4QFTgVnM6oan/DWDZRqtk0o6Z0=";
13 };
14
15 hardeningDisable = [ "format" ];
16
17 postPatch = ''
18 substituteInPlace Makefile --replace 'rm abstime.h' ""
19 '';
20
21 # Workaround build failure on -fno-common toolchains:
22 # ld: mmix-config.o:(.bss+0x600): multiple definition of `buffer'; /build/ccDuGrwH.o:(.bss+0x20): first defined here
23 env.NIX_CFLAGS_COMPILE = "-fcommon";
24
25 nativeBuildInputs = [ tetex ];
26 enableParallelBuilding = true;
27
28 makeFlags = [ "all" "doc" "CFLAGS=-O2" ];
29
30 installPhase = ''
31 runHook preInstall
32 mkdir -p $out/share/doc
33 cp *.ps $out/share/doc
34 install -Dm755 mmixal -t $out/bin
35 install -Dm755 mmix -t $out/bin
36 install -Dm755 mmotype -t $out/bin
37 install -Dm755 mmmix -t $out/bin
38 runHook postInstall
39 '';
40
41 meta = with lib; {
42 description = "MMIX simulator and assembler";
43 homepage = "https://www-cs-faculty.stanford.edu/~knuth/mmix-news.html";
44 maintainers = with maintainers; [ siraben ];
45 platforms = platforms.unix;
46 license = licenses.publicDomain;
47 };
48}