From: iyzsong--- via Guix-patches via <guix-patches@gnu.org>
To: 69638@debbugs.gnu.org
Cc: 宋文武 <iyzsong@member.fsf.org>
Subject: [bug#69638] [PATCH] gnu: sdl: Replace with sdl12-compat.
Date: Fri, 8 Mar 2024 22:40:00 +0800 [thread overview]
Message-ID: <0979322c4288b59afb9c87759a58489143ce1438.1709908788.git.iyzsong@member.fsf.org> (raw)
From: 宋文武 <iyzsong@member.fsf.org>
* gnu/packages/sdl.scm (sdl12-compat): New package.
(sdl): Remove package, defined as sdl12-compat.
(sdl2): Don't inherit from sdl.
(propagated-inputs-with-sdl2): Add case for sdl12-compat.
(sdl-union): Hardcode version to "1.2.15" to avoid rebuilds.
Change-Id: I843d349b3d69164cc640c7db204464a51819a0df
---
gnu/packages/sdl.scm | 165 ++++++++++++++++++++++++-------------------
1 file changed, 94 insertions(+), 71 deletions(-)
diff --git a/gnu/packages/sdl.scm b/gnu/packages/sdl.scm
index 3a4aafcaa7..8646e505c4 100644
--- a/gnu/packages/sdl.scm
+++ b/gnu/packages/sdl.scm
@@ -43,6 +43,7 @@ (define-module (gnu packages sdl)
#: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,48 @@ (define-module (gnu packages sdl)
#: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.28.5")
(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
+ "1r36cspzv6h8abiqbbkrgm17g975p9wiziir2xabj3721dyv6b1k"))))
(build-system gnu-build-system)
+ ;; TODO: Remove 'append' and 'cons*', was used to avoid rebuilds.
(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 +119,67 @@ (define-public sdl
;; 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.28.5")
+ (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
- "1r36cspzv6h8abiqbbkrgm17g975p9wiziir2xabj3721dyv6b1k"))))
+ "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")))
+ (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
@@ -423,7 +444,7 @@ (define* (sdl-union #:optional (packages (list sdl sdl-gfx sdl-net sdl-ttf
If PACKAGES are not specified, all SDL packages are used."
(package
(name "sdl-union")
- (version (package-version sdl))
+ (version "1.2.15") ;TODO: use correct SDL version
(source #f)
(build-system trivial-build-system)
(arguments
@@ -452,6 +473,8 @@ (define (propagated-inputs-with-sdl2 package)
(map (match-lambda
(("sdl" _)
`("sdl2" ,sdl2))
+ (("sdl12-compat" _)
+ `("sdl2" ,sdl2))
(other other))
(package-propagated-inputs package)))
base-commit: de3f86443837b7bd6e3bad11dbaeed2550d4207c
--
2.41.0
next reply other threads:[~2024-03-08 14:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-08 14:40 iyzsong--- via Guix-patches via [this message]
2024-03-08 15:06 ` [bug#69638] [PATCH v2] gnu: sdl: Replace with sdl12-compat iyzsong--- via Guix-patches via
2024-03-10 9:33 ` [bug#69638] [PATCH v3] " iyzsong--- via Guix-patches via
2024-04-12 19:00 ` bug#69638: " Maxim Cournoyer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0979322c4288b59afb9c87759a58489143ce1438.1709908788.git.iyzsong@member.fsf.org \
--to=guix-patches@gnu.org \
--cc=69638@debbugs.gnu.org \
--cc=iyzsong@envs.net \
--cc=iyzsong@member.fsf.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.