summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: eb6f32ba13df49363f1da08b8e003d7dbbcb99d9 (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

# Maintainer: Gabriel Brown <gabriel.h.brown@gmail.com>

_gituser="chapel-lang"
_gitname="chapel"

pkgname=${_gitname}-git
pkgver=1.32.0.3604.gd9a881bfbe4 #autogenerated/written by pkgver()
pkgrel=1
pkgdesc="Programming language designed for productive parallel computing at scale"
url="https://chapel-lang.org/"
arch=('x86_64' 'arm')
license=('Apache')
provides=("${_gitname}")
conflicts=("${_gitname}")
# depends=('python' 'perl' 'llvm' 'clang')
depends=('python' 'perl' 'llvm16' 'llvm16-libs' 'clang16') # if using old versions
makedepends=('git' 'cmake')
options=('!debug' '!lto')  # build currently fails from default flags these add
source=("git+https://github.com/${_gituser}/${_gitname}.git")
sha256sums=('SKIP') # source is not static

pkgver() {
  cd "${srcdir}/${_gitname}"
  # get correct numerical version from internal file
  ver_file="CMakeLists.txt"
  major_ver=$(grep set\(CHPL_MAJOR_VERSION  ${ver_file} \
                   | cut -d ' ' -f 2 | cut -d ')' -f 1)
  minor_ver=$(grep set\(CHPL_MINOR_VERSION  ${ver_file} \
                   | cut -d ' ' -f 2 | cut -d ')' -f 1) 
  update_ver=$(grep set\(CHPL_PATCH_VERSION ${ver_file} \
                   | cut -d ' ' -f 2 | cut -d ')' -f 1) 
  ver_num="${major_ver}.${minor_ver}.${update_ver}"
  # keep second (correct) half of git describe result
  gitdescribe=$(git describe --long --tags --always)
  tail=$(echo ${gitdescribe} | cut -d '-' -f 2,3) # no version number
  # combine two pieces
  ver_hyphen="${ver_num}-${tail}"
  ver=$(echo ${ver_hyphen} | sed 's/\-/\./g')
  echo ${ver}
  # use below when git describe begins with correct version number
  #git describe --long --tags --always | sed 's/\-/\./g' 
}

build() {
        cd "${srcdir}/${_gitname}"
        # if depending on old versions like llvmXX and clangXX
        export CHPL_TARGET_CPU="native"
        export CHPL_HOST_COMPILER="clang"
        export CHPL_HOST_CC="/usr/lib/llvm16/bin/clang"
        export CHPL_HOST_CXX="/usr/lib/llvm16/bin/clang++"
        ./configure --prefix=/usr
        make
}

check() {
        cd "${srcdir}/${_gitname}"
        export PATH="${srcdir}/${_gitname}/bin/linux64-x86_64:${PATH}"
        make check
}

package() {
        cd "${_gitname}"
        make DESTDIR="${pkgdir}" install
}