summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 7a295ed5552455b9d24c12339ebbfb73ea53dccf (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
66
# Mainainer: Christian Hesse <mail@eworm.de>
# Contributor: Sébastien Luttringer <seblu@archlinux.org>
# Contributor: Allan McRae <allan@archlinux.org>
# Contributor: Andreas Radke <andyrtr@archlinux.org>

pkgname=file-git
pkgver=5.43.r81.g4cfda317
pkgrel=1
pkgdesc='File type identification utility - git checkout'
arch=('i686' 'x86_64')
license=('custom')
groups=('base-devel')
url='http://www.darwinsys.com/file/'
depends=('glibc' 'zlib' 'xz' 'bzip2' 'libseccomp' 'libseccomp.so')
makedepends=('git')
provides=('libmagic.so' 'file')
conflicts=('file')
source=('git+https://github.com/file/file.git')
sha256sums=('SKIP')

pkgver() {
	cd file/

	if GITTAG="$(git describe --abbrev=0 --tags 2>/dev/null)"; then
		printf '%s.r%s.g%s' \
			"$(sed -e "s/^${pkgname%%-git}//" -e 's/^[-_/a-zA-Z]\+//' -e 's/[-_+]/./g' <<< ${GITTAG})" \
			"$(git rev-list --count ${GITTAG}..)" \
			"$(git rev-parse --short HEAD)"
	else
		printf '0.r%s.g%s' \
			"$(git rev-list --count master)" \
			"$(git rev-parse --short HEAD)"
	fi
}

prepare() {
	cd file/

	autoreconf -fi
}

build() {
	cd file/

	./configure \
		--prefix=/usr \
		--datadir=/usr/share/file \
		--enable-fsect-man5 \
		--enable-libseccomp
	make
}

check() {
	cd file/

	make check
}

package() {
	cd file/

	make DESTDIR="${pkgdir}" install

	install -D -m0644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/COPYING"
}