;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2013, 2015, 2017 David Thompson ;;; Copyright © 2014 Mark H Weaver ;;; Copyright © 2015, 2017 Sou Bunnbu ;;; Copyright © 2015 Alex Kost ;;; Copyright © 2016, 2017, 2021 Efraim Flashner ;;; Copyright © 2017, 2018, 2019 Rutger Helling ;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice ;;; Copyright © 2018, 2019, 2020 Ricardo Wurmus ;;; Copyright © 2019 Kei Kebreau ;;; Copyright © 2019, 2020 Nicolas Goaziou ;;; Copyright © 2019, 2022 Marius Bakke ;;; Copyright © 2019 Pierre Neidhardt ;;; Copyright © 2020 Timotej Lazar ;;; Copyright © 2020 Oleg Pykhalov ;;; Copyright © 2022 Maxim Cournoyer ;;; Copyright © 2023 Evgeny Pisemsky ;;; Copyright © 2023, 2024 dan ;;; ;;; This file is part of GNU Guix. ;;; ;;; GNU Guix is free software; you can redistribute it and/or modify it ;;; under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 3 of the License, or (at ;;; your option) any later version. ;;; ;;; GNU Guix 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 General Public License ;;; along with GNU Guix. If not, see . (define-module (gnu packages sdl) #:use-module (ice-9 match) #:use-module (srfi srfi-1) #:use-module (srfi srfi-26) #:use-module (gnu packages) #:use-module (guix gexp) #:use-module ((guix licenses) #:prefix license:) #:use-module (guix packages) #:use-module (guix download) #:use-module (guix git-download) #:use-module (guix utils) #:use-module (guix build-system cmake) #:use-module (guix build-system copy) #:use-module (guix build-system gnu) #:use-module (guix build-system trivial) #:use-module (gnu packages audio) #:use-module (gnu packages autotools) #:use-module (gnu packages compression) #:use-module (gnu packages fontutils) #:use-module (gnu packages freedesktop) #:use-module (gnu packages glib) #:use-module (gnu packages gtk) #:use-module (gnu packages guile) #:use-module (gnu packages ibus) #:use-module (gnu packages image) #:use-module (gnu packages linux) #:use-module (gnu packages mp3) #:use-module (gnu packages pkg-config) #:use-module (gnu packages pulseaudio) #:use-module (gnu packages gl) #:use-module (gnu packages vulkan) #:use-module (gnu packages xdisorg) #:use-module (gnu packages xiph) #:use-module (gnu packages xorg) #:export (sdl-union)) (define-public sdl2 (package (name "sdl2") (version "2.30.8") (source (origin (method url-fetch) (uri (string-append "https://libsdl.org/release/SDL2-" version ".tar.gz")) (sha256 (base32 "0n006l1zds2av8a9p6m6l0mj7jwb3jbr6mq7j0nxg6vblxg2j31q")))) (build-system gnu-build-system) (arguments (list #:tests? #f ;no check target ;; Explicitly link against shared libraries instead of dlopening them. ;; For X11, ALSA, and PulseAudio. ;; OpenGL library is still dlopened at runtime. #:configure-flags #~(append '("--disable-wayland-shared" "--enable-video-kmsdrm" "--disable-kmsdrm-shared") '("--disable-alsa-shared" "--disable-pulseaudio-shared" "--disable-x11-shared" ;; Explicitly link with mesa. ;; This add mesa to libsdl's RUNPATH, to make dlopen ;; finding the libGL from mesa at runtime. "LDFLAGS=-lGL")) #: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")))) ;build verbosely (propagated-inputs ;; SDL headers include X11 headers. (list libx11 libcap ; 'libSDL.la' contain `-lcap'. ;; TODO: Since building Mesa with Meson it is now necessary that Mesa is ;; a propogated input. We still need to figure out why, possibly due to a ;; change in pkg-config. mesa)) (native-inputs (list pkg-config)) (inputs ;; SDL2 needs to be built with ibus support otherwise some systems ;; experience a bug where input events are doubled. ;; ;; For more information, see: https://dev.solus-project.com/T1721 (list libxrandr glu alsa-lib pulseaudio dbus eudev ;for discovering input devices glib ibus-minimal libxkbcommon libxcursor ;enables X11 cursor support vulkan-loader wayland wayland-protocols)) (outputs '("out" "debug")) (synopsis "Cross platform game development library") (description "Simple DirectMedia Layer is a cross-platform development library designed to provide low level access to audio, keyboard, mouse, joystick, and graphics hardware.") (home-page "https://libsdl.org/") (license license:bsd-3))) (define-public sdl12-compat (package (name "sdl12-compat") (version "1.2.68") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/libsdl-org/sdl12-compat") (commit (string-append "release-" version)))) (file-name (git-file-name name version))