1{ stdenv, fetchurl, makeFontsConf, makeWrapper
2, cairo, coreutils, fontconfig, freefont_ttf
3, glib, gmp, gtk, libffi, libjpeg, libpng
4, libtool, mpfr, openssl, pango, poppler
5, readline, sqlite
6, disableDocs ? true
7}:
8
9let
10
11 fontsConf = makeFontsConf {
12 fontDirectories = [ freefont_ttf ];
13 };
14
15 libPath = stdenv.lib.makeLibraryPath [
16 cairo
17 fontconfig
18 glib
19 gmp
20 gtk
21 libjpeg
22 libpng
23 mpfr
24 openssl
25 pango
26 poppler
27 readline
28 sqlite
29 ];
30
31in
32
33stdenv.mkDerivation rec {
34 name = "racket-${version}";
35 version = "6.6";
36
37 src = fetchurl {
38 url = "http://mirror.racket-lang.org/installers/${version}/${name}-src.tgz";
39 sha256 = "1kzdi1n6h6hmz8zd9k8r5a5yp2ryi4w3c2fjm1k6cqicn18cwaxz";
40 };
41
42 FONTCONFIG_FILE = fontsConf;
43 LD_LIBRARY_PATH = libPath;
44 NIX_LDFLAGS = stdenv.lib.optionalString stdenv.cc.isGNU "-lgcc_s";
45
46 buildInputs = [ fontconfig libffi libtool makeWrapper sqlite ];
47
48 preConfigure = ''
49 substituteInPlace src/configure --replace /usr/bin/uname ${coreutils}/bin/uname
50 mkdir src/build
51 cd src/build
52 '';
53
54 shared = if stdenv.isDarwin then "dylib" else "shared";
55 configureFlags = [ "--enable-${shared}" "--enable-lt=${libtool}/bin/libtool" ]
56 ++ stdenv.lib.optional disableDocs [ "--disable-docs" ]
57 ++ stdenv.lib.optional stdenv.isDarwin [ "--enable-xonx" ];
58
59 configureScript = "../configure";
60
61 enableParallelBuilding = false;
62
63 postInstall = ''
64 for p in $(ls $out/bin/) ; do
65 wrapProgram $out/bin/$p --set LD_LIBRARY_PATH "${LD_LIBRARY_PATH}";
66 done
67 '';
68
69 meta = with stdenv.lib; {
70 description = "A programmable programming language";
71 longDescription = ''
72 Racket is a full-spectrum programming language. It goes beyond
73 Lisp and Scheme with dialects that support objects, types,
74 laziness, and more. Racket enables programmers to link
75 components written in different dialects, and it empowers
76 programmers to create new, project-specific dialects. Racket's
77 libraries support applications from web servers and databases to
78 GUIs and charts.
79 '';
80 homepage = http://racket-lang.org/;
81 license = licenses.lgpl3;
82 maintainers = with maintainers; [ kkallio henrytill vrthra ];
83 platforms = platforms.unix;
84 };
85}