diff --git a/srcpkgs/dlib/patches/pybind11cmake.patch b/srcpkgs/dlib/patches/pybind11cmake.patch new file mode 100644 index 00000000000..b8d58a55776 --- /dev/null +++ b/srcpkgs/dlib/patches/pybind11cmake.patch @@ -0,0 +1,23 @@ +--- a/dlib/CMakeLists.txt ++++ b/dlib/CMakeLists.txt +@@ -49,6 +49,7 @@ + endif() + endif() + ++find_package(pybind11 REQUIRED) + + if (COMMAND pybind11_add_module AND MSVC) + # True when building a python extension module using Visual Studio. We care +--- a/tools/python/CMakeLists.txt ++++ b/tools/python/CMakeLists.txt +@@ -35,7 +35,8 @@ + include(${CMAKE_CURRENT_LIST_DIR}/../../dlib/cmake_utils/tell_visual_studio_to_use_static_runtime.cmake) + endif() + +-add_subdirectory(../../dlib/external/pybind11 pybind11_build) ++#add_subdirectory(../../dlib/external/pybind11 pybind11_build) ++find_package(pybind11 REQUIRED) + add_subdirectory(../../dlib dlib_build) + + add_definitions(-DDLIB_VERSION=${DLIB_VERSION}) + diff --git a/srcpkgs/dlib/template b/srcpkgs/dlib/template index bd85c15d64b..ba06f1ddadc 100644 --- a/srcpkgs/dlib/template +++ b/srcpkgs/dlib/template @@ -1,27 +1,59 @@ # Template file for 'dlib' pkgname=dlib -version=19.20 +version=19.24.6 revision=1 build_style=cmake +# arm6/7 need helper +build_helper=python3 configure_args="-DBUILD_SHARED_LIBS=ON" -makedepends="libjpeg-turbo-devel libpng-devel zlib-devel - $(vopt_if openblas openblas-devel) $(vopt_if x11 libX11-devel)" +hostmakedepends="pkg-config python3-devel python3-setuptools python3-distutils-extra + python3-packaging-bootstrap" +makedepends="libjpeg-turbo-devel libpng-devel zlib-devel ffmpeg6-devel cblas-devel + $(vopt_if openblas openblas-devel) $(vopt_if x11 libX11-devel) python3-pybind11 python3" short_desc="Modern C++ toolkit containing machine learning algorithms and tools" maintainer="Felix Hanley " license="BSL-1.0" homepage="http://dlib.net" -distfiles="https://github.com/davisking/${pkgname}/archive/v${version}.tar.gz" -checksum=fc3f0986350e8e53aceadf95a71d2f413f1eedc469abda99a462cb528741d411 +distfiles="https://github.com/davisking/dlib/archive/v${version}.tar.gz" +checksum=22513c353ec9c153300c394050c96ca9d088e02966ac0f639e989e50318c82d6 build_options="openblas x11" desc_option_x11="Enable X11 for GUI components" build_options_default="openblas x11" +case "$XBPS_TARGET_MACHINE" in + arm*) + configure_args+=" -DPYBIND11_FINDPYTHON=ON" + cmake_args+=" -DPYBIND11_USE_CROSSCOMPILING=ON" + ;; +esac + post_extract() { # don't prefer bundled libs rm -rf ./dlib/external } +post_build() { + if [[ "$XBPS_TARGET_MACHINE" == arm* ]]; then + inc="include($(pwd)/$(find -name 'cross_*cmake'))" + sed -i "1i$inc" tools/python/CMakeLists.txt + fi + python3 setup.py build --set DPYBIND11_FINDPYTHON=ON --set PYBIND11_USE_CROSSCOMPILING=ON \ + --no DLIB_USE_CUDA ${make_build_args} +} + +post_install() { + python setup.py install --skip-build --prefix=/usr --root="${DESTDIR}" --optimize=1 --compiler-flags +} + +python3-dlib_package() { + depends="${sourcepkg}>=${version}_${revision}" + short_desc+=" - python3" + pkg_install() { + vmove "usr/lib/python*" + } +} + dlib-devel_package() { depends="${sourcepkg}>=${version}_${revision}" short_desc+=" - development files" diff --git a/srcpkgs/python3-dlib b/srcpkgs/python3-dlib new file mode 120000 index 00000000000..9076da8e02e --- /dev/null +++ b/srcpkgs/python3-dlib @@ -0,0 +1 @@ +dlib \ No newline at end of file