summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 2e85771394a911c6b95f0686e3af8bb0aa73e96d (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
# Maintainer: envolution
# Contributor: pingplug < aur at pingplug dot me >
# Contributor: Martin Sandsmark <martin.sandsmark@kde.org>
# Contributor: AdriĆ  Arrufat <swiftscythe@gmail.com>
# Contributor: perlawk

pkgname=dlib-git
_pkgname=dlib
pkgver=19.24.6+r8289+g230c0b019
pkgrel=2
pkgdesc="Cross-platform C++ library using contract programming and modern C++ techniques"
arch=('x86_64')
url="http://dlib.net"
license=('BSL-1.0')
depends=('cblas'
         'lapack'
         'blas'
         'libjpeg-turbo'
         'libjxl'
         'libpng'
         'libwebp'
         'libx11')
optdepends=('ffmpeg: for FFmpeg support'
            'giflib: for GIF support'
            'sqlite: for sqlite support')
makedepends=('cmake' 'ninja')
source=(
  "${_pkgname}::git+https://github.com/davisking/dlib.git"
)
sha256sums=('SKIP')
pkgver(){
  cd "${_pkgname}"
  _version=$(git tag --sort=-v:refname --list | grep '^v[0-9.]*$' | head -n1 )
  _commits=$(git rev-list --count HEAD)
  _short_commit_hash=$(git rev-parse --short=9 HEAD)
  echo "${_version#'v'}+r${_commits}+g${_short_commit_hash}"
}

build() {
    #Test avx capabilities
    grep -q 'flags.*avx' /proc/cpuinfo && _AVX=ON || _AVX=OFF
    mkdir -p build && cd build
    cmake -GNinja \
        -DCMAKE_INSTALL_PREFIX:PATH=/usr \
        -DCMAKE_INSTALL_LIBDIR:PATH=/usr/lib \
        -DBUILD_SHARED_LIBS=ON \
        -DCMAKE_BUILD_TYPE=Release \
        -DUSE_AVX_INSTRUCTIONS=$_AVX \
        -DDLIB_USE_CUDA=OFF \
        "../${_pkgname}"
    ninja ${MAKEFLAGS:--j1}
}

package() {
    cd "build"
    DESTDIR=${pkgdir} ninja install
    install -Dm644 "../${_pkgname}/dlib/LICENSE.txt" "${pkgdir}/usr/share/licenses/${_pkgname}/LICENSE"
    # remove redundant external libraries
    rm -r "${pkgdir}/usr/include/dlib/external"
}