guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] gnu: Add laby.


From: Jan Nieuwenhuizen
Subject: Re: [PATCH] gnu: Add laby.
Date: Thu, 11 Feb 2016 23:21:30 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

Efraim Flashner writes:

> The patch isn't registered in gnu-system.am, so that should be why.

Ah... And also, ocaml-findlib was missing and lablgtk did not compile
cmxa files, which laby needs.  So, three patches to get a running Laby.

> That's all I have to add, other than I'm also looking forward to playing the
> game.


:-)

Greetings, Jan

>From 0a2531c254a33d49de6ac70cc941c3306592bf34 Mon Sep 17 00:00:00 2001
From: Jan Nieuwenhuizen <address@hidden>
Date: Thu, 11 Feb 2016 18:52:15 +0100
Subject: [PATCH 1/3] gnu: lablgtk: also build cmxa libraries.

    * gnu/packages/ocaml.scm (lablgtk): use "opt" to build *.cmxa files,
      set OCAMLPATH to find them.
---
 gnu/packages/ocaml.scm | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
index 1311b1b..434b9d8 100644
--- a/gnu/packages/ocaml.scm
+++ b/gnu/packages/ocaml.scm
@@ -455,6 +455,10 @@ provers.")
             (base32
               "1bybn3jafxf4cx25zvn8h2xj9agn1xjbn7j3ywxxqx6az7rfnnwp"))))
     (build-system gnu-build-system)
+   (native-search-paths
+    (list (search-path-specification
+           (variable "OCAMLPATH")
+           (files (list (string-append "lib/ocaml"))))))
     (native-inputs
      `(("camlp4" ,camlp4)
        ("ocaml" ,ocaml)
@@ -471,6 +475,8 @@ provers.")
     (arguments
      `(#:tests? #f ; no check target
 
+       ;; opt: also install cmxa files
+       #:make-flags (list "all" "opt")
        ;; Occasionally we would get "Error: Unbound module GtkThread" when
        ;; compiling 'gtkThInit.ml', with 'make -j'.  So build sequentially.
        #:parallel-build? #f
-- 
2.1.4

>From 50daba8389a3cfa0f2d33ddf1abdd7e92065f152 Mon Sep 17 00:00:00 2001
From: Jan Nieuwenhuizen <address@hidden>
Date: Thu, 11 Feb 2016 18:53:07 +0100
Subject: [PATCH 2/3] gnu: Add ocaml-findlib.

    * gnu/packages/ocaml.scm (ocaml-findlib): New variable.
    * gnu/packages/patches/ocaml-findlib-make-install.patch: New file.
    * gnu-system.am (dist_patch_DATA): Register it.
---
 gnu-system.am                                      |  1 +
 gnu/packages/ocaml.scm                             | 51 ++++++++++++++++++++++
 .../patches/ocaml-findlib-make-install.patch       | 11 +++++
 3 files changed, 63 insertions(+)
 create mode 100644 gnu/packages/patches/ocaml-findlib-make-install.patch

diff --git a/gnu-system.am b/gnu-system.am
index 3b5f241..0cd2ca3 100644
--- a/gnu-system.am
+++ b/gnu-system.am
@@ -624,6 +624,7 @@ dist_patch_DATA =                                           
\
   gnu/packages/patches/nvi-assume-preserve-path.patch          \
   gnu/packages/patches/nvi-dbpagesize-binpower.patch           \
   gnu/packages/patches/nvi-db4.patch                           \
+  gnu/packages/patches/ocaml-findlib-make-install.patch        \
   gnu/packages/patches/openexr-missing-samples.patch           \
   gnu/packages/patches/openimageio-boost-1.60.patch            \
   gnu/packages/patches/openjpeg-CVE-2015-6581.patch            \
diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
index 434b9d8..759fdad 100644
--- a/gnu/packages/ocaml.scm
+++ b/gnu/packages/ocaml.scm
@@ -4,6 +4,7 @@
 ;;; Copyright © 2015 Andreas Enge <address@hidden>
 ;;; Copyright © 2015 David Hashe <address@hidden>
 ;;; Copyright © 2016 Eric Bavier <address@hidden>
+;;; Copyright © 2016 Jan Nieuwenhuizen <address@hidden>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -42,6 +43,7 @@
   #:use-module (gnu packages lynx)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages python)
+  #:use-module (gnu packages m4)
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages version-control)
   #:use-module (gnu packages curl))
@@ -619,3 +621,52 @@ a collection of files and directories to be stored on 
different hosts
 brought up to date by propagating the changes in each replica
 to the other.")
     (license gpl3+)))
+
+(define-public ocaml-findlib
+  (package
+    (name "ocaml-findlib")
+    (version "1.6.1")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "http://download.camlcity.org/download/";
+                                  "findlib" "-" version ".tar.gz"))
+              (sha256
+               (base32
+                "02abg1lsnwvjg3igdyb8qjgr5kv1nbwl4gaf8mdinzfii5p82721"))
+              (patches
+               (list (search-patch "ocaml-findlib-make-install.patch")))))
+    (build-system gnu-build-system)
+    (inputs
+     `(("camlp4" ,camlp4)
+       ("m4" ,m4)
+       ("ocaml" ,ocaml)))
+    (arguments
+     `(#:tests? #f  ; no test suite
+       #:parallel-build? #f
+       #:make-flags (list "all" "opt")
+       #:phases (modify-phases %standard-phases
+                  (replace
+                   'configure
+                   (lambda* (#:key inputs outputs #:allow-other-keys)
+                     (let ((out (assoc-ref outputs "out")))
+                       (system*
+                        "./configure"
+                        "-bindir" (string-append out "/bin")
+                        "-config" (string-append out "/etc/ocamfind.conf")
+                        "-mandir" (string-append out "/share/man")
+                        "-sitelib" (string-append out "/lib/ocaml/site-lib")
+                        "-with-toolbox")))))))
+    (home-page "http://projects.camlcity.org/projects/findlib.html";)
+    (synopsis "Management tool for OCaml libraries")
+    (description
+     "The \"findlib\" library provides a scheme to manage reusable software
+components (packages), and includes tools that support this scheme.  Packages
+are collections of OCaml modules for which metainformation can be stored.  The
+packages are kept in the filesystem hierarchy, but with strict directory
+structure.  The library contains functions to look the directory up that
+stores a package, to query metainformation about a package, and to retrieve
+dependency information about multiple packages.  There is also a tool that
+allows the user to enter queries on the command-line.  In order to simplify
+compilation and linkage, there are new frontends of the various OCaml
+compilers that can directly deal with packages.")
+    (license x11)))
diff --git a/gnu/packages/patches/ocaml-findlib-make-install.patch 
b/gnu/packages/patches/ocaml-findlib-make-install.patch
new file mode 100644
index 0000000..a559a6a
--- /dev/null
+++ b/gnu/packages/patches/ocaml-findlib-make-install.patch
@@ -0,0 +1,11 @@
+--- findlib-1.5.3/src/findlib/Makefile 2014-09-16 13:21:46.000000000 +0200
++++ findlib-1.5.3/src/findlib/Makefile.new     2014-10-01 14:30:54.141082521 
+0200
+@@ -89,7 +89,7 @@
+ install: all
+       mkdir -p "$(prefix)$(OCAML_SITELIB)/$(NAME)"
+       mkdir -p "$(prefix)$(OCAMLFIND_BIN)"
+-      test $(INSTALL_TOPFIND) -eq 0 || cp topfind 
"$(prefix)$(OCAML_CORE_STDLIB)"
++      test $(INSTALL_TOPFIND) -eq 0 || cp topfind "$(prefix)$(OCAML_SITELIB)"
+       files=`$(TOP)/tools/collect_files $(TOP)/Makefile.config findlib.cmi 
findlib.mli findlib.cma topfind.cmi topfind.mli fl_package_base.mli 
fl_package_base.cmi fl_metascanner.mli fl_metascanner.cmi fl_metatoken.cmi 
findlib_top.cma findlib.cmxa findlib.a findlib.cmxs findlib_dynload.cma 
findlib_dynload.cmxa findlib_dynload.a findlib_dynload.cmxs fl_dynload.mli 
fl_dynload.cmi META` && \
+       cp $$files "$(prefix)$(OCAML_SITELIB)/$(NAME)"
+       f="ocamlfind$(EXEC_SUFFIX)"; { test -f ocamlfind_opt$(EXEC_SUFFIX) && 
f="ocamlfind_opt$(EXEC_SUFFIX)"; }; \
-- 
2.1.4

>From b805b9099cd4051e2d664ed43df9f1c497497599 Mon Sep 17 00:00:00 2001
From: Jan Nieuwenhuizen <address@hidden>
Date: Sun, 7 Feb 2016 12:57:40 +0100
Subject: [PATCH 3/3] gnu: Add laby.

    * gnu/packages/games.scm (laby): New variable.
    * gnu/packages/patches/laby-make-install.patch: New file.
    * gnu/packages/patches/laby-make-png.patch: New file.
    * gnu-system.am (dist_patch_DATA): Register them.
---
 gnu-system.am                                |  2 ++
 gnu/packages/games.scm                       | 45 ++++++++++++++++++++++++++++
 gnu/packages/patches/laby-make-install.patch | 25 ++++++++++++++++
 gnu/packages/patches/laby-make-png.patch     | 27 +++++++++++++++++
 4 files changed, 99 insertions(+)
 create mode 100644 gnu/packages/patches/laby-make-install.patch
 create mode 100644 gnu/packages/patches/laby-make-png.patch

diff --git a/gnu-system.am b/gnu-system.am
index 0cd2ca3..59fb975 100644
--- a/gnu-system.am
+++ b/gnu-system.am
@@ -539,6 +539,8 @@ dist_patch_DATA =                                           
\
   gnu/packages/patches/jasper-CVE-2016-1867.patch              \
   gnu/packages/patches/jbig2dec-ignore-testtest.patch          \
   gnu/packages/patches/kmod-module-directory.patch             \
+  gnu/packages/patches/laby-make-png.patch                     \
+  gnu/packages/patches/laby-make-install.patch                 \
   gnu/packages/patches/ldc-disable-tests.patch                 \
   gnu/packages/patches/lftp-dont-save-unknown-host-fingerprint.patch \
   gnu/packages/patches/liba52-enable-pic.patch                 \
diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm
index 7eb0e7a..aa74665 100644
--- a/gnu/packages/games.scm
+++ b/gnu/packages/games.scm
@@ -14,6 +14,7 @@
 ;;; Copyright © 2015, 2016 Alex Kost <address@hidden>
 ;;; Copyright © 2015 Paul van der Walt <address@hidden>
 ;;; Copyright © 2015 Taylan Ulrich Bayırlı/Kammer <address@hidden>
+;;; Copyright © 2016 Jan Nieuwenhuizen <address@hidden>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -56,9 +57,11 @@
   #:use-module (gnu packages libcanberra)
   #:use-module (gnu packages libunwind)
   #:use-module (gnu packages haskell)
+  #:use-module (gnu packages imagemagick)
   #:use-module (gnu packages mp3)
   #:use-module (gnu packages image)
   #:use-module (gnu packages ncurses)
+  #:use-module (gnu packages ocaml)
   #:use-module (gnu packages python)
   #:use-module (gnu packages readline)
   #:use-module (gnu packages xorg)
@@ -1891,3 +1894,45 @@ and a game metadata scraper.")
     (description "The Emilia Pinball Project is a pinball simulator.  There
 are only two levels to play with, but they are very addictive.")
     (license license:gpl2)))
+
+(define-public laby
+  (package
+    (name "laby")
+    (version "0.6.4")
+    (source
+     (origin (method url-fetch)
+             (uri (string-append
+                   "https://github.com/sgimenez/laby/tarball/";
+                   name "-" version))
+             (file-name (string-append name "-" version ".tar.gz"))
+             (sha256
+              (base32
+               "113ip48308ps3lsw427xswgx3wdanils43nyal9n4jr6bcx1bj2j"))
+             (patches (list (search-patch "laby-make-install.patch")
+                            (search-patch "laby-make-png.patch")))))
+    (build-system gnu-build-system)
+    (native-inputs
+     `(("imagemagick" ,imagemagick)))
+    (inputs
+     `(("lablgtk" ,lablgtk)
+       ("ocaml" ,ocaml)
+       ("ocaml-findlib" ,ocaml-findlib)))
+    (arguments
+     '(#:phases (modify-phases %standard-phases
+                  (delete 'configure)
+                  (add-before
+                   'build 'setenv
+                   (lambda* (#:key inputs outputs #:allow-other-keys)
+                     (let ((lablgtk (assoc-ref inputs "lablgtk")))
+                       (setenv "LD_LIBRARY_PATH"
+                               (string-append lablgtk 
"/lib/ocaml/stublibs"))))))
+       #:tests? #f ; no 'check' target
+       #:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
+                          "all" "png")))
+    (home-page "https://sgimenez.github.io/laby/";)
+    (synopsis "Programming game")
+    (description "Learn programming, playing with ants and spider webs ;-)
+Your robot ant can be programmed in many languages: OCaml, Python, C, C++,
+Java, Ruby, Lua, JavaScript, Pascal, Perl, Scheme, Vala, Prolog.  Experienced
+programmers may also add their own favorite language.")
+    (license license:gpl3+)))
diff --git a/gnu/packages/patches/laby-make-install.patch 
b/gnu/packages/patches/laby-make-install.patch
new file mode 100644
index 0000000..3e956be
--- /dev/null
+++ b/gnu/packages/patches/laby-make-install.patch
@@ -0,0 +1,25 @@
+From e9896b8951f9faf1f76a3b45be6e70d0aeb30a73 Mon Sep 17 00:00:00 2001
+From: Jan Nieuwenhuizen <address@hidden>
+Date: Sat, 15 Nov 2014 17:48:18 +0100
+Subject: [PATCH] Add make install.
+
+---
+ Makefile | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/Makefile b/Makefile
+index ca18c1e..65af31b 100644
+--- a/Makefile 2016-02-09 21:34:01.883660009 +0100
++++ b/Makefile 2016-02-09 21:34:30.672150679 +0100
+@@ -19,3 +19,11 @@
+       @git archive --prefix="$(PROJECT_ARCHIVE)/" HEAD \
+                | gzip >_dist/"$(PROJECT_ARCHIVE)".tar.gz
+       @echo archive stored in "_dist/$(PROJECT_ARCHIVE).tar.gz"
++
++PREFIX=/usr/local
++install:
++      strip laby
++      mkdir -p $(PREFIX)/bin
++      cp laby $(PREFIX)/bin/laby
++      mkdir -p $(PREFIX)/share/laby
++      tar -C data -cf - . | tar -C $(PREFIX)/share/laby -xf-
diff --git a/gnu/packages/patches/laby-make-png.patch 
b/gnu/packages/patches/laby-make-png.patch
new file mode 100644
index 0000000..6851e4a
--- /dev/null
+++ b/gnu/packages/patches/laby-make-png.patch
@@ -0,0 +1,27 @@
+From 6d3c05e25f2b5f231abf5bb4af4bc0b06455b0e4 Mon Sep 17 00:00:00 2001
+From: Jan Nieuwenhuizen <address@hidden>
+Date: Thu, 11 Feb 2016 18:30:19 +0100
+Subject: [PATCH] Add make png.
+
+---
+ Makefile | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/Makefile b/Makefile
+index 5d9d733..f54d09b 100644
+--- a/Makefile
++++ b/Makefile
+@@ -27,3 +27,10 @@ install:
+       cp laby $(PREFIX)/bin/laby
+       mkdir -p $(PREFIX)/share/laby
+       tar -C data -cf - . | tar -C $(PREFIX)/share/laby -xf-
++
++SVG:=$(wildcard data/tiles/*.svg)
++PNG:=$(SVG:%.svg=%.png)
++png: $(PNG)
++
++%.png: %.svg
++      convert $^ $@
+-- 
+2.1.4
+
-- 
2.1.4


-- 
Jan Nieuwenhuizen <address@hidden> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | Avatar®  http://AvatarAcademy.nl  

reply via email to

[Prev in Thread] Current Thread [Next in Thread]