commit: 182a324f44e60684c6c72750ead69fb7149b3012 Author: Ionen Wolkens <sudinave <AT> gmail <DOT> com> AuthorDate: Sat May 29 07:38:30 2021 +0000 Commit: Piotr Karbowski <slashbeast <AT> gentoo <DOT> org> CommitDate: Mon May 31 19:30:38 2021 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=182a324f
dev-libs/ncnn: add 20210525 ebuild updates: - respect $(get_libdir) - build shared library over static (this new version also exports additional symbols needed by waifu2x-ncnn-vulkan for shared linking) - install more docs - add IUSE for tools and vulkan - add ZLIB license for *_mathfun.h - add temporary workaround for bug 730468 - scrubbed previous patch and added upstream issue link (still needed) Closes: https://bugs.gentoo.org/730468 Signed-off-by: Ionen Wolkens <sudinave <AT> gmail.com> Signed-off-by: Piotr Karbowski <slashbeast <AT> gentoo.org> dev-libs/ncnn/Manifest | 1 + dev-libs/ncnn/files/ncnn-fix-glslang-include.patch | 10 +-- dev-libs/ncnn/metadata.xml | 4 ++ dev-libs/ncnn/ncnn-20210525.ebuild | 76 ++++++++++++++++++++++ 4 files changed, 84 insertions(+), 7 deletions(-) diff --git a/dev-libs/ncnn/Manifest b/dev-libs/ncnn/Manifest index e72cd830e5e..6bb71095c01 100644 --- a/dev-libs/ncnn/Manifest +++ b/dev-libs/ncnn/Manifest @@ -2,3 +2,4 @@ DIST ncnn-20200226.tar.gz 10363010 BLAKE2B 3f5e22ecffc7d36d7babb8c316eb95785f60b DIST ncnn-20200413.tar.gz 10520160 BLAKE2B 10fc59f3a09d1a6b21a6c73b87dabd450279d2c30923b15266461360c6a63b7cc58f91e33c6563752161de3ca067098ed4f2d22963410fe3f72a8affbd39172e SHA512 3f3610f94cbfa6072347857675865b3b21e4cb330a3b889214e7e8cf6e7a558451979ee4ba727c28fc5919a38b27d3b0288dfbd1bfa06d92d3677b4035b019fd DIST ncnn-20200727.tar.gz 10989866 BLAKE2B 27ec105d4ea24b1bcccfb64074f47332515112b7fed7b6f833c6d3fd846542f14248254d076e3d1e63eb16cedb51d16dd156890ca805f4160d7e6ceb3de1b46a SHA512 122653ee4fcf6e45665154ff6014eb3291d48174ec153b27ccb9013bd705a81e664e4c4ad94df5cb3ea661891115929562db45c7c714747fb6f7673b09a16b68 DIST ncnn-20210322.tar.gz 11339362 BLAKE2B 26848f8c6598c98e10e62717bf4aa86f803b425848bdeebd7dacd752f57174e4c3a7fe56d309cafa150be7cb80176fbd8f487c9fe79bc957e29157b1781fe849 SHA512 78862bdbba3ae4127d856f514ea37903098e8a9e827ccbdc85faa498d8a343b4c404465b7f55d368f2ea867063340f33facf286c2bad6a0587b903ba8bbf2394 +DIST ncnn-20210525.tar.gz 11578821 BLAKE2B 1b6dc67cb89e4761c6de256c8854c3969c553159c11713d9bbbe04abd027e9439ffb694e8129da4d965807d1ec326d643c71c00ee1f032dbf4c2271c2699ceb2 SHA512 5d919b6830f5a75c751d64476f5bf2b9b71ced1cee29e4156c4f01a9d7d8833dfdf8420747c55979c5b39b29fd63b5bf4bc3d27b756a617ef39f4e2ce4da2f93 diff --git a/dev-libs/ncnn/files/ncnn-fix-glslang-include.patch b/dev-libs/ncnn/files/ncnn-fix-glslang-include.patch index bd96a79e175..00eb01f03fc 100644 --- a/dev-libs/ncnn/files/ncnn-fix-glslang-include.patch +++ b/dev-libs/ncnn/files/ncnn-fix-glslang-include.patch @@ -1,13 +1,9 @@ -diff --git a/src/gpu.cpp b/src/gpu.cpp -index ce1306c..468cd03 100644 +Needed to use system's glslang rather than bundled. +https://github.com/Tencent/ncnn/issues/2622 --- a/src/gpu.cpp +++ b/src/gpu.cpp -@@ -21,7 +21,7 @@ - #include <vulkan/vulkan.h> - +@@ -23,3 +23,3 @@ #include "glslang/SPIRV/GlslangToSpv.h" -#include "glslang/glslang/Public/ShaderLang.h" +#include "glslang/Public/ShaderLang.h" - #include "command.h" - #include "layer.h" diff --git a/dev-libs/ncnn/metadata.xml b/dev-libs/ncnn/metadata.xml index 5f85797b979..93b23a68d96 100644 --- a/dev-libs/ncnn/metadata.xml +++ b/dev-libs/ncnn/metadata.xml @@ -9,6 +9,10 @@ <email>sudin...@gmail.com</email> <name>Ionen Wolkens</name> </maintainer> + <use> + <flag name="tools">Enable installation of various tools in addition to the library</flag> + <flag name="vulkan">Enable vulkan compute support</flag> + </use> <upstream> <remote-id type="github">Tencent/ncnn</remote-id> </upstream> diff --git a/dev-libs/ncnn/ncnn-20210525.ebuild b/dev-libs/ncnn/ncnn-20210525.ebuild new file mode 100644 index 00000000000..efac9e4e581 --- /dev/null +++ b/dev-libs/ncnn/ncnn-20210525.ebuild @@ -0,0 +1,76 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit cmake + +DESCRIPTION="High-performance neural network inference framework" +HOMEPAGE="https://github.com/Tencent/ncnn" +SRC_URI="https://github.com/Tencent/ncnn/archive/${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="BSD ZLIB" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="tools +vulkan" + +# Need the static library to run tests: +# -DNCNN_BUILD_TESTS=ON, -DNCNN_SHARED_LIB=OFF, USE=-vulkan (skip GPU) +RESTRICT="test" + +RDEPEND=" + dev-util/glslang + tools? ( dev-libs/protobuf:= ) + vulkan? ( media-libs/vulkan-loader )" +DEPEND=" + ${RDEPEND} + vulkan? ( dev-util/vulkan-headers )" + +PATCHES=( + "${FILESDIR}"/${PN}-fix-glslang-include.patch +) +DOCS=( README.md docs/. ) + +src_prepare() { + cmake_src_prepare + + sed -i "/DESTINATION/s| lib| $(get_libdir)|" src/CMakeLists.txt || die + + # Workaround build issues on AVX without AVX2 (bug #730468) + # This can be removed if CXXFLAGS="-mavx -mno-avx2" builds after a bump. + find src -type f -exec sed -i s/__AVX__/__AVX2__/g {} + || die +} + +src_configure() { + local mycmakeargs=( + -DCMAKE_SKIP_RPATH=ON # for tools + -DGLSLANG_TARGET_DIR="${ESYSROOT}"/usr/$(get_libdir)/cmake + -DNCNN_BUILD_EXAMPLES=OFF + -DNCNN_BUILD_TOOLS=$(usex tools) + -DNCNN_PYTHON=OFF # missing portalocker, and nothing needs this for now + -DNCNN_SHARED_LIB=ON + -DNCNN_SYSTEM_GLSLANG=ON + -DNCNN_VERSION=${PV} # avoids libncnn.so.*.%Y%m%d (build date) + -DNCNN_VULKAN=$(usex vulkan) + ) + + cmake_src_configure +} + +src_install() { + cmake_src_install + + if use tools; then + local tools=( + caffe/caffe2ncnn + darknet/darknet2ncnn + mxnet/mxnet2ncnn + ncnn2mem + ncnnmerge + ncnnoptimize + onnx/onnx2ncnn + quantize/{ncnn2int8,ncnn2table} + ) + dobin "${tools[@]/#/${BUILD_DIR}/tools/}" + fi +}