unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#30009] [PATCH 0/1] gnu: Add selene.
@ 2018-01-06 18:02 Fis Trivial
  2018-01-06 18:04 ` [bug#30009] [PATCH 1/1] " Fis Trivial
  0 siblings, 1 reply; 6+ messages in thread
From: Fis Trivial @ 2018-01-06 18:02 UTC (permalink / raw)
  To: 30009


Hi Guix,

This patch adds Selene, a C++11 binding for Lua.

There are a few things I'm not certain that I did right. So I decided to
add some notes here then somebody else will be able to correct me.
   1. This is a header only library, so in the install phase I just copy
      everything to the output directory explicitly.
   2. There is one test executable calling multiple test files. The path
      of those test files are hard coded. In order to overcome this, I
      modified the check phase to use *copy* and *chdir*. The code looks
      more bash than scheme.
   3. The source version is from the master branch due to the last release
      is quite dated. Besides, the author is seeking for maintainer now. I
      packaged it so that it can serve as dependency for other packages who
      need c++ binding.

fis (1):
  gnu: Add selene.

 gnu/packages/lua.scm | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 62 insertions(+)

--
2.13.6

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

* [bug#30009] [PATCH 1/1] gnu: Add selene.
  2018-01-06 18:02 [bug#30009] [PATCH 0/1] gnu: Add selene Fis Trivial
@ 2018-01-06 18:04 ` Fis Trivial
  2018-01-08  8:58   ` Ludovic Courtès
  0 siblings, 1 reply; 6+ messages in thread
From: Fis Trivial @ 2018-01-06 18:04 UTC (permalink / raw)
  To: 30009@debbugs.gnu.org


* gnu/packages/lua.scm (selene): New public variable.
---
 gnu/packages/lua.scm | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 62 insertions(+)

diff --git a/gnu/packages/lua.scm b/gnu/packages/lua.scm
index 3fd1c43d4..dba704ffe 100644
--- a/gnu/packages/lua.scm
+++ b/gnu/packages/lua.scm
@@ -28,8 +28,11 @@
   #: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 utils)
   #:use-module (guix build-system gnu)
+  #:use-module (guix build-system cmake)
   #:use-module (gnu packages)
   #:use-module (gnu packages readline)
   #:use-module (gnu packages tls)
@@ -434,3 +437,62 @@ on numbers.")

 (define-public lua5.1-bitop
   (make-lua-bitop "lua5.1-bitop" lua-5.1))
+
+(define-public selene
+  (package
+    (name "selene")
+    (version "2017.08.25")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/jeremyong/Selene.git")
+                    ;; The release is quite old.
+                    (commit "ffe1ade2568d4cff5894552be8f43e63e379a4c9")))
+              (file-name "Selene")
+              (sha256
+               (base32
+                "1axrgv3rxxdsaf807lwvklfzicn6x6gpf35narllrnz9lg6hn508"))))
+    (build-system cmake-build-system)
+    (arguments
+     `(#:configure-flags
+       ;; lua pc file in CMakeLists.txt is lua5.3.pc
+       '("-DLUA_PC_CFG=lua;lua-5.3;lua-5.1")
+       #:test-target "all"
+       #:phases
+       ;; This is a header only library
+       (modify-phases %standard-phases
+         (delete 'build)
+         (replace 'install
+           (lambda _
+             (let* ((output     (assoc-ref %outputs "out"))
+                    (source     (assoc-ref %build-inputs "source"))
+                    (includedir (string-append output "/include")))
+               (copy-recursively
+                (string-append source "/include")
+                includedir))
+             #t))
+         ;; The path of test files are hard coded.
+         (replace 'check
+           (lambda _
+             (let* ((output (assoc-ref %output "out"))
+                    (source (assoc-ref %build-inputs "source"))
+                    (builddir   (getcwd))
+                    (testdir    (string-append builddir "/test")))
+               (and
+                (copy-recursively
+                 (string-append source "/test")
+                 testdir)
+                (system* "make")
+                ;; To overcome the hardcoded test path
+                (mkdir-p "runner")
+                (copy-file "./test_runner" "./runner/test_runner")
+                (chdir "./runner")
+                (system* "./test_runner"))))))))
+    (native-inputs
+     `(("lua" ,lua)
+       ("pkg-config" ,pkg-config)))
+    (home-page "https://github.com/jeremyong/Selene")
+    (synopsis "Lua C++11 bindings")
+    (description
+     "Selene is a simple C++11 friendly header-only binding to Lua.")
+    (license license:zlib)))
-- 
2.13.6


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

* [bug#30009] [PATCH 1/1] gnu: Add selene.
  2018-01-06 18:04 ` [bug#30009] [PATCH 1/1] " Fis Trivial
@ 2018-01-08  8:58   ` Ludovic Courtès
  2018-01-08 13:13     ` Fis Trivial
  2018-01-08 17:19     ` [bug#30009] [PATCH] " Fis Trivial
  0 siblings, 2 replies; 6+ messages in thread
From: Ludovic Courtès @ 2018-01-08  8:58 UTC (permalink / raw)
  To: Fis Trivial; +Cc: 30009@debbugs.gnu.org

Hello,

Some mostly cosmetic suggestions, which hopefully answer your questions:

Fis Trivial <ybbs.daans@hotmail.com> skribis:

> * gnu/packages/lua.scm (selene): New public variable.

[...]

> +         (replace 'install
> +           (lambda _
> +             (let* ((output     (assoc-ref %outputs "out"))
> +                    (source     (assoc-ref %build-inputs "source"))
> +                    (includedir (string-append output "/include")))

Avoid the ‘%outputs’ and ‘%build-inputs’ global variables by writing:

  (lambda* (#:key inputs outputs #:allow-other-keys)
    (let ((output (assoc-ref outputs "out")))
      …))

> +         ;; The path of test files are hard coded.
> +         (replace 'check
> +           (lambda _

Likewise.

> +             (let* ((output (assoc-ref %output "out"))
> +                    (source (assoc-ref %build-inputs "source"))
> +                    (builddir   (getcwd))
> +                    (testdir    (string-append builddir "/test")))
> +               (and
> +                (copy-recursively
> +                 (string-append source "/test")
> +                 testdir)
> +                (system* "make")
> +                ;; To overcome the hardcoded test path
> +                (mkdir-p "runner")
> +                (copy-file "./test_runner" "./runner/test_runner")
> +                (chdir "./runner")
> +                (system* "./test_runner"))))))))

Here you can remove ‘and’ and use ‘invoke’ instead of ‘system*’
(‘invoke’ throws an exception when execution fails.)

> +    (home-page "https://github.com/jeremyong/Selene")
> +    (synopsis "Lua C++11 bindings")
> +    (description
> +     "Selene is a simple C++11 friendly header-only binding to Lua.")

It’s a library to create Lua bindings, pretty much like Boost::Python,
isn’t it?  Perhaps the description could clarify that somehow.

Otherwise LGTM.  Could you send an updated patch?

Thank you!

Ludo’.

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

* [bug#30009] [PATCH 1/1] gnu: Add selene.
  2018-01-08  8:58   ` Ludovic Courtès
@ 2018-01-08 13:13     ` Fis Trivial
  2018-01-08 17:19     ` [bug#30009] [PATCH] " Fis Trivial
  1 sibling, 0 replies; 6+ messages in thread
From: Fis Trivial @ 2018-01-08 13:13 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 30009@debbugs.gnu.org

> 
> It’s a library to create Lua bindings, pretty much like Boost::Python,
> isn’t it?  Perhaps the description could clarify that somehow.
> 

This one is header only. I will try to add better description.

>
> Otherwise LGTM.  Could you send an updated patch?
>

I will sent another patch that fix these a few days latter.
Thanks for the help.

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

* [bug#30009] [PATCH] gnu: Add selene.
  2018-01-08  8:58   ` Ludovic Courtès
  2018-01-08 13:13     ` Fis Trivial
@ 2018-01-08 17:19     ` Fis Trivial
  2018-01-11 20:47       ` bug#30009: " Ludovic Courtès
  1 sibling, 1 reply; 6+ messages in thread
From: Fis Trivial @ 2018-01-08 17:19 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 30009@debbugs.gnu.org


* gnu/packages/lua.scm (selene): New public variable.
---
 gnu/packages/lua.scm | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 60 insertions(+)

diff --git a/gnu/packages/lua.scm b/gnu/packages/lua.scm
index 3fd1c43d4..b375ff90c 100644
--- a/gnu/packages/lua.scm
+++ b/gnu/packages/lua.scm
@@ -8,6 +8,7 @@
 ;;; Copyright © 2016 doncatnip <gnopap@gmail.com>
 ;;; Copyright © 2016, 2017 Clément Lassieur <clement@lassieur.org>
 ;;; Copyright © 2016 José Miguel Sánchez García <jmi2k@openmailbox.org>
+;;; Copyright © 2018 Fis Trivial <ybbs.daans@hotmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -28,8 +29,11 @@
   #: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 utils)
   #:use-module (guix build-system gnu)
+  #:use-module (guix build-system cmake)
   #:use-module (gnu packages)
   #:use-module (gnu packages readline)
   #:use-module (gnu packages tls)
@@ -434,3 +438,59 @@ on numbers.")

 (define-public lua5.1-bitop
   (make-lua-bitop "lua5.1-bitop" lua-5.1))
+
+(define-public selene
+  (package
+    (name "selene")
+    (version "2017.08.25")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/jeremyong/Selene.git")
+                    ;; The release is quite old.
+                    (commit "ffe1ade2568d4cff5894552be8f43e63e379a4c9")))
+              (file-name "Selene")
+              (sha256
+               (base32
+                "1axrgv3rxxdsaf807lwvklfzicn6x6gpf35narllrnz9lg6hn508"))))
+    (build-system cmake-build-system)
+    (arguments
+     `(#:configure-flags
+       ;; lua pc file in CMakeLists.txt is lua5.3.pc
+       '("-DLUA_PC_CFG=lua;lua-5.3;lua-5.1")
+       #:test-target "all"
+       #:phases
+       ;; This is a header only library
+       (modify-phases %standard-phases
+         (delete 'build)
+         (replace 'install
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let* ((output (assoc-ref outputs "out"))
+                    (source (assoc-ref inputs "source"))
+                    (includedir (string-append output "/include")))
+               (copy-recursively
+                (string-append source "/include")
+                includedir))
+             #t))
+         ;; The path of test files are hard coded.
+         (replace 'check
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let* ((output (assoc-ref outputs "out"))
+                    (source (assoc-ref inputs "source"))
+                    (builddir (getcwd))
+                    (testdir  (string-append builddir "/test")))
+               (copy-recursively (string-append source "/test") testdir)
+               (invoke "make")
+               (mkdir-p "runner")
+               (copy-file "./test_runner" "./runner/test_runner")
+               (chdir "./runner")
+               (invoke "./test_runner")))))))
+    (native-inputs
+     `(("lua" ,lua)
+       ("pkg-config" ,pkg-config)))
+    (home-page "https://github.com/jeremyong/Selene")
+    (synopsis "Lua C++11 bindings")
+    (description
+     "Selene is a simple C++11 header-only library enabling seamless
+ interoperability between C++ and Lua programming language.")
+    (license license:zlib)))
-- 
2.13.6


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

* bug#30009: [PATCH] gnu: Add selene.
  2018-01-08 17:19     ` [bug#30009] [PATCH] " Fis Trivial
@ 2018-01-11 20:47       ` Ludovic Courtès
  0 siblings, 0 replies; 6+ messages in thread
From: Ludovic Courtès @ 2018-01-11 20:47 UTC (permalink / raw)
  To: Fis Trivial; +Cc: 30009-done

Fis Trivial <ybbs.daans@hotmail.com> skribis:

> * gnu/packages/lua.scm (selene): New public variable.

Perfect.  Applied, thanks!

Ludo’.

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

end of thread, other threads:[~2018-01-11 20:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-06 18:02 [bug#30009] [PATCH 0/1] gnu: Add selene Fis Trivial
2018-01-06 18:04 ` [bug#30009] [PATCH 1/1] " Fis Trivial
2018-01-08  8:58   ` Ludovic Courtès
2018-01-08 13:13     ` Fis Trivial
2018-01-08 17:19     ` [bug#30009] [PATCH] " Fis Trivial
2018-01-11 20:47       ` bug#30009: " Ludovic Courtès

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).