1{
2 config,
3 lib,
4 stdenv,
5 fetchurl,
6 pkg-config,
7 libtool,
8 zip,
9 libffi,
10 libsigsegv,
11 readline,
12 gmp,
13 gnutls,
14 gtk2,
15 cairo,
16 SDL,
17 sqlite,
18 emacsSupport ? config.emacsSupport or false,
19 emacs ? null,
20}:
21
22assert emacsSupport -> (emacs != null);
23
24let
25 # The gnu-smalltalk project has a dependency to the libsigsegv library.
26 # The project ships with sources for this library, but deprecated this option.
27 # Using the vanilla libsigsegv library results in error: "cannot relocate [...]"
28 # Adding --enable-static=libsigsegv to the gnu-smalltalk configuration flags
29 # does not help, the error still occurs. The only solution is to build a
30 # shared version of libsigsegv.
31 libsigsegv-shared = lib.overrideDerivation libsigsegv (oldAttrs: {
32 configureFlags = [ "--enable-shared" ];
33 });
34
35in
36stdenv.mkDerivation rec {
37
38 version = "3.2.5";
39 pname = "gnu-smalltalk";
40
41 src = fetchurl {
42 url = "mirror://gnu/smalltalk/smalltalk-${version}.tar.xz";
43 sha256 = "1k2ssrapfzhngc7bg1zrnd9n2vyxp9c9m70byvsma6wapbvib6l1";
44 };
45
46 patches = [
47 # The awk script incorrectly parsed `glib/glib.h` and was trying to find `glib/gwin32.h`,
48 # that isn't included since we're building only for linux.
49 ./0000-fix_mkorder.patch
50 ];
51
52 # The dependencies and their justification are explained at
53 # http://smalltalk.gnu.org/download
54 nativeBuildInputs = [ pkg-config ];
55 buildInputs = [
56 libtool
57 zip
58 libffi
59 libsigsegv-shared
60 readline
61 gmp
62 gnutls
63 gtk2
64 cairo
65 SDL
66 sqlite
67 ]
68 ++ lib.optional emacsSupport emacs;
69
70 configureFlags = lib.optional (!emacsSupport) "--without-emacs";
71
72 hardeningDisable = [ "format" ];
73
74 installFlags = lib.optional emacsSupport "lispdir=$(out)/share/emacs/site-lisp";
75
76 # For some reason the tests fail if executated with nix-build, but pass if
77 # executed within nix-shell --pure.
78 doCheck = false;
79
80 meta = with lib; {
81 description = "Free implementation of the Smalltalk-80 language";
82 longDescription = ''
83 GNU Smalltalk is a free implementation of the Smalltalk-80 language. It
84 runs on most POSIX compatible operating systems (including GNU/Linux, of
85 course), as well as under Windows. Smalltalk is a dynamic object-oriented
86 language, well-versed to scripting tasks.
87 '';
88 homepage = "http://smalltalk.gnu.org/";
89 license = with licenses; [
90 gpl2
91 lgpl2
92 ];
93 platforms = platforms.linux;
94 maintainers = with maintainers; [ ];
95 };
96}