GNU bug report logs - #69638
[PATCH] gnu: sdl: Replace with sdl12-compat.

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix-patches; Reported by: iyzsong@HIDDEN; Keywords: patch; Done: Maxim Cournoyer <maxim.cournoyer@HIDDEN>; Maintainer for guix-patches is guix-patches@HIDDEN.

Message received at 69638-done <at> debbugs.gnu.org:


Received: (at 69638-done) by debbugs.gnu.org; 12 Apr 2024 19:00:53 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Apr 12 15:00:52 2024
Received: from localhost ([127.0.0.1]:59584 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rvM8o-00021T-Rm
	for submit <at> debbugs.gnu.org; Fri, 12 Apr 2024 15:00:52 -0400
Received: from mail-qt1-x82e.google.com ([2607:f8b0:4864:20::82e]:54753)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <maxim.cournoyer@HIDDEN>) id 1rvM8m-0001zd-Cp
 for 69638-done <at> debbugs.gnu.org; Fri, 12 Apr 2024 15:00:50 -0400
Received: by mail-qt1-x82e.google.com with SMTP id
 d75a77b69052e-43651b7004bso8605061cf.1
 for <69638-done <at> debbugs.gnu.org>; Fri, 12 Apr 2024 12:00:38 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1712948432; x=1713553232; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=po1W8KI7fDwizJVNVjkbV17OL1aXS9rTNE5mgZAuy2c=;
 b=jyVngcqjGgfHPt+S9i8i5kCu2YhLeliZLpBT+gm1mriN/C5puEzDj2p6D5crR3+AKl
 7pl6n8uUibvSbN2CJzFiWNstHQGqD69lOhyXwYt/OczH9wcA6+iZFPQhiGZdd4Z7NLhj
 45MFRJjd7OnjpGN86t64at4nXCDnzn6SVnWfwjej64aj7tL7DJsDwt9dVfxJZio0mbEQ
 3yB6hBc9jHExhjQlP1OjsZRnsWWFbB28OobBmoevBR4zV+zxXAtg8utUZwIZuUPD4KzY
 lGFRH4fS+dh73+RSf6gBOOJVXWMKzvAhDaRNrbTofHmniJw1MhuDUZtz8PrK1z4Py5+y
 LbIQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1712948432; x=1713553232;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from
 :to:cc:subject:date:message-id:reply-to;
 bh=po1W8KI7fDwizJVNVjkbV17OL1aXS9rTNE5mgZAuy2c=;
 b=ISz5UtJacqHeOsDMNvPtIr+Lr9xcnKzd9GHKvaHaXfPv4Ho/lR2xflTi/DUYDGrjGR
 X7oF6jimWJvM6A6sUQTZnZxmYJcVHXkXXVdCAmAaHWWNNYVi/jfzADzN1vFvzfUDH4PG
 XWofvk+jc1G7+NFgmW1Y9KnY5GqtoB0TxuTfST5RtvbwJmttOmVIUxtpMdWjbof/urXv
 SmzovSajamvZFFFwtHL+CwsDaavzg7OIvIcdMFXbmbgKIcdzjA16YxrryIfkNevuG8pm
 zkwnSXOfbjADRl4ZTAdv1u5t8/dRXlYcF1n+JldGjuy+LH/QOc5hVFZ8vGaxoflVKCEt
 PAgA==
X-Gm-Message-State: AOJu0Yx4Fwcl1vqKRIouw+PawK0PSlh7EKNbdETBjCVJSwzRoJF3VxXr
 caHOA5+FucwSw1n7CCe0R+QoNbBdgMX3U6x2ZJQUNux0djTiNepvU1+fAw==
X-Google-Smtp-Source: AGHT+IFLTybCHGXyQDqYpbkddRGU0vYwZEpplukWbEdb1o8k9cetbi72qG2Pse97pPMXCwtDf+TjuA==
X-Received: by 2002:a05:622a:58f:b0:434:973e:7af2 with SMTP id
 c15-20020a05622a058f00b00434973e7af2mr3919798qtb.40.1712948432406; 
 Fri, 12 Apr 2024 12:00:32 -0700 (PDT)
Received: from hurd (dsl-148-172.b2b2c.ca. [66.158.148.172])
 by smtp.gmail.com with ESMTPSA id
 o15-20020ac8698f000000b00434e251a9e3sm2550818qtq.20.2024.04.12.12.00.31
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 12 Apr 2024 12:00:31 -0700 (PDT)
From: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
To: iyzsong@HIDDEN
Subject: Re: [bug#69638] [PATCH v3] gnu: sdl: Replace with sdl12-compat.
In-Reply-To: <4347cc9aa13d3d76e413ebedd6d20f2965868667.1710062633.git.iyzsong@HIDDEN>
 (iyzsong@HIDDEN's message of "Sun, 10 Mar 2024 17:33:51 +0800")
References: <0979322c4288b59afb9c87759a58489143ce1438.1709908788.git.iyzsong@HIDDEN>
 <4347cc9aa13d3d76e413ebedd6d20f2965868667.1710062633.git.iyzsong@HIDDEN>
Date: Fri, 12 Apr 2024 15:00:28 -0400
Message-ID: <877ch2pfsj.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 69638-done
Cc: =?utf-8?B?5a6L5paH5q2m?= <iyzsong@HIDDEN>,
 69638-done <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hi,

iyzsong@HIDDEN writes:

> From: ®æ‡­ <iyzsong@HIDDEN>
>
> * 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.

It was triggering a mass rebuild anyway, so I've opted to use the actual
'sdl' version and merged this to core-updates.

Thank you, closing.

-- 
Thanks,
Maxim




Notification sent to iyzsong@HIDDEN:
bug acknowledged by developer. Full text available.
Reply sent to Maxim Cournoyer <maxim.cournoyer@HIDDEN>:
You have taken responsibility. Full text available.

Message received at 69638 <at> debbugs.gnu.org:


Received: (at 69638) by debbugs.gnu.org; 10 Mar 2024 09:34:31 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Mar 10 05:34:31 2024
Received: from localhost ([127.0.0.1]:35644 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rjFZe-0001tz-Op
	for submit <at> debbugs.gnu.org; Sun, 10 Mar 2024 05:34:31 -0400
Received: from mail.envs.net ([5.199.136.28]:48954)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <iyzsong@HIDDEN>) id 1rjFZa-0001tn-5o
 for 69638 <at> debbugs.gnu.org; Sun, 10 Mar 2024 05:34:30 -0400
Received: from localhost (mail.envs.net [127.0.0.1])
 by mail.envs.net (Postfix) with ESMTP id DC4EB38A071C;
 Sun, 10 Mar 2024 09:33:50 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=envs.net; s=modoboa;
 t=1710063230; bh=g21cdaeICgTDV0zopoJQSUtOEjIYxzDCSeSmSHdifxg=;
 h=From:To:Cc:Subject:Date:From;
 b=Oc0YH/NKKvL4nXARY8KroAONmIoNqCAeuMACKskKNChH1NfpL5JjiFOc3GU0xsrm1
 SD+SMUuviU0jpA/dz3DzRAIyVDfUOWiwgiMI9AiN7YEzjpT2HUhzx31o6DMtsRW4Bu
 v+n034oI+Kc6nSIcqKN2ixBGV8Li5asjEQYY8BXdet7ZxZuS5Xu8Yc/SugX5X40qEh
 ghDEqNzeOBljrvrKBOWlB+OMojOAJKOKx37LhKyHf+sT4iw/Hc4PW/ljzhsJTQosRk
 MFUa0hkvutqUQBqrUAIIgHFaQUQ1rTqFy3WL/VinyvGlUkwE3oxZEAvQiLC/UEjBnQ
 z6ay9Ghvg99JzwCrbweCZtN/TF7bKAm8+KcltdjSPiMpEzLM69sytp0Cyhrpgy9GjF
 HfNjTwXvMKnG4FSqRbTBvvELBsBJoy51eTXQomndkM/oG9ujFk3TeXk9ZECYeT4Qbk
 rwiLS1b8XhZR6OJu4zeLTZ5CW9gdJHJ76V3/+0bATi+7f9oU2DLZIq97iRhkFr+Yy9
 IY9TVbnm2dDzbhem/ajiuJKATB+OuWQNDOMoQmYusG/WfV/hgZEeFfggZjf7ixqgsp
 XzKeIOqBcV0V9aenJSnsbuFHaTF4EEDxmS3oGEzqVozoBdI8jVk6iPnj0a8uYPk2Yc
 ax7k/v4bGi+X/p6ttLVJJ1FU=
X-Virus-Scanned: Debian amavisd-new at mail.envs.net
Received: from mail.envs.net ([127.0.0.1])
 by localhost (mail.envs.net [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id YW4RStho5Ovm; Sun, 10 Mar 2024 09:33:46 +0000 (UTC)
Received: from localhost (unknown [36.170.57.203])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest
 SHA256) (No client certificate requested)
 by mail.envs.net (Postfix) with ESMTPSA;
 Sun, 10 Mar 2024 09:33:46 +0000 (UTC)
Received: from localhost.localdomain (localhost [127.0.0.1])
 by localhost (OpenSMTPD) with ESMTP id 0bb842bd;
 Sun, 10 Mar 2024 09:34:06 +0000 (UTC)
From: iyzsong@HIDDEN
To: 69638 <at> debbugs.gnu.org
Subject: [PATCH v3] gnu: sdl: Replace with sdl12-compat.
Date: Sun, 10 Mar 2024 17:33:51 +0800
Message-ID: <4347cc9aa13d3d76e413ebedd6d20f2965868667.1710062633.git.iyzsong@HIDDEN>
X-Mailer: git-send-email 2.41.0
MIME-Version: 1.0
Content-Type: text/plain; charset=yes
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 69638
Cc: =?UTF-8?q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

From: 宋文武 <iyzsong@HIDDEN>

* 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.
* gnu/packages/patches/sdl-libx11-1.6.patch: Remove file.
* gnu/local.mk (dist_patch_DATA): Unregister it.

Change-Id: I843d349b3d69164cc640c7db204464a51819a0df
---
Changes since v2:
  sdl12-compat: Add a 'patch-sdl-config' phase to fix build for frozen-bubble.


---
 gnu/local.mk                              |   1 -
 gnu/packages/patches/sdl-libx11-1.6.patch |  13 --
 gnu/packages/sdl.scm                      | 180 +++++++++++++---------
 3 files changed, 109 insertions(+), 85 deletions(-)
 delete mode 100644 gnu/packages/patches/sdl-libx11-1.6.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 174c4c30e2..93bed266ac 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -2030,7 +2030,6 @@ dist_patch_DATA =						\
   %D%/packages/patches/scons-test-environment.patch		\
   %D%/packages/patches/screen-hurd-path-max.patch		\
   %D%/packages/patches/scsh-nonstring-search-path.patch	\
-  %D%/packages/patches/sdl-libx11-1.6.patch			\
   %D%/packages/patches/seed-webkit.patch			\
   %D%/packages/patches/sendgmail-accept-ignored-gsuite-flag.patch	\
   %D%/packages/patches/sendgmail-remove-domain-restriction.patch	\
diff --git a/gnu/packages/patches/sdl-libx11-1.6.patch b/gnu/packages/patches/sdl-libx11-1.6.patch
deleted file mode 100644
index 73ba9ac071..0000000000
--- a/gnu/packages/patches/sdl-libx11-1.6.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-Update _XData32 declaration in SDL_x11sym.h to match that of libx11 1.6.
-
---- SDL-1.2.15/src/video/x11/SDL_x11sym.h.~1~	2012-01-19 01:30:06.000000000 -0500
-+++ SDL-1.2.15/src/video/x11/SDL_x11sym.h	2014-12-26 00:22:36.445067694 -0500
-@@ -165,7 +165,7 @@
-  */
- #ifdef LONG64
- SDL_X11_MODULE(IO_32BIT)
--SDL_X11_SYM(int,_XData32,(Display *dpy,register long *data,unsigned len),(dpy,data,len),return)
-+SDL_X11_SYM(int,_XData32,(Display *dpy,register _Xconst long *data,unsigned len),(dpy,data,len),return)
- SDL_X11_SYM(void,_XRead32,(Display *dpy,register long *data,long len),(dpy,data,len),)
- #endif
- 
diff --git a/gnu/packages/sdl.scm b/gnu/packages/sdl.scm
index 3a4aafcaa7..17cae5708f 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,82 @@ (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")
+           #: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* (#:key outputs #:allow-other-keys)
+                   (let ((pcdir (string-append (assoc-ref outputs "out")
+                                               "/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
@@ -423,7 +459,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 +488,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: 7758e63f7a89f53fbb7c7a265ae472af0a8dfab0
-- 
2.41.0





Information forwarded to guix-patches@HIDDEN:
bug#69638; Package guix-patches. Full text available.

Message received at 69638 <at> debbugs.gnu.org:


Received: (at 69638) by debbugs.gnu.org; 8 Mar 2024 15:07:17 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 08 10:07:17 2024
Received: from localhost ([127.0.0.1]:59265 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1riboa-0002Gc-NN
	for submit <at> debbugs.gnu.org; Fri, 08 Mar 2024 10:07:17 -0500
Received: from mail.envs.net ([5.199.136.28]:48050)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <iyzsong@HIDDEN>) id 1riboY-0002GN-05
 for 69638 <at> debbugs.gnu.org; Fri, 08 Mar 2024 10:07:15 -0500
Received: from localhost (mail.envs.net [127.0.0.1])
 by mail.envs.net (Postfix) with ESMTP id A65AF38A0720;
 Fri,  8 Mar 2024 15:06:38 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=envs.net; s=modoboa;
 t=1709910398; bh=CG9Pgw3Vv9Sgw/IFYu56oIaxjxQtrBWnoD0sy9PW/gQ=;
 h=From:To:Cc:Subject:Date:From;
 b=Vf6CEjs8KaPHzMUOS9UTKBfvF3Gbp1xhqdo+CSMdQlgWgXpQ0OgAL9XIWj79FYTM0
 sVmIWFdVmBf+c4YjC4CkiX6LBHnQM3NnW+c5AYpZX9eYaXDN3jPOEmddesdLBPqwLF
 pjgve0oOfRWVJX9r/JAHeOknGAYrbJRoGDIrgzGeGeahSvbRKgU6FwScH+GMKDzYUb
 sodAmruspuWSyoU5rTbOohrUofwC9auvq6IJYZb4SxPY+KZZjA69TX1px42hFBGoEb
 vENWxhxhk6kuLkRt7AfhqGWYPXj2gHB6SbWdLfsiB0839QaAWdhXh3UCNtC1x55BWd
 qpO6X+ohj2rFhOxHUD/zdNiy3hWfThyWrHP3UCEXnqBYwrE+HKIwQw/IoXbtlsJk7h
 /6o4Cp8Pg3/0qruULakq5YyiBOthPrDroDfevXZZPtRG5hjVXT3HlW8xGIXeLDbNc8
 4Kcwt5fgigR+yg0JGsp1/GNDYqmSpB9z3b9tnWbkXL20mRrM7unRAVD15Zjl3JzVHS
 xKZoJsJzpDM7CpreidZlIMszifi/jesayHsgsFoXEyp6cT+jQTMPaNNto9Btr3H/ay
 CCVk1R0LPKVZGwM1eI5jWtpsS0tMKdjDy0Hp4Qj/2IRXijQccRI+xT2YzL40b25Vj0
 ZJRlO1pZFXF0FFgDKmDiU/0E=
X-Virus-Scanned: Debian amavisd-new at mail.envs.net
Received: from mail.envs.net ([127.0.0.1])
 by localhost (mail.envs.net [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id amtz9Eczj2pm; Fri,  8 Mar 2024 15:06:34 +0000 (UTC)
Received: from localhost (unknown [36.170.57.203])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest
 SHA256) (No client certificate requested)
 by mail.envs.net (Postfix) with ESMTPSA;
 Fri,  8 Mar 2024 15:06:34 +0000 (UTC)
Received: from localhost.localdomain (localhost [127.0.0.1])
 by localhost (OpenSMTPD) with ESMTP id f102fce8;
 Fri, 8 Mar 2024 15:06:52 +0000 (UTC)
From: iyzsong@HIDDEN
To: 69638 <at> debbugs.gnu.org
Subject: [PATCH v2] gnu: sdl: Replace with sdl12-compat.
Date: Fri,  8 Mar 2024 23:06:48 +0800
Message-ID: <7eeca0be6e33b66a1f15e4e43d5b66f6a531616a.1709910349.git.iyzsong@HIDDEN>
X-Mailer: git-send-email 2.41.0
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 69638
Cc: =?UTF-8?q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

From: 宋文武 <iyzsong@HIDDEN>

* 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.
* gnu/packages/patches/sdl-libx11-1.6.patch: Remove file.
* gnu/local.mk (dist_patch_DATA): Unregister it.

Change-Id: I843d349b3d69164cc640c7db204464a51819a0df
---
 gnu/local.mk                              |   1 -
 gnu/packages/patches/sdl-libx11-1.6.patch |  13 --
 gnu/packages/sdl.scm                      | 173 +++++++++++++---------
 3 files changed, 102 insertions(+), 85 deletions(-)
 delete mode 100644 gnu/packages/patches/sdl-libx11-1.6.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 16241ee441..0f76d0c771 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -2027,7 +2027,6 @@ dist_patch_DATA =						\
   %D%/packages/patches/scons-test-environment.patch		\
   %D%/packages/patches/screen-hurd-path-max.patch		\
   %D%/packages/patches/scsh-nonstring-search-path.patch	\
-  %D%/packages/patches/sdl-libx11-1.6.patch			\
   %D%/packages/patches/seed-webkit.patch			\
   %D%/packages/patches/sendgmail-accept-ignored-gsuite-flag.patch	\
   %D%/packages/patches/sendgmail-remove-domain-restriction.patch	\
diff --git a/gnu/packages/patches/sdl-libx11-1.6.patch b/gnu/packages/patches/sdl-libx11-1.6.patch
deleted file mode 100644
index 73ba9ac071..0000000000
--- a/gnu/packages/patches/sdl-libx11-1.6.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-Update _XData32 declaration in SDL_x11sym.h to match that of libx11 1.6.
-
---- SDL-1.2.15/src/video/x11/SDL_x11sym.h.~1~	2012-01-19 01:30:06.000000000 -0500
-+++ SDL-1.2.15/src/video/x11/SDL_x11sym.h	2014-12-26 00:22:36.445067694 -0500
-@@ -165,7 +165,7 @@
-  */
- #ifdef LONG64
- SDL_X11_MODULE(IO_32BIT)
--SDL_X11_SYM(int,_XData32,(Display *dpy,register long *data,unsigned len),(dpy,data,len),return)
-+SDL_X11_SYM(int,_XData32,(Display *dpy,register _Xconst long *data,unsigned len),(dpy,data,len),return)
- SDL_X11_SYM(void,_XRead32,(Display *dpy,register long *data,long len),(dpy,data,len),)
- #endif
- 
diff --git a/gnu/packages/sdl.scm b/gnu/packages/sdl.scm
index 3a4aafcaa7..3d81baf368 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,75 @@ (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")
+           #:phases
+           #~(modify-phases %standard-phases
+               (add-after 'install 'install-sdl.pc
+                 (lambda* (#:key outputs #:allow-other-keys)
+                   (let ((pcdir (string-append (assoc-ref outputs "out")
+                                               "/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
@@ -423,7 +452,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 +481,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





Information forwarded to guix-patches@HIDDEN:
bug#69638; Package guix-patches. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 8 Mar 2024 14:40:38 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 08 09:40:37 2024
Received: from localhost ([127.0.0.1]:57155 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ribOn-0000fd-10
	for submit <at> debbugs.gnu.org; Fri, 08 Mar 2024 09:40:37 -0500
Received: from lists.gnu.org ([209.51.188.17]:47534)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <iyzsong@HIDDEN>) id 1ribOk-0000fP-6a
 for submit <at> debbugs.gnu.org; Fri, 08 Mar 2024 09:40:35 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <iyzsong@HIDDEN>) id 1ribOC-0006Vi-F9
 for guix-patches@HIDDEN; Fri, 08 Mar 2024 09:40:00 -0500
Received: from mail.envs.net ([5.199.136.28])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <iyzsong@HIDDEN>) id 1ribO8-0000Yi-W5
 for guix-patches@HIDDEN; Fri, 08 Mar 2024 09:40:00 -0500
Received: from localhost (mail.envs.net [127.0.0.1])
 by mail.envs.net (Postfix) with ESMTP id 7838E38A071C;
 Fri,  8 Mar 2024 14:39:52 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=envs.net; s=modoboa;
 t=1709908792; bh=giXcNYMqVSryJoEHBlznFZ5ss2WbCS28d2XQKgdKcIo=;
 h=From:To:Cc:Subject:Date:From;
 b=IcMK9jVQsb0P2rrQuJXNOK4DmLRPC9km92YcuR7Pt/UZW73Wdeelqs7q2Gta5ByIR
 yrJ42Qt9/8JzOiF2XbZDU83dfu2fFbempVQ2xM/5wmJD4Nkl8uK8fuhgdL9mme3jhV
 SZSxVZmFNB9iNudj9OeBRxw/Ot02rcjBT18Yu5waMp59sbdzQDeKE3H8ZTIrLE5CRr
 VrxxtCyIin2ONQKnBilOwbHnLVGXNAh9SoyIMbPS/jHvp6QAEADDEwH5GgESDMPuln
 TuXWvu732LmKfBVuOzj9H0TPTUwhYsLXACZQeRaZ31BlwutZuVKII1kXD2/hRi1tZ4
 u8nr4emRlewtEYwBiFn5gqKoF5luvnMs14tgmWNlzBFWPx9lmsmBEwqhhP4L/ehTjX
 QGqjom84LzeaHK/Mpjm2DOmROzLGH2hdYZT9koHdzI4e/lT1wXPODFpO0NV3WcetDh
 cA4cN0GdqFHWJmnm2xLt+TcqqMUkuPVxlXwsnuBqKkH4baWz2XWYlbR3FrHeRGL5KS
 KEcAaf4ITYUjJh5oOPorvIaH+6pbQIZHRvT8fE6iIf/Nbm3V5Mw7B6TadkYRmi959+
 No7FZRtJRsUjBCtUMNUIttwheK0ViRGZnyGaHruuO0Ne4hbDjkKf/qLqDCiJT/ZXBG
 HUcZQA8Yzrn18FhVBjujGwWI=
X-Virus-Scanned: Debian amavisd-new at mail.envs.net
Received: from mail.envs.net ([127.0.0.1])
 by localhost (mail.envs.net [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id fW-5G0yhStt5; Fri,  8 Mar 2024 14:39:48 +0000 (UTC)
Received: from localhost (unknown [36.170.57.203])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest
 SHA256) (No client certificate requested)
 by mail.envs.net (Postfix) with ESMTPSA;
 Fri,  8 Mar 2024 14:39:48 +0000 (UTC)
Received: from localhost.localdomain (localhost [127.0.0.1])
 by localhost (OpenSMTPD) with ESMTP id 67cc2e9c;
 Fri, 8 Mar 2024 14:40:05 +0000 (UTC)
From: iyzsong@HIDDEN
To: guix-patches@HIDDEN
Subject: [PATCH] gnu: sdl: Replace with sdl12-compat.
Date: Fri,  8 Mar 2024 22:40:00 +0800
Message-ID: <0979322c4288b59afb9c87759a58489143ce1438.1709908788.git.iyzsong@HIDDEN>
X-Mailer: git-send-email 2.41.0
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Received-SPF: pass client-ip=5.199.136.28; envelope-from=iyzsong@HIDDEN;
 helo=mail.envs.net
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.4 (-)
X-Debbugs-Envelope-To: submit
Cc: =?UTF-8?q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.4 (--)

From: 宋文武 <iyzsong@HIDDEN>

* 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





Acknowledgement sent to iyzsong@HIDDEN:
New bug report received and forwarded. Copy sent to guix-patches@HIDDEN. Full text available.
Report forwarded to guix-patches@HIDDEN:
bug#69638; Package guix-patches. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Fri, 12 Apr 2024 19:15:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.