unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
To: Roel Janssen <roel@gnu.org>
Cc: guix-devel@gnu.org
Subject: Re: [PATCH] Add LDC.
Date: Tue, 29 Dec 2015 16:02:00 +0100	[thread overview]
Message-ID: <idjio3hi9hz.fsf@bimsb-sys02.mdc-berlin.net> (raw)
In-Reply-To: <87ziwtec5x.fsf@gnu.org>

Hi Roel,

Roel Janssen <roel@gnu.org> writes:

> Here is a patch to add the LLVM-based D compiler.  The developers split
> the source code in "submodules".  Since these submodules are specific to
> LDC, they are described in a single package.

I think that’s okay.

> I tried to conform to all style/syntax "rules", so please let me know
> when some formatting is wrong.

thanks for the patch!  Below is a style critique with additional
ramblings.

> From 02ac3c5d71e16dc0851018e04aec817e86c8597c Mon Sep 17 00:00:00 2001
> From: Roel Janssen <roel@gnu.org>
> Date: Tue, 29 Dec 2015 12:06:25 +0100
> Subject: [PATCH] gnu: add LDC.

Please capitalise “add”.

> * gnu/packages/dlanguage.scm (ldc): New variable.
> * gnu/packages/patches/ldc-disable-tests.patch: New file.
> * gnu-system.am (GNU_SYSTEM_MODULES): Add (gnu packages dlanguage).
> * gnu-system.am (dist_patch_DATA): Add patch file.

Actually, since “dlanguage.scm” is a new file it should be something
like this:

  * gnu/packages/dlanguage.scm: New file.
  * gnu/packages/patches/ldc-disable-tests.patch: New file.
  * gnu-system.am (GNU_SYSTEM_MODULES): Add dlanguage.scm.
  (dist_patch_DATA): Add patch file.

Why “dlanguage.scm” and not just “d.scm”?

> @@ -175,6 +175,7 @@ GNU_SYSTEM_MODULES =				\
>    gnu/packages/key-mon.scm			\
>    gnu/packages/kodi.scm				\
>    gnu/packages/language.scm			\
> +  gnu/packages/dlanguage.scm			\
>    gnu/packages/less.scm				\
>    gnu/packages/lesstif.scm			\
>    gnu/packages/libcanberra.scm			\

Could you please place this in alphabetic order?

> +(define-module (gnu packages dlanguage)
> +  #:use-module ((guix licenses) #:prefix license:)
> +  #:use-module (gnu packages)
> +  #:use-module (guix packages)
> +  #:use-module (guix download)
> +  #:use-module (guix build-system cmake)
> +  #:use-module (gnu packages textutils)
> +  #:use-module (gnu packages base)
> +  #:use-module (gnu packages libedit)
> +  #:use-module (gnu packages llvm)
> +  #:use-module (gnu packages zip)
> +  #:use-module (guix git-download))

It would be nice if (guix git-download) were up there with the other
(guix ...) imports.

> +
> +(define-public ldc
> +  (package
> +    (name "ldc")
> +    (version "0.16.1")
> +    (source (origin
> +              (method url-fetch)
> +              (uri (string-append
> +                    "https://github.com/ldc-developers/ldc/archive/v"
> +                    version ".tar.gz"))
> +              (file-name (string-append name "-" version ".tar.gz"))
> +              (sha256
> +               (base32
> +                "1jvilxx0rpqmkbja4m69fhd5g09697xq7vyqp2hz4hvxmmmv4j40"))))
> +    (build-system cmake-build-system)
> +    (supported-systems '("x86_64-linux" "i686-linux"))

Could you add a comment here?  Does upstream say that only these two
systems are supported?

> +    (arguments
> +     `(#:tests? #t

This is the default, so it’s not needed.

> +       #:phases
> +       (modify-phases %standard-phases
> +         (add-after 'unpack 'unpack-phobos-source
> +                    (lambda* (#:key source inputs #:allow-other-keys)
> +                      (with-directory-excursion "runtime/phobos"
> +                        (copy-file (assoc-ref inputs "phobos-src")
> +                                   "phobos-src.tar")
> +                        (zero? (system* "tar" "xvf" "phobos-src.tar"
> +                                        "--strip-components=1")))))

We usually align the “(lambda” with the first “d” in “add-after”.  Why
is “source” among the keys when you don’t use it?  Why copy the file
from the inputs to some other place rather than using (assoc-ref inputs
...) as the argument to “tar”?  (I may have done the same in the icedtea
packages—this probably could also be changed.)

> +         (add-after 'unpack 'unpack-druntime-source
[...]
> +         (add-after 'unpack 'unpack-dmd-testsuite-source

I think all these three phases could be merged into one appropriately
named phase.

> +         (add-after
> +          'unpack-phobos-source 'patch-phobos
> +          (lambda* (#:key source inputs #:allow-other-keys)
> +            (substitute* "runtime/phobos/std/process.d"
> +              (("/bin/sh") (which "sh"))
> +              (("echo") (which "echo")))
> +            (substitute* "runtime/phobos/std/datetime.d"
> +              (("/usr/share/zoneinfo/") (string-append
> +                                         (assoc-ref inputs "tzdata")
> +                                         "/share/zoneinfo")))

Please put the “(string-append” on a new line.

> +            #t))
> +         (add-after
> +          'unpack-dmd-testsuite-source 'patch-dmd-testsuite
> +          (lambda _
> +            (substitute* "tests/d2/dmd-testsuite/Makefile"
> +              (("/bin/bash") (which "bash")))
> +            #t)))))
> +    (inputs
> +     `(("libconfig" ,libconfig)
> +       ("libedit" ,libedit)
> +       ("tzdata" ,tzdata)))  ;; needed for tests

If it’s needed for tests shouldn’t it be among the native-inputs then?

> +    (native-inputs
> +     `(("llvm" ,llvm)

The home page says that the compiler “relies on the LLVM Core libraries
for code generation”.  Doesn’t this mean that llvm should be a regular
input?

> +       ("clang" ,clang)
> +       ("unzip" ,unzip) ;; needed for tests
> +       ("phobos-src"
> +        ,(origin
> +          (method url-fetch)
> +          (uri (string-append
> +                "https://github.com/ldc-developers/phobos/archive/ldc-v"
> +                version ".tar.gz"))
> +          (sha256
> +           (base32
> +            "0sgdj0536c4nb118yiw1f8lqy5d3g3lpg9l99l165lk9xy45l9z4"))
> +          (patches (list (search-patch "ldc-disable-tests.patch")))))

Why is this patch needed?  Can they not be disabled elsewhere?

> +       ("druntime-src"
> +        ,(origin
> +          (method url-fetch)
> +          (uri (string-append
> +                "https://github.com/ldc-developers/druntime/archive/ldc-v"
> +                version ".tar.gz"))
> +          (sha256
> +           (base32
> +            "0z4mkyddx6c4sy1vqgqvavz55083dsxws681qkh93jh1rpby9yg6"))))
> +       ("dmd-testsuite-src"
> +        ,(origin
> +          (method url-fetch)
> +          (uri (string-append
> +                "https://github.com/ldc-developers/dmd-testsuite/archive/ldc-v"
> +                version ".tar.gz"))
> +          (sha256
> +           (base32
> +            "0yc6miidzgl9k33ygk7xcppmfd6kivqj02cvv4fmkbs3qz4yy3z1"))))))
> +    (home-page "https://github.com/ldc-developers/ldc")

Is this really the project home page?  Or is it
“http://wiki.dlang.org/LDC”?

> +    (synopsis "LLVM compiler for the D programming language")

Must “LLVM” be part of the synopsis?  I’d think of this as just a
compiler, not an “LLVM compiler”.

> +    (description
> +     "LDC is a compiler for the D programming Language.  It is based on the
> +latest DMD frontend and uses LLVM as backend.  LLVM provides a fast and modern
> +backend for high quality code generation.  LDC is released under a BSD license
> +with exceptions for the DMD frontend and code from GDC.  The development takes
> +place mostly on x86-32 and x86-64 Linux and that is where LDC works best.")

“D programming Language” —> “D programming language”.
Please remove the third sentence (“LLVM provides...”) because it doesn’t
really describe LDC.  Also the next sentence (“LDC is released
under...”) should not be part of the description (that’s what the
“license” field is there for).

Also the last sentence probably isn’t a good fit for the description.
It would make a good comment for the “supported-systems” field, though.

> +    (license license:bsd-3)))

Please also mention in a comment the exceptions alluded to in the
description.

> diff --git a/gnu/packages/patches/ldc-disable-tests.patch b/gnu/packages/patches/ldc-disable-tests.patch
> new file mode 100644
> index 0000000..42e394d
> --- /dev/null
> +++ b/gnu/packages/patches/ldc-disable-tests.patch
> @@ -0,0 +1,90 @@
> +This patch fixes a failing unit test by feeding buildNormalizedPath to the
> +tzdata properly. Three other tests are disables, one assumes /root and the
> +two others use networking. Not bad out of almost 700 tests!

Please use two spaces between sentences.
s/disables/disabled/.

Is there no other way to disable tests, e.g. by name or by passing some
kind of variable to the build system?

~~ Ricardo

  reply	other threads:[~2015-12-29 15:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-29 11:18 [PATCH] Add LDC Roel Janssen
2015-12-29 15:02 ` Ricardo Wurmus [this message]
2015-12-29 15:37   ` Pjotr Prins
2016-01-04 14:23   ` Roel Janssen
2016-01-05 10:06     ` Ricardo Wurmus
2016-01-05 14:48       ` Roel Janssen
2016-01-05 15:22         ` Ricardo Wurmus
2016-01-05 18:46           ` Roel Janssen
2016-02-27  6:20         ` Pjotr Prins
2016-02-29  9:58           ` Ludovic Courtès
2015-12-29 15:42 ` Ricardo Wurmus

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=idjio3hi9hz.fsf@bimsb-sys02.mdc-berlin.net \
    --to=ricardo.wurmus@mdc-berlin.de \
    --cc=guix-devel@gnu.org \
    --cc=roel@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).