@@ -1,31 +1,75 @@
1−{ stdenv, fetchurl, openssl }:
1+{ stdenv, fetchurl, fetchgit, git, openssl, autoconf, pkgs }:
22
33stdenv.mkDerivation rec {
44 name = "gambit-${version}";
5− version = "4.8.6";
6− devver = "4_8_6";
5+ version = "4.8.8-f3ffeb6";
6+ bootstrap = import ./bootstrap.nix ( pkgs );
77
8− src = fetchurl {
9− url = "http://www.iro.umontreal.ca/~gambit/download/gambit/v4.8/source/gambit-v${devver}-devel.tgz";
10− sha256 = "0j3ka76cfb007rlcc3nv5p1s6vh31cwp87hwwabawf16vs1jb7bl";
8+# devver = "4_8_8";
9+# src = fetchurl {
10+# url = "http://www.iro.umontreal.ca/~gambit/download/gambit/v4.8/source/gambit-v${version}-devel.tgz";
11+# sha256 = "0j3ka76cfb007rlcc3nv5p1s6vh31cwp87hwwabawf16vs1jb7bl";
12+# };
13+ src = fetchgit {
14+ url = "https://github.com/feeley/gambit.git";
15+ rev = "f3ffeb695aeea80c18c1b9ef276b57898c780dca";
16+ sha256 = "1lqixsrgk9z2gj6z1nkys0pfd3m5zjxrp3gvqn2wpr9h7hjb8x06";
1117 };
1218
13− configureFlags = [
14− "--enable-single-host"
15− "--enable-shared"
16− "--enable-absolute-shared-libs"
17− "--enable-c-opt=-O6" "--enable-gcc-opts" "--enable-inline-jumps"
18− "--enable-thread-system=posix" "--enable-dynamic-tls"
19− "--enable-openssl"
20− ];
19+ buildInputs = [ openssl git autoconf bootstrap ];
2120
22− buildInputs = [ openssl ];
21+ configurePhase = ''
22+ options=(
23+ --prefix=$out
24+ --enable-single-host
25+ --enable-c-opt=-O2
26+ --enable-gcc-opts
27+ --enable-shared
28+ --enable-absolute-shared-libs # Yes, NixOS will want an absolute path, and fix it.
29+ --enable-poll
30+ --enable-openssl
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/wip-compiler &&
53+ cp -rp ${bootstrap}/. boot/wip-compiler/. &&
54+ chmod -R u+w boot &&
55+ cd boot/wip-compiler && \
56+ cp ../../gsc/makefile.in ../../gsc/*.scm gsc && \
57+ (cd gsc && make bootclean ) &&
58+ make bootstrap &&
59+ cd ../.. &&
60+ cp boot/wip-compiler/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;
2367
2468 meta = {
2569 description = "Optimizing Scheme to C compiler";
2670 homepage = "http://gambitscheme.org";
2771 license = stdenv.lib.licenses.lgpl2;
2872 platforms = stdenv.lib.platforms.linux;
29− maintainers = with stdenv.lib.maintainers; [ thoughtpolice raskin ];
73+ maintainers = with stdenv.lib.maintainers; [ thoughtpolice raskin fare ];
3074 };
3175}