File PKGBUILD of Package ninja-1.11.0-archlinux

# Maintainer: Anatol Pomozov <anatol.pomozov@gmail.com>
# Contributor: Filip Brcic <brcha@gna.org>
# Contributor: Mika Fischer <mika.fischer@zoopnet.de>
# Contributor: Gergely Imreh <imrehgATgmailDOTcom>
# Get some information about the machine we are building on:
_numberOfProcessorsOnMachine=$(nproc)
_wantedJobs=$(echo "1.25*${_numberOfProcessorsOnMachine}" | bc -l)
_jobsIget=$(echo ${_wantedJobs} | awk '{print int($1+0.5)}')
_TOTAL_DISK=$(df -h --total | awk 'END{print $2}')
_FREEMEM=$(free --mega)
_TOTAL_MEM=$(free --total --mega | xargs | awk '{print $19"MB"}')
_TOTAL_RAM=$(free --total --mega | xargs | awk '{print $8"MB"}')
_TOTAL_SWAP=$(free --total --mega | xargs | awk '{print $15"MB"}')
pkgname=ninja
pkgver=1.11.0
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=(python re2c emacs-nox procps-ng bc)
#$pkgname-$pkgver.zip::https://github.com/martine/ninja/archive/v$pkgver.zip
source=(v${pkgver}.zip)
sha1sums=('e2de757c4dfa38985b348863b43e2609b56ad305')

build() {
  echo
  echo
  echo
  echo
  echo "--- Entering section build() ---"
  echo
  echo
  echo
  echo
  echo "--- Machine data we are building on ---"
  echo "Total disk: $_TOTAL_DISK"
  echo "Output of free -h:"
  echo "$_FREEMEM"
  echo "Total memory: $_TOTAL_MEM"
  echo "Total RAM: $_TOTAL_RAM"
  echo "Total SWAP: $_TOTAL_SWAP"
  echo "_numberOfProcessorsOnMachine=$_numberOfProcessorsOnMachine"
  echo "_wantedJobs=$_wantedJobs"
  echo "_jobsIget=$_jobsIget"
  echo "--- End machine data we are building on ---"
  cd ninja-$pkgver

  python configure.py --bootstrap
  emacs -Q --batch -f batch-byte-compile misc/ninja-mode.el
  echo
  echo
  echo
  echo
  echo "--- Exiting section build() ---"
  echo
  echo
  echo
  echo
}

check() {
  cd ninja-$pkgver

  python ./configure.py
  ./ninja ninja_test
  ./ninja_test
}

package() {
  cd ninja-$pkgver

  install -m755 -D ninja "$pkgdir/usr/bin/ninja"
  install -m644 -D doc/manual.asciidoc "$pkgdir/usr/share/doc/ninja/manual.asciidoc"
  install -Dm644 COPYING "$pkgdir/usr/share/licenses/$pkgname/COPYING"

  install -m644 -D misc/ninja-mode.el "$pkgdir/usr/share/emacs/site-lisp/ninja-mode.el"
  install -m644 -D misc/ninja-mode.elc "$pkgdir/usr/share/emacs/site-lisp/ninja-mode.elc"
  install -m644 -D misc/ninja.vim "$pkgdir/usr/share/vim/vimfiles/syntax/ninja.vim"

  install -m644 -D misc/bash-completion "$pkgdir/usr/share/bash-completion/completions/ninja"
  install -m644 -D misc/zsh-completion "$pkgdir/usr/share/zsh/site-functions/_ninja"
}
openSUSE Build Service is sponsored by