all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH 1/2] gnu: idris: Update to 0.99.
@ 2016-12-15 17:28 David Craven
  2016-12-15 17:28 ` [PATCH 2/2] gnu: Add idris-lightyear David Craven
  2016-12-19 14:13 ` [PATCH 1/2] gnu: idris: Update to 0.99 Ludovic Courtès
  0 siblings, 2 replies; 6+ messages in thread
From: David Craven @ 2016-12-15 17:28 UTC (permalink / raw)
  To: guix-devel

* gnu/packages/haskell.scm (idris): Update to 0.99.
---
 gnu/local.mk                                       |  2 +
 gnu/packages/haskell.scm                           | 35 ++++++++--------
 .../patches/idris-IDRIS_LIBRARY_PATH.patch         | 46 ++++++++++++++++++++++
 gnu/packages/patches/idris-install-to-TARGET.patch | 27 +++++++++++++
 4 files changed, 91 insertions(+), 19 deletions(-)
 create mode 100644 gnu/packages/patches/idris-IDRIS_LIBRARY_PATH.patch
 create mode 100644 gnu/packages/patches/idris-install-to-TARGET.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 739d92a7b..af6e36618 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -632,6 +632,8 @@ dist_patch_DATA =						\
   %D%/packages/patches/icu4c-CVE-2014-6585.patch		\
   %D%/packages/patches/icu4c-CVE-2015-1270.patch		\
   %D%/packages/patches/icu4c-CVE-2015-4760.patch		\
+  %D%/packages/patches/idris-IDRIS_LIBRARY_PATH.patch		\
+  %D%/packages/patches/idris-install-to-TARGET.patch		\
   %D%/packages/patches/id3lib-CVE-2007-4460.patch			\
   %D%/packages/patches/ilmbase-fix-tests.patch			\
   %D%/packages/patches/inkscape-drop-wait-for-targets.patch	\
diff --git a/gnu/packages/haskell.scm b/gnu/packages/haskell.scm
index 8e5927a00..2f75c6c37 100644
--- a/gnu/packages/haskell.scm
+++ b/gnu/packages/haskell.scm
@@ -32,6 +32,7 @@
   #:use-module (guix utils)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system haskell)
+  #:use-module (gnu packages)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages compression)
@@ -6670,24 +6671,9 @@ constant-time:
     (license license:bsd-3)))
 
 (define-public idris
-  ;; TODO: IDRIS_LIBRARY_PATH only accepts a single path and not a colon
-  ;; separated list.
-  ;; TODO: When installing idris the location of the standard libraries
-  ;; cannot be specified.
-  ;; NOTE: Creating an idris build system:
-  ;; Idris packages can be packaged and installed using a trivial
-  ;; build system.
-  ;; (zero? (system* (string-append idris "/bin/idris")
-  ;;                                "--ibcsubdir"
-  ;;                                (string-append out "/idris/libs/lightyear")
-  ;;                                "--install" "lightyear.ipkg")
-  ;; (native-search-paths
-  ;;   (list (search-path-specification
-  ;;          (variable "IDRIS_LIBRARY_PATH")
-  ;;          (files '("idris/libs")))))
   (package
     (name "idris")
-    (version "0.12.3")
+    (version "0.99")
     (source (origin
               (method url-fetch)
               (uri (string-append
@@ -6695,7 +6681,9 @@ constant-time:
                     "idris-" version "/idris-" version ".tar.gz"))
               (sha256
                (base32
-                "1ijrbgzaahw9aagn4al55nqcggrg9ajlrkq2fjc1saq3xdd3v7rs"))))
+                "1sd4vy5rx0mp32xj99qijhknkgw4d2rxvz6wiy3pym6kaqmc497i"))
+              (patches (search-patches "idris-IDRIS_LIBRARY_PATH.patch"
+                                       "idris-install-to-TARGET.patch"))))
     (build-system haskell-build-system)
     (arguments
      `(;; FIXME: runhaskell Setup.hs test doesn't set paths required by test
@@ -6704,8 +6692,13 @@ constant-time:
        #:phases
        (modify-phases %standard-phases
          (add-before 'configure 'patch-cc-command
-           (lambda _
-             (setenv "CC" "gcc"))))))
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (lib (string-append out "/idris")))
+               (setenv "CC" "gcc")
+               ;; TARGET sets the path that the idris stdlibs are installed to.
+               (setenv "TARGET" lib))
+             #t)))))
     (inputs
      `(("gmp" ,gmp)
        ("ncurses" ,ncurses)
@@ -6741,6 +6734,10 @@ constant-time:
        ("ghc-vector" ,ghc-vector)
        ("ghc-zip-archive" ,ghc-zip-archive)
        ("ghc-zlib" ,ghc-zlib)))
+    (native-search-paths
+     (list (search-path-specification
+            (variable "IDRIS_LIBRARY_PATH")
+            (files '("idris/libs")))))
     (home-page "http://www.idris-lang.org")
     (synopsis "General purpose language with full dependent types")
     (description "Idris is a general purpose language with full dependent
diff --git a/gnu/packages/patches/idris-IDRIS_LIBRARY_PATH.patch b/gnu/packages/patches/idris-IDRIS_LIBRARY_PATH.patch
new file mode 100644
index 000000000..97a2f5bd3
--- /dev/null
+++ b/gnu/packages/patches/idris-IDRIS_LIBRARY_PATH.patch
@@ -0,0 +1,46 @@
+From 8617ba8f391da875ea0d59c6b8fdce26b64e2abd Mon Sep 17 00:00:00 2001
+From: David Craven <david@craven.ch>
+Date: Sun, 6 Nov 2016 15:46:50 +0100
+Subject: [PATCH 1/2] IDRIS_LIBRARY_PATH accepts a colon separated search path.
+
+* src/Idris/Imports.hs (installedPackages): SplitOn colon and concatMap
+  the results.
+---
+ src/Idris/Imports.hs | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/src/Idris/Imports.hs b/src/Idris/Imports.hs
+index f7bec7be..7018ec57 100644
+--- a/src/Idris/Imports.hs
++++ b/src/Idris/Imports.hs
+@@ -18,6 +18,7 @@ import IRTS.System (getIdrisLibDir)
+ import Control.Applicative ((<$>))
+ import Control.Monad.State.Strict
+ import Data.List (isSuffixOf)
++import Data.List.Split (splitOn)
+ import System.Directory
+ import System.FilePath
+ 
+@@ -94,7 +95,7 @@ findPkgIndex p = do let idx = pkgIndex p
+ installedPackages :: IO [String]
+ installedPackages = do
+   idir <- getIdrisLibDir
+-  filterM (goodDir idir) =<< dirContents idir
++  filterM (goodDir idir) =<< concat <$> (mapM dirContents (splitOn ":" idir))
+   where
+   allFilesInDir base fp = do
+     let fullpath = base </> fp
+@@ -102,7 +103,9 @@ installedPackages = do
+     if isDir
+       then fmap concat (mapM (allFilesInDir fullpath) =<< dirContents fullpath)
+       else return [fp]
+-  dirContents = fmap (filter (not . (`elem` [".", ".."]))) . getDirectoryContents
++  prependDirname dir = fmap (fmap (dir </>))
++  filterPaths = fmap (filter (not . (`elem` [".", ".."])))
++  dirContents dir = prependDirname dir (filterPaths (getDirectoryContents dir))
+   goodDir idir d = any (".ibc" `isSuffixOf`) <$> allFilesInDir idir d
+ 
+ 
+-- 
+2.11.0
+
diff --git a/gnu/packages/patches/idris-install-to-TARGET.patch b/gnu/packages/patches/idris-install-to-TARGET.patch
new file mode 100644
index 000000000..695044e8d
--- /dev/null
+++ b/gnu/packages/patches/idris-install-to-TARGET.patch
@@ -0,0 +1,27 @@
+From 51d84e9adde98b4acf734c0f2631c8d956d2e281 Mon Sep 17 00:00:00 2001
+From: David Craven <david@craven.ch>
+Date: Sun, 6 Nov 2016 16:12:54 +0100
+Subject: [PATCH 2/2] Override default library install path with TARGET.
+
+* Setup.hs (idrisInstall): installStdLib to TARGET when set.
+---
+ Setup.hs | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/Setup.hs b/Setup.hs
+index 8f58b6b3..affb61dc 100644
+--- a/Setup.hs
++++ b/Setup.hs
+@@ -254,7 +254,8 @@ idrisInstall verbosity copy pkg local = unless (execOnly (configFlags local)) $
+       target = datadir $ L.absoluteInstallDirs pkg local copy
+ 
+       installStdLib = do
+-        let target' = target -- </> "libs"
++        envTarget <- lookupEnv "TARGET"
++        let target' = maybe target id envTarget -- </> "libs"
+         putStrLn $ "Installing libraries in " ++ target'
+         makeInstall "libs" target'
+ 
+-- 
+2.11.0
+
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] gnu: Add idris-lightyear.
  2016-12-15 17:28 [PATCH 1/2] gnu: idris: Update to 0.99 David Craven
@ 2016-12-15 17:28 ` David Craven
  2016-12-19 14:14   ` Ludovic Courtès
  2016-12-19 14:13 ` [PATCH 1/2] gnu: idris: Update to 0.99 Ludovic Courtès
  1 sibling, 1 reply; 6+ messages in thread
From: David Craven @ 2016-12-15 17:28 UTC (permalink / raw)
  To: guix-devel

* gnu/packages/haskell.scm (idris-lightyear): New variable.
---
 gnu/packages/haskell.scm | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/gnu/packages/haskell.scm b/gnu/packages/haskell.scm
index 2f75c6c37..54fdba72f 100644
--- a/gnu/packages/haskell.scm
+++ b/gnu/packages/haskell.scm
@@ -29,6 +29,7 @@
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix packages)
   #:use-module (guix download)
+  #:use-module (guix git-download)
   #:use-module (guix utils)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system haskell)
@@ -6747,6 +6748,51 @@ can be specified precisely in the type.  The language is closely related to
 Epigram and Agda.")
     (license license:bsd-3)))
 
+(define-public idris-lightyear
+  (let ((commit "6d65ad111b4bed2bc131396f8385528fc6b3678a")
+        (revision "1"))
+    (package
+      (name "idris-lightyear")
+      (version (string-append "0.1-" revision "."
+                              (string-take commit 7)))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/ziman/lightyear")
+                      (commit commit)))
+                (file-name (string-append name "-" version "-checkout"))
+                (sha256
+                 (base32
+                  "1pkxnn3ryr0v0cin4nasw7kgkc9dnnpja1nfbj466mf3qv5s98af"))))
+      ;; Uses the gnu-build-system so that the IDRIS_LIBRARY_PATH is set.
+      (build-system gnu-build-system)
+      (native-inputs
+       `(("idris" ,idris)))
+      (arguments
+       `(#:phases
+         (modify-phases %standard-phases
+           (delete 'configure)
+           (delete 'build)
+           (delete 'check)
+           (replace 'install
+             (lambda* (#:key inputs outputs #:allow-other-keys)
+               (let* ((out (assoc-ref outputs "out"))
+                      (src (assoc-ref inputs "source"))
+                      (idris (assoc-ref inputs "idris"))
+                      (libs (string-append out "/idris/libs/lightyear")))
+                 (mkdir-p libs)
+                 (zero? (system* (string-append idris "/bin/idris")
+                          "--ibcsubdir" libs
+                          "--install" "lightyear.ipkg"))
+                 ;; Seems to be a bug in idris.
+                 #t))))))
+      (home-page "https://github.com/ziman/lightyear")
+      (synopsis "Lightweight parser combinator library for Idris")
+      (description "Lightweight parser combinator library for Idris, inspired
+by Parsec.  This package is used (almost) the same way as Parsec, except for one
+difference: backtracking.")
+      (license license:bsd-2))))
+
 (define-public ghc-base16-bytestring
   (package
     (name "ghc-base16-bytestring")
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] gnu: idris: Update to 0.99.
  2016-12-15 17:28 [PATCH 1/2] gnu: idris: Update to 0.99 David Craven
  2016-12-15 17:28 ` [PATCH 2/2] gnu: Add idris-lightyear David Craven
@ 2016-12-19 14:13 ` Ludovic Courtès
  2016-12-19 14:17   ` David Craven
  1 sibling, 1 reply; 6+ messages in thread
From: Ludovic Courtès @ 2016-12-19 14:13 UTC (permalink / raw)
  To: David Craven; +Cc: guix-devel

Hi!

David Craven <david@craven.ch> skribis:

> * gnu/packages/haskell.scm (idris): Update to 0.99.

[...]

> +    (native-search-paths
> +     (list (search-path-specification
> +            (variable "IDRIS_LIBRARY_PATH")
> +            (files '("idris/libs")))))

The conventional thing would be to use “lib/idris” (just like we have
“lib/perl5”, “lib/python2.7”, “lib/guile”, etc.)  Could you make this
change?

I suppose it’s OK to make this change now since there are no Idris
libraries packaged yet.

> +++ b/gnu/packages/patches/idris-IDRIS_LIBRARY_PATH.patch
> @@ -0,0 +1,46 @@
> +From 8617ba8f391da875ea0d59c6b8fdce26b64e2abd Mon Sep 17 00:00:00 2001
> +From: David Craven <david@craven.ch>
> +Date: Sun, 6 Nov 2016 15:46:50 +0100
> +Subject: [PATCH 1/2] IDRIS_LIBRARY_PATH accepts a colon separated search path.
> +
> +* src/Idris/Imports.hs (installedPackages): SplitOn colon and concatMap
> +  the results.

Could you indicate what the upstream status of this patch is?

If you haven’t done it yet, I encourage you to submit it upstream: it
looks like there’s no reason not to have it upstream.

Otherwise LGTM.

Thank you!

Ludo’.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] gnu: Add idris-lightyear.
  2016-12-15 17:28 ` [PATCH 2/2] gnu: Add idris-lightyear David Craven
@ 2016-12-19 14:14   ` Ludovic Courtès
  0 siblings, 0 replies; 6+ messages in thread
From: Ludovic Courtès @ 2016-12-19 14:14 UTC (permalink / raw)
  To: David Craven; +Cc: guix-devel

David Craven <david@craven.ch> skribis:

> * gnu/packages/haskell.scm (idris-lightyear): New variable.

[...]

> +             (lambda* (#:key inputs outputs #:allow-other-keys)
> +               (let* ((out (assoc-ref outputs "out"))
> +                      (src (assoc-ref inputs "source"))
> +                      (idris (assoc-ref inputs "idris"))
> +                      (libs (string-append out "/idris/libs/lightyear")))

This would become “lib/idris/lightyear”.

Apart from that, LGTM!

Thank you,
Ludo’.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] gnu: idris: Update to 0.99.
  2016-12-19 14:13 ` [PATCH 1/2] gnu: idris: Update to 0.99 Ludovic Courtès
@ 2016-12-19 14:17   ` David Craven
  2016-12-19 16:22     ` Ludovic Courtès
  0 siblings, 1 reply; 6+ messages in thread
From: David Craven @ 2016-12-19 14:17 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

> The conventional thing would be to use “lib/idris” (just like we have
> “lib/perl5”, “lib/python2.7”, “lib/guile”, etc.)  Could you make this
> change?

you're right, much better. thank you.

> If you haven’t done it yet, I encourage you to submit it upstream: it
> looks like there’s no reason not to have it upstream.

It still needs some work, the goal is to get it upstream. Still needs
more testing and it's not a complete solution yet, but only a partial
one.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] gnu: idris: Update to 0.99.
  2016-12-19 14:17   ` David Craven
@ 2016-12-19 16:22     ` Ludovic Courtès
  0 siblings, 0 replies; 6+ messages in thread
From: Ludovic Courtès @ 2016-12-19 16:22 UTC (permalink / raw)
  To: David Craven; +Cc: guix-devel

David Craven <david@craven.ch> skribis:

>> The conventional thing would be to use “lib/idris” (just like we have
>> “lib/perl5”, “lib/python2.7”, “lib/guile”, etc.)  Could you make this
>> change?
>
> you're right, much better. thank you.
>
>> If you haven’t done it yet, I encourage you to submit it upstream: it
>> looks like there’s no reason not to have it upstream.
>
> It still needs some work, the goal is to get it upstream. Still needs
> more testing and it's not a complete solution yet, but only a partial
> one.

OK.  Well it’s probably good enough for our own use.  Maybe just add a
note in the patch that this is not submitted yet.

Thanks!

Ludo’.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-12-19 16:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-15 17:28 [PATCH 1/2] gnu: idris: Update to 0.99 David Craven
2016-12-15 17:28 ` [PATCH 2/2] gnu: Add idris-lightyear David Craven
2016-12-19 14:14   ` Ludovic Courtès
2016-12-19 14:13 ` [PATCH 1/2] gnu: idris: Update to 0.99 Ludovic Courtès
2016-12-19 14:17   ` David Craven
2016-12-19 16:22     ` Ludovic Courtès

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.