[packages/libimagequant/DEVEL-rust] - updated to rusted 4.3.0 version

qboosh qboosh at pld-linux.org
Sun Apr 14 13:12:52 CEST 2024


commit 7694865889155989bb2a5a32c8f5a5fd95070469
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Sun Apr 14 12:17:13 2024 +0200

    - updated to rusted 4.3.0 version

 libimagequant-shared.patch | 32 ----------------------
 libimagequant.spec         | 66 ++++++++++++++++++++++++----------------------
 2 files changed, 34 insertions(+), 64 deletions(-)
---
diff --git a/libimagequant.spec b/libimagequant.spec
index 54cd427..06ac377 100644
--- a/libimagequant.spec
+++ b/libimagequant.spec
@@ -1,10 +1,9 @@
 # TODO:
 # - finish java (create .jar, install)
-# - build C#, rust bindings
+# - build C# bindings, rust crates
 #
 # Conditional build:
 %bcond_without	static_libs	# static library
-%bcond_without	openmp		# OpenMP support
 %bcond_with	sse		# SSE instructions
 %bcond_with	java		# Java bindings [TODO: finish]
 #
@@ -14,19 +13,20 @@
 Summary:	Image Quantization library
 Summary(pl.UTF-8):	Biblioteka do kwantyzacji obrazów
 Name:		libimagequant
-Version:	2.18.0
+Version:	4.3.0
 Release:	1
 # some original code was on MIT-like license
 License:	GPL v3+ with MIT parts or commercial
 Group:		Libraries
 #Source0Download: https://github.com/ImageOptim/libimagequant/tags
 Source0:	https://github.com/ImageOptim/libimagequant/archive/%{version}/%{name}-%{version}.tar.gz
-# Source0-md5:	bc0870e98d02fef68f65ef770d0d5c30
-Patch0:		%{name}-shared.patch
+# Source0-md5:	c5290deecd9a1a7d115a823435dbd0a2
+Source1:	%{name}-%{version}-vendor.tar.xz
+# Source1-md5:	1e5c3a19b4c5099e151eb4fcfed4e96b
 URL:		https://pngquant.org/lib/
-%{?with_openmp:BuildRequires:	gcc >= 6:4.2}
 %{?with_java:BuildRequires:	jdk}
-%{?with_openmp:BuildRequires:	libgomp-devel}
+BuildRequires:	rpmbuild(macros) >= 2.012
+ExclusiveArch:	%{x8664} %{ix86} x32 aarch64 armv6hl armv7hl armv7hnl
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
 %description
@@ -62,36 +62,37 @@ Static libimagequant library.
 Statyczna biblioteka libimagequant.
 
 %prep
-%setup -q
-%patch0 -p1
+%setup -q -b1
+
+export CARGO_HOME="$(pwd)/.cargo"
+
+mkdir -p "$CARGO_HOME"
+cat >.cargo/config <<EOF
+[source.crates-io]
+replace-with = 'vendored-sources'
+
+[source.vendored-sources]
+directory = '$PWD/vendor'
+EOF
 
 %build
-# not autoconf configure
-./configure \
-	CC="%{__cc}" \
-	CFLAGS="%{rpmcflags} %{rpmcppflags}" \
-	LDFLAGS="%{rpmldflags}" \
-	--prefix=%{_prefix} \
-	--libdir=%{_libdir} \
-	%{__enable_disable sse} \
-	%{?with_openmp:--with-openmp}
-
-%{__make} shared %{?with_static_libs:static}
-
-%if %{with java}
-%{__make} java \
-	CLASSPATH=.
-%endif
+export CARGO_HOME="$(pwd)/.cargo"
+
+cd imagequant-sys
+cargo -v cbuild --offline --release --target %{rust_target} \
+        --prefix %{_prefix} \
+        --libdir %{_libdir}
 
 %install
 rm -rf $RPM_BUILD_ROOT
+export CARGO_HOME="$(pwd)/.cargo"
 
-%{__make} install \
-	DESTDIR=$RPM_BUILD_ROOT
-
-%if %{with static_libs}
-cp -p libimagequant.a $RPM_BUILD_ROOT%{_libdir}
-%endif
+cd imagequant-sys
+cargo -v cinstall --frozen --release --target %{rust_target} \
+	--destdir $RPM_BUILD_ROOT \
+	--prefix %{_prefix} \
+	--includedir %{_includedir} \
+	--libdir %{_libdir}
 
 %clean
 rm -rf $RPM_BUILD_ROOT
@@ -102,7 +103,8 @@ rm -rf $RPM_BUILD_ROOT
 %files
 %defattr(644,root,root,755)
 %doc CHANGELOG COPYRIGHT README.md
-%attr(755,root,root) %{_libdir}/libimagequant.so.0
+%attr(755,root,root) %{_libdir}/libimagequant.so.*.*.*
+%attr(755,root,root) %ghost %{_libdir}/libimagequant.so.0.4
 
 %files devel
 %defattr(644,root,root,755)
diff --git a/libimagequant-shared.patch b/libimagequant-shared.patch
deleted file mode 100644
index 97afee3..0000000
--- a/libimagequant-shared.patch
+++ /dev/null
@@ -1,32 +0,0 @@
---- libimagequant-2.17.0/Makefile.orig	2021-11-15 00:57:01.000000000 +0100
-+++ libimagequant-2.17.0/Makefile	2022-03-16 21:05:11.342090757 +0100
-@@ -64,8 +64,8 @@ libimagequant.dylib: $(SHAREDOBJS)
- 
- $(OBJS): $(wildcard *.h) config.mk
- 
--$(JNILIB): $(JAVAHEADERS) $(STATICLIB) org/pngquant/PngQuant.c
--	$(CC) -g $(CFLAGS) $(LDFLAGS) $(JAVAINCLUDE) -shared -o $@ org/pngquant/PngQuant.c $(STATICLIB)
-+$(JNILIB): $(JAVAHEADERS) $(SHAREDLIB) org/pngquant/PngQuant.c
-+	$(CC) -g $(CFLAGS) $(LDFLAGS) $(JAVAINCLUDE) -shared -o $@ org/pngquant/PngQuant.c $(SHAREDLIB)
- 
- $(JNIDLL) $(JNIDLLIMP): $(JAVAHEADERS) $(OBJS) org/pngquant/PngQuant.c
- 	$(CC) -fPIC -shared -I. $(JAVAINCLUDE) -o $(JNIDLL) $^ $(LDFLAGS) -Wl,--out-implib,$(JNIDLLIMP),--output-def,$(JNIDLLDEF)
-@@ -134,7 +134,7 @@ ifeq ($(filter %clean %distclean, $(MAKE
- endif
- 
- $(PKGCONFIG): config.mk
--	sed 's|@PREFIX@|$(PREFIX)|;s|@VERSION@|$(VERSION)|' < imagequant.pc.in > $(PKGCONFIG)
-+	sed 's|@PREFIX@|$(PREFIX)|;s|@LIBDIR@|$(LIBDIR)|;s|@VERSION@|$(VERSION)|' < imagequant.pc.in > $(PKGCONFIG)
- 
- .PHONY: all static shared clean dist distclean dll java cargo
- .DELETE_ON_ERROR:
---- libimagequant-2.17.0/imagequant.pc.in.orig	2022-03-16 21:03:51.702522202 +0100
-+++ libimagequant-2.17.0/imagequant.pc.in	2022-03-16 21:05:58.435168965 +0100
-@@ -1,6 +1,6 @@
- prefix=@PREFIX@
- includedir=${prefix}/include
--libdir=${prefix}/lib
-+libdir=@LIBDIR@
- 
- Name: imagequant
- Description: Small, portable C library for high-quality conversion of RGBA images to 8-bit indexed-color (palette) images.
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/libimagequant.git/commitdiff/7694865889155989bb2a5a32c8f5a5fd95070469



More information about the pld-cvs-commit mailing list