summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 25a7dd742acff85bde0a3549f37cb06ccd76fcfa (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
92
93
# -*- sh -*-

# Contributor: Dan Beste <dan.ray.beste@gmail.com>
# Comtributor: Stefan Husmann <stefan-husmann@t-online.de>
#  Maintainer: Klaus Alexander Seistrup <$(echo 0x1fd+d59decfa=40 | tr 0-9+a-f=x ka-i@p-u.l)>

pkgname='ngs-lang-git'
_pkgname="${pkgname/-git}"
pkgver=0.2.16.r6.g9f5eb49
pkgrel=2
epoch=1
pkgdesc='NGS: Next Generation Shell (latest commit)'
arch=('x86_64')
url='https://github.com/ngs-lang/ngs'
license=('GPL-3.0-or-later')
makedepends=(
  'cmake'
  'git'
  'pandoc'
  'peg'
  'uthash'
)
depends=(
  'gc'
  'glibc'
  'json-c'
  'libffi'
  'pcre'
)
provides=('ngs' "$_pkgname")
conflicts=('ngs' "$_pkgname")
source=('git+https://github.com/ngs-lang/ngs.git')
sha256sums=('SKIP')

pkgver() {
  cd 'ngs'

  git describe --tags | cut -c2- | sed 's+-+.r+' |tr - .
}

prepare() {
  cd 'ngs'

  sed -i 's@VERSION 3\.0@VERSION 3.5@'                   CMakeLists.txt
  sed -i 's@^link_directories@#link_directories@g'       CMakeLists.txt
  sed -i 's@/usr/local/include /opt/homebrew/include@@g' CMakeLists.txt

  mkdir -p build
  cd build
  cmake -DCMAKE_INSTALL_PREFIX="$pkgdir/usr" ..
}

build() {
  cd 'ngs/build'

  # RFC-0023
  # 🔗 https://rfc.archlinux.page/0023-pack-relative-relocs/
  #
  # ld(1) says: “Supported for i386 and x86-64.”
  case "Z${CARCH:-unknown}" in
    'Zx86_64' | 'Zi386' )
      export LDFLAGS="$LDFLAGS -Wl,-z,pack-relative-relocs"
    ;;
    * ) : pass ;;
  esac

  make
}

check() {
  cd 'ngs/build'

  ctest || true
}

package() {
  cd 'ngs/build'

  make install

  install -vDm0644 -t "$pkgdir/usr/share/doc/$pkgname/" \
    ../{CHANGELOG,readme}.md ../one-liners.txt

  cd "$pkgdir/usr"

  rm -vrf doc
  mv -v man share/
  find   "$pkgdir/usr/bin" -type f -exec chmod o-w {} +
  install -vdm0755 "$pkgdir/usr/share/doc/$pkgname/demo"
  mv -vf "$pkgdir/usr/bin/"*.ngs "share/doc/$pkgname/demo/"
}

# vim: ts=2 sw=2 et: