summary refs log tree commit diff
path: root/pkgs/development/compilers/miranda/default.nix
diff options
context:
space:
mode:
authorBen Siraphob <bensiraphob@gmail.com>2020-10-09 20:38:29 +0700
committerBen Siraphob <bensiraphob@gmail.com>2020-10-11 09:09:27 +0700
commit4600ea9c31f9c9171ce35a8f97e42fbb0e81c72e (patch)
treed086e8762be5f6123c820fc48b552031465a5ff9 /pkgs/development/compilers/miranda/default.nix
parent0790b3e4dc797a097175eb14361dab32217c1a00 (diff)
downloadnixpkgs-4600ea9c31f9c9171ce35a8f97e42fbb0e81c72e.tar
nixpkgs-4600ea9c31f9c9171ce35a8f97e42fbb0e81c72e.tar.gz
nixpkgs-4600ea9c31f9c9171ce35a8f97e42fbb0e81c72e.tar.bz2
nixpkgs-4600ea9c31f9c9171ce35a8f97e42fbb0e81c72e.tar.lz
nixpkgs-4600ea9c31f9c9171ce35a8f97e42fbb0e81c72e.tar.xz
nixpkgs-4600ea9c31f9c9171ce35a8f97e42fbb0e81c72e.tar.zst
nixpkgs-4600ea9c31f9c9171ce35a8f97e42fbb0e81c72e.zip
miranda: init at 2.066
Diffstat (limited to 'pkgs/development/compilers/miranda/default.nix')
-rw-r--r--pkgs/development/compilers/miranda/default.nix73
1 files changed, 73 insertions, 0 deletions
diff --git a/pkgs/development/compilers/miranda/default.nix b/pkgs/development/compilers/miranda/default.nix
new file mode 100644
index 00000000000..c3cb854cdf4
--- /dev/null
+++ b/pkgs/development/compilers/miranda/default.nix
@@ -0,0 +1,73 @@
+{ stdenv, lib, fetchzip, fetchpatch, gcc }:
+
+stdenv.mkDerivation rec {
+  pname = "miranda";
+  version = "2.066";
+
+  # The build generates object files (`.x`) from module files (`.m`).
+  # To be able to invalidate object file, it contains the `mtime`
+  # of the corresponding module file at the time of the build.
+  # When a file is installed to Nix store its `mtime` is set to `1`,
+  # so the `mtime` field in the object file would no longer match
+  # and Miranda would try to regenerate it at the runtime,
+  # even though it is up to date.
+  # Using `fetchzip` will make all the source files have `mtime=1`
+  # from the start so this mismatch cannot occur.
+  src = fetchzip {
+    url = "https://www.cs.kent.ac.uk/people/staff/dat/miranda/src/mira-${builtins.replaceStrings [ "." ] [ "" ] version}-src.tgz";
+    sha256 = "KE/FTL9YW9l7VBAgkFZlqgSM1Bt/BXT6GkkONtyKJjQ=";
+  };
+
+  patches = [
+    # Allow passing `PREFIX` to makeFlags.
+    # Sent upstream on 2020-10-10.
+    (fetchpatch {
+      name = "fix-makefile-variables.patch";
+      url = "https://github.com/jtojnar/miranda/commit/be62d2150725a4c314aa7e3e1e75a165c90be65d.patch";
+      sha256 = "0r8nnr7iyzp1a3w3n6y1xi0ralqhm1ifp75yhyj3h1g229vk51a6";
+    })
+
+    # Create the installation directories.
+    # Sent upstream on 2020-10-10.
+    (fetchpatch {
+      name = "add-mkdirs-makefile.patch";
+      url = "https://github.com/jtojnar/miranda/commit/048754606625975d5358e946549c41ae7b5d3428.patch";
+      sha256 = "1n8xv679i7s789km2dxxrs2pphyyi7vr7rhafqvmkcdmhmxk9h2a";
+    })
+
+    # Use correct installation path for finding the library.
+    # Sent upstream on 2020-10-10.
+    (fetchpatch {
+      name = "c-path-fixes.patch";
+      url = "https://github.com/jtojnar/miranda/commit/aea0a118a802a0da6029b781f7cfd388224263cf.patch";
+      sha256 = "1z3giv8fzc35a23ga9ahz9d1fbvya67kavnb8h4rv2icbzr5j5gd";
+    })
+
+    # Make build reproducible.
+    # Sent upstream on 2020-10-10.
+    (fetchpatch {
+      name = "deterministic-build.patch";
+      url = "https://github.com/jtojnar/miranda/commit/daf8abb8f30ec1cca21698e3fc355578b9f7c571.patch";
+      sha256 = "TC/YrHrMzdlwicJ3oJ/TjwhkufmV3ypemgyqhMmVut4=";
+    })
+  ];
+
+  makeFlags = [
+    "CC=cc"
+    "CFLAGS=-O2"
+    "PREFIX=${placeholder "out"}"
+  ];
+
+  enableParallelBuilding = true;
+
+  postPatch = ''
+    patchShebangs quotehostinfo
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Compiler for Miranda -- a pure, non-strict, polymorphic, higher order functional programming language";
+    homepage = "https://www.cs.kent.ac.uk/people/staff/dat/miranda/";
+    license = licenses.bsd2;
+    maintainers = with maintainers; [ siraben ];
+  };
+}