summaryrefslogtreecommitdiff
path: root/testing/imageflow/APKBUILD
blob: 09ef23d702efbc282a7968750fc4025e6453fb0a (plain)
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
# Contributor: Adam Jensen <adam@acj.sh>
# Maintainer: Adam Jensen <adam@acj.sh>
pkgname=imageflow
pkgver=1.7.0
_rcver=-rc64 # needed until first official release
_commit=c8951261f8d90ea3a445eaa569538d398e19a25e
pkgrel=1
pkgdesc="High-performance image manipulation for web servers"
url="https://github.com/imazen/imageflow"
arch="x86_64" # limited by cargo and SIMD dependency
license="AGPL-3.0-only"
makedepends="bash cargo zip nasm git openssl-dev>3 wget curl libpng-dev dssim"
source="$pkgname-$pkgver$_rcver.tar.gz::https://github.com/imazen/imageflow/archive/v$pkgver$_rcver.tar.gz"
builddir="$srcdir/$pkgname-$pkgver$_rcver"
subpackages="$pkgname-server:_server
	$pkgname-tool:_tool
	"

prepare() {
	# Workaround for environment consistency checks in build
	touch .git

	default_prepare
}

build() {
	# Needed to populate fields displayed at runtime
	version_prefix="v$pkgver$_rcver"
	export GIT_COMMIT="$_commit"
	export GIT_COMMIT_SHORT="${GIT_COMMIT:0:7}"
	export GIT_OPTIONAL_TAG=$version_prefix
	export GIT_DESCRIBE_ALWAYS="$version_prefix"
	export GIT_DESCRIBE_ALWAYS_LONG="$version_prefix-0-alpine"
	export GIT_DESCRIBE_AAL="tags/$version_prefix-0-alpine"
	export GIT_OPTIONAL_BRANCH="n/a"

	cargo build --workspace --release --locked
}

check() {
	cargo test --workspace --release --locked
}

package() {
	install -Dm644 "$builddir/target/release/libimageflow.so" \
		"$pkgdir/usr/lib/libimageflow.so.$pkgver"
	ln -s "libimageflow.so.$pkgver" "$pkgdir/usr/lib/libimageflow.so.${pkgver:0:1}"
	ln -s "libimageflow.so.$pkgver" "$pkgdir/usr/lib/libimageflow.so"
}

_server() {
	pkgdesc="$pkgdesc (HTTP server)"

	install -Dm755 "$builddir/target/release/imageflow_server" \
		"$subpkgdir/usr/bin/imageflow_server"
}

_tool() {
	pkgdesc="$pkgdesc (image resizing tool)"

	install -Dm755 "$builddir/target/release/imageflow_tool" \
		"$subpkgdir/usr/bin/imageflow_tool"
}

sha512sums="192cb6790050b6e0733ffcc2ce204a9840e65c8d2139b8c6ef0207441e3606a43817de9c68d5844054754282daa3b5d594110a115cb6bb793faa44f90b6647fd  imageflow-1.7.0-rc64.tar.gz"