From patchwork Fri Mar 8 14:40:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "ashish.is--- via Guix-patches\" via" X-Patchwork-Id: 61526 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 750F227BBEA; Fri, 8 Mar 2024 14:40:57 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id EF9CA27BBE2 for ; Fri, 8 Mar 2024 14:40:53 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ribOn-0006iL-EI; Fri, 08 Mar 2024 09:40:37 -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 ) id 1ribOg-0006hx-Jx for guix-patches@gnu.org; Fri, 08 Mar 2024 09:40:30 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ribOg-0000nZ-Bu for guix-patches@gnu.org; Fri, 08 Mar 2024 09:40:30 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ribPB-0000hC-U9 for guix-patches@gnu.org; Fri, 08 Mar 2024 09:41:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#69638] [PATCH] gnu: sdl: Replace with sdl12-compat. Resent-From: iyzsong@envs.net Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 08 Mar 2024 14:41:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 69638 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 69638@debbugs.gnu.org Cc: =?utf-8?b?5a6L5paH5q2m?= X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.17099088382585 (code B ref -1); Fri, 08 Mar 2024 14:41:01 +0000 Received: (at submit) by debbugs.gnu.org; 8 Mar 2024 14:40:38 +0000 Received: from localhost ([127.0.0.1]:57155 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ribOn-0000fd-10 for submit@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 ) id 1ribOk-0000fP-6a for submit@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 ) id 1ribOC-0006Vi-F9 for guix-patches@gnu.org; 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 ) id 1ribO8-0000Yi-W5 for guix-patches@gnu.org; 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) Date: Fri, 8 Mar 2024 22:40:00 +0800 Message-ID: <0979322c4288b59afb9c87759a58489143ce1438.1709908788.git.iyzsong@member.fsf.org> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Received-SPF: pass client-ip=5.199.136.28; envelope-from=iyzsong@envs.net; 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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: iyzsong@envs.net X-ACL-Warn: , iyzsong--- via Guix-patches X-Patchwork-Original-From: iyzsong--- via Guix-patches via From: "ashish.is--- via Guix-patches\" via" Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches From: 宋文武 * 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(-) base-commit: de3f86443837b7bd6e3bad11dbaeed2550d4207c 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)))