From 6c26e8ae5feb17e9506868fc24980a6ceca3bab3 Mon Sep 17 00:00:00 2001 From: zlice Date: Fri, 1 Nov 2024 08:05:23 -0400 Subject: [PATCH] dlib: update to 19.24.6 --- srcpkgs/dlib/patches/pybind11cmake.patch | 23 ++++++++++++++ srcpkgs/dlib/template | 40 +++++++++++++++++++++--- srcpkgs/python3-dlib | 1 + 3 files changed, 60 insertions(+), 4 deletions(-) create mode 100644 srcpkgs/dlib/patches/pybind11cmake.patch create mode 120000 srcpkgs/python3-dlib diff --git a/srcpkgs/dlib/patches/pybind11cmake.patch b/srcpkgs/dlib/patches/pybind11cmake.patch new file mode 100644 index 00000000000000..b8d58a557762f9 --- /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 bd85c15d64b77c..565e0f57b9aea2 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 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" +makedepends="libjpeg-turbo-devel libpng-devel zlib-devel ffmpeg6-devel cblas-devel + $(vopt_if openblas openblas-devel) $(vopt_if x11 libX11-devel) python3-pybind11" 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 +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";; + 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 + # extracted from 'python setup.py build --no DLIB_USE_CUDA' failures to cross compile + CFALGS=${CFLAGS} CXXFLAGS=${CXX_FLAGS} cmake /builddir/dlib-19.24.6/tools/python \ + -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/builddir/dlib-19.24.6/build/lib.linux-x86_64-cpython-312 \ + -DPYTHON_EXECUTABLE=/usr/bin/python -DDLIB_USE_FFMPEG=OFF -DDLIB_USE_CUDA=no ${cmake_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 00000000000000..9076da8e02e809 --- /dev/null +++ b/srcpkgs/python3-dlib @@ -0,0 +1 @@ +dlib \ No newline at end of file