Add graphics/libimagequant-c v2.18.0

Follow the example of graphics/librsvg{,-c} and re-add the last C
version of imagequant-turned-rust, for the sake of platforms which
cannot reasonably build or run rusted tools for lack of support or
resources.

See also the
<https://mail-index.netbsd.org/pkgsrc-users/2023/06/02/msg037421.html>
thread.
This commit is contained in:
hauke 2023-07-21 15:54:20 +00:00
parent 724ceffae2
commit 876548650f
7 changed files with 141 additions and 1 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.1016 2023/07/19 06:59:38 wiz Exp $
# $NetBSD: Makefile,v 1.1017 2023/07/21 15:54:20 hauke Exp $
#
COMMENT= Graphics tools and libraries
@ -340,6 +340,7 @@ SUBDIR+= libgnomecanvasmm
SUBDIR+= libheif
SUBDIR+= libhighway
SUBDIR+= libimagequant
SUBDIR+= libimagequant-c
SUBDIR+= libiptcdata
SUBDIR+= libjpeg-turbo
SUBDIR+= libkdcraw

View File

@ -0,0 +1,4 @@
Small, portable C library for high-quality conversion of RGBA images
to 8-bit indexed-color (palette) images.
This package provides the older 2.x branch written in plain C.

View File

@ -0,0 +1,37 @@
# $NetBSD: Makefile,v 1.1 2023/07/21 15:54:20 hauke Exp $
DISTNAME= libimagequant-2.18.0
CATEGORIES= graphics
MASTER_SITES+= ${MASTER_SITE_GITHUB:=ImageOptim/}
GITHUB_TAG= ${PKGVERSION_NOREV}
MAINTAINER= pkg-users@NetBSD.org
HOMEPAGE= https://pngquant.org/lib/
COMMENT= Conversion of RGBA images to 8-bit indexed-color (2.x, C-only)
LICENSE= gnu-gpl-v3
USE_LIBTOOL= yes
USE_TOOLS+= bash gmake
HAS_CONFIGURE= yes
CONFIGURE_ARGS+= --prefix="${PREFIX}"
BUILD_TARGET= shared
CONFIG_SHELL= ${BASH}
INSTALLATION_DIRS= include lib
REPLACE_BASH= configure
.include "../../mk/bsd.prefs.mk"
.if ${MACHINE_ARCH} == "x86_64"
CONFIGURE_ARGS+= --enable-sse
.else
CONFIGURE_ARGS+= --disable-sse
.endif
do-install:
${INSTALL_DATA} ${WRKSRC}/libimagequant.h \
${DESTDIR}${PREFIX}/include/libimagequant.h
${LIBTOOL} --mode=install ${INSTALL_LIB} \
${WRKSRC}/libimagequant.la ${DESTDIR}${PREFIX}/lib
.include "../../mk/bsd.pkg.mk"

View File

@ -0,0 +1,3 @@
@comment $NetBSD: PLIST,v 1.1 2023/07/21 15:54:20 hauke Exp $
include/libimagequant.h
lib/libimagequant.la

View File

@ -0,0 +1,7 @@
$NetBSD: distinfo,v 1.1 2023/07/21 15:54:20 hauke Exp $
BLAKE2s (libimagequant-2.18.0.tar.gz) = 17a3a23927f5fc2e05401a5cb21430c026d040a2b6182a8d1696573d804af96b
SHA512 (libimagequant-2.18.0.tar.gz) = ff2d4c2b901108525f403567ed2cc81dcda6e3600c58661de6324abb191ec04d954987e23b9c4d0e02cbec64ab905d717e3a0e1aecc6e1399ecc6126e889a356
Size (libimagequant-2.18.0.tar.gz) = 382092 bytes
SHA1 (patch-Makefile) = 979f07975806619b8bff6a7868c948903f8697db
SHA1 (patch-configure) = 89e4a07015ba59e6688eeee35e30289d24ac5307

View File

@ -0,0 +1,35 @@
$NetBSD: patch-Makefile,v 1.1 2023/07/21 15:54:20 hauke Exp $
Libtoolize.
--- Makefile.orig 2018-06-03 19:46:28.000000000 +0000
+++ Makefile
@@ -1,7 +1,7 @@
-include config.mk
STATICLIB=libimagequant.a
-SHAREDLIB=libimagequant.$(SOLIBSUFFIX)
+SHAREDLIB=libimagequant.la
SOVER=0
ifeq ($(SOLIBSUFFIX),dylib)
SHAREDLIBVER=libimagequant.$(SOVER).$(SOLIBSUFFIX)
@@ -52,15 +52,11 @@ $(STATICLIB): $(OBJS)
$(AR) $(ARFLAGS) $@ $^
$(SHAREDOBJS):
- $(CC) -fPIC $(CFLAGS) -c $(@:.lo=.c) -o $@
+ ${LIBTOOL} --mode=compile --tag=CC $(CC) -fPIC $(CFLAGS) -c $(@:.lo=.c) -o $@
-libimagequant.so: $(SHAREDOBJS)
- $(CC) -shared -Wl,-soname,$(SHAREDLIBVER) -o $(SHAREDLIBVER) $^ $(LDFLAGS)
- ln -fs $(SHAREDLIBVER) $(SHAREDLIB)
-
-libimagequant.dylib: $(SHAREDOBJS)
- $(CC) -shared -o $(SHAREDLIBVER) $^ $(LDFLAGS)
- ln -fs $(SHAREDLIBVER) $(SHAREDLIB)
+$(SHAREDLIB): $(SHAREDOBJS)
+ ${LIBTOOL} --mode=link --tag=CC $(CC) -o $(SHAREDLIB) $^ $(LDFLAGS) \
+ -rpath ${PREFIX}/lib -version-info $(subst .,:,$(basename $(VERSION)))
$(OBJS): $(wildcard *.h) config.mk

View File

@ -0,0 +1,53 @@
$NetBSD: patch-configure,v 1.1 2023/07/21 15:54:20 hauke Exp $
Remove unwanted compiler flags.
Avoid leaving scratch files in /tmp.
Do not look for Xcode.
--- configure.orig 2020-11-22 13:18:54.000000000 +0000
+++ configure
@@ -5,7 +5,7 @@ PREFIX="/usr/local"
LIBDIR="$PREFIX/lib"
INCLUDEDIR="$PREFIX/include"
PKGCONFIGDIR="$LIBDIR/pkgconfig"
-VERSION=$(grep LIQ_VERSION_STRING libimagequant.h | grep -Eo "2\.[0-9.]+")
+VERSION=$(awk -F\" '/LIQ_VERSION_STRING/ {print $2}' libimagequant.h)
DEBUG=
QUIET=0
@@ -157,7 +157,7 @@ cflags "-std=c99 -I."
# DEBUG
if [ -z "$DEBUG" ]; then
- cflags "-O3 -DNDEBUG"
+ cflags "-DNDEBUG"
status "Debug" "no"
else
cflags "-O1 -g -DDEBUG"
@@ -195,15 +195,9 @@ if [ -n "$OPENMP" ]; then
else
OPENMPFLAGS="-fopenmp"
fi
- if [[ "$("$CC" -xc -E $OPENMPFLAGS <(echo "#ifdef _OPENMP
- #include <omp.h>
- #endif") 2>&1)" =~ "omp_get_thread_num" ]]; then
cflags "$OPENMPFLAGS"
lflags "$OPENMPFLAGS"
status "OpenMP" "yes"
- else
- error "OpenMP" "not supported by compiler (please install a compiler that supports OpenMP (e.g. gcc) and specify it with the CC= argument)"
- fi
else
# silence warnings about omp pragmas
cflags "-Wno-unknown-pragmas"
@@ -223,10 +217,6 @@ if [[ "$OSTYPE" =~ "darwin" ]]; then
SOLIBSUFFIX=dylib
# Search Developer SDK paths, since Apple seems to have dropped the standard Unixy ones
- XCODE_CMD="xcode-select"
- XCODE_PATH=$($XCODE_CMD -p)
- DIRS+=("$XCODE_PATH/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include $XCODE_PATH/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib")
- DIRS+=("$XCODE_PATH/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include $XCODE_PATH/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/lib")
elif [[ "$OSTYPE" =~ "msys" ]]; then
SOLIBSUFFIX=dll
else