commit: 1853049bec92e1def4d2c1eb40b8ec66cc766f23 Author: Lucas Mitrak <lucas <AT> lucasmitrak <DOT> com> AuthorDate: Thu Jun 3 22:16:31 2021 +0000 Commit: Andrew Ammerlaan <andrewammerlaan <AT> gentoo <DOT> org> CommitDate: Sat Jun 5 12:38:22 2021 +0000 URL: https://gitweb.gentoo.org/proj/sci.git/commit/?id=1853049b
media-libs/libgfx: add test, dependencies, patches * Add test, dependencies, and new patches to ebuild * Add cstring to needed files due to newer version of gcc * Change png jmpbuf to use the newer safer method due to GLSA 200408-03 Currently, media-libs/libgfx will not compile due to a vulnerability in libpng which has since been patched [1]. Therefore, the patch libPNG-1.2.5 updates the code to libPNG's newer and safer method. This also fixes bug https://bugs.gentoo.org/756061. However, even with this patch the package will not compile due to outdated C++, so the patch gcc-4.3 updates two files to include cstring, which is neccessary for memcpy. These patches will allow the package to compile. Without these patches, the package will not compile. In addition, the ebuild was updated to include these patches, as well as add the dependencies listed on upstream's homepage [2]. Without these dependencies, the package will not compile. Finally, a test IUSE flag as well as the src_test() function were added. Due to the package using outdated FLTK code, some of the tests had to be disabled using a sed command. This commit was tested in a docker image with dev-util/ebuildtester. This commit was written, tested, and submitted by Lucas Mitrak. [1] https://security.gentoo.org/glsa/200408-03 [2] http://mgarland.org/software/libgfx.html Closes: https://bugs.gentoo.org/756061 Signed-off-by: Lucas Mitrak <lucas <AT> lucasmitrak.com> Signed-off-by: Andrew Ammerlaan <andrewammerlaan <AT> gentoo.org> media-libs/libgfx/files/1.1.0-gcc-4.3.patch | 24 ++++++++++++++++++++++++ media-libs/libgfx/files/1.1.0-gcc4.3.patch | 11 ----------- media-libs/libgfx/files/1.1.0-libPNG-1.2.5.patch | 24 ++++++++++++++++++++++++ media-libs/libgfx/libgfx-1.1.0.ebuild | 20 ++++++++++++++++++-- 4 files changed, 66 insertions(+), 13 deletions(-) diff --git a/media-libs/libgfx/files/1.1.0-gcc-4.3.patch b/media-libs/libgfx/files/1.1.0-gcc-4.3.patch new file mode 100644 index 000000000..ba5eba38a --- /dev/null +++ b/media-libs/libgfx/files/1.1.0-gcc-4.3.patch @@ -0,0 +1,24 @@ +cstring now contains memcpy. +Written and tested by Lucas Mitrak. + +--- a/src/raster-png.cxx ++++ b/src/raster-png.cxx +@@ -12,6 +12,7 @@ + #include <vector> + #include <gfx/gfx.h> + #include <gfx/raster.h> ++#include <cstring> + + #ifdef HAVE_LIBPNG + +--- a/src/raster.cxx ++++ b/src/raster.cxx +@@ -9,7 +9,7 @@ + #include <gfx/gfx.h> + #include <gfx/raster.h> + +-#include <string> ++#include <cstring> + #include <cctype> + + namespace gfx diff --git a/media-libs/libgfx/files/1.1.0-gcc4.3.patch b/media-libs/libgfx/files/1.1.0-gcc4.3.patch deleted file mode 100644 index 811d5dbcc..000000000 --- a/media-libs/libgfx/files/1.1.0-gcc4.3.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/src/raster.cxx 2004-09-27 06:45:31.000000000 +0200 -+++ b/src/raster.cxx.new 2009-05-17 23:48:58.417607175 +0200 -@@ -9,7 +9,7 @@ - #include <gfx/gfx.h> - #include <gfx/raster.h> - --#include <string> -+#include <cstring> - #include <cctype> - - namespace gfx diff --git a/media-libs/libgfx/files/1.1.0-libPNG-1.2.5.patch b/media-libs/libgfx/files/1.1.0-libPNG-1.2.5.patch new file mode 100644 index 000000000..0d648d06e --- /dev/null +++ b/media-libs/libgfx/files/1.1.0-libPNG-1.2.5.patch @@ -0,0 +1,24 @@ +Changes the png buffer pointer to the new function call. +Written and tested by Lucas Mitrak. +https://bugs.gentoo.org/756061 + +--- a/src/raster-png.cxx ++++ b/src/raster-png.cxx +@@ -43,7 +43,7 @@ ByteRaster *read_png_image(const char *file_name) + // Because we didn't set up any error handlers, we need to be + // prepared to handle longjmps out of the library on error + // conditions. +- if( setjmp(png_ptr->jmpbuf) ) ++ if( setjmp(png_jmpbuf(png_ptr)) ) + { + png_destroy_read_struct(&png_ptr, &info_ptr, NULL); + fclose(fp); +@@ -133,7 +133,7 @@ bool write_png_image(const char *file_name, const ByteRaster& img) + return false; + } + +- if( setjmp(png_ptr->jmpbuf) ) ++ if( setjmp(png_jmpbuf(png_ptr)) ) + { + fclose(fp); + png_destroy_write_struct(&png_ptr, (png_infopp)NULL); diff --git a/media-libs/libgfx/libgfx-1.1.0.ebuild b/media-libs/libgfx/libgfx-1.1.0.ebuild index 7fba3d1da..334825790 100644 --- a/media-libs/libgfx/libgfx-1.1.0.ebuild +++ b/media-libs/libgfx/libgfx-1.1.0.ebuild @@ -10,9 +10,19 @@ SRC_URI="http://mgarland.org/dist/${P}.tar.gz" LICENSE="LGPL-2.1" SLOT="0" KEYWORDS="~amd64 ~x86" -IUSE="static-libs" +IUSE="static-libs test" -PATCHES=( "${FILESDIR}"/${PV}-gcc4.3.patch ) +DEPEND=" + virtual/opengl + x11-libs/fltk +" + +RDEPEND="${DEPEND}" + +PATCHES=( + "${FILESDIR}"/${PV}-gcc-4.3.patch + "${FILESDIR}"/${PV}-libPNG-1.0.6.patch +) src_compile() { cd src || die @@ -25,3 +35,9 @@ src_install() { dodoc doc/* } + +src_test() { + cd tests || die + sed -i -e 's/t-vec.cxx t-img.cxx t-gui.cxx t-glimg.cxx t-script.cxx t-glext.cxx/t-vec.cxx t-img.cxx t-script.cxx/' Makefile + emake +}