nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
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 (finalAttrs: {
37 pname = "gnu-smalltalk";
38 version = "3.2.5";
39
40 src = fetchurl {
41 url = "mirror://gnu/smalltalk/smalltalk-${finalAttrs.version}.tar.xz";
42 hash = "sha256-gZoV97qKG1X19gucmli63W9hU7P5h7cOexZ+d1XWWsw=";
43 };
44
45 patches = [
46 # The awk script incorrectly parsed `glib/glib.h` and was trying to find `glib/gwin32.h`,
47 # that isn't included since we're building only for linux.
48 ./0000-fix_mkorder.patch
49 ./0001-fix-compilation.patch
50 ];
51
52 enableParallelBuilding = true;
53
54 # The dependencies and their justification are explained at
55 # http://smalltalk.gnu.org/download
56 nativeBuildInputs = [ pkg-config ];
57 buildInputs = [
58 libtool
59 zip
60 libffi
61 libsigsegv-shared
62 readline
63 gmp
64 gnutls
65 gtk2
66 cairo
67 SDL
68 sqlite
69 ]
70 ++ lib.optional emacsSupport emacs;
71
72 configureFlags = lib.optional (!emacsSupport) "--without-emacs";
73
74 hardeningDisable = [ "format" ];
75
76 installFlags = lib.optional emacsSupport "lispdir=${placeholder "$out"}/share/emacs/site-lisp";
77
78 # For some reason the tests fail if executated with nix-build, but pass if
79 # executed within nix-shell --pure.
80 doCheck = false;
81
82 meta = {
83 description = "Free implementation of the Smalltalk-80 language";
84 longDescription = ''
85 GNU Smalltalk is a free implementation of the Smalltalk-80 language. It
86 runs on most POSIX compatible operating systems (including GNU/Linux, of
87 course), as well as under Windows. Smalltalk is a dynamic object-oriented
88 language, well-versed to scripting tasks.
89 '';
90 homepage = "http://smalltalk.gnu.org/";
91 license = with lib.licenses; [
92 gpl2
93 lgpl2
94 ];
95 platforms = lib.platforms.linux;
96 maintainers = [ ];
97 };
98})