aboutsummaryrefslogtreecommitdiffstats
path: root/main/libjpeg-turbo/APKBUILD
blob: 77def7e546b84ea31a78233aba4ae9821b79fb10 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# Contributor: Carlo Landmeter <clandmeter@alpinelinux.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=libjpeg-turbo
pkgver=2.0.6
pkgrel=0
pkgdesc="Accelerated baseline JPEG compression and decompression library"
url="https://libjpeg-turbo.org/"
arch="all"
license="BSD-3-Clause IJG Zlib"
makedepends="cmake nasm"
replaces="libjpeg"
subpackages="$pkgname-static $pkgname-doc $pkgname-dev $pkgname-utils"
source="https://downloads.sourceforge.net/libjpeg-turbo/libjpeg-turbo-$pkgver.tar.gz"

# Some tests broken on mips64.
[ "$CARCH" = "mips64" ] && options="!check"

# secfixes:
#   2.0.4-r2:
#     - CVE-2020-13790
#   2.0.4-r0:
#     - CVE-2019-2201
#   2.0.2-r0:
#     - CVE-2018-20330
#     - CVE-2018-19664
#   1.5.3-r3:
#     - CVE-2018-11813
#   1.5.3-r2:
#     - CVE-2018-1152


build() {
	local _floattest=
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	case "$CARCH" in
		ppc64le) export JSIMD_FORCENONE=1;;
		s390x|riscv64) _floattest="-DFLOATTEST=fp-contract";;
	esac
	cmake \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=/usr/lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_C_FLAGS="$CFLAGS" \
		-DWITH_JPEG8=1 \
		$_floattest \
		$CMAKE_CROSSOPTS
	make
}

check() {
	make test
}

package() {
	make -j1 DESTDIR="$pkgdir" install
	install -d "$pkgdir"/usr/share/licenses/$pkgname
	ln -s ../../doc/libjpeg-turbo/LICENSE.md "$pkgdir/usr/share/licenses/$pkgname"
}

utils() {
	pkgdesc="Utilities for manipulating JPEG images"
	replaces="jpeg"
	mkdir -p "$subpkgdir"/usr
	mv "$pkgdir"/usr/bin "$subpkgdir"/usr/
}

doc() {
	default_doc
	replaces="jpeg-doc"
}

dev() {
	default_dev
	replaces="jpeg-dev"
}

sha512sums="504062778224f2ed2ddb64c988fbf466a14247952aab0cf1d35d281942b6f0874eafd34b45914d2208e087f05ddd896c5ba87a67c944e8bb80323e187413038c  libjpeg-turbo-2.0.6.tar.gz"