summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 38d46f408f2369b38b262c90a4c827d9497485ef (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
# Maintainer: Adrián Pérez de Castro <aperez@igalia.com>
# Maintainer: Alexandre Macabies <web+oss@zopieux.com>

pkgname=gn-git
pkgdesc='Meta-build system which generates Ninja build files'
pkgver=r1682.a5bcbd72
pkgrel=1
license=('BSD')
arch=('x86_64' 'i686')
conflicts=(gn-bin gn)
provides=(gn)
depends=(gcc-libs)
makedepends=(python ninja git)
url='https://gn.googlesource.com/gn'
source=("gn::git+${url}" gcc-support.patch)
sha256sums=('SKIP'
            'f372f4d2129219d29d4c4adbade6a653059d376d8ecd8785a3bad2c0ac96f304')

pkgver () {
	export GIT_DIR="${startdir}/gn"
	printf "r%s.%s" "$(git --bare rev-list --count HEAD)" "$(git --bare rev-parse --short HEAD)"
}

prepare () {
	cd gn
	patch -p1 < "${srcdir}/gcc-support.patch"
}

build () {
	cd gn
	CC=cc CXX=c++ AR=ar \
	CFLAGS="${CFLAGS} -pthread" \
	CXXFLAGS="${CXXFLAGS} -pthread" \
	LDFLAGS="${LDFLAGS} -pthread" \
		python build/gen.py --use-lto --no-strip
	ninja -C out
}

package () {
	install -Dm755 gn/out/gn "${pkgdir}/usr/bin/gn"

	# Documentation
	install -Dm644 -t "${pkgdir}/usr/share/doc/${pkgname}" \
		gn/docs/*.md gn/README.md

	install -Dm644 -t "${pkgdir}/usr/share/doc/${pkgname}/example" \
		gn/examples/simple_build/*.*
	install -Dm644 -t "${pkgdir}/usr/share/doc/${pkgname}/example/build" \
		gn/examples/simple_build/build/*.*
	install -Dm644 -t "${pkgdir}/usr/share/doc/${pkgname}/example/build/toolchain" \
		gn/examples/simple_build/build/toolchain/*.*

	# Vim support
	local item
	for item in autoload ftplugin ftdetect syntax ; do
		install -Dm 644 -t "${pkgdir}/usr/share/vim/vimfiles/${item}" \
			"gn/misc/vim/${item}"/*.vim
	done
		
	# License
	install -m 644 -D gn/LICENSE \
		"${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}