@@ -0,0 +1,45 @@
1+{ stdenv, fetchurl, cmake, x11 }:
2+
3+stdenv.mkDerivation rec {
4+ version = "18.10";
5+ name = "dlib-${version}";
6+
7+ src = fetchurl {
8+ url = "mirror://sourceforge/dclib/dlib/${name}.tar.bz2";
9+ sha256 = "1g3v13azc29m5r7zqs3x0g731hny6spb66cxnra7f167z31ka3s7";
10+ };
11+
12+ # The supplied CMakeLists.txt does not have any install targets.
13+ sources_var = "\$\{sources\}";
14+ headers_var = "\$\{hearders\}";
15+ preConfigure = ''
16+ cat << EOF > CMakeLists.txt
17+ cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
18+ project(dlib)
19+
20+ include_directories(./)
21+
22+ file(GLOB sources ./dlib/all/*.cpp)
23+ file(GLOB headers ./dlib/*.h)
24+
25+ SET(LIBRARY_OUTPUT_PATH ".")
26+ add_library(dlib "SHARED" dlib/all/source.cpp ${sources_var} ${headers_var})
27+
28+ install(TARGETS dlib DESTINATION lib)
29+ install(DIRECTORY dlib/ DESTINATION include/dlib FILES_MATCHING PATTERN "*.h")
30+ EOF
31+ '';
32+
33+ enableParallelBuilding = true;
34+ buildInputs = [ cmake x11 ];
35+ propagatedBuildInputs = [ x11 ];
36+
37+ meta = with stdenv.lib; {
38+ description = "Dlib is a general purpose cross-platform C++ machine learning library.";
39+ homepage = http://www.dlib.net;
40+ license = stdenv.lib.licenses.boost;
41+ maintainers = with maintainers; [ christopherpoole ];
42+ platforms = stdenv.lib.platforms.all;
43+ };
44+}
45+