commit:     91ac7792bee5d1fc1de7bc12018b51edc36fb384
Author:     Alexey Sokolov <alexey+gentoo <AT> asokolov <DOT> org>
AuthorDate: Sun Dec 14 00:36:34 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Dec 18 08:35:20 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=91ac7792

media-gfx/metapixel: fix build on musl

Closes: https://bugs.gentoo.org/944937
Signed-off-by: Alexey Sokolov <alexey+gentoo <AT> asokolov.org>
Part-of: https://github.com/gentoo/gentoo/pull/45019
Closes: https://github.com/gentoo/gentoo/pull/45019
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../metapixel/files/metapixel-1.0.2-getopt.patch   | 16 ++++++++
 media-gfx/metapixel/metapixel-1.0.2-r3.ebuild      | 46 ++++++++++++++++++++++
 2 files changed, 62 insertions(+)

diff --git a/media-gfx/metapixel/files/metapixel-1.0.2-getopt.patch 
b/media-gfx/metapixel/files/metapixel-1.0.2-getopt.patch
new file mode 100644
index 000000000000..6707421e77de
--- /dev/null
+++ b/media-gfx/metapixel/files/metapixel-1.0.2-getopt.patch
@@ -0,0 +1,16 @@
+Use system getopt instead of custom one
+https://bugs.gentoo.org/944937
+
+--- a/Makefile
++++ b/Makefile
+@@ -24,8 +24,8 @@ CC = gcc
+ export CCOPTS CC FORMATDEFS
+ 
+ LISPREADER_OBJS = lispreader.o pools.o allocator.o
+-OBJS = metapixel.o vector.o zoom.o $(LISPREADER_OBJS) getopt.o getopt1.o
+-CONVERT_OBJS = convert.o $(LISPREADER_OBJS) getopt.o getopt1.o
++OBJS = metapixel.o vector.o zoom.o $(LISPREADER_OBJS)
++CONVERT_OBJS = convert.o $(LISPREADER_OBJS)
+ IMAGESIZE_OBJS = imagesize.o
+ 
+ all : metapixel metapixel.1 convert metapixel-imagesize

diff --git a/media-gfx/metapixel/metapixel-1.0.2-r3.ebuild 
b/media-gfx/metapixel/metapixel-1.0.2-r3.ebuild
new file mode 100644
index 000000000000..34eb664d8696
--- /dev/null
+++ b/media-gfx/metapixel/metapixel-1.0.2-r3.ebuild
@@ -0,0 +1,46 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+inherit toolchain-funcs
+
+DESCRIPTION="a program for generating photomosaics"
+HOMEPAGE="https://www.complang.tuwien.ac.at/schani/metapixel/";
+SRC_URI="https://www.complang.tuwien.ac.at/schani/${PN}/files/${P}.tar.gz";
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+
+RDEPEND="
+       dev-lang/perl
+       >=media-libs/giflib-5:0=
+       >=media-libs/libpng-1.4:0=
+       media-libs/libjpeg-turbo:=
+"
+DEPEND="${RDEPEND}"
+
+PATCHES=(
+       "${FILESDIR}"/${P}-libpng15.patch
+       "${FILESDIR}"/${P}-giflib5.patch
+       "${FILESDIR}"/${P}-clang16-build-fix.patch
+       "${FILESDIR}"/${P}-getopt.patch
+)
+
+src_prepare() {
+       default
+
+       sed -i -e 's:/usr/X11R6:/usr:g' Makefile || die
+       sed -i -e 's:ar:$(AR):' rwimg/Makefile || die
+       rm getopt* || die
+}
+
+src_compile() {
+       emake AR="$(tc-getAR)" CC="$(tc-getCC)" OPTIMIZE="${CFLAGS}" 
LDOPTS="${LDFLAGS}"
+}
+
+src_install() {
+       dobin ${PN}{,-prepare,-imagesize,-sizesort}
+       doman ${PN}.1
+       dodoc NEWS README
+}

Reply via email to