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

pkgname=nnpack-git
pkgver=r230.32c1a9d
pkgrel=1
pkgdesc="An acceleration package for neural network computations (git version)"
arch=('i386' 'x86_64')
url="https://github.com/Maratyszcza/NNPACK/"
license=('BSD')
makedepends=(
    # binary repositories:
        'git' 'python2' 'ninja'
    # AUR:
        'confu2-git' 'python2-peachpy-git'
)
options=('staticlibs')
source=("$pkgname"::"git+https://github.com/Maratyszcza/NNPACK.git")
sha256sums=('SKIP')

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

build() {
    cd "$pkgname"
    
    confu2 setup
    python2 ./configure.py #--enable-shared # https://github.com/Maratyszcza/NNPACK/issues/56
    sed -i '/cflags[[:space:]]=[[:space:]]/s/$/ -fPIC/'              build.ninja # add -fPIC
    sed -i '/cxxflags[[:space:]]=[[:space:]]/s/$/ -fPIC/'            build.ninja # add -fPIC
    sed -i '/peachpy[[:space:]]=[[:space:]]python/s/python/python2/' build.ninja # use python2
    ninja
}

package() {
    cd "${pkgname}"
    
    # directories creation
    mkdir -p "${pkgdir}/usr/include/nnpack"
    mkdir -p "${pkgdir}/usr/lib"
    mkdir -p "${pkgdir}/usr/share/licenses/${pkgname}"
    
    # include
    install -D -m644 include/*.h        "${pkgdir}/usr/include"
    install -D -m644 include/nnpack/*.h "${pkgdir}/usr/include/nnpack"
    
    # lib
    install -D -m644 lib/libnnpack.a    "${pkgdir}/usr/lib"
    
    # license
    install -D -m644 "LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}