summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 7a70fee1d6c3c96a469958aab07a3b083229677e (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
# Maintainer: Jingbei Li <i@jingbei.li>
# Contributor: Lev Velykoivanenko <velykoivanenko dot lev at gmail dot com>
# Contributor: Flávio Zavan <flavio dot zavan at gmail dot com>
# Contributor: pingplug
# Contributor: perlawk
# Contributor: xsmile

_build_cpu=1
_build_cuda=1

pkgbase=python-dlib
[[ $_build_cpu -eq 1 ]] && pkgname+=('python-dlib')
[[ $_build_cuda -eq 1 ]] && pkgname+=('python-dlib-cuda')
_pkgname=dlib
pkgver=19.24.6
pkgrel=1
pkgdesc="Dlib is a general purpose cross-platform C++ library designed using contract programming and modern C++ techniques."
arch=('x86_64')
url="http://www.dlib.net/"
license=('Boost')
depends=('cblas' 'ffmpeg' 'giflib' 'lapack' 'libjpeg-turbo' 'libjxl' 'libpng' 'libx11')
makedepends=('boost' 'cmake' 'python-setuptools' 'sqlite')
[[ $_build_cuda -eq 1 ]] && makedepends+=('ccache-ext' 'cuda' 'cudnn')
optdepends=('sqlite')
#source=("$url/files/${_pkgname}-${pkgver}.tar.bz2")
#source=("https://pypi.io/packages/source/${_pkgname:0:1}/${_pkgname}/${_pkgname}-${pkgver}.tar.gz")
source=("https://github.com/davisking/dlib/archive/refs/tags/v${pkgver}.tar.gz")
sha256sums=('22513c353ec9c153300c394050c96ca9d088e02966ac0f639e989e50318c82d6')
[[ $_build_cuda -eq 1 ]] && options=(!lto)

prepare() {
	cd "$srcdir/"
	if [[ $_build_cuda -eq 1 ]]; then cp -a "${_pkgname}-${pkgver}" "${_pkgname}-${pkgver}-cuda"; fi
}

build_python-dlib(){
	cd "${srcdir}/${_pkgname}-${pkgver}"
	python setup.py build --no DLIB_USE_CUDA
}

build_python-dlib-cuda(){
	cd "${srcdir}/${_pkgname}-${pkgver}-cuda"
	python setup.py build \
		--set CUDA_HOST_COMPILER=/usr/bin/gcc-13 \
		--set CUDA_NVCC_EXECUTABLE=/usr/lib/ccache/bin/nvcc-ccache \
		--set CMAKE_C_COMPILER=/usr/bin/gcc-13 \
		--set CMAKE_CXX_COMPILER=/usr/bin/g++-13
}

build(){
	if [[ $_build_cpu -eq 1 ]]; then build_python-dlib; fi
	if [[ $_build_cuda -eq 1 ]]; then build_python-dlib-cuda; fi
}

package_python-dlib(){
	depends+=('python')
	cd "${srcdir}/${_pkgname}-${pkgver}"
	python setup.py install --skip-build --prefix=/usr --root="$pkgdir" --optimize=1
}

package_python-dlib-cuda(){
	depends+=('cuda' 'cudnn' 'python')
	provides=('python-dlib')
	conflicts=('python-dlib')
	cd "${srcdir}/${_pkgname}-${pkgver}-cuda"
	python setup.py install --skip-build --prefix=/usr --root="$pkgdir" --optimize=1
}