1{ stdenv, fetchurl, fetchgit, git, openssl, autoconf, pkgs, makeStaticLibraries }:
2
3# TODO: distinct packages for gambit-release and gambit-devel
4
5stdenv.mkDerivation rec {
6 name = "gambit-${version}";
7 version = "4.8.9";
8 bootstrap = import ./bootstrap.nix ( pkgs );
9
10 src = fetchgit {
11 url = "https://github.com/feeley/gambit.git";
12 rev = "dd54a71dfc0bd09813592f1645d755867a02195d";
13 sha256 = "120kg73k39gshrwas8a3xcrxgnq1c7ww92wgy4d3mmrwy3j9nzzc";
14 };
15
16 # Use makeStaticLibraries to enable creation of statically linked binaries
17 buildInputs = [ git autoconf bootstrap openssl (makeStaticLibraries openssl)];
18
19 configurePhase = ''
20 options=(
21 --prefix=$out
22 --enable-single-host
23 --enable-c-opt=-O2
24 --enable-gcc-opts
25 --enable-shared
26 --enable-absolute-shared-libs # Yes, NixOS will want an absolute path, and fix it.
27 --enable-poll
28 --enable-openssl
29 --enable-default-runtime-options="f8,-8,t8" # Default to UTF-8 for source and all I/O
30 #--enable-debug # Nope: enables plenty of good stuff, but also the costly console.log
31
32 #--enable-multiple-versions # Nope, NixOS already does version multiplexing
33 #--enable-guide
34 #--enable-track-scheme
35 #--enable-high-res-timing
36 #--enable-max-processors=4
37 #--enable-multiple-vms
38 #--enable-dynamic-tls
39 #--enable-multiple-vms
40 #--enable-multiple-threaded-vms ## when SMP branch is merged in
41 #--enable-thread-system=posix ## default when --enable-multiple-vms is on.
42 #--enable-profile
43 #--enable-coverage
44 #--enable-inline-jumps
45 #--enable-char-size=1" ; default is 4
46 )
47 ./configure ''${options[@]}
48 '';
49
50 buildPhase = ''
51 # Make bootstrap compiler, from release bootstrap
52 mkdir -p boot &&
53 cp -rp ${bootstrap}/. boot/. &&
54 chmod -R u+w boot &&
55 cd boot &&
56 cp ../gsc/makefile.in ../gsc/*.scm gsc && # */
57 ./configure &&
58 for i in lib gsi gsc ; do (cd $i ; make ) ; done &&
59 cd .. &&
60 cp boot/gsc/gsc gsc-boot &&
61
62 # Now use the bootstrap compiler to build the real thing!
63 make -j2 from-scratch
64 '';
65
66 doCheck = true;
67
68 meta = {
69 description = "Optimizing Scheme to C compiler";
70 homepage = "http://gambitscheme.org";
71 license = stdenv.lib.licenses.lgpl2;
72 platforms = stdenv.lib.platforms.unix;
73 maintainers = with stdenv.lib.maintainers; [ thoughtpolice raskin fare ];
74 };
75}