Diff libimagequant-2.18.0 with a libimagequant-4.2.0-r2

/usr/portage/media-gfx/libimagequant/libimagequant-4.2.0-r2.ebuild 2023-10-09 14:52:31.636368404 +0300
3 3

  
4 4
EAPI=8
5 5

  
6
inherit toolchain-funcs
6
CRATES="
7
adler-1.0.2
8
ahash-0.8.3
9
arrayvec-0.7.2
10
autocfg-1.1.0
11
bitflags-1.3.2
12
bytemuck-1.13.1
13
cc-1.0.79
14
cfg-if-1.0.0
15
crc32fast-1.3.2
16
crossbeam-channel-0.5.8
17
crossbeam-deque-0.8.3
18
crossbeam-epoch-0.9.14
19
crossbeam-utils-0.8.15
20
either-1.8.1
21
fallible_collections-0.4.7
22
flate2-1.0.26
23
hashbrown-0.13.2
24
hermit-abi-0.2.6
25
libc-0.2.142
26
lodepng-3.7.2
27
memoffset-0.8.0
28
miniz_oxide-0.7.1
29
num_cpus-1.15.0
30
once_cell-1.17.1
31
rayon-1.7.0
32
rayon-core-1.11.0
33
rgb-0.8.36
34
scopeguard-1.1.0
35
thread_local-1.1.7
36
version_check-0.9.4
37
"
38

  
39
inherit cargo
7 40

  
8 41
DESCRIPTION="Palette quantization library that powers pngquant and other PNG optimizers"
9 42
HOMEPAGE="https://pngquant.org/lib/"
10 43
SRC_URI="https://github.com/ImageOptim/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
44
SRC_URI+=" $(cargo_crate_uris)"
45
S="${WORKDIR}"/${P}/imagequant-sys
11 46

  
12 47
LICENSE="GPL-3"
13 48
SLOT="0/0"
14
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~ppc ~ppc64 ~riscv ~sparc ~x86 ~amd64-linux ~x86-linux"
15
IUSE="cpu_flags_x86_sse2 openmp"
16

  
17
PATCHES=(
18
	"${FILESDIR}"/${PN}-2.12.2-respect-CFLAGS.patch
19
	"${FILESDIR}"/${PN}-2.15.1-fix-pkgconfig.patch
20
)
49
KEYWORDS="amd64 arm arm64 ~loong ppc ppc64 ~s390 sparc"
21 50

  
22
pkg_pretend() {
23
	[[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
24
}
51
BDEPEND="
52
	>=dev-util/cargo-c-0.9.11
53
	>=virtual/rust-1.60
54
"
25 55

  
26
pkg_setup() {
27
	[[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
28
}
56
QA_FLAGS_IGNORED="usr/lib.*/libimagequant.so.*"
29 57

  
30
src_prepare() {
31
	default
58
src_compile() {
59
	local cargoargs=(
60
		--library-type=cdylib
61
		--prefix=/usr
62
		--libdir="/usr/$(get_libdir)"
63
		$(usev !debug '--release')
64
	)
32 65

  
33
	# Avoid always building static library
34
	# (Fixes side-effect of compiling in src_install too)
35
	sed -i \
36
		-e '/install.*STATICLIB/d' \
37
		-e 's/all: static shared/all: shared/' \
38
		Makefile || die
66
	cargo cbuild "${cargoargs[@]}" || die "cargo cbuild failed"
39 67
}
40 68

  
41
src_configure() {
42
	tc-export AR CC
43

  
44
	# Hand rolled configure script, so not all flags are supported.
45
	./configure \
46
		--prefix="${EPREFIX}/usr" \
47
		--libdir="${EPREFIX}/usr/$(get_libdir)" \
48
		$(use_enable cpu_flags_x86_sse2 sse) \
49
		$(use_with openmp) \
50
		CFLAGS="${CFLAGS} ${CPPFLAGS}" \
51
		LDFLAGS="${LDFLAGS}" || die
52
}
69
src_install() {
70
	local cargoargs=(
71
		--library-type=cdylib
72
		--prefix=/usr
73
		--libdir="/usr/$(get_libdir)"
74
		--destdir="${ED}"
75
		$(usex debug '--debug' '--release')
76
	)
53 77

  
54
src_compile() {
55
	emake shared imagequant.pc
78
	cargo cinstall "${cargoargs[@]}" || die "cargo cinstall failed"
56 79
}
Thank you!