blob: e8c5a944ed6dc86cfb88fec8621d5086101ff267 (
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
|
# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{10..14} )
DISTUTILS_USE_PEP517=setuptools
DISTUTILS_EXT=1
DISTUTILS_OPTIONAL=1
inherit cmake cuda distutils-r1
DESCRIPTION="Numerical and networking C++ library"
HOMEPAGE="https://dlib.net/"
SRC_URI="
https://github.com/davisking/dlib/archive/v${PV}.tar.gz -> ${P}.tar.gz
https://github.com/davisking/dlib/commit/e529d2a1f11ff9dac86251e21a0c90d4a58721e0.patch
-> ${P}-docs-c++14.patch
https://github.com/davisking/dlib/commit/a078e810f7e653daa4172b2ed19d8f0e22e26b6f.patch
-> ${P}-pessimizing-move.patch
https://github.com/davisking/dlib/commit/79e2d1373add8d9e265d6a16c4952f5273600e97.patch
-> ${P}-fix-YOLO-loss-gradient.patch
https://github.com/davisking/dlib/commit/d0f41798be7a64cb15f94611d960475cf3097b0c.patch
-> ${P}-matlab-ut-library.patch
https://github.com/davisking/dlib/commit/3cb1f350021b5d64771d05678672e887000062ce.patch
-> ${P}-large-image-load.patch
https://github.com/davisking/dlib/commit/131e46e4c5fb75a89a3c6ad89f6dccc7ed38473c.patch
-> ${P}-throw-noexcept.patch
https://github.com/davisking/dlib/commit/043bed89bd5e922446b0705e5c42ece51940b075.patch
-> ${P}-python-3.14-numpy-fix.patch
https://github.com/davisking/dlib/commit/e93a0ef1d81b3747b84d89f65bdd52974cac71b9.patch
-> ${P}-c++23-update.patch
https://github.com/davisking/dlib/commit/56b806d1d389ea016c845a4da546ab082c4ff7a0.patch
-> ${P}-regular-tools.patch
https://github.com/davisking/dlib/commit/4cf8f5759fe715b0defb0ba998ac1c354b814cca.patch
-> ${P}-newer-python-tools.patch
https://github.com/davisking/dlib/commit/fb0865ba8c7f04ee1f8fea3fe3d04870bda3ea08.patch
-> ${P}-Wcast-user-defined.patch
https://github.com/davisking/dlib/commit/0d2153abd0da7f9bba8104ba8c732a985d821461.patch
-> ${P}-enable-FFMpeg-7.1-API.patch
https://github.com/davisking/dlib/commit/ffe78814638d100cbd12e116990afb1903b82b5e.patch
-> ${P}-unicode.patch
https://github.com/davisking/dlib/commit/5ce4891406d32d8b49ee44253bd1bd1f1ca34c54.patch
-> ${P}-FindCUDAToolkit.patch
https://github.com/davisking/dlib/commit/35a8e1fa3fa1bd1689119f437bd2e3a27d548332.patch
-> ${P}-test_loss_multibinary_log.patch
"
LICENSE="Boost-1.0"
SLOT="0/${PV}"
KEYWORDS="~amd64 ~x86"
IUSE="cblas cuda debug examples ffmpeg gif jpeg lapack mkl png python sqlite test webp X cpu_flags_x86_avx cpu_flags_x86_sse2 cpu_flags_x86_sse4_1"
REQUIRED_USE="python? ( png ${PYTHON_REQUIRED_USE} )"
RESTRICT="!test? ( test )"
# doc needs a bunch of deps not in portage
RDEPEND="
cblas? ( virtual/cblas )
cuda? ( dev-libs/cudnn:= )
ffmpeg? ( media-video/ffmpeg:=[X?] )
gif? ( media-libs/giflib:= )
jpeg? ( media-libs/libjpeg-turbo:0= )
lapack? ( virtual/lapack )
mkl? ( sci-libs/mkl )
png? ( media-libs/libpng:0= )
python? ( ${PYTHON_DEPS} )
sqlite? ( dev-db/sqlite:3 )
webp? ( media-libs/libwebp:= )
X? ( x11-libs/libX11 )"
DEPEND="${RDEPEND}"
BDEPEND="
python? (
${DISTUTILS_DEPS}
test? (
dev-python/pytest[${PYTHON_USEDEP}]
dev-python/pip[${PYTHON_USEDEP}]
)
)
"
DOCS=( docs/README.txt )
PATCHES=(
# Do not treat warnings as errors
"${FILESDIR}/${PN}-19.24.8-disable-upstream-flags.patch"
# Docs: dlib requires c++14 (#3079)
"${DISTDIR}/${P}-docs-c++14.patch"
# Remove std::move where clang warns of pessimizing-
# move (#3080)
"${DISTDIR}/${P}-pessimizing-move.patch"
# Fix: Correct YOLO loss gradient for x,y coordinates (#3088)
"${DISTDIR}/${P}-fix-YOLO-loss-gradient.patch"
# Fix the miss of including matlab ut library (#3089)
"${DISTDIR}/${P}-matlab-ut-library.patch"
# Fix large images (40792x20480 RGBA PNG for ex.)
# read (#3091)
"${DISTDIR}/${P}-large-image-load.patch"
# throw() -> noexcept (#3092)
"${DISTDIR}/${P}-throw-noexcept.patch"
# Account for change in ref count in Python 3.14+ (#3098)
"${DISTDIR}/${P}-python-3.14-numpy-fix.patch"
# std::aligned_storage_t is deprecated in c++23 (#3100)
"${DISTDIR}/${P}-c++23-update.patch"
# Fix up build errors with the regular makefile
# and non-cmake builds
"${DISTDIR}/${P}-regular-tools.patch"
# Update python packaging to work with newer
# toolchains (#3102)
"${DISTDIR}/${P}-newer-python-tools.patch"
# Fix -Wcast-user-defined (#3103)
"${DISTDIR}/${P}-Wcast-user-defined.patch"
# FFMpeg 7.1 API (#3105)
"${DISTDIR}/${P}-enable-FFMpeg-7.1-API.patch"
# Fixed warning in convert_mbstring_to_wstring() (#3110)
"${DISTDIR}/${P}-unicode.patch"
# Replace FindCUDA with FindCUDAToolkit (fix #2833) (#3090)
"${DISTDIR}/${P}-FindCUDAToolkit.patch"
# Improve the somewhat flaky test_loss_multibinary_log
# by avoiding samples very close to class boundaries (#3112)
"${DISTDIR}/${P}-test_loss_multibinary_log.patch"
)
src_prepare() {
# CUDA
use cuda && cuda_src_prepare
# CMake
cmake_src_prepare
# Python
use python && distutils-r1_src_prepare
}
src_configure() {
local mycmakeargs=(
-DDLIB_ENABLE_ASSERTS=$(usex debug)
-DDLIB_ENABLE_STACK_TRACE=$(usex debug)
-DDLIB_USE_FFMPEG=$(usex ffmpeg)
-DDLIB_GIF_SUPPORT=$(usex gif)
-DDLIB_JPEG_SUPPORT=$(usex jpeg)
-DDLIB_PNG_SUPPORT=$(usex png)
-DDLIB_LINK_WITH_SQLITE3=$(usex sqlite)
-DDLIB_NO_GUI_SUPPORT=$(usex X OFF ON)
-DDLIB_USE_BLAS=$(usex cblas)
-DDLIB_USE_CUDA=$(usex cuda)
-DDLIB_USE_LAPACK=$(usex lapack)
-DDLIB_WEBP_SUPPORT=$(usex webp)
-DUSE_AVX_INSTRUCTIONS=$(usex cpu_flags_x86_avx)
-DUSE_SSE2_INSTRUCTIONS=$(usex cpu_flags_x86_sse2)
-DUSE_SSE4_INSTRUCTIONS=$(usex cpu_flags_x86_sse4_1)
)
cmake_src_configure
use python && distutils-r1_src_configure
}
src_compile() {
cmake_src_compile
use python && distutils-r1_src_compile
}
src_test() {
(
local BUILD_DIR="${BUILD_DIR}"/dlib/test
mkdir -p "${BUILD_DIR}" || die
cd "${BUILD_DIR}" >/dev/null || die
local CMAKE_USE_DIR="${S}"/dlib/test
cmake_src_configure
cmake_build
./dtest --runall || die "Tests failed"
)
use python && distutils-r1_src_test
}
python_test() {
epytest
}
src_install() {
cmake_src_install
use python && distutils-r1_src_install
if use examples; then
dodoc -r examples
docompress -x /usr/share/doc/${PF}
fi
}
|