2b4995e93cc1d6e02fa10b944a2b58b716eb5dfa
[chickadee.git] / guix.scm
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)
41 (guix download)
42 (guix git-download)
43 (guix build-system gnu)
44 (guix utils)
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
65 (define (package-with-guile-2.2 p)
66 (package-with-guile p guile-2.2.4))
67
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
100 (define guile-sdl2
101 (let ((commit "d0f9c26dce6e23533c23e401f604d712b43d4420"))
102 (package
103 (name "guile-sdl2")
104 (version (string-append "0.3.1-1." (string-take commit 7)))
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
112 "183r50bsf317f4iclsdw4ag83s915nymvadh3izw04iv7fm8xbwj"))))
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 _
129 (zero? (system* "sh" "bootstrap")))))))
130 (native-inputs
131 `(("autoconf" ,autoconf)
132 ("automake" ,automake)
133 ("pkg-config" ,pkg-config)
134 ("texinfo" ,texinfo)))
135 (inputs
136 `(("guile" ,guile-next)
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
143 SDL2 C shared library via the foreign function interface.")
144 (home-page "https://git.dthompson.us/guile-sdl2.git")
145 (license lgpl3+))))
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
158 `(("guile" ,guile-next)))
159 (propagated-inputs
160 `(("guile-opengl" ,guile-opengl)
161 ("guile-sdl2" ,guile-sdl2)))
162 (synopsis "Game development toolkit for Guile Scheme")
163 (description "Chickadee is a game development toolkit for Guile
164 Scheme. It contains all of the basic components needed to develop
165 2D/3D video games.")
166 (home-page "https://dthompson.us/projects/chickadee.html")
167 (license gpl3+))