1{ stdenv, lib, fetchFromGitHub, cmake, pkgconfig, libpng, libjpeg
2, guiSupport ? false, libX11
3
4 # see http://dlib.net/compile.html
5, avxSupport ? true
6}:
7
8stdenv.mkDerivation rec {
9 version = "19.16";
10 name = "dlib-${version}";
11
12 src = fetchFromGitHub {
13 owner = "davisking";
14 repo = "dlib";
15 rev ="v${version}";
16 sha256 = "0ix52npsxfm6324jli7y0zkyijl5yirv2yzfncyd4sq0r9fcwb4p";
17 };
18
19 postPatch = ''
20 rm -rf dlib/external
21 '';
22
23 cmakeFlags = [ "-DUSE_AVX_INSTRUCTIONS=${if avxSupport then "yes" else "no"}" ];
24
25 enableParallelBuilding = true;
26 nativeBuildInputs = [ cmake pkgconfig ];
27 buildInputs = [ libpng libjpeg ] ++ lib.optional guiSupport libX11;
28
29 meta = with stdenv.lib; {
30 description = "A general purpose cross-platform C++ machine learning library";
31 homepage = http://www.dlib.net;
32 license = licenses.boost;
33 maintainers = with maintainers; [ christopherpoole ma27 ];
34 platforms = platforms.linux;
35 };
36}