unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Mark H Weaver <mhw@netris.org>
To: Federico Beffa <beffa@ieee.org>
Cc: Guix-devel <guix-devel@gnu.org>
Subject: Re: [PATCH] profiles: Generate GHC's package database cache.
Date: Sun, 05 Apr 2015 01:21:59 -0400	[thread overview]
Message-ID: <87pp7j40aw.fsf@netris.org> (raw)
In-Reply-To: <CAKrPhPNOoT7mfc7B7O4vcCSdagbQJE1WFQdVbiRikLOsu3T54w@mail.gmail.com> (Federico Beffa's message of "Sat, 4 Apr 2015 23:10:57 +0200")

Federico Beffa <beffa@ieee.org> writes:

> From dfe3b875267731006512b8a9803aaa56f07db12e Mon Sep 17 00:00:00 2001
> From: Federico Beffa <beffa@fbengineering.ch>
> 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

  reply	other threads:[~2015-04-05  5:21 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-04 21:10 [PATCH] profiles: Generate GHC's package database cache Federico Beffa
2015-04-05  5:21 ` Mark H Weaver [this message]
2015-04-05  8:16   ` Federico Beffa
2015-04-05 20:24     ` Mark H Weaver
2015-04-05 20:33       ` Federico Beffa
2015-04-06  8:18         ` Federico Beffa
2015-04-06  8:24           ` Mark H Weaver
2015-04-06  8:27             ` Federico Beffa
2015-04-06 19:00               ` Ludovic Courtès
2015-04-10 12:30                 ` Alexandre Héaumé
2015-04-05 20:06 ` Ludovic Courtès
2015-04-05 20:27   ` Federico Beffa
2015-04-15 21:28     ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87pp7j40aw.fsf@netris.org \
    --to=mhw@netris.org \
    --cc=beffa@ieee.org \
    --cc=guix-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).