(define-public ghc-4
(arguments
`(#:system "i686-linux"
#:strip-binaries? #f
+ #:modules ((guix build gnu-build-system)
+ (guix build utils)
+ (srfi srfi-1)
+ (ice-9 match))
#:phases
(modify-phases %standard-phases
+ (add-after 'unpack 'unpack-generated-c-code
+ (lambda* (#:key inputs #:allow-other-keys)
+ (let ((tarball
+ (match inputs
+ (((_ . locations) ...)
+ (let ((suffix (string-append "ghc-" ,version "-hc-unreg.tar.bz2")))
+ (find (lambda (location)
+ (string-suffix? suffix location))
+ locations))))))
+ (invoke "tar" "-xvf" tarball
+ "--strip-components=1"))))
(replace 'bootstrap
(lambda* (#:key inputs #:allow-other-keys)
(delete-file "configure")
(define-public ghc-4
(("FPTOOLS_HAPPY") "echo sure\n"))
;; Set options suggested in ghc/interpreter/README.BUILDING.HUGS.
+ #;
(with-output-to-file "mk/build.mk"
(lambda ()
(display "
(define-public ghc-4
(substitute* "mk/config.mk.in"
(("-traditional")
"-traditional -x c"))
+ (substitute* "mk/config.mk.in"
+ (("^GhcWithNativeCodeGen=.*")
+ "GhcWithNativeCodeGen=NO\n"))
(setenv "CPP" (which "cpp"))
(invoke "autoreconf" "--verbose" "--force")))
(define-public ghc-4
(or (getenv "CPATH") "")))
(invoke "make" "boot")))
(replace 'build
- (lambda _
- ;; TODO: since we don't have a Haskell compiler we cannot build
- ;; the standard library. And without the standard library we
- ;; cannot build a Haskell compiler.
- ;; make[3]: *** No rule to make target 'Array.o', needed by 'libHSstd.a'. Stop.
- ;; make[2]: *** No rule to make target 'utils/Argv.o', needed by 'hsc'. Stop.
- (invoke "make" "all")))
+ (lambda* (#:key build inputs outputs #:allow-other-keys)
+ (let ((bash (which "bash"))
+ (out (assoc-ref outputs "out")))
+ (substitute* "distrib/hc-build"
+ (("gmake") "make"))
+ (substitute* "ghc/includes/TailCalls.h"
+ (("extern void __DISCARD.*") "")
+ (("__DISCARD__ ?\\(\\);") ""))
+ (substitute* "ghc/compiler/Makefile"
+ (("parser/hschooks.o" m)
+ (string-append m " ../lib/std/libHSstd.a")))
+ (invoke "sh" "distrib/hc-build"
+ (string-append "--prefix=" out)
+ (string-append "--build=" build)
+ (string-append "--host=" build)))))
+ #;
(add-after 'build 'build-hugs
(lambda _
(invoke "make" "-C" "ghc/interpreter")
- (invoke "make" "-C" "ghc/interpreter" "install")))
+ (invoke "make" "-C" "ghc/interpreter" "install")))
+ #;
(add-after 'install 'install-sources
(lambda* (#:key outputs #:allow-other-keys)
(let ((lib (string-append (assoc-ref outputs "out") "/lib")))
(define-public ghc-4
(copy-recursively "ghc/compiler"
(string-append lib "/ghc/compiler"))
(copy-recursively "ghc/interpreter/lib" lib)
+ #;
(install-file "ghc/interpreter/nHandle.so" lib)))))))
(native-inputs
(list autoconf-2.13
(define-public ghc-4
;; TODO: Perl used to allow setting $* to enable multi-line
;; matching. If we want to use a more recent Perl we need to patch
;; all expressions that require multi-line matching. Hard to tell.
- perl-5.14))
+ perl-5.14
+
+ (origin
+ (method url-fetch)
+ (uri (string-append "http://downloads.haskell.org/~ghc/"
+ version "/ghc-" version "-hc-unreg.tar.bz2"))
+ (sha256
+ (base32
+ "0sd6q2hckbj31jalanap00r674129s10s1hizpw84b1cmzrww0qx")))))
(home-page "https://www.haskell.org/ghc")
(synopsis "The Glasgow Haskell Compiler")
(description