commit:     56b835de43c60269973d4c7ea331338cd4eb9011
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 12 05:29:09 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Oct 12 05:31:22 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=56b835de

media-gfx/imagemagick: workaround GCC 13 bug

-O3 implies -funswitch-loops which triggers an unfortunate rare edgecase
with one of the switch statements in ImageMagick. Apply a workaround
for GCC 13 for now (14+ is fixed already and it's latent otherwise).

The fix will land on the 13 branch shortly upstream but let's get the fix
out quickly on our end so we don't have to rush to stable it and so on
(although we will of course do it soon).

Bug: https://github.com/ImageMagick/ImageMagick/issues/7677
Bug: https://gcc.gnu.org/PR117100
Closes: https://bugs.gentoo.org/941208
Signed-off-by: Sam James <sam <AT> gentoo.org>

 ...1.25.ebuild => imagemagick-6.9.13.16-r1.ebuild} | 41 +++++++++-------------
 ....1.25.ebuild => imagemagick-7.1.1.25-r1.ebuild} |  3 ++
 ...-9999.ebuild => imagemagick-7.1.1.38-r2.ebuild} |  5 +++
 media-gfx/imagemagick/imagemagick-9999.ebuild      |  3 ++
 4 files changed, 28 insertions(+), 24 deletions(-)

diff --git a/media-gfx/imagemagick/imagemagick-7.1.1.25.ebuild 
b/media-gfx/imagemagick/imagemagick-6.9.13.16-r1.ebuild
similarity index 82%
copy from media-gfx/imagemagick/imagemagick-7.1.1.25.ebuild
copy to media-gfx/imagemagick/imagemagick-6.9.13.16-r1.ebuild
index be2efbd13782..63df7afa7352 100644
--- a/media-gfx/imagemagick/imagemagick-7.1.1.25.ebuild
+++ b/media-gfx/imagemagick/imagemagick-6.9.13.16-r1.ebuild
@@ -4,17 +4,17 @@
 EAPI=8
 
 QA_PKGCONFIG_VERSION=$(ver_cut 1-3)
-inherit autotools flag-o-matic perl-functions toolchain-funcs
+inherit flag-o-matic libtool perl-functions toolchain-funcs
 
 if [[ ${PV} == 9999 ]] ; then
-       EGIT_REPO_URI="https://github.com/ImageMagick/ImageMagick.git";
+       EGIT_REPO_URI="https://github.com/ImageMagick/ImageMagick6.git";
        inherit git-r3
        MY_P="imagemagick-9999"
 else
        MY_PV="$(ver_rs 3 '-')"
        MY_P="ImageMagick-${MY_PV}"
        SRC_URI="mirror://imagemagick/${MY_P}.tar.xz"
-       KEYWORDS="~alpha amd64 arm arm64 hppa ~loong ~m68k ~mips ppc ppc64 
~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos 
~x64-macos ~x64-solaris"
+       KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~mips ~ppc ~ppc64 ~s390 
~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x64-solaris"
 fi
 
 S="${WORKDIR}/${MY_P}"
@@ -25,8 +25,8 @@ HOMEPAGE="https://imagemagick.org/index.php";
 LICENSE="imagemagick"
 # Please check this on bumps, SONAME is often not updated! Use abidiff on 
old/new.
 # If ABI is broken, change the bit after the '-'.
-SLOT="0/$(ver_cut 1-3)-18"
-IUSE="bzip2 corefonts +cxx djvu fftw fontconfig fpx graphviz hardened hdri 
heif jbig jpeg jpeg2k jpegxl lcms lqr lzma opencl openexr openmp pango perl 
+png postscript q32 q8 raw static-libs svg test tiff truetype webp wmf X xml 
zip zlib"
+SLOT="0/$(ver_cut 1-3)-0"
+IUSE="bzip2 corefonts +cxx djvu fftw fontconfig fpx graphviz hardened hdri 
heif jbig jpeg jpeg2k lcms lqr lzma opencl openexr openmp pango perl +png 
postscript q32 q8 raw static-libs svg test tiff truetype webp wmf X xml zlib"
 
 REQUIRED_USE="
        corefonts? ( truetype )
@@ -50,7 +50,6 @@ RDEPEND="
        jbig? ( >=media-libs/jbigkit-2:= )
        jpeg? ( media-libs/libjpeg-turbo:= )
        jpeg2k? ( >=media-libs/openjpeg-2.1.0:2 )
-       jpegxl? ( >=media-libs/libjxl-0.6:= )
        lcms? ( media-libs/lcms:2= )
        lqr? ( media-libs/liblqr )
        opencl? ( virtual/opencl )
@@ -79,7 +78,6 @@ RDEPEND="
        )
        xml? ( dev-libs/libxml2 )
        lzma? ( app-arch/xz-utils )
-       zip? ( dev-libs/libzip:= )
        zlib? ( sys-libs/zlib:= )
 "
 DEPEND="
@@ -88,10 +86,6 @@ DEPEND="
 "
 BDEPEND="virtual/pkgconfig"
 
-PATCHES=(
-       "${FILESDIR}/${PN}-9999-nocputuning.patch"
-)
-
 pkg_pretend() {
        [[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
 }
@@ -103,10 +97,10 @@ pkg_setup() {
 src_prepare() {
        default
 
-       #elibtoolize # for Darwin modules
-       eautoreconf
+       # for Darwin modules
+       elibtoolize
 
-       # For testsuite, see https://bugs.gentoo.org/show_bug.cgi?id=500580#c3
+       # For testsuite, see bug #500580#c3
        local ati_cards mesa_cards nvidia_cards render_cards
        shopt -s nullglob
        ati_cards=$(echo -n /dev/ati/card* | sed 's/ /:/g')
@@ -138,6 +132,9 @@ src_configure() {
 
        [[ ${CHOST} == *-solaris* ]] && append-ldflags -lnsl -lsocket
 
+       # Workaround for bug #941208 (gcc PR117100)
+       tc-is-gcc && [[ $(gcc-major-version) == 13 ]] && append-flags 
-fno-unswitch-loops
+
        local myeconfargs=(
                $(use_enable static-libs static)
                $(use_enable hdri)
@@ -152,7 +149,6 @@ src_configure() {
                --with-gs-font-dir="${EPREFIX}"/usr/share/fonts/urw-fonts
                $(use_with bzip2 bzlib)
                $(use_with X x)
-               $(use_with zip)
                $(use_with zlib)
                --without-autotrace
                $(use_with postscript dps)
@@ -168,7 +164,6 @@ src_configure() {
                $(use_with jbig)
                $(use_with jpeg)
                $(use_with jpeg2k openjp2)
-               $(use_with jpegxl jxl)
                $(use_with lcms)
                $(use_with lqr)
                $(use_with lzma)
@@ -182,6 +177,7 @@ src_configure() {
                $(use_with corefonts windows-font-dir 
"${EPREFIX}"/usr/share/fonts/corefonts)
                $(use_with wmf)
                $(use_with xml)
+               --with-gcc-arch=no-automagic
 
                # Default upstream (as of 6.9.12.96/7.1.1.18 anyway) is open
                # For now, let's make USE=hardened do 'limited', and have 
USE=-hardened
@@ -196,7 +192,7 @@ src_configure() {
 }
 
 src_test() {
-       # Install default (unrestricted) policy in $HOME for test suite, bug 
#664238
+       # Install default (unrestricted) policy in ${HOME} for test suite, bug 
#664238
        local _im_local_config_home="${HOME}/.config/ImageMagick"
        mkdir -p "${_im_local_config_home}" || \
                die "Failed to create IM config dir in 
'${_im_local_config_home}'"
@@ -204,12 +200,8 @@ src_test() {
                die "Failed to install default blank policy.xml in 
'${_im_local_config_home}'"
 
        local im_command= IM_COMMANDS=()
-       if [[ ${PV} == 9999 ]] ; then
-               IM_COMMANDS+=( "magick -version" ) # Show version we are using 
-- cannot verify because of live ebuild
-       else
-               IM_COMMANDS+=( "magick -version | grep -q -- \"${MY_PV}\"" ) # 
Verify that we are using version we just built
-       fi
-       IM_COMMANDS+=( "magick -list policy" ) # Verify that policy.xml is used
+       IM_COMMANDS+=( "identify -version | grep -q -- \"${MY_PV}\"" ) # Verify 
that we are using version we just built
+       IM_COMMANDS+=( "identify -list policy" ) # Verify that policy.xml is 
used
        IM_COMMANDS+=( "emake check" ) # Run tests
 
        for im_command in "${IM_COMMANDS[@]}"; do
@@ -244,7 +236,8 @@ src_install() {
                EOF
 
                insinto /etc/sandbox.d
-               doins "${T}"/99${PN} #472766
+               # bug #472766
+               doins "${T}"/99${PN}
        fi
 
        insinto /usr/share/${PN}

diff --git a/media-gfx/imagemagick/imagemagick-7.1.1.25.ebuild 
b/media-gfx/imagemagick/imagemagick-7.1.1.25-r1.ebuild
similarity index 98%
rename from media-gfx/imagemagick/imagemagick-7.1.1.25.ebuild
rename to media-gfx/imagemagick/imagemagick-7.1.1.25-r1.ebuild
index be2efbd13782..52d6378e2f26 100644
--- a/media-gfx/imagemagick/imagemagick-7.1.1.25.ebuild
+++ b/media-gfx/imagemagick/imagemagick-7.1.1.25-r1.ebuild
@@ -138,6 +138,9 @@ src_configure() {
 
        [[ ${CHOST} == *-solaris* ]] && append-ldflags -lnsl -lsocket
 
+       # Workaround for bug #941208 (gcc PR117100)
+       tc-is-gcc && [[ $(gcc-major-version) == 13 ]] && append-flags 
-fno-unswitch-loops
+
        local myeconfargs=(
                $(use_enable static-libs static)
                $(use_enable hdri)

diff --git a/media-gfx/imagemagick/imagemagick-9999.ebuild 
b/media-gfx/imagemagick/imagemagick-7.1.1.38-r2.ebuild
similarity index 97%
copy from media-gfx/imagemagick/imagemagick-9999.ebuild
copy to media-gfx/imagemagick/imagemagick-7.1.1.38-r2.ebuild
index 45cfe4d2db47..bc9b5913ef75 100644
--- a/media-gfx/imagemagick/imagemagick-9999.ebuild
+++ b/media-gfx/imagemagick/imagemagick-7.1.1.38-r2.ebuild
@@ -89,6 +89,8 @@ DEPEND="
 BDEPEND="virtual/pkgconfig"
 
 PATCHES=(
+       "${FILESDIR}/${PN}-7.1.1.38-perl-1.patch"
+       "${FILESDIR}/${PN}-7.1.1.38-perl-2.patch"
        "${FILESDIR}/${PN}-9999-nocputuning.patch"
 )
 
@@ -138,6 +140,9 @@ src_configure() {
 
        [[ ${CHOST} == *-solaris* ]] && append-ldflags -lnsl -lsocket
 
+       # Workaround for bug #941208 (gcc PR117100)
+       tc-is-gcc && [[ $(gcc-major-version) == 13 ]] && append-flags 
-fno-unswitch-loops
+
        local myeconfargs=(
                $(use_enable static-libs static)
                $(use_enable hdri)

diff --git a/media-gfx/imagemagick/imagemagick-9999.ebuild 
b/media-gfx/imagemagick/imagemagick-9999.ebuild
index 45cfe4d2db47..36da9357938f 100644
--- a/media-gfx/imagemagick/imagemagick-9999.ebuild
+++ b/media-gfx/imagemagick/imagemagick-9999.ebuild
@@ -138,6 +138,9 @@ src_configure() {
 
        [[ ${CHOST} == *-solaris* ]] && append-ldflags -lnsl -lsocket
 
+       # Workaround for bug #941208 (gcc PR117100)
+       tc-is-gcc && [[ $(gcc-major-version) == 13 ]] && append-flags 
-fno-unswitch-loops
+
        local myeconfargs=(
                $(use_enable static-libs static)
                $(use_enable hdri)

Reply via email to