summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 7ada5351b153ce059c410834a3f5e0c6ec3fcb0e (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
# Maintainer : Daniel Bermond < gmail-com: danielbermond >

pkgname=fp16-git
_srcname=FP16
pkgver=r40.34d4bf0
pkgrel=3
pkgdesc='Header-only library for conversion to/from half-precision floating point formats (git version)'
arch=('any')
url='https://github.com/Maratyszcza/FP16/'
license=('MIT')
makedepends=('git')
checkdepends=(
     # official repositories:
        'python2' 'ninja'
     # AUR:
        'confu2-git' 'python2-peachpy-git'
)
provides=('fp16')
conflicts=('fp16')
source=('git+https://github.com/Maratyszcza/FP16.git')
sha256sums=('SKIP')

pkgver() {
    cd "$_srcname"
    
    # git, no tags available
    printf 'r%s.%s' "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

check() {
    cd "$_srcname"
    confu2 setup
    python2 ./configure.py
    sed -i '/peachpy[[:space:]]=[[:space:]]python/s/python/python2/' build.ninja # use python2
    ninja
    
    cd bin
    local _test
    for _test in *
    do
        if [[ "$_test" = alt-to-fp32*-psimd ]] ||
           [[ "$_test" = ieee-to-fp32*-psimd ]]
        then
            # skip broken tests
            printf '%s\n' "  -> Skipping test '${_test}'..."
            continue
        else
            printf '%s\n' "  -> Running test '${_test}'..."
            ./"$_test"
        fi
    done
}

package() {
    cd "$_srcname"
    
    # headers
    mkdir -p "${pkgdir}/usr/include/fp16"
    install -D -m644 include/*.h      "${pkgdir}/usr/include"
    install -D -m644 include/fp16/*.h "${pkgdir}/usr/include/fp16"
    
    # license
    install -D -m644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"
}