From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 595D1158003 for ; Sat, 24 Jun 2023 20:59:43 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id ADF75E087E; Sat, 24 Jun 2023 20:59:42 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 99A10E087E for ; Sat, 24 Jun 2023 20:59:42 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id E1894335C29 for ; Sat, 24 Jun 2023 20:59:41 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 7C693A66 for ; Sat, 24 Jun 2023 20:59:40 +0000 (UTC) From: "James Le Cuirot" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "James Le Cuirot" Message-ID: <1687640356.b1988d72f5a434d9eedb52fd25b6324a16b0922d.chewi@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: games-arcade/shovel-knight/ X-VCS-Repository: repo/gentoo X-VCS-Files: games-arcade/shovel-knight/shovel-knight-4.1b-r1.ebuild X-VCS-Directories: games-arcade/shovel-knight/ X-VCS-Committer: chewi X-VCS-Committer-Name: James Le Cuirot X-VCS-Revision: b1988d72f5a434d9eedb52fd25b6324a16b0922d X-VCS-Branch: master Date: Sat, 24 Jun 2023 20:59:40 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 7831e7bd-1623-4a83-ab6f-6ff3762bf028 X-Archives-Hash: 07d03d0aadb955b1e5f572f623ad74e4 commit: b1988d72f5a434d9eedb52fd25b6324a16b0922d Author: James Le Cuirot gentoo org> AuthorDate: Sat Jun 24 20:59:16 2023 +0000 Commit: James Le Cuirot gentoo org> CommitDate: Sat Jun 24 20:59:16 2023 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b1988d72 games-arcade/shovel-knight: Work around crash when a controller is connected Signed-off-by: James Le Cuirot gentoo.org> .../shovel-knight/shovel-knight-4.1b-r1.ebuild | 110 +++++++++++++++++++++ 1 file changed, 110 insertions(+) diff --git a/games-arcade/shovel-knight/shovel-knight-4.1b-r1.ebuild b/games-arcade/shovel-knight/shovel-knight-4.1b-r1.ebuild new file mode 100644 index 000000000000..185cfa3f331a --- /dev/null +++ b/games-arcade/shovel-knight/shovel-knight-4.1b-r1.ebuild @@ -0,0 +1,110 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit desktop unpacker wrapper xdg + +MY_PN="ShovelKnight" +DESCRIPTION="Sweeping classic action adventure with an 8-bit retro aesthetic" +HOMEPAGE="https://yachtclubgames.com/games/shovel-knight-treasure-trove/" +SRC_URI="${PN//-/_}_treasure_trove_4_1b_arby_s_46298.sh" +S="${WORKDIR}/data/noarch/game" + +LICENSE="Yacht-Club-Games-EULA" +SLOT="0" +KEYWORDS="-* ~amd64 ~x86" +IUSE="+joystick" +RESTRICT="bindist fetch splitdebug" + +# I packaged Box2D in the hope of unbundling it but it turns out this +# game uses a custom version. -- Chewi :( + +RDEPEND=" + media-libs/glew:1.10 + virtual/opengl + !x86? ( media-libs/libsdl2[joystick?,opengl,sound,video] ) + x86? ( !joystick? ( media-libs/libsdl2[opengl,sound,video] ) ) +" + +BDEPEND=" + dev-util/patchelf +" + +DIR="/opt/${PN}" +QA_PREBUILT="${DIR#/}/*" + +pkg_nofetch() { + einfo "Please buy and download ${SRC_URI} from:" + einfo " https://www.gog.com/game/${PN//-/_}" + einfo "and move it to your distfiles directory." +} + +src_unpack() { + unpack_zip ${A} +} + +src_install() { + local BITS=$(usex amd64 64 32) LIB= + + exeinto "${DIR}" + doexe ${BITS}/${MY_PN} + make_wrapper ${MY_PN} ./${MY_PN} "${DIR}" + + exeinto "${DIR}"/lib + doexe ${BITS}/lib/lib{Box2D.so.*,fmod*-*.so} + + for LIB in ${BITS}/lib/libfmod*-*.so; do + LIB=${LIB##*/} + + # The FMOD libraries are duplicated rather than symlinked, which is + # silly, so create our own symlinks. Both sets of names are needed. + dosym "${LIB}" "${DIR}/lib/${LIB%-*}.so" + + # The SONAMEs are also unset, which upsets our QA check, so fix. + patchelf --set-soname "${LIB%-*}.so" "${ED}${DIR}/lib/${LIB}" || die + done + + if use joystick; then + local SDL=libSDL2-2.0.so.0 + local SDLj=libSDL2-joystick.so + + if use x86; then + # Under x86, using our own SDL2 causes the game to crash when a + # controller is connected, even after applying the workaround below. + # It is seemingly caused by a change to the SDL_GetJoystickGUIDInfo + # signature. We must therefore use the bundled SDL2. + doexe ${BITS}/lib/${SDL} + else + # The game uses internal SDL2 joystick functions. These functions + # have since been hidden and some have been removed. Using our own + # SDL2 therefore causes the game to crash when a controller is + # connected. We still want to use our own SDL2 for things like + # Wayland, but we can work around this by loading both, using the + # bundled one as a fallback. + newexe ${BITS}/lib/${SDL} ${SDLj} + + # The bundled SDL2 SONAME has to be set to something different. + patchelf --set-soname ${SDLj} "${ED}${DIR}"/lib/${SDLj} || die + + # We need to add the new SONAME as a NEEDED entry, but the order is + # important, so we also need to remove the existing NEEDED entry + # first and add it back again afterwards. + patchelf \ + --remove-needed ${SDL} \ + --add-needed ${SDLj} \ + --add-needed ${SDL} \ + "${ED}${DIR}"/${MY_PN} || die + fi + fi + + # The RUNPATHs are not entirely correct so fix up. + patchelf --set-rpath '$ORIGIN/lib' "${ED}${DIR}"/${MY_PN} || die + patchelf --set-rpath '$ORIGIN' "${ED}${DIR}"/lib/libfmodevent*.so || die + + insinto "${DIR}" + doins -r data/ + + newicon -s 256 ../support/icon.png ${PN}.png + make_desktop_entry ${MY_PN} "Shovel Knight" +}