summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2024-03-12 00:26:30 +0000
committerSam James <sam@gentoo.org>2024-03-12 00:26:30 +0000
commit544223720d50b2f2786bccfb32ab124e86782af4 (patch)
tree19e02f57291f15b5892b073326aae2d11281e483 /media-gfx
parentdev-debug/ddd: mark as LTO-unsafe (diff)
downloadgentoo-544223720d50b2f2786bccfb32ab124e86782af4.tar.gz
gentoo-544223720d50b2f2786bccfb32ab124e86782af4.tar.bz2
gentoo-544223720d50b2f2786bccfb32ab124e86782af4.zip
media-gfx/potrace: fix build w/ lto on non-amd64
Closes: https://bugs.gentoo.org/868465 Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'media-gfx')
-rw-r--r--media-gfx/potrace/files/potrace-1.16-lto.patch18
-rw-r--r--media-gfx/potrace/potrace-1.16-r1.ebuild48
2 files changed, 66 insertions, 0 deletions
diff --git a/media-gfx/potrace/files/potrace-1.16-lto.patch b/media-gfx/potrace/files/potrace-1.16-lto.patch
new file mode 100644
index 000000000000..a1704783f83e
--- /dev/null
+++ b/media-gfx/potrace/files/potrace-1.16-lto.patch
@@ -0,0 +1,18 @@
+https://git.altlinux.org/srpms/p/potrace.git?p=potrace.git;a=commitdiff;h=385f40d2d9827049f5f43f73d05e9fc7472e0da4
+https://bugs.gentoo.org/868465
+--- a/configure.ac
++++ b/configure.ac
+@@ -251,9 +251,10 @@ AC_CHECK_FUNC(strncasecmp, ,
+ dnl ----------------------------------------------------------------------
+ dnl Check whether we have i386 features
+ AC_MSG_CHECKING([for Intel 386])
+-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[int x;
+- asm("bsf %1,%0\njnz 0f\nmovl $32,%0\n0:":"=r"(x):"r"(x));
+- return x; /* need this so that -O2 does not optimize the asm away */
++AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[int x = 1;
++ volatile asm("bsf %1,%0\njnz 0f\nmovl $32,%0\n0:":"=r"(x):"r"(x):"memory");
++ /* volatile and "memory" clobber ensures '-O2 -flto' does not optimize the asm away */
++ return x;
+ ]])],[AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_I386,, Can we use Intel 386 optimizations?)
+ ],[AC_MSG_RESULT(no)])
diff --git a/media-gfx/potrace/potrace-1.16-r1.ebuild b/media-gfx/potrace/potrace-1.16-r1.ebuild
new file mode 100644
index 000000000000..ac9fe7c8ddb2
--- /dev/null
+++ b/media-gfx/potrace/potrace-1.16-r1.ebuild
@@ -0,0 +1,48 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit autotools toolchain-funcs
+
+DESCRIPTION="Transforming bitmaps into vector graphics"
+HOMEPAGE="https://potrace.sourceforge.net/"
+SRC_URI="https://potrace.sourceforge.net/download/${PV}/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos"
+IUSE="metric"
+
+RDEPEND="sys-libs/zlib:="
+DEPEND="${RDEPEND}"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-1.16-lto.patch
+)
+
+src_prepare() {
+ default
+
+ # Needed for lto patch
+ eautoreconf
+}
+
+src_configure() {
+ tc-export CC # bug 610098
+ local myeconfargs=(
+ --disable-static
+ --enable-zlib
+ --with-libpotrace
+ $(use_enable metric a4)
+ $(use_enable metric)
+ )
+ econf "${myeconfargs[@]}"
+}
+
+src_install() {
+ default
+
+ # no static archives
+ find "${ED}" -name '*.la' -delete || die
+}