Update a couple of examples to use new sprite batch API.
[chickadee.git] / guix.scm
CommitLineData
98dc87a0
DT
1;;; Chickadee Game Toolkit
2;;; Copyright © 2016 David Thompson <davet@gnu.org>
3;;;
4;;; Chickadee is free software: you can redistribute it and/or modify it
5;;; under the terms of the GNU General Public License as published by
6;;; the Free Software Foundation, either version 3 of the License, or
7;;; (at your option) any later version.
8;;;
9;;; Chickadee is distributed in the hope that it will be useful, but WITHOUT
10;;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11;;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
12;;; License for more details.
13;;;
14;;; You should have received a copy of the GNU General Public License
15;;; along with this program. If not, see
16;;; <http://www.gnu.org/licenses/>.
17
18;;; Commentary:
19;;
20;; Development environment for GNU Guix.
21;;
22;; To setup the development environment, run the following:
23;;
24;; guix environment -l guix.scm
25;; ./bootstrap && ./configure;
26;;
27;; To build the development snapshot, run:
28;;
29;; guix build -f guix.scm
30;;
31;; To install the development snapshot, run:
32;;
33;; guix install -f guix.scm
34;;
35;;; Code:
36
37(use-modules (ice-9 match)
38 (srfi srfi-1)
39 (guix packages)
40 (guix licenses)
98de9282 41 (guix download)
1bc3c115 42 (guix git-download)
98dc87a0 43 (guix build-system gnu)
3497df5e 44 (guix utils)
98dc87a0
DT
45 (gnu packages)
46 (gnu packages autotools)
47 (gnu packages pkg-config)
48 (gnu packages texinfo)
49 (gnu packages guile)
50 (gnu packages gl)
51 (gnu packages sdl)
52 (gnu packages maths)
53 (gnu packages image))
54
55(define (package-with-guile p guile)
56 (package
57 (inherit p)
58 (inputs
59 (map (match-lambda
60 (("guile" _)
61 `("guile" ,guile))
62 (input input))
63 (package-inputs p)))))
64
4ba1a033 65(define (package-with-guile-2.2 p)
0542d928 66 (package-with-guile p guile-2.2.4))
98dc87a0 67
3497df5e
DT
68(define guile-opengl
69 (package
70 (inherit guile-opengl)
71 (inputs
72 (map (match-lambda
73 (("guile" _)
74 `("guile" ,guile-next))
75 (input input))
76 (package-inputs guile-opengl)))
77 (native-inputs
78 (append (package-native-inputs guile-opengl)
79 `(("autoconf" ,autoconf)
80 ("automake" ,automake))))
81 (arguments
82 (substitute-keyword-arguments (package-arguments guile-opengl)
83 ((#:phases phases)
84 `(modify-phases ,phases
85 (delete 'patch-makefile)
86 (add-before 'bootstrap 'patch-configure.ac
87 (lambda _
88 ;; The Guile version check doesn't work for the 3.0
89 ;; pre-release, so just remove it.
90 (substitute* "configure.ac"
91 (("GUILE_PKG\\(\\[2.2 2.0\\]\\)") ""))
92 (substitute* "Makefile.am"
93 (("\\$\\(GUILE_EFFECTIVE_VERSION\\)") "3.0")
94 (("ccache") "site-ccache"))
95 #t))
96 (replace 'bootstrap
97 (lambda _
98 (invoke "autoreconf" "-vfi")))))))))
99
98dc87a0 100(define guile-sdl2
e0ee9c2c 101 (let ((commit "ecc007fd0a576a96382fd12a507138121e377ad6"))
1bc3c115
DT
102 (package
103 (name "guile-sdl2")
3497df5e 104 (version (string-append "0.3.1-1." (string-take commit 7)))
1bc3c115
DT
105 (source (origin
106 (method git-fetch)
107 (uri (git-reference
108 (url "git://dthompson.us/guile-sdl2.git")
109 (commit commit)))
110 (sha256
111 (base32
e0ee9c2c 112 "1kms8bzxphy91mhn36jrxl1jxgprknzf8d02mab3z2rz8ypq1jvd"))))
1bc3c115
DT
113 (build-system gnu-build-system)
114 (arguments
115 '(#:configure-flags
116 (list (string-append "--with-libsdl2-prefix="
117 (assoc-ref %build-inputs "sdl2"))
118 (string-append "--with-libsdl2-image-prefix="
119 (assoc-ref %build-inputs "sdl2-image"))
120 (string-append "--with-libsdl2-ttf-prefix="
121 (assoc-ref %build-inputs "sdl2-ttf"))
122 (string-append "--with-libsdl2-mixer-prefix="
123 (assoc-ref %build-inputs "sdl2-mixer")))
124 #:make-flags '("GUILE_AUTO_COMPILE=0")
125 #:phases
126 (modify-phases %standard-phases
127 (add-after 'unpack 'bootstrap
128 (lambda _
faa92ac6 129 (zero? (system* "sh" "bootstrap")))))))
1bc3c115
DT
130 (native-inputs
131 `(("autoconf" ,autoconf)
132 ("automake" ,automake)
133 ("pkg-config" ,pkg-config)
134 ("texinfo" ,texinfo)))
135 (inputs
3497df5e 136 `(("guile" ,guile-next)
1bc3c115
DT
137 ("sdl2" ,sdl2)
138 ("sdl2-image" ,sdl2-image)
139 ("sdl2-mixer" ,sdl2-mixer)
140 ("sdl2-ttf" ,sdl2-ttf)))
141 (synopsis "Guile bindings for SDL2")
142 (description "Guile-sdl2 provides pure Guile Scheme bindings to the
98dc87a0 143SDL2 C shared library via the foreign function interface.")
1bc3c115
DT
144 (home-page "https://git.dthompson.us/guile-sdl2.git")
145 (license lgpl3+))))
98dc87a0
DT
146
147(package
148 (name "chickadee")
149 (version "0.1")
150 (source #f)
151 (build-system gnu-build-system)
152 (native-inputs
153 `(("autoconf" ,autoconf)
154 ("automake" ,automake)
155 ("pkg-config" ,pkg-config)
156 ("texinfo" ,texinfo)))
157 (inputs
3497df5e 158 `(("guile" ,guile-next)))
98dc87a0 159 (propagated-inputs
3497df5e 160 `(("guile-opengl" ,guile-opengl)
4ba1a033 161 ("guile-sdl2" ,guile-sdl2)))
98dc87a0
DT
162 (synopsis "Game development toolkit for Guile Scheme")
163 (description "Chickadee is a game development toolkit for Guile
164Scheme. It contains all of the basic components needed to develop
1652D/3D video games.")
166 (home-page "https://dthompson.us/projects/chickadee.html")
167 (license gpl3+))