1{ config, lib, stdenv, fetchurl, pkg-config, libtool
2, zip, libffi, libsigsegv, readline, gmp
3, gnutls, gtk2, cairo, SDL, sqlite
4, emacsSupport ? config.emacsSupport or false, emacs ? null }:
5
6assert emacsSupport -> (emacs != null);
7
8let # The gnu-smalltalk project has a dependency to the libsigsegv library.
9 # The project ships with sources for this library, but deprecated this option.
10 # Using the vanilla libsigsegv library results in error: "cannot relocate [...]"
11 # Adding --enable-static=libsigsegv to the gnu-smalltalk configuration flags
12 # does not help, the error still occurs. The only solution is to build a
13 # shared version of libsigsegv.
14 libsigsegv-shared = lib.overrideDerivation libsigsegv (oldAttrs: {
15 configureFlags = [ "--enable-shared" ];
16 });
17
18in stdenv.mkDerivation rec {
19
20 version = "3.2.5";
21 pname = "gnu-smalltalk";
22
23 src = fetchurl {
24 url = "mirror://gnu/smalltalk/smalltalk-${version}.tar.xz";
25 sha256 = "1k2ssrapfzhngc7bg1zrnd9n2vyxp9c9m70byvsma6wapbvib6l1";
26 };
27
28 # The dependencies and their justification are explained at
29 # http://smalltalk.gnu.org/download
30 nativeBuildInputs = [ pkg-config ];
31 buildInputs = [
32 libtool zip libffi libsigsegv-shared readline gmp gnutls gtk2
33 cairo SDL sqlite
34 ]
35 ++ lib.optional emacsSupport emacs;
36
37 configureFlags = lib.optional (!emacsSupport) "--without-emacs";
38
39 hardeningDisable = [ "format" ];
40
41 installFlags = lib.optional emacsSupport "lispdir=$(out)/share/emacs/site-lisp";
42
43 # For some reason the tests fail if executated with nix-build, but pass if
44 # executed within nix-shell --pure.
45 doCheck = false;
46
47 meta = with lib; {
48 description = "A free implementation of the Smalltalk-80 language";
49 longDescription = ''
50 GNU Smalltalk is a free implementation of the Smalltalk-80 language. It
51 runs on most POSIX compatible operating systems (including GNU/Linux, of
52 course), as well as under Windows. Smalltalk is a dynamic object-oriented
53 language, well-versed to scripting tasks.
54 '';
55 homepage = "http://smalltalk.gnu.org/";
56 license = with licenses; [ gpl2 lgpl2 ];
57 platforms = platforms.linux;
58 maintainers = with maintainers; [ skeidel ];
59 };
60}