From 567863b2398b6832f686b258709396572af0e980 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Wed, 2 Oct 2024 21:22:19 -0400 Subject: First commit! --- guix.scm | 111 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 guix.scm (limited to 'guix.scm') diff --git a/guix.scm b/guix.scm new file mode 100644 index 0000000..afc747d --- /dev/null +++ b/guix.scm @@ -0,0 +1,111 @@ +;;; guile-sdl3 --- FFI bindings for SDL3 +;;; Copyright © 2024 David Thompson +;;; +;;; 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 +;;; . + +;;; 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+)) -- cgit v1.2.3