summaryrefslogtreecommitdiff
path: root/guix.scm
blob: afc747d4938ebfaaf9f62e72a5a1121d227f8df9 (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
;;; 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 guile)
             (gnu packages linux)
             (gnu packages pkg-config)
             (gnu packages sdl)
             (gnu packages texinfo)
             (guix build-system cmake)
             (guix build-system gnu)
             (guix gexp)
             (guix git)
             (guix git-download)
             (guix licenses)
             (guix packages))

(define sdl3
  (let ((commit "91b074beb7337416c3921da0b667ad88491b9c7b")
        (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
           "1s2yvhsx129in2f92hj6gc11aalzjml7gc70rxvplji0d3x629kf"))))
      (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_KMSDRM_SHARED=OFF"
                ;; "-DSDL_HIDAPI_LIBUSB_SHARED=OFF"
                (string-append "-DCMAKE_SHARED_LINKER_FLAGS=-Wl,-rpath,"
                               #$(this-package-input "eudev") "/lib"
                               ",-rpath,"
                               #$(this-package-input "vulkan-loader") "/lib"))
        ;; #:make-flags
        ;; #~(cons*
        ;;    ;; SDL dlopens libudev and libvulkan, so make sure they are in
        ;;    ;; rpath. This overrides the LDFLAG set in sdl’s configure-flags,
        ;;    ;; which isn’t necessary as sdl2 includes Mesa by default.
        ;;    (string-append "LDFLAGS=-Wl,-rpath,"
        ;;                   #$(this-package-input "eudev") "/lib"
        ;;                   ",-rpath,"
        ;;                   #$(this-package-input "vulkan-loader") "/lib")
        ;;    '("V=1"))
        ))
      (inputs
       (modify-inputs (package-inputs sdl2)
         (append pipewire))))))

(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))
  (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 lgpl3+))