guix: Make it easier to switch the Guile used for builds.
[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
f0091483 55(define target-guile guile-next)
98dc87a0 56
3497df5e
DT
57(define guile-opengl
58 (package
59 (inherit guile-opengl)
60 (inputs
61 (map (match-lambda
62 (("guile" _)
f0091483 63 `("guile" ,target-guile))
3497df5e
DT
64 (input input))
65 (package-inputs guile-opengl)))
66 (native-inputs
67 (append (package-native-inputs guile-opengl)
68 `(("autoconf" ,autoconf)
69 ("automake" ,automake))))
70 (arguments
71 (substitute-keyword-arguments (package-arguments guile-opengl)
72 ((#:phases phases)
73 `(modify-phases ,phases
74 (delete 'patch-makefile)
75 (add-before 'bootstrap 'patch-configure.ac
76 (lambda _
77 ;; The Guile version check doesn't work for the 3.0
78 ;; pre-release, so just remove it.
79 (substitute* "configure.ac"
80 (("GUILE_PKG\\(\\[2.2 2.0\\]\\)") ""))
81 (substitute* "Makefile.am"
82 (("\\$\\(GUILE_EFFECTIVE_VERSION\\)") "3.0")
83 (("ccache") "site-ccache"))
84 #t))
85 (replace 'bootstrap
86 (lambda _
87 (invoke "autoreconf" "-vfi")))))))))
88
98dc87a0 89(define guile-sdl2
e0ee9c2c 90 (let ((commit "ecc007fd0a576a96382fd12a507138121e377ad6"))
1bc3c115
DT
91 (package
92 (name "guile-sdl2")
3497df5e 93 (version (string-append "0.3.1-1." (string-take commit 7)))
1bc3c115
DT
94 (source (origin
95 (method git-fetch)
96 (uri (git-reference
97 (url "git://dthompson.us/guile-sdl2.git")
98 (commit commit)))
99 (sha256
100 (base32
e0ee9c2c 101 "1kms8bzxphy91mhn36jrxl1jxgprknzf8d02mab3z2rz8ypq1jvd"))))
1bc3c115
DT
102 (build-system gnu-build-system)
103 (arguments
104 '(#:configure-flags
105 (list (string-append "--with-libsdl2-prefix="
106 (assoc-ref %build-inputs "sdl2"))
107 (string-append "--with-libsdl2-image-prefix="
108 (assoc-ref %build-inputs "sdl2-image"))
109 (string-append "--with-libsdl2-ttf-prefix="
110 (assoc-ref %build-inputs "sdl2-ttf"))
111 (string-append "--with-libsdl2-mixer-prefix="
112 (assoc-ref %build-inputs "sdl2-mixer")))
113 #:make-flags '("GUILE_AUTO_COMPILE=0")
114 #:phases
115 (modify-phases %standard-phases
116 (add-after 'unpack 'bootstrap
117 (lambda _
faa92ac6 118 (zero? (system* "sh" "bootstrap")))))))
1bc3c115
DT
119 (native-inputs
120 `(("autoconf" ,autoconf)
121 ("automake" ,automake)
122 ("pkg-config" ,pkg-config)
123 ("texinfo" ,texinfo)))
124 (inputs
f0091483 125 `(("guile" ,target-guile)
1bc3c115
DT
126 ("sdl2" ,sdl2)
127 ("sdl2-image" ,sdl2-image)
128 ("sdl2-mixer" ,sdl2-mixer)
129 ("sdl2-ttf" ,sdl2-ttf)))
130 (synopsis "Guile bindings for SDL2")
131 (description "Guile-sdl2 provides pure Guile Scheme bindings to the
98dc87a0 132SDL2 C shared library via the foreign function interface.")
1bc3c115
DT
133 (home-page "https://git.dthompson.us/guile-sdl2.git")
134 (license lgpl3+))))
98dc87a0
DT
135
136(package
137 (name "chickadee")
138 (version "0.1")
139 (source #f)
140 (build-system gnu-build-system)
141 (native-inputs
142 `(("autoconf" ,autoconf)
143 ("automake" ,automake)
144 ("pkg-config" ,pkg-config)
145 ("texinfo" ,texinfo)))
146 (inputs
f0091483 147 `(("guile" ,target-guile)))
98dc87a0 148 (propagated-inputs
3497df5e 149 `(("guile-opengl" ,guile-opengl)
4ba1a033 150 ("guile-sdl2" ,guile-sdl2)))
98dc87a0
DT
151 (synopsis "Game development toolkit for Guile Scheme")
152 (description "Chickadee is a game development toolkit for Guile
153Scheme. It contains all of the basic components needed to develop
1542D/3D video games.")
155 (home-page "https://dthompson.us/projects/chickadee.html")
156 (license gpl3+))