aboutsummaryrefslogtreecommitdiffstats
path: root/community/x264/APKBUILD
blob: 245926a21df1b7c252ebb5308a1d67005fd69df1 (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
# 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.164_git20220602
_gitrev=baee400fa9ced6f5481a728138fed6e867b0ff7f
pkgrel=0
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
	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="
3c7147457cbe0fea20cf3ed8cf7bbdca9ac15060cf86f81b9b5b54b018f922964e91b3c38962c81fedef92bc5b14489e04d0966d03d2b7a85b4dabab6ad816a2  x264-baee400fa9ced6f5481a728138fed6e867b0ff7f.tar.gz
"