1{ lib, stdenv, fetchurl, readline, gettext, ncurses }:
2
3stdenv.mkDerivation rec {
4 pname = "gnu-apl";
5 version = "1.9";
6
7 src = fetchurl {
8 url = "mirror://gnu/apl/apl-${version}.tar.gz";
9 sha256 = "sha256-KRhn8bGTdpOrtXvn2aN2GLA3bj4nCVdIVKe75Suyjrg=";
10 };
11
12 buildInputs = [ readline gettext ncurses ];
13
14 env.NIX_CFLAGS_COMPILE = with lib; toString ((optionals stdenv.cc.isGNU [
15 # Needed with GCC 8
16 "-Wno-error=int-in-bool-context"
17 "-Wno-error=class-memaccess"
18 "-Wno-error=restrict"
19 "-Wno-error=format-truncation"
20 # Needed with GCC 10
21 "-Wno-error=maybe-uninitialized"
22 # Needed with GCC 11
23 "-Wno-error=misleading-indentation"
24 # Needed with GCC 12
25 "-Wno-error=nonnull"
26 "-Wno-error=stringop-overflow"
27 "-Wno-error=use-after-free"
28 ]) ++ optional stdenv.cc.isClang "-Wno-error=null-dereference");
29
30 patchPhase = lib.optionalString stdenv.isDarwin ''
31 substituteInPlace src/LApack.cc --replace "malloc.h" "malloc/malloc.h"
32 '';
33
34 postInstall = ''
35 cp -r support-files/ $out/share/doc/
36 find $out/share/doc/support-files -name 'Makefile*' -delete
37 '';
38
39 meta = with lib; {
40 broken = stdenv.isDarwin;
41 description = "Free interpreter for the APL programming language";
42 homepage = "https://www.gnu.org/software/apl/";
43 license = licenses.gpl3Plus;
44 maintainers = [ maintainers.kovirobi ];
45 platforms = with platforms; linux ++ darwin;
46 mainProgram = "apl";
47
48 longDescription = ''
49 GNU APL is a free interpreter for the programming language APL, with an
50 (almost) complete implementation of ISO standard 13751 aka. Programming
51 Language APL, Extended. GNU APL was written and is being maintained by
52 Jürgen Sauermann.
53 '';
54 };
55}