;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2013 Nikita Karetnikov
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix. If not, see .
(define-module (gnu packages ghc)
#:use-module ((guix licenses) #:select (bsd-style))
#:use-module (guix packages)
#:use-module (guix download)
#:use-module (guix build-system gnu)
#:use-module (gnu packages base)
#:use-module (gnu packages bootstrap)
#:use-module (gnu packages multiprecision)
#:use-module (gnu packages ncurses)
#:use-module (gnu packages patchelf)
#:use-module (gnu packages perl))
(define-public ghc-7.0.1-bin
(package
(name "ghc-bin")
;; 7.0.2--7.6.3
(version "7.0.1")
(source
(origin
(method url-fetch)
;; XXX: Support other platforms.
(uri (string-append "http://www.haskell.org/ghc/dist/"
version "/ghc-" version
"-i386-unknown-linux.tar.bz2"))
(sha256
(base32
"1cc9ih3h804gj53vf1xabg4155m6bz5r468mjsv54kckmabgsmav"))))
(build-system gnu-build-system)
(arguments
`(#:modules ((guix build gnu-build-system)
(guix build utils)
(srfi srfi-1))
#:phases (alist-cons-before
'configure 'pre-configure
(lambda _
(let ((gmp (format #f "~a/lib"
(assoc-ref %build-inputs "gmp")))
(linker (format #f "~a~a"
(assoc-ref %build-inputs "libc")
,(glibc-dynamic-linker)))
(ncurses (format #f "~a/lib"
(assoc-ref %build-inputs "ncurses"))))
(begin (substitute* '("configure"
"mk/config.mk.in"
"utils/ghc-pkg/ghc.mk"
"inplace/bin/mkdirhier"
"utils/ghc-pkg/ghc.mk")
(("/bin/sh") (which "sh"))
(("/usr/local/bin/bash") (which "sh")))
(substitute* "configure"
(("utils/ghc-pwd/ghc-pwd") (which "pwd")))
;; XXX: The following doesn't change shared libs.
(every (lambda (file)
(zero?
(system (format #f
"~a ~a ~a ~a ~a:~a ~a"
(which "patchelf")
"--set-interpreter"
linker
"--set-rpath"
gmp
ncurses
file))))
(filter executable-file?
(find-files "utils" ""))))))
(alist-delete 'build %standard-phases))
#:tests? #f))
(inputs
`(("gmp" ,gmp)
("libc" ,glibc)
("ncurses" ,ncurses)
("patchelf" ,patchelf)
("perl" ,perl)))
(home-page "http://www.haskell.org/ghc/")
(synopsis "Haskell compiler and interactive environment")
(description
"This is a binary distribution of GHC, a compiler and interactive
environment for the Haskell functional programming language.")
(license (bsd-style "file://LICENSE"
"See LICENSE in the distribution."))))