unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: "Clément Lassieur" <clement@lassieur.org>
To: 26618@debbugs.gnu.org
Subject: bug#26618: [PATCH 2/2] gnu: Add 0ad.
Date: Sun, 23 Apr 2017 03:35:54 +0200	[thread overview]
Message-ID: <20170423013554.4534-2-clement@lassieur.org> (raw)
In-Reply-To: <20170423013554.4534-1-clement@lassieur.org>

* gnu/packages/games.scm (0ad, 0ad-data): New variables.

Co-authored-by: ng0 <ng0@no-reply.pragmatique.xyz>
---
 gnu/packages/games.scm | 186 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 186 insertions(+)

diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm
index f6b4e3f0b..c0e0f7823 100644
--- a/gnu/packages/games.scm
+++ b/gnu/packages/games.scm
@@ -28,6 +28,7 @@
 ;;; Copyright © 2017 Arun Isaac <arunisaac@systemreboot.net>
 ;;; Copyright © 2017 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2017 nee <nee-git@hidamari.blue>
+;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -52,6 +53,7 @@
   #:use-module (guix download)
   #:use-module (guix git-download)
   #:use-module (guix svn-download)
+  #:use-module (guix gexp)
   #:use-module (gnu packages)
   #:use-module (gnu packages algebra)
   #:use-module (gnu packages autotools)
@@ -119,6 +121,10 @@
   #:use-module (gnu packages wxwidgets)
   #:use-module (gnu packages bison)
   #:use-module (gnu packages flex)
+  #:use-module (gnu packages cmake)
+  #:use-module (gnu packages gnuzilla)
+  #:use-module (gnu packages icu4c)
+  #:use-module (gnu packages networking)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system haskell)
   #:use-module (guix build-system python)
@@ -3881,3 +3887,183 @@ fabulous Orb of Zot.")
                    license:expat
                    license:zlib
                    license:asl2.0))))
+
+(define-public 0ad-data
+  (package
+    (name "0ad-data")
+    (version "0.0.21-alpha")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append
+             "http://releases.wildfiregames.com/0ad-"
+             version "-unix-data.tar.xz"))
+       (file-name (string-append name "-" version ".tar.xz"))
+       (sha256
+        (base32
+         "15xadyrpvq27lm9p1ny7bcmmv56m16h3xadbkdx69gfkzxc3razk"))
+       (modules '((guix build utils)))
+       (snippet
+        #~(begin
+            (for-each
+             (lambda (name)
+               (let* ((dir (string-append "binaries/data/mods/" name))
+                      (file (string-append dir "/" name ".zip"))
+                      (unzip #$(file-append unzip "/bin/unzip")))
+                 (system* unzip "-d" dir file)
+                 (delete-file file)))
+             '("mod" "public"))
+            #t))))
+    (build-system trivial-build-system)
+    (native-inputs `(("tar" ,tar)
+                     ("xz" ,xz)))
+    (arguments
+     `(#:modules ((guix build utils))
+       #:builder
+       (begin
+         (use-modules (guix build utils))
+         (let ((out (assoc-ref %outputs "out"))
+               (source (assoc-ref %build-inputs "source"))
+               (tar (string-append (assoc-ref %build-inputs "tar") "/bin/tar"))
+               (xz-path (string-append (assoc-ref %build-inputs "xz") "/bin")))
+           (setenv "PATH" xz-path)
+           (mkdir out)
+           (zero? (system* tar "xvf" source "-C" out "--strip=3"))))))
+    (synopsis "Data files for 0ad")
+    (description "This package provides the data files for 0ad.")
+    (home-page "https://play0ad.com")
+    (license (list license:arev
+                   license:bitstream-vera
+                   license:cc-by-sa3.0
+                   license:expat
+                   license:gfl1.0
+                   license:gpl2+
+                   license:gpl3+))))
+
+(define-public 0ad
+  (package
+    (name "0ad")
+    (version "0.0.21-alpha")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append
+             "http://releases.wildfiregames.com/0ad-"
+             version "-unix-build.tar.xz"))
+       (file-name (string-append name "-" version ".tar.xz"))
+       (sha256
+        (base32
+         "1kw3hqnr737ipx4f03khz3hvsh3ha7r8iy9njppk2faa53j27gln"))
+       ;; A snippet here would cause a build failure, probably because of
+       ;; timestamps reset or file sorting.
+       ))
+    (inputs
+     `(("0ad-data" ,0ad-data)
+       ("curl" ,curl)
+       ("enet" ,enet)
+       ("gloox" ,gloox)
+       ("icu4c" ,icu4c)
+       ("libpng" ,libpng)
+       ("libvorbis" ,libvorbis)
+       ("libxcursor" ,libxcursor)
+       ("libxml2" ,libxml2)
+       ("miniupnpc" ,miniupnpc)
+       ("mozjs-38" ,mozjs-38)
+       ("openal" ,openal)
+       ("sdl2" ,sdl2)
+       ("wxwidgets" ,wxwidgets)
+       ("zlib" ,zlib)))
+    (native-inputs
+     `(("boost" ,boost)
+       ("cmake" ,cmake)
+       ("mesa" ,mesa)
+       ("pkg-config" ,pkg-config)
+       ("python-2" ,python-2)))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'delete-bundles
+           (lambda _
+             (delete-file-recursively "libraries/source/spidermonkey")
+             #t))
+         (add-after 'unpack 'fix-x11-includes
+           (lambda _
+             (substitute* "source/lib/sysdep/os/unix/x/x.cpp"
+               (("<Xlib.h>") "<X11/Xlib.h>"))
+             (substitute* "source/lib/sysdep/os/unix/x/x.cpp"
+               (("<Xatom.h>") "<X11/Xatom.h>"))
+             (substitute* "source/lib/sysdep/os/unix/x/x.cpp"
+               (("<Xcursor/Xcursor.h>") "<X11/Xcursor/Xcursor.h>"))
+             #t))
+         (replace 'configure
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let* ((jobs (number->string (parallel-job-count)))
+                    (out (assoc-ref outputs "out"))
+                    (lib (string-append out "/lib"))
+                    (data (string-append out "/share/0ad")))
+               (setenv "JOBS" (string-append "-j" jobs))
+               (setenv "CC" "gcc")
+               (with-directory-excursion "build/workspaces"
+                 (zero? (system* "./update-workspaces.sh"
+                                 (string-append "--libdir=" lib)
+                                 (string-append "--datadir=" data)
+                                 "--minimal-flags"
+                                 ;; TODO: "--with-system-nvtt"
+                                 "--with-system-mozjs38"))))))
+         (add-before 'build 'chdir
+           (lambda _
+             (chdir "build/workspaces/gcc")
+             #t))
+         (delete 'check)
+         (replace 'install
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (chdir "../../../binaries")
+             (let* ((out (assoc-ref outputs "out"))
+                    (bin (string-append out "/bin"))
+                    (lib (string-append out "/lib"))
+                    (data (string-append out "/share/0ad"))
+                    (applications (string-append out "/share/applications"))
+                    (pixmaps (string-append out "/share/pixmaps"))
+                    (0ad-data (assoc-ref inputs "0ad-data")))
+               ;; data
+               (copy-recursively "data" data)
+               (for-each (lambda (file)
+                           (symlink (string-append 0ad-data "/" file)
+                                    (string-append data "/" file)))
+                         '("config" "mods/mod" "mods/public" "tools"))
+               ;; libraries
+               (for-each (lambda (file)
+                           (install-file file lib))
+                         (find-files "system" "\\.so$"))
+               ;; binaries
+               (install-file "system/pyrogenesis" bin)
+               (with-directory-excursion bin
+                 (symlink "pyrogenesis" "0ad"))
+               ;; resources
+               (with-directory-excursion "../build/resources"
+                 (install-file "0ad.desktop" applications)
+                 (install-file "0ad.png" pixmaps))
+               #t)))
+         (add-after 'install 'check
+           (lambda _
+             (with-directory-excursion "system"
+               (zero? (system* "./test"))))))))
+    (home-page "https://play0ad.com")
+    (synopsis "3D, historically-based RTS game of ancient warfare")
+    (description "0 A.D. is a real-time strategy (RTS) game of ancient
+warfare.  It's a historically-based war/economy game that allows players to
+relive or rewrite the history of twelve ancient civilizations, each depicted
+at their peak of economic growth and military prowess.
+
+0ad needs a window manager that supports 'Extended Window Manager Hints'.")
+    (license (list license:bsd-2
+                   license:bsd-3
+                   license:expat
+                   license:gpl2+
+                   license:ibmpl1.0
+                   license:isc
+                   license:lgpl2.1
+                   license:lgpl3
+                   license:mpl2.0
+                   license:zlib))))
-- 
2.12.2

  reply	other threads:[~2017-04-23  1:37 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-23  1:34 bug#26618: Add 0ad Clément Lassieur
2017-04-23  1:35 ` bug#26618: [PATCH 1/2] gnu: Add mozjs-38 (Mozilla SpiderMonkey 38) Clément Lassieur
2017-04-23  1:35   ` Clément Lassieur [this message]
2017-04-23 12:07 ` bug#26618: Add 0ad ng0
2017-04-23 20:50   ` ng0
2017-04-23 20:54   ` ng0
2017-04-23 21:05     ` Clément Lassieur
2017-05-08 18:16   ` Clément Lassieur
2017-04-23 20:11 ` Clément Lassieur
2017-04-23 22:14 ` ng0
2017-05-01 11:05 ` Clément Lassieur
2017-05-01 11:09   ` bug#26618: [PATCH] gnu: " Clément Lassieur
2017-05-01 14:03     ` Clément Lassieur

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=20170423013554.4534-2-clement@lassieur.org \
    --to=clement@lassieur.org \
    --cc=26618@debbugs.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).