[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] profiles: Generate GHC's package database cache.
From: |
Mark H Weaver |
Subject: |
Re: [PATCH] profiles: Generate GHC's package database cache. |
Date: |
Sun, 05 Apr 2015 01:21:59 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
Federico Beffa <address@hidden> writes:
> From dfe3b875267731006512b8a9803aaa56f07db12e Mon Sep 17 00:00:00 2001
> From: Federico Beffa <address@hidden>
> Date: Sat, 4 Apr 2015 22:51:13 +0200
> Subject: [PATCH] profiles: Generate GHC's package database cache.
[...]
> +(define (ghc-package-cache-file manifest)
> + "Return a derivation that builds the GHC 'package.cache' file for all the
> +entries of MANIFEST."
> + (define ghc ;lazy reference
> + (module-ref (resolve-interface '(gnu packages haskell)) 'ghc))
> +
> + (define build
> + #~(begin
> + (use-modules (guix build utils)
> + (srfi srfi-1) (srfi srfi-26)
> + (ice-9 ftw))
> +
> + (define ghc-name-version
> + (let* ((base (basename #+ghc)))
> + (string-drop base
> + (+ 1 (string-index base #\-)))))
> +
> + (define db-subdir
> + (string-append "lib/" ghc-name-version "/package.conf.d"))
> +
> + (define db-dir
> + (string-append #$output "/" db-subdir))
> +
> + (define (conf-files top)
> + (find-files (string-append top "/" db-subdir) "\\.conf$"))
> +
> + (define (copy-conf-file conf)
> + (let ((base (basename conf)))
> + (copy-file conf (string-append db-dir "/" base))))
> +
> + (system* (string-append #+ghc "/bin/ghc-pkg") "init" db-dir)
> + (for-each copy-conf-file
> + (append-map conf-files
> + '#$(manifest-inputs manifest)))
> + (let ((success
> + (zero?
> + (system* (string-append #+ghc "/bin/ghc-pkg") "recache"
> + (string-append "--package-db=" db-dir)))))
> + (for-each delete-file (find-files db-dir "\\.conf$"))
> + success)))
> +
> + ;; Don't depend on GHC when there's nothing to do.
> + (if (null? (manifest-entries manifest))
> + (gexp->derivation "ghc-package-cache" #~(mkdir #$output))
> + (gexp->derivation "ghc-package-cache" build
> + #:modules '((guix build utils))
> + #:local-build? #t)))
I believe this will require GHC to build *any* non-empty profile. Since
GHC is only available on Intel platforms, this will break profile
building on MIPS and ARM.
Even on Intel platforms, I don't want to have to install GHC to build
profiles that don't contain any Haskell packages, especially since it
involves trusting the upstream binaries from GHC.
What if I want to use Hugs instead, or some other Haskell implementation
that is capable of being bootstrapped from source code. Is GHC the only
tool that can do this job?
Mark
- [PATCH] profiles: Generate GHC's package database cache., Federico Beffa, 2015/04/04
- Re: [PATCH] profiles: Generate GHC's package database cache.,
Mark H Weaver <=
- Re: [PATCH] profiles: Generate GHC's package database cache., Federico Beffa, 2015/04/05
- Re: [PATCH] profiles: Generate GHC's package database cache., Mark H Weaver, 2015/04/05
- Re: [PATCH] profiles: Generate GHC's package database cache., Federico Beffa, 2015/04/05
- Re: [PATCH] profiles: Generate GHC's package database cache., Federico Beffa, 2015/04/06
- Re: [PATCH] profiles: Generate GHC's package database cache., Mark H Weaver, 2015/04/06
- Re: [PATCH] profiles: Generate GHC's package database cache., Federico Beffa, 2015/04/06
- Re: [PATCH] profiles: Generate GHC's package database cache., Ludovic Courtès, 2015/04/06
- Re: [PATCH] profiles: Generate GHC's package database cache., Alexandre Héaumé, 2015/04/10
Re: [PATCH] profiles: Generate GHC's package database cache., Ludovic Courtès, 2015/04/05