nixpkgs/pkgs/by-name/at/ats2/package.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

77 lines
2.0 KiB
Nix
Raw Normal View History

2024-11-05 01:54:45 +00:00
{
lib,
stdenv,
fetchurl,
gmp,
withEmacsSupport ? true,
withContrib ? true,
}:
let
2022-04-26 21:04:13 +01:00
versionPkg = "0.4.2";
contrib = fetchurl {
url = "mirror://sourceforge/ats2-lang/ATS2-Postiats-contrib-${versionPkg}.tgz";
2022-04-26 21:04:13 +01:00
hash = "sha256-m0hfBLsaNiLaIktcioK+ZtWUsWht3IDSJ6CzgJmS06c=";
};
2016-10-24 12:44:21 +01:00
2024-11-05 01:54:45 +00:00
postInstallContrib = lib.optionalString withContrib ''
2016-10-24 12:44:21 +01:00
local contribDir=$out/lib/ats2-postiats-*/ ;
mkdir -p $contribDir ;
tar -xzf "${contrib}" --strip-components 1 -C $contribDir ;
'';
2024-11-05 01:54:45 +00:00
postInstallEmacs = lib.optionalString withEmacsSupport ''
2016-10-24 12:44:21 +01:00
local siteLispDir=$out/share/emacs/site-lisp/ats2 ;
mkdir -p $siteLispDir ;
install -m 0644 -v ./utils/emacs/*.el $siteLispDir ;
'';
in
stdenv.mkDerivation rec {
pname = "ats2";
version = versionPkg;
2016-10-24 12:44:21 +01:00
src = fetchurl {
url = "mirror://sourceforge/ats2-lang/ATS2-Postiats-gmp-${version}.tgz";
2022-04-26 21:04:13 +01:00
hash = "sha256-UWgDjFojPBYgykrCrJyYvVWY+Gc5d4aRGjTWjc528AM=";
};
2023-01-02 13:44:38 +00:00
postPatch = lib.optionalString stdenv.cc.isClang ''
sed -i 's/gcc/clang/g' utils/*/DATS/atscc_util.dats
'';
buildInputs = [ gmp ];
2022-01-29 10:34:48 +00:00
# Disable parallel build, errors:
# *** No rule to make target 'patscc.dats', needed by 'patscc_dats.c'. Stop.
enableParallelBuilding = false;
2023-01-02 12:41:43 +00:00
makeFlags = [
"CC=${stdenv.cc.targetPrefix}cc"
"CCOMP=${stdenv.cc.targetPrefix}cc"
];
2024-11-05 01:55:13 +00:00
env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang "-Wno-error=implicit-function-declaration";
2024-08-16 20:07:43 +01:00
setupHook =
2016-10-24 12:44:21 +01:00
let
2024-08-16 20:07:43 +01:00
hookFiles = [ ./setup-hook.sh ] ++ lib.optional withContrib ./setup-contrib-hook.sh;
in
2024-11-05 01:54:45 +00:00
builtins.toFile "setupHook.sh" (lib.concatMapStringsSep "\n" builtins.readFile hookFiles);
postInstall = postInstallContrib + postInstallEmacs;
2015-04-30 23:54:40 +01:00
meta = with lib; {
description = "Functional programming language with dependent types";
2024-11-05 01:54:45 +00:00
homepage = "http://www.ats-lang.org";
license = licenses.gpl3Plus;
platforms = platforms.unix;
maintainers = with maintainers; [
thoughtpolice
ttuegel
bbarker
];
};
}