media-gfx/metapixel: fix build on musl

Closes: https://bugs.gentoo.org/944937
Signed-off-by: Alexey Sokolov <alexey+gentoo@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@gentoo.org>
This commit is contained in:
Alexey Sokolov 2025-12-14 00:36:34 +00:00 committed by Sam James
parent f5db95df6a
commit 91ac7792be
No known key found for this signature in database
GPG Key ID: 738409F520DF9190
2 changed files with 62 additions and 0 deletions

View File

@ -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

View File

@ -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
}