aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages/sdl.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/sdl.scm')
-rw-r--r--gnu/packages/sdl.scm185
1 files changed, 111 insertions, 74 deletions
diff --git a/gnu/packages/sdl.scm b/gnu/packages/sdl.scm
index d3a0e33b19..4ae128a41c 100644
--- a/gnu/packages/sdl.scm
+++ b/gnu/packages/sdl.scm
@@ -14,7 +14,7 @@
;;; Copyright © 2020 Timotej Lazar <timotej.lazar@araneo.si>
;;; Copyright © 2020 Oleg Pykhalov <go.wigust@gmail.com>
;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
-;;; Copyright © 2023 Evgeny Pisemsky <evgeny@pisemsky.com>
+;;; Copyright © 2023 Evgeny Pisemsky <mail@pisemsky.site>
;;; Copyright © 2023, 2024 dan <i@dan.games>
;;;
;;; This file is part of GNU Guix.
@@ -43,6 +43,7 @@
#: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)
@@ -67,35 +68,47 @@
#:use-module (gnu packages xorg)
#:export (sdl-union))
-(define-public sdl
+(define-public sdl2
(package
- (name "sdl")
- (version "1.2.15")
+ (name "sdl2")
+ (version "2.30.1")
(source (origin
- (method url-fetch)
- (uri
- (string-append "https://libsdl.org/release/SDL-"
- version ".tar.gz"))
- (sha256
- (base32
- "005d993xcac8236fpvd1iawkz4wqjybkpn8dbwaliqz5jfkidlyn"))
- (patches (search-patches "sdl-libx11-1.6.patch"))))
+ (method url-fetch)
+ (uri
+ (string-append "https://libsdl.org/release/SDL2-"
+ version ".tar.gz"))
+ (sha256
+ (base32
+ "0fj7gxc7rlzzrafnx9nmf7ws3paxy583fmx7bcbavi6gr3xmy881"))))
(build-system gnu-build-system)
(arguments
- '(;; Explicitly link against shared libraries instead of dlopening them.
- ;; For X11, ALSA, and PulseAudio.
- ;; OpenGL library is still dlopened at runtime.
- #:configure-flags '("--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 '("V=1") ;build verbosely
-
- #:tests? #f)) ; no check target
+ (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
@@ -105,60 +118,82 @@
;; change in pkg-config.
mesa))
(native-inputs (list pkg-config))
- (inputs (list libxrandr glu alsa-lib pulseaudio))
+ (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.")
+ (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:lgpl2.1)))
+ (license license:bsd-3)))
-(define-public sdl2
+(define-public sdl12-compat
(package
- (inherit sdl)
- (name "sdl2")
- (version "2.30.1")
+ (name "sdl12-compat")
+ (version "1.2.68")
(source (origin
- (method url-fetch)
- (uri
- (string-append "https://libsdl.org/release/SDL2-"
- version ".tar.gz"))
+ (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))
(sha256
(base32
- "0fj7gxc7rlzzrafnx9nmf7ws3paxy583fmx7bcbavi6gr3xmy881"))))
+ "0qsjlzi1wqszi6k4pc3k9xdvzid5cx6ql8wbjw6qdapzpvf6arvz"))))
+ (build-system cmake-build-system)
(arguments
- (substitute-keyword-arguments (package-arguments sdl)
- ((#:configure-flags flags)
- #~(append '("--disable-wayland-shared" "--enable-video-kmsdrm"
- "--disable-kmsdrm-shared")
- #$flags))
- ((#:make-flags 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")
- #$flags))))
- (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
- (modify-inputs (package-inputs sdl)
- (append dbus
- eudev ;for discovering input devices
- glib
- ibus-minimal
- libxkbcommon
- libxcursor ;enables X11 cursor support
- vulkan-loader
- wayland
- wayland-protocols)))
- (license license:bsd-3)))
+ (list #:tests? #f ;no check target
+ #:configure-flags
+ ;; This add SDL2 to sdl12-compat's RUNPATH, to make dlopen finding the
+ ;; libSDL2 at runtime.
+ #~'("-DCMAKE_SHARED_LINKER_FLAGS=-lSDL2")
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'patch-sdl-config
+ (lambda _
+ ;; Keep the old behaviour to honour "--prefix" option for
+ ;; "--cflags" and "--libs", required by 'perl-alien-sdl'.
+ (substitute* "sdl-config.in"
+ (("echo -I[$][{]includedir[}]") "echo -I${prefix}/include")
+ (("echo -L[$][{]libdir[}]") "echo -L${prefix}/lib"))))
+ (add-after 'install 'install-sdl.pc
+ (lambda _
+ (let ((pcdir (string-append #$output
+ "/lib/pkgconfig")))
+ (symlink (string-append pcdir "/sdl12_compat.pc")
+ (string-append pcdir "/sdl.pc"))))))))
+ (inputs (list sdl2))
+ (propagated-inputs (list glu)) ;required by SDL_opengl.h
+ (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. This package is a compatibility layer; it provides a binary and
+source compatible API for programs written against SDL 1.2, but it uses SDL 2.0
+behind the scenes.")
+ (home-page "https://libsdl.org/")
+ ;; dr_mp3 code are under public domain.
+ (license (list license:zlib license:public-domain))))
+
+(define-public sdl sdl12-compat)
(define-public sdl2-2.0
(package
@@ -452,6 +487,8 @@ directory.")
(map (match-lambda
(("sdl" _)
`("sdl2" ,sdl2))
+ (("sdl12-compat" _)
+ `("sdl2" ,sdl2))
(other other))
(package-propagated-inputs package)))
@@ -571,8 +608,8 @@ directory.")
(properties '((upstream-name . "SDL2_ttf")))))
(define-public sdl2-gamecontrollerdb
- (let ((commit "6f3c4edcb5a2e2ed090ca8af40d2c0f00dcd77f6")
- (revision "0"))
+ (let ((commit "9d0994523206c9d73925d78d185531c4c7331db7")
+ (revision "1"))
(package
(name "sdl2-gamecontrollerdb")
(version (git-version "0" revision commit))
@@ -584,7 +621,7 @@ directory.")
(commit commit)))
(file-name (git-file-name name version))
(sha256
- (base32 "1gciqc8qm2qgcjj5s9jpclznznsp6awl4ldrnj7g01chkcx0l6a3"))))
+ (base32 "08rv3i6sh90ibphxnv9r6h1zjyq88x9hq3smvf6cnlqvirnam94s"))))
(build-system copy-build-system)
(arguments
'(#:install-plan '(("gamecontrollerdb.txt" "share/sdl2/"))))