aboutsummaryrefslogtreecommitdiffstats
path: root/PKGBUILD
blob: 9f190b75535e44639de4d5bd4e41160e165289d6 (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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
pkgname=pacman-git
pkgver=4.2.1.r116.gf34e48a
pkgrel=1

pkgdesc="A library-based package manager with dependency support. git version."
url="http://www.archlinux.org/pacman/"
arch=('x86_64')
license=('GPL')

depends=('bash' 'curl' 'gpgme' 'libarchive' 'pacman-mirrorlist')
optdepends=('fakeroot: for makepkg usage as normal user')
makedepends=('git' 'asciidoc')
checkdepends=('python2' 'fakechroot')

provides=("pacman=$pkgver" 'pacman-contrib' 'libalpm.so')
conflicts=('pacman' 'pacman-contrib')

options=('strip' 'debug')

backup=(etc/pacman.conf
        etc/makepkg.conf)

source=(git://projects.archlinux.org/pacman.git
        pacman.conf
        makepkg.conf)

sha1sums=('SKIP'
          '3c1bddf27602e02fb57801c0ea7313b3869acc92'
          'f2ef3115adaf2aa5c13a1ab7e948c21028451465')

pkgver() {
	cd pacman
	git describe --long | sed -r 's/^v//;s/([^-]*-g)/r\1/;s/-/./g'
}

build() {
	cd pacman

	./autogen.sh
	./configure \
	    --prefix=/usr \
	    --sysconfdir=/etc \
	    --localstatedir=/var \
	    --enable-doc \
	    --enable-git-version \
	    --enable-debug \
	    --with-scriptlet-shell=/usr/bin/bash \
	    --with-ldconfig=/usr/bin/ldconfig

	make
	make -C contrib
}

check() {
	make -C "pacman" check
}

package() {
	cd pacman

	make DESTDIR="$pkgdir" install
	make DESTDIR="$pkgdir" -C contrib install

	# install Arch specific stuff
	install -dm755 "$pkgdir"/etc
	install -m644 "$srcdir"/pacman.conf "$pkgdir"/etc/
	install -m644 "$srcdir"/makepkg.conf "$pkgdir"/etc/

	# set things correctly in the default conf file
	sed -i "$pkgdir/etc/makepkg.conf" \
		-e "s|@CARCH[@]|x86_64|g" \
		-e "s|@CHOST[@]|x86_64-unknown-linux-gn|g" \
		-e "s|@CARCHFLAGS[@]|-march=x86-64 |g"


	install -Dm644 contrib/PKGBUILD.vim "$pkgdir"/usr/share/vim/vimfiles/syntax/PKGBUILD.vim
	install -dm755 "$pkgdir"/usr/share/vim/vimfiles/ftdetect
	echo "au BufNewFile,BufRead PKGBUILD set filetype=PKGBUILD" \
		>"$pkgdir"/usr/share/vim/vimfiles/ftdetect/PKGBUILD.vim

	# install completion files
	rm -r "$pkgdir"/etc/bash_completion.d
	install -Dm644 contrib/bash_completion "$pkgdir"/usr/share/bash-completion/completions/pacman
	install -Dm644 contrib/zsh_completion "$pkgdir"/usr/share/zsh/site-functions/_pacman

	for f in makepkg pacman-key; do
		ln -s pacman "$pkgdir"/usr/share/bash-completion/completions/"$f"
	done

	install -Dm644 contrib/PKGBUILD.vim "$pkgdir"/usr/share/vim/vimfiles/syntax/PKGBUILD.vim
}