Diff shovel-knight-4.1b with a shovel-knight-4.1b-r1

/usr/portage/games-arcade/shovel-knight/shovel-knight-4.1b-r1.ebuild 2023-10-09 14:52:31.068368390 +0300
14 14
LICENSE="Yacht-Club-Games-EULA"
15 15
SLOT="0"
16 16
KEYWORDS="-* ~amd64 ~x86"
17
IUSE="+joystick"
17 18
RESTRICT="bindist fetch splitdebug"
18 19

  
19 20
# I packaged Box2D in the hope of unbundling it but it turns out this
......
21 22

  
22 23
RDEPEND="
23 24
	media-libs/glew:1.10
24
	media-libs/libsdl2[opengl,sound,video]
25 25
	virtual/opengl
26
	!x86? ( media-libs/libsdl2[joystick?,opengl,sound,video] )
27
	x86? ( !joystick? ( media-libs/libsdl2[opengl,sound,video] ) )
28
"
29

  
30
BDEPEND="
31
	dev-util/patchelf
26 32
"
27 33

  
28 34
DIR="/opt/${PN}"
......
48 54
	exeinto "${DIR}"/lib
49 55
	doexe ${BITS}/lib/lib{Box2D.so.*,fmod*-*.so}
50 56

  
51
	# The FMOD libraries are duplicated rather than symlinked, which is
52
	# silly, so create our own symlinks. Both sets of names are needed.
53 57
	for LIB in ${BITS}/lib/libfmod*-*.so; do
54 58
		LIB=${LIB##*/}
59

  
60
		# The FMOD libraries are duplicated rather than symlinked, which is
61
		# silly, so create our own symlinks. Both sets of names are needed.
55 62
		dosym "${LIB}" "${DIR}/lib/${LIB%-*}.so"
63

  
64
		# The SONAMEs are also unset, which upsets our QA check, so fix.
65
		patchelf --set-soname "${LIB%-*}.so" "${ED}${DIR}/lib/${LIB}" || die
56 66
	done
57 67

  
68
	if use joystick; then
69
		local SDL=libSDL2-2.0.so.0
70
		local SDLj=libSDL2-joystick.so
71

  
72
		if use x86; then
73
			# Under x86, using our own SDL2 causes the game to crash when a
74
			# controller is connected, even after applying the workaround below.
75
			# It is seemingly caused by a change to the SDL_GetJoystickGUIDInfo
76
			# signature. We must therefore use the bundled SDL2.
77
			doexe ${BITS}/lib/${SDL}
78
		else
79
			# The game uses internal SDL2 joystick functions. These functions
80
			# have since been hidden and some have been removed. Using our own
81
			# SDL2 therefore causes the game to crash when a controller is
82
			# connected. We still want to use our own SDL2 for things like
83
			# Wayland, but we can work around this by loading both, using the
84
			# bundled one as a fallback.
85
			newexe ${BITS}/lib/${SDL} ${SDLj}
86

  
87
			# The bundled SDL2 SONAME has to be set to something different.
88
			patchelf --set-soname ${SDLj} "${ED}${DIR}"/lib/${SDLj} || die
89

  
90
			# We need to add the new SONAME as a NEEDED entry, but the order is
91
			# important, so we also need to remove the existing NEEDED entry
92
			# first and add it back again afterwards.
93
			patchelf \
94
				--remove-needed ${SDL} \
95
				--add-needed ${SDLj} \
96
				--add-needed ${SDL} \
97
				"${ED}${DIR}"/${MY_PN} || die
98
		fi
99
	fi
100

  
101
	# The RUNPATHs are not entirely correct so fix up.
102
	patchelf --set-rpath '$ORIGIN/lib' "${ED}${DIR}"/${MY_PN} || die
103
	patchelf --set-rpath '$ORIGIN' "${ED}${DIR}"/lib/libfmodevent*.so || die
104

  
58 105
	insinto "${DIR}"
59 106
	doins -r data/
60 107

  
Thank you!