summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 7bbefca1ce72b82a7d3451fa6d656cb696042bb8 (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
# Maintainer: BlackEagle < ike DOT devolder AT gmail DOT com >
pkgname=par2cmdline-git
pkgver=20120324
pkgrel=1
pkgdesc="A file verification and repair tool"
url="https://github.com/BlackIkeEagle/par2cmdline"
license="GPL"
makedepends=('git')
depends=('gcc-libs')
arch=('i686' 'x86_64')
source=()

if [ -e .githash_${CARCH} ] ; then
	_gitphash=$(cat .githash_${CARCH})
else
	_gitphash=""
fi

_gitname='par2cmdline'
_gitroot='git://github.com/BlackIkeEagle/par2cmdline.git'

build() {
	if [ -d ${srcdir}/${_gitname}/.git ] ; then
		( cd ${srcdir}/${_gitname} && git pull origin )
		msg "The local files are updated."
	else
		( git clone --depth 1 ${_gitroot} ${_gitname} )
	fi
	msg "GIT checkout done or server timeout"

	cd ${_gitname}
	if [ "${_gitphash}" == $(git show | grep -m 1 commit | sed 's/commit //') ]; then
		msg "Git hash is the same as previous build"
		return 1
	fi

	msg "creating build directory"
	cd ${srcdir}
	[ -d ${_gitname}-build ] && rm -rf ${_gitname}-build
	cp -a ${_gitname} ${_gitname}-build

	msg "Starting make..."
	cd ${_gitname}-build

	# automake
	aclocal
	automake --add-missing
	autoconf
	# configure
	./configure --prefix=/usr
	# make
	make
}

check() {
	cd ${_gitname}-build
	make check
}

package() {
	cd ${_gitname}-build
	make DESTDIR=$startdir/pkg install

	git show | grep -m 1 commit | sed 's/commit //' > ${startdir}/.githash_${CARCH}
}