guix-devel
[Top][All Lists]
Advanced

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

New build-system quest (premake4 t-engine)


From: Oleg Pykhalov
Subject: New build-system quest (premake4 t-engine)
Date: Sun, 09 Jul 2017 00:20:06 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux)

Hi,

I try to package premake4 build-system and t-engine game.  I have an
issue with "No such file or directory" "../bla/bla/bla/*.h".

(info "(guix) Debugging Build Failures")

./pre-inst-env guix environment -C t-engine
source ./environment-variables
cd t-engine*
make

succeeded.

But building with guix build failed.  Checkout patch and logs.  Any
ideas appreciating :-)

>From 2529572312b40cd3920fcc845619fa77d9a6d874 Mon Sep 17 00:00:00 2001
From: Oleg Pykhalov <address@hidden>
Date: Sat, 8 Jul 2017 18:29:36 +0300
Subject: [PATCH] gnu: New build-system quest.

* guix/build/premake4-build-system.scm: New file.
* guix/build-system/premake4.scm: New file.
* Makefile.am (MODULES): Add them.
* gnu/packages/build-tools.scm (premake4): New variable.
*
* gnu/packages/games.scm (t-engine): New variable.
---
 Makefile.am                                        |   2 +
 gnu/packages/build-tools.scm                       |  35 ++++++
 gnu/packages/games.scm                             |  42 +++++++
 gnu/packages/patches/t-engine-fix-sdl-h-path.patch |  39 ++++++
 guix/build-system/premake4.scm                     | 135 +++++++++++++++++++++
 guix/build/premake4-build-system.scm               |  59 +++++++++
 6 files changed, 312 insertions(+)
 create mode 100644 gnu/packages/patches/t-engine-fix-sdl-h-path.patch
 create mode 100644 guix/build-system/premake4.scm
 create mode 100644 guix/build/premake4-build-system.scm

diff --git a/Makefile.am b/Makefile.am
index 4d1512f8c..1aac383fd 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -83,6 +83,7 @@ MODULES =                                     \
   guix/build-system/gnu.scm                    \
   guix/build-system/haskell.scm                        \
   guix/build-system/perl.scm                   \
+  guix/build-system/premake4.scm               \
   guix/build-system/python.scm                 \
   guix/build-system/ocaml.scm                  \
   guix/build-system/waf.scm                    \
@@ -112,6 +113,7 @@ MODULES =                                   \
   guix/build/gnu-build-system.scm              \
   guix/build/gnu-dist.scm                      \
   guix/build/perl-build-system.scm             \
+  guix/build/premake4-build-system.scm         \
   guix/build/python-build-system.scm           \
   guix/build/ocaml-build-system.scm            \
   guix/build/r-build-system.scm                        \
diff --git a/gnu/packages/build-tools.scm b/gnu/packages/build-tools.scm
index 66f46433f..78da66818 100644
--- a/gnu/packages/build-tools.scm
+++ b/gnu/packages/build-tools.scm
@@ -23,6 +23,7 @@
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (gnu packages)
+  #:use-module (gnu packages compression)
   #:use-module (gnu packages python)
   #:use-module (gnu packages ninja)
   #:use-module (guix build-system gnu)
@@ -90,3 +91,37 @@ Autoconf/Automake/make combo.  Build specifications, also 
known as @dfn{Meson
 files}, are written in a custom domain-specific language (DSL) that resembles
 Python.")
     (license license:asl2.0)))
+
+(define-public premake4
+  (package
+    (name "premake4")
+    (version "4.3")
+    (source (origin
+             (method url-fetch)
+             (uri (string-append 
"http://downloads.sourceforge.net/project/premake/Premake/";
+                                 version "/premake-" version "-src.zip"))
+             (sha256
+              (base32
+               "1017rd0wsjfyq2jvpjjhpszaa7kmig6q1nimw76qx3cjz2868lrn"))))
+    (build-system gnu-build-system)
+    (native-inputs
+     `(("unzip" ,unzip))) ; for unpacking the source
+    (arguments
+     `(#:make-flags '("CC=gcc")
+       #:tests? #f ; No test suite
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+        (add-after 'unpack 'enter-source
+           (lambda _ (chdir "build/gmake.unix") #t))
+        (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (install-file "../../bin/release/premake4"
+                           (string-append (assoc-ref outputs "out")
+                                          "/bin"))
+             #t)))))
+    (synopsis "A makefile generation tool")
+    (description "@code{premake4} is a command line utility which reads a
+scripted definition of a software project.")
+    (home-page "https://premake.github.io";)
+    (license license:bsd-3)))
diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm
index a7f697ece..b24766bc9 100644
--- a/gnu/packages/games.scm
+++ b/gnu/packages/games.scm
@@ -133,6 +133,7 @@
   #:use-module (gnu packages networking)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system haskell)
+  #:use-module (guix build-system premake4)
   #:use-module (guix build-system python)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system trivial))
@@ -4577,3 +4578,44 @@ computer-hosted roleplaying games.  This is the last 
version released by
 Crowther & Woods, its original authors, in 1995.  It has been known as
 \"adventure 2.5\" and \"430-point adventure\".")
       (license license:bsd-2))))
+
+(define-public t-engine
+  (package
+    (name "t-engine")
+    (version "1.5.5")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "https://te4.org/dl/t-engine/t-engine4-src-";
+                           version ".tar.bz2"))
+       (sha256
+        (base32
+         "0v2qgdfpvdzd1bcbp9v8pfahj1bgczsq2d4xfhh5wg11jgjcwz03"))
+       (patches (search-patches "t-engine-fix-sdl-h-path.patch"))))
+    (build-system premake4-build-system)
+    (inputs
+     `(("sdl-union" ,(sdl-union (list sdl2 sdl2-image sdl2-mixer sdl2-ttf)))
+       ("glu" ,glu)
+       ("libpng" ,libpng)
+       ("luajit" ,luajit)
+       ("openal" ,openal)
+       ("vorbis" ,libvorbis)))
+    (arguments
+     `(#:make-flags '("CC=gcc")
+       #:phases (modify-phases %standard-phases
+                  (add-after 'set-paths 'set-sdl-paths
+                    (lambda* (#:key inputs #:allow-other-keys)
+                      (setenv "CPATH"
+                              (string-append (assoc-ref inputs "sdl-union")
+                                             "/include/SDL2")))))))
+    (home-page "https://te4.org/";)
+    (synopsis "Roguelike RPG")
+    (description "Tales of Maj’Eyal (ToME) is a free, open source roguelike
+RPG, featuring tactical turn-based combat and advanced character building.
+Play as one of many unique races and classes in the lore-filled world of Eyal,
+exploring random dungeons, facing challenging battles, and developing
+characters with your own tailored mix of abilities and powers.  With a modern
+graphical and customisable interface, intuitive mouse control, streamlined
+mechanics and deep, challenging combat, Tales of Maj’Eyal offers engaging
+roguelike gameplay for the 21st century.")
+    (license license:bsd-2)))
diff --git a/gnu/packages/patches/t-engine-fix-sdl-h-path.patch 
b/gnu/packages/patches/t-engine-fix-sdl-h-path.patch
new file mode 100644
index 000000000..dd550632d
--- /dev/null
+++ b/gnu/packages/patches/t-engine-fix-sdl-h-path.patch
@@ -0,0 +1,39 @@
+From 2c3eedcccf2da85cffa08baefa6e437c819276e6 Mon Sep 17 00:00:00 2001
+From: Oleg Pykhalov <address@hidden>
+Date: Mon, 3 Apr 2017 16:20:48 +0300
+Subject: [PATCH] Fix make -k config=release for GNUC
+
+---
+ src/music.h | 2 +-
+ src/tSDL.h  | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/music.h b/src/music.h
+index 894426cb8..c8490e456 100644
+--- a/src/music.h
++++ b/src/music.h
+@@ -27,7 +27,7 @@
+ #include <vorbis/vorbisfile.h>
+ #include <SDL2/SDL.h>
+ #include <SDL2/SDL_thread.h>
+-#elif defined(__FreeBSD__)
++#elif defined(__FreeBSD__) || defined(__GNUC__)
+ #include <AL/al.h>
+ #include <AL/alc.h>
+ #include <vorbis/vorbisfile.h>
+diff --git a/src/tSDL.h b/src/tSDL.h
+index a7d36c92f..4f7690255 100644
+--- a/src/tSDL.h
++++ b/src/tSDL.h
+@@ -3,7 +3,7 @@
+ #include <SDL2_ttf/SDL_ttf.h>
+ //#include <SDL2_mixer/SDL_mixer.h>
+ #include <SDL2_image/SDL_image.h>
+-#elif defined(__FreeBSD__)
++#elif defined(__FreeBSD__) || defined(__GNUC__)
+ #include <SDL2/SDL.h>
+ #include <SDL2/SDL_ttf.h>
+ //#include <SDL2/SDL_mixer.h>
+-- 
+2.13.2
+
diff --git a/guix/build-system/premake4.scm b/guix/build-system/premake4.scm
new file mode 100644
index 000000000..876c516fb
--- /dev/null
+++ b/guix/build-system/premake4.scm
@@ -0,0 +1,135 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2015 Ricardo Wurmus <address@hidden>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (guix build-system premake4)
+  #:use-module (guix store)
+  #:use-module (guix utils)
+  #:use-module (guix packages)
+  #:use-module (guix derivations)
+  #:use-module (guix search-paths)
+  #:use-module (guix build-system)
+  #:use-module (guix build-system gnu)
+  #:use-module (ice-9 match)
+  #:export (%premake4-build-system-modules
+            premake4-build
+            premake4-build-system))
+
+;; Commentary:
+;;
+;; Standard build procedure for applications using 'premake4'.
+;; Implemented as an extension of 'gnu-build-system'.
+;;
+;; Code:
+
+(define %premake4-build-system-modules
+  ;; Build-side modules imported by default.
+  `((guix build premake4-build-system)
+    ,@%gnu-build-system-modules))
+
+(define (default-premake4)
+  "Return the default premake4 package."
+  (let ((premake4 (resolve-interface '(gnu packages build-tools))))
+    (module-ref premake4 'premake4)))
+
+(define* (lower name
+                #:key source inputs native-inputs outputs system target
+               (premake4 (default-premake4))
+                #:allow-other-keys
+                #:rest arguments)
+  "Return a bag for NAME."
+  (define private-keywords
+    '(#:source #:target #:inputs #:native-inputs))
+
+  (and (not target)                               ;XXX: no cross-compilation
+       (bag
+         (name name)
+         (system system)
+         (host-inputs `(,@(if source
+                              `(("source" ,source))
+                              '())
+                        ,@inputs
+
+                        ;; Keep the standard inputs of 'gnu-build-system'.
+                        ,@(standard-packages)))
+         (build-inputs `(("premake4" ,premake4)
+                        ,@native-inputs))
+         (outputs outputs)
+         (build premake4-build)
+         (arguments (strip-keyword-arguments private-keywords arguments)))))
+
+(define* (premake4-build store name inputs
+                       #:key
+                       (tests? #t)
+                       (test-target "tests")
+                       (configure-flags ''())
+                      (make-flags ''())
+                       (phases '(@ (guix build premake4-build-system)
+                                   %standard-phases))
+                       (outputs '("out"))
+                       (search-paths '())
+                       (system (%current-system))
+                       (guile #f)
+                       (imported-modules %premake4-build-system-modules)
+                       (modules '((guix build premake4-build-system)
+                                  (guix build utils))))
+  "Build SOURCE with INPUTS.  This assumes that SOURCE provides a
+'premake4' file as its build system."
+  (define builder
+    `(begin
+       (use-modules ,@modules)
+       (premake4-build #:name ,name
+                  #:source ,(match (assoc-ref inputs "source")
+                              (((? derivation? source))
+                               (derivation->output-path source))
+                              ((source)
+                               source)
+                              (source
+                               source))
+                  #:configure-flags ,configure-flags
+                 #:make-flags ,make-flags
+                  #:test-target ,test-target
+                  #:tests? ,tests?
+                  #:phases ,phases
+                  #:outputs %outputs
+                  #:search-paths ',(map search-path-specification->sexp
+                                        search-paths)
+                  #:inputs %build-inputs)))
+
+  (define guile-for-build
+    (match guile
+      ((? package?)
+       (package-derivation store guile system #:graft? #f))
+      (#f                                         ; the default
+       (let* ((distro (resolve-interface '(gnu packages commencement)))
+              (guile  (module-ref distro 'guile-final)))
+         (package-derivation store guile system #:graft? #f)))))
+
+  (build-expression->derivation store name builder
+                                #:inputs inputs
+                                #:system system
+                                #:modules imported-modules
+                                #:outputs outputs
+                                #:guile-for-build guile-for-build))
+
+(define premake4-build-system
+  (build-system
+    (name 'premake4)
+    (description "The standard premake4 build system")
+    (lower lower)))
+
+;;; premake4.scm ends here
diff --git a/guix/build/premake4-build-system.scm 
b/guix/build/premake4-build-system.scm
new file mode 100644
index 000000000..ddb787e7a
--- /dev/null
+++ b/guix/build/premake4-build-system.scm
@@ -0,0 +1,59 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2015 Ricardo Wurmus <address@hidden>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (guix build premake4-build-system)
+  #:use-module ((guix build gnu-build-system) #:prefix gnu:)
+  #:use-module (guix build utils)
+  #:use-module (ice-9 match)
+  #:use-module (ice-9 ftw)
+  #:use-module (srfi srfi-1)
+  #:use-module (srfi srfi-26)
+  #:export (%standard-phases
+            premake4-build))
+
+;; Commentary:
+;;
+;; Builder-side code of the standard premake4 build procedure.
+;;
+;; Code:
+
+(define (call-premake4 command params)
+  (if (file-exists? "premake4.lua")
+      (begin
+         (format #t "running \"premake4\" with command ~s and parameters ~s~%"
+                command params)
+         (zero? (apply system* "premake4" command params)))
+      (error "no premake4 found")))
+
+(define* (configure #:key target native-inputs inputs outputs
+                    (configure-flags '())
+                    #:allow-other-keys)
+  "Build a given premake4 application."
+  (let* ((prefix (assoc-ref outputs "out"))
+         (flags  `(,@configure-flags)))
+    (call-premake4 "gmake" flags)))
+
+(define %standard-phases
+  (modify-phases gnu:%standard-phases
+    (replace 'configure configure)))
+
+(define* (premake4-build #:key inputs (phases %standard-phases)
+                     #:allow-other-keys #:rest args)
+  (apply gnu:gnu-build #:inputs inputs #:phases phases args))
+
+;;; premake4-build-system.scm ends here
-- 
2.13.2

Attachment: txte33YT3j0Fq.txt
Description: t-engine build log


reply via email to

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