aboutsummaryrefslogtreecommitdiffstats
path: root/community/x264/APKBUILD
blob: 4651c908c5efa1025d2bf0eba256719aeea74016 (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
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=x264
# Upstream doesn't do releases; track branch "stable"
#   https://code.videolan.org/videolan/x264/-/tree/stable.
# The minor version corresponds the ABI version. If it needs to be bumbed,
# abuild will alert you.
pkgver=0.163_git20210613
_gitrev=5db6aa6cab1b146e07b60cc1736a01f21da01154
pkgrel=1
pkgdesc="Free library for encoding H264/AVC video streams"
url="https://www.videolan.org/developers/x264.html"
arch="all"
license="GPL-2.0-or-later"
makedepends="
	bash
	coreutils
	libx11-dev
	nasm
	perl
	"
subpackages="$pkgname-dev $pkgname-libs $pkgname-bash-completion:bashcomp:noarch"
source="$pkgname-$_gitrev.tar.gz::https://code.videolan.org/videolan/x264/-/archive/$_gitrev/x264-$_gitrev.tar.gz"
builddir="$srcdir/$pkgname-$_gitrev"

prepare() {
	default_prepare
	update_config_guess
	update_config_sub

	local abi; abi=$(sed -n 's/^#define X264_BUILD \([1-9][0-9]*\).*$/\1/p' x264.h)
	if [ "${pkgver%_*}" != "0.$abi" ]; then
		error "ABI version has been changed to $abi!"
		error "Bump pkgver to 0.${abi}_${pkgver##*_} and rebuild all dependent packages"
		return 1
	fi
}

build() {
	local asmopts=
	case "$CARCH" in
		# x86 assembly contains TEXTRELs
		x86) asmopts="--disable-asm";;
	esac

	# note: not autotools
	CFLAGS="${CFLAGS/-Os/}" ./configure \
		--host=$CHOST \
		--prefix=/usr \
		--enable-lto \
		--enable-shared \
		--enable-static \
		$asmopts \
		--enable-pic \
		--extra-cflags=-fno-aggressive-loop-optimizations
	make
}

check() {
	./x264 --version
}

package() {
	make DESTDIR="$pkgdir" \
		bindir=/usr/bin libdir=/usr/lib includedir=/usr/include \
		install

	mkdir -p "$pkgdir"/usr/share/bash-completion/completions
		mv "$builddir"/tools/bash-autocomplete.sh \
		"$pkgdir"/usr/share/bash-completion/completions/x264
}

sha512sums="
d2cdd40d195fd6507abacc8b8810107567dff2c0a93424ba1eb00b544cb78a5430f00f9bcf8f19bd663ae77849225577da05bfcdb57948a8af9dc32a7c8b9ffd  x264-5db6aa6cab1b146e07b60cc1736a01f21da01154.tar.gz
"