summaryrefslogtreecommitdiff
path: root/guix.scm
blob: 8e3902172452bae1e6f8faaf66d28946efdbf6e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
;;; guile-sdl3 --- FFI bindings for SDL3
;;; Copyright © 2024 David Thompson <dthompson2@worcester.edu>
;;;
;;; This file is part of guile-sdl3.
;;;
;;; Guile-sdl3 is free software; you can redistribute it and/or modify
;;; it under the terms of the GNU Lesser General Public License as
;;; published by the Free Software Foundation; either version 3 of the
;;; License, or (at your option) any later version.
;;;
;;; Guile-sdl3 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 Lesser General Public
;;; License along with guile-sdl3.  If not, see
;;; <http://www.gnu.org/licenses/>.

;;; Commentary:
;;
;; GNU Guix development package.  To build and install, run:
;;
;;   guix package -f guix.scm
;;
;; To use as the basis for a development environment, run:
;;
;;   guix shell
;;
;;; Code:

(use-modules (gnu packages)
             (gnu packages autotools)
             (gnu packages fcitx)
             (gnu packages freedesktop)
             (gnu packages glib)
             (gnu packages guile)
             (gnu packages ibus)
             (gnu packages linux)
             (gnu packages pkg-config)
             (gnu packages pulseaudio)
             (gnu packages sdl)
             (gnu packages texinfo)
             (gnu packages vulkan)
             (gnu packages xdisorg)
             (gnu packages xorg)
             (guix build-system cmake)
             (guix build-system gnu)
             (guix gexp)
             (guix git)
             (guix git-download)
             ((guix licenses) #:prefix license:)
             (guix packages))

(define sdl3
  (let ((commit "596fcfa6c4fd20e5a952c0a1b0147f2fa9f69198")
        (revision "1"))
    (package
      (inherit sdl2)
      (name "sdl3")
      (source
       (origin
         (method git-fetch)
         (uri (git-reference
               (url "https://github.com/libsdl-org/SDL")
               (commit commit)))
         (sha256
          (base32
           "0f3dx1r92crkf3l0iyf8rbmzba06dpcy90vha39i1jvdmifhyqbs"))))
      (build-system cmake-build-system)
      (arguments
       (list
        #:tests? #f
        #:configure-flags
        #~(list "-DSDL_KMSDRM=ON"
                "-DSDL_ALSA_SHARED=OFF"
                "-DSDL_PULSEAUDIO_SHARED=OFF"
                "-DSDL_PIPEWIRE_SHARED=OFF"
                "-DSDL_X11_SHARED=OFF"
                "-DSDL_WAYLAND_SHARED=OFF"
                "-DSDL_WAYLAND_LIBDECOR_SHARED=OFF"
                "-DSDL_KMSDRM_SHARED=OFF"
                (string-append "-DCMAKE_SHARED_LINKER_FLAGS=-Wl,-rpath,"
                               #$(this-package-input "eudev") "/lib"
                               ",-rpath,"
                               #$(this-package-input "vulkan-loader") "/lib"))))
      (propagated-inputs
       (list
        alsa-lib
        libxcursor                      ;enables X11 cursor support
        libxkbcommon
        libxrandr
        pipewire
        pulseaudio
        wayland))
      (inputs
       (list
        dbus
        eudev                           ;for discovering input devices
        fcitx
        glib
        ibus-minimal
        libdecor
        vulkan-loader
        wayland-protocols)))))

(define guile-bstruct
  (let ((commit "3186036e116d3e885eae3970e0cad77289d922fd")
        (revision "1"))
    (package
      (name "guile-bstruct")
      (version "0.1.0-git")
      (source
       (origin
         (method git-fetch)
         (uri (git-reference
               (url "https://git.dthompson.us/guile-bstruct.git")
               (commit commit)))
         (sha256
          (base32
           "0128p1wdiad1sfifaa40w45899pii4mpw30aw3h1rc1dsgm6288m"))))
      (build-system gnu-build-system)
      (native-inputs (list automake autoconf pkg-config texinfo))
      (inputs (list guile-3.0-latest))
      (synopsis "Efficient binary structures for Guile")
      (description "Guile-bstruct provides an efficient implementation of low-level binary
structures for Guile Scheme.")
      (home-page "https://dthompson.us/projects/guile-bstruct.html")
      (license license:asl2.0))))

(package
  (name "guile-sdl3")
  (version "0.1.0")
  (source (git-checkout (url (dirname (current-filename)))))
  (build-system gnu-build-system)
  (arguments
   '(#:make-flags '("GUILE_AUTO_COMPILE=0")
     #:phases
     (modify-phases %standard-phases
       (add-after 'unpack 'bootstrap
         (lambda _ (invoke "sh" "bootstrap"))))))
  (native-inputs (list autoconf automake pkg-config texinfo))
  (inputs (list guile-3.0-latest sdl3))
  (propagated-inputs (list guile-bstruct))
  (synopsis "Guile bindings for SDL3")
  (description "Guile-SDL3 provides pure Guile Scheme bindings to the SDL3 C shared
library via the foreign function interface.")
  (home-page "https://git.dthompson.us/guile-sdl3.git")
  (license license:asl2.0))