summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 476355e1898547bb1aaa6250f36524d1aa7f3054 (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
# Maintainer: Ivan Shapovalov <intelfx@intelfx.name>
# Contributor: Anatol Pomozov <anatol.pomozov@gmail.com>
# Contributor: Filip Brcic <brcha@gna.org>
# Contributor: Mika Fischer <mika.fischer@zoopnet.de>
# Contributor: Gergely Imreh <imrehgATgmailDOTcom>

pkgname=ninja-git
epoch=2
pkgver=1.11.1.r197.g903a05ce
pkgrel=1
pkgdesc='Small build system with a focus on speed'
arch=(x86_64)
url='https://ninja-build.org/'
license=(Apache)
depends=(gcc-libs)
makedepends=(git cmake python re2c emacs-nox)
provides=(ninja)
conflicts=(ninja)
source=('git+https://github.com/ninja-build/ninja.git')
md5sums=('SKIP')

pkgver() {
  cd ninja
  #
  # This is a somewhat unconventional use of git to derive a reasonable version.
  # We need this because ninja does not merge releases back into master.
  #
  local tag revs abbrev
  tag="$(git describe --tags --abbrev=0 origin/release)"
  revs="$(git rev-list --count "$tag..")"
  abbrev="$(git rev-parse --short HEAD)"
  # reconstruct pkgver()ized git-describe output by hand
  echo "${tag#v}.r${revs}.g${abbrev}"
}

build() {
  cmake \
    -S ninja \
    -B build \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -Wno-dev
  cmake --build build

  cd ninja
  emacs -Q --batch -f batch-byte-compile misc/ninja-mode.el
}

check() {
  cd build
  ./ninja_test
}

package() {
  local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")

  cd "$srcdir/build"
  install -Dm755 -t "$pkgdir/usr/bin" ninja

  cd "$srcdir/ninja"
  install -Dm644 -t "$pkgdir/usr/share/licenses/$pkgname" COPYING
  install -Dm644 -t "$pkgdir/usr/share/doc/ninja" doc/manual.asciidoc
  install -Dm644 -t "$pkgdir/usr/share/emacs/site-lisp" \
    misc/ninja-mode.elc \
    misc/ninja-mode.el \

  install -Dm644 -t "$pkgdir/usr/share/vim/vimfiles/syntax" misc/ninja.vim
  install -Dm644 -t "$pkgdir/$site_packages" misc/ninja_syntax.py

  install -Dm644 misc/bash-completion "$pkgdir/usr/share/bash-completion/completions/ninja"
  install -Dm644 misc/zsh-completion "$pkgdir/usr/share/zsh/site-functions/_ninja"
}