diff options
author | Alexander Miller <alex.miller@gmx.de> | 2024-03-31 04:12:40 +0200 |
---|---|---|
committer | Joonas Niilola <juippis@gentoo.org> | 2024-05-09 16:18:22 +0300 |
commit | 67dc6a60f1db5b26e4bbe0552f80827e33be66c1 (patch) | |
tree | 47f8f2bae15835fc882e930ff9ef44d7776fdf43 /x11-misc | |
parent | x11-misc/shutter: add 0.99.5 (diff) | |
download | gentoo-67dc6a60f1db5b26e4bbe0552f80827e33be66c1.tar.gz gentoo-67dc6a60f1db5b26e4bbe0552f80827e33be66c1.tar.bz2 gentoo-67dc6a60f1db5b26e4bbe0552f80827e33be66c1.zip |
x11-misc/rss-glx: Fix strict aliasing issue and type mismatch
Bug: https://bugs.gentoo.org/928251
Signed-off-by: Alexander Miller <alex.miller@gmx.de>
Signed-off-by: Joonas Niilola <juippis@gentoo.org>
Diffstat (limited to 'x11-misc')
-rw-r--r-- | x11-misc/rss-glx/files/rss-glx-0.9.1-strict-aliasing.patch | 36 | ||||
-rw-r--r-- | x11-misc/rss-glx/files/rss-glx-0.9.1-variable-mismatch.patch | 192 | ||||
-rw-r--r-- | x11-misc/rss-glx/rss-glx-0.9.1-r4.ebuild | 145 |
3 files changed, 373 insertions, 0 deletions
diff --git a/x11-misc/rss-glx/files/rss-glx-0.9.1-strict-aliasing.patch b/x11-misc/rss-glx/files/rss-glx-0.9.1-strict-aliasing.patch new file mode 100644 index 000000000000..e95b1f6a1a7d --- /dev/null +++ b/x11-misc/rss-glx/files/rss-glx-0.9.1-strict-aliasing.patch @@ -0,0 +1,36 @@ +Fix strict aliasing violation in FMotion.cpp + +Bug: https://bugs.gentoo.org/928251 + +--- a/src/FMotion.cpp ++++ b/src/FMotion.cpp +@@ -22,6 +22,7 @@ + */ + + #include <stdio.h> ++#include <string.h> + #include <cmath> + + // In case cmath doesn't pull in all the usual suspects from math.h +@@ -54,15 +55,19 @@ + #define FLOATTOINTCONST2 (((65536.0*16))) + inline int f2int2 (float f) + { ++ int i; + f += FLOATTOINTCONST2; +- return ((*((int *)(void *)&f)) & 0x007fffff) - 0x00400000; ++ memcpy(&i, &f, sizeof(i)); ++ return (i & 0x007fffff) - 0x00400000; + } + + #define FLOATTOINTCONST (((1.5*65536*256))) + inline int f2int (float f) + { ++ int i; + f += FLOATTOINTCONST; +- return ((*((int *)(void *)&f)) & 0x007fffff) - 0x00400000; ++ memcpy(&i, &f, sizeof(i)); ++ return (i & 0x007fffff) - 0x00400000; + } + + #define Float2Int(f) (f2int(f)) diff --git a/x11-misc/rss-glx/files/rss-glx-0.9.1-variable-mismatch.patch b/x11-misc/rss-glx/files/rss-glx-0.9.1-variable-mismatch.patch new file mode 100644 index 000000000000..19da515feff9 --- /dev/null +++ b/x11-misc/rss-glx/files/rss-glx-0.9.1-variable-mismatch.patch @@ -0,0 +1,192 @@ +Subject: [PATCH] Fix variable type mismatch in hyperspace +From: Alexander Miller <alex.miller@gmx.de> +Date: Sun, 31 Mar 2024 2024-03-31 03:08:04 +0200 + +Some source files of hyperspace (flare.cpp, goo.cpp, starBurst.cpp) +were referring to a variable "extern float frameTime" which doesn't +exist in hyperspace (it's only a parameter of hack_draw() nowadays). + +It got mixed up with the driver.c variable "int frameTime". + +Remove the mismatched declaration from the 3 files and pass the value +from hack_draw() to the functions using it by adding a new parameter. +Also make frameTime (and most other variables) in driver.c static. + +Bug: https://bugs.gentoo.org/928251 +Signed-off-by: Alexander Miller <alex.miller@gmx.de> +--- a/src/driver.c ++++ b/src/driver.c +@@ -49,24 +49,24 @@ + + #include "vroot.h" + +-xstuff_t *XStuff; ++static xstuff_t *XStuff; + + extern const char *hack_name; + + /* + * display parameters + */ +-int rootWindow = False; ++static int rootWindow = False; + int glewInitialized = False; + #ifdef HAVE_GLEW +-int frameTime = 10000; +-int vsync = 1; ++static int frameTime = 10000; ++static int vsync = 1; + #else +-int frameTime = 33333; +-int vsync = 0; ++static int frameTime = 33333; ++static int vsync = 0; + #endif +-int idleOnDPMS = 1; +-int signalled = 0; ++static int idleOnDPMS = 1; ++static volatile int signalled = 0; + + void createWindow (int argc, char **argv) + { +--- a/src/flare.cpp ++++ b/src/flare.cpp +@@ -45,7 +45,6 @@ extern double modelMat[16]; + extern double projMat[16]; + extern int viewport[4]; + // Calculated in main draw routine each frame +-extern float frameTime; + extern float camPos[3]; + + +@@ -182,7 +181,7 @@ void initFlares(){ + // Draw a flare at a specified (x,y) location on the screen + // Screen corners are at (0,0) and (1,1) + // alpha = 0.0 for lowest intensity; alpha = 1.0 for highest intensity +-void flare(double *pos, float red, float green, float blue, float alpha){ ++void flare(double *pos, float red, float green, float blue, float alpha, float frameTime){ + double winx, winy, winz; // in screen coordinates + float x, y, dx, dy; + float fadewidth, temp; +--- a/src/flare.h ++++ b/src/flare.h +@@ -36,7 +36,7 @@ void initFlares(); + // Draw a flare at a specified (x,y) location on the screen + // Screen corners are at (0,0) and (1,1) + // alpha = 0.0 for lowest intensity; alpha = 1.0 for highest intensity +-void flare(double *pos, float red, float green, float blue, float alpha); ++void flare(double *pos, float red, float green, float blue, float alpha, float frameTime); + + + #endif // FLARE_H +--- a/src/goo.cpp ++++ b/src/goo.cpp +@@ -25,9 +25,7 @@ + #include "goo.h" + + +-extern float frameTime, simulationTime; + extern float shiftx, shiftz; +-extern float dFov; + + + goo::goo(int res, float rad, float (*func)(float* position)){ +--- a/src/hyperspace.cpp ++++ b/src/hyperspace.cpp +@@ -340,10 +340,10 @@ void hack_draw (xstuff_t * XStuff, doubl + } + #ifdef HAVE_GLEW + if (dShaders) +- theStarBurst->draw(lerp); ++ theStarBurst->draw(frameTime, lerp); + else + #endif +- theStarBurst->draw(); ++ theStarBurst->draw(frameTime); + + // draw tunnel + theTunnel->make(frameTime); +@@ -379,7 +379,7 @@ void hack_draw (xstuff_t * XStuff, doubl + float diff[3] = {(float)flarepos[0] - camPos[0], (float)flarepos[1] - camPos[1], (float)flarepos[2] - camPos[2]}; + float alpha = 0.5f - 0.005f * sqrtf(diff[0] * diff[0] + diff[1] * diff[1] + diff[2] * diff[2]); + if(alpha > 0.0f) +- flare(flarepos, 1.0f, 1.0f, 1.0f, alpha); ++ flare(flarepos, 1.0f, 1.0f, 1.0f, alpha, frameTime); + glEnable(GL_FOG); + } + +--- a/src/starBurst.cpp ++++ b/src/starBurst.cpp +@@ -38,7 +38,6 @@ + + extern int xsize, ysize; + extern float aspectRatio; +-extern float frameTime; + extern float camPos[3]; + extern int numAnimTexFrames; + extern wavyNormalCubeMaps* theWNCM; +@@ -136,7 +135,7 @@ void starBurst::restart(float* position) + } + + +-void starBurst::drawStars(){ ++void starBurst::drawStars(float frameTime){ + int i; + float distance; + +@@ -158,8 +157,8 @@ void starBurst::drawStars(){ + } + + +-void starBurst::draw(){ +- drawStars(); ++void starBurst::draw(float frameTime){ ++ drawStars(frameTime); + + size += frameTime * 0.5f; + if(size >= 3.0f) +@@ -172,7 +171,7 @@ void starBurst::draw(float frameTime){ + p[0] = pos[0]; + p[1] = pos[1]; + p[2] = pos[2]; +- flare(p, 1.0f, 1.0f, 1.0f, brightness); ++ flare(p, 1.0f, 1.0f, 1.0f, brightness, frameTime); + } + + glMatrixMode(GL_MODELVIEW); +@@ -201,8 +200,8 @@ void starBurst::draw(){ + + + #ifdef HAVE_GLEW +-void starBurst::draw(float lerp){ +- drawStars(); ++void starBurst::draw(float frameTime, float lerp){ ++ drawStars(frameTime); + + size += frameTime * 0.5f; + if(size >= 3.0f) +@@ -215,7 +214,7 @@ void starBurst::draw(float frameTime, fl + p[0] = pos[0]; + p[1] = pos[1]; + p[2] = pos[2]; +- flare(p, 1.0f, 1.0f, 1.0f, brightness); ++ flare(p, 1.0f, 1.0f, 1.0f, brightness, frameTime); + } + + glMatrixMode(GL_MODELVIEW); +--- a/src/starBurst.h ++++ b/src/starBurst.h +@@ -43,10 +43,10 @@ public: + starBurst(); + ~starBurst(); + void restart(float* position); +- void drawStars(); +- void draw(); // draw regular ++ void drawStars(float frameTime); ++ void draw(float frameTime); // draw regular + #ifdef HAVE_GLEW +- void draw(float lerp); // draw with shaders ++ void draw(float frameTime, float lerp); // draw with shaders + #endif + }; + diff --git a/x11-misc/rss-glx/rss-glx-0.9.1-r4.ebuild b/x11-misc/rss-glx/rss-glx-0.9.1-r4.ebuild new file mode 100644 index 000000000000..0bbbaa643911 --- /dev/null +++ b/x11-misc/rss-glx/rss-glx-0.9.1-r4.ebuild @@ -0,0 +1,145 @@ +# Copyright 1999-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit autotools + +MY_P=${PN}_${PV} + +DESCRIPTION="Really Slick OpenGL Screensavers for XScreenSaver" +HOMEPAGE="http://rss-glx.sourceforge.net" +SRC_URI="mirror://sourceforge/${PN}/${MY_P}.tar.bz2" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~ppc ~ppc64 ~sparc ~x86" +IUSE="+bzip2 openal quesoglc" + +RDEPEND=" + x11-libs/libX11 + x11-libs/libXext + >=media-libs/glew-1.5.1:= + media-libs/mesa[X(+)] + >=media-gfx/imagemagick-6.4:= + >=x11-misc/xscreensaver-5.08-r2 + bzip2? ( app-arch/bzip2 ) + openal? ( >=media-libs/freealut-1.1.0-r1 ) + quesoglc? ( media-libs/quesoglc ) +" +DEPEND=" + ${RDEPEND} + x11-base/xorg-proto +" +BDEPEND=" + virtual/pkgconfig + bzip2? ( app-arch/bzip2 ) +" + +S="${WORKDIR}/${MY_P}" + +PATCHES=( + "${FILESDIR}"/${P}-quesoglc.patch + "${FILESDIR}"/${P}-asneeded.patch + "${FILESDIR}"/${P}-imagemagick-7.patch + "${FILESDIR}"/${P}-c++11-narrowing.patch + "${FILESDIR}"/${P}-hang.patch + "${FILESDIR}"/${P}-matrixview-copy-font.patch + "${FILESDIR}"/${P}-missing-include.patch + "${FILESDIR}"/${P}-bashism.patch + "${FILESDIR}"/${P}-strict-aliasing.patch + "${FILESDIR}"/${P}-variable-mismatch.patch +) + +src_prepare() { + default + + sed -i \ + -e '/CFLAGS=/s:-O2:${CFLAGS}:' \ + -e '/CXXFLAGS=/s:-O2:${CXXFLAGS}:' \ + -e 's|AM_CONFIG_HEADER|AC_CONFIG_HEADERS|g' \ + configure.in || die + mv configure.{in,ac} || die + + eautoreconf +} + +src_configure() { + econf \ + --disable-static \ + --enable-shared \ + $(use_enable bzip2) \ + $(use_enable openal sound) \ + $(use_with quesoglc) \ + --bindir="${EPREFIX}"/usr/$(get_libdir)/misc/xscreensaver \ + --with-configdir="${EPREFIX}"/usr/share/xscreensaver/config +} + +src_install() { + default + find "${ED}" -name '*.la' -delete || die +} + +pkg_postinst() { + local xssconf="${EROOT}"/usr/share/X11/app-defaults/XScreenSaver + + if [[ -f ${xssconf} ]]; then + sed -e '/*programs:/a\ + GL: \"Cyclone\" cyclone --root \\n\\\ + GL: \"Euphoria\" euphoria --root \\n\\\ + GL: \"Fieldlines\" fieldlines --root \\n\\\ + GL: \"Flocks\" flocks --root \\n\\\ + GL: \"Flux\" flux --root \\n\\\ + GL: \"Helios\" helios --root \\n\\\ + GL: \"Hyperspace\" hyperspace --root \\n\\\ + GL: \"Lattice\" lattice --root \\n\\\ + GL: \"Plasma\" plasma --root \\n\\\ + GL: \"Pixelcity\" pixelcity --root \\n\\\ + GL: \"Skyrocket\" skyrocket --root \\n\\\ + GL: \"Solarwinds\" solarwinds --root \\n\\\ + GL: \"Colorfire\" colorfire --root \\n\\\ + GL: \"Hufo\x27s Smoke\" hufo_smoke --root \\n\\\ + GL: \"Hufo\x27s Tunnel\" hufo_tunnel --root \\n\\\ + GL: \"Sundancer2\" sundancer2 --root \\n\\\ + GL: \"BioF\" biof --root \\n\\\ + GL: \"BusySpheres\" busyspheres --root \\n\\\ + GL: \"SpirographX\" spirographx --root \\n\\\ + GL: \"MatrixView\" matrixview --root \\n\\\ + GL: \"Lorenz\" lorenz --root \\n\\\ + GL: \"Drempels\" drempels --root \\n\\\ + GL: \"Feedback\" feedback --root \\n\\' \ + -i "${xssconf}" || die + fi +} + +pkg_postrm() { + local xssconf="${EROOT}"/usr/share/X11/app-defaults/XScreenSaver + + if [[ -f ${xssconf} ]]; then + sed \ + -e '/\"Cyclone\" cyclone/d' \ + -e '/\"Euphoria\" euphoria/d' \ + -e '/\"Fieldlines\" fieldlines/d' \ + -e '/\"Flocks\" flocks/d' \ + -e '/\"Flux\" flux/d' \ + -e '/\"Helios\" helios/d' \ + -e '/\"Hyperspace\" hyperspace/d' \ + -e '/\"Lattice\" lattice/d' \ + -e '/\"Plasma\" plasma/d' \ + -e '/\"Pixelcity\" pixelcity/d' \ + -e '/\"Skyrocket\" skyrocket/d' \ + -e '/\"Solarwinds\" solarwinds/d' \ + -e '/\"Colorfire\" colorfire/d' \ + -e '/\"Hufo.*Smoke\" hufo_smoke/d' \ + -e '/\"Hufo.*Tunnel\" hufo_tunnel/d' \ + -e '/\"Sundancer2\" sundancer2/d' \ + -e '/\"BioF\" biof/d' \ + -e '/\"BusySpheres\" busyspheres/d' \ + -e '/\"SpirographX\" spirographx/d' \ + -e '/\"MatrixView\" matrixview/d' \ + -e '/\"Lorenz\" lorenz/d' \ + -e '/\"Drempels\" drempels/d' \ + -e '/\"Feedback\" feedback/d' \ + -i "${xssconf}" || die + fi +} |