1 |
commit: 182a324f44e60684c6c72750ead69fb7149b3012 |
2 |
Author: Ionen Wolkens <sudinave <AT> gmail <DOT> com> |
3 |
AuthorDate: Sat May 29 07:38:30 2021 +0000 |
4 |
Commit: Piotr Karbowski <slashbeast <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon May 31 19:30:38 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=182a324f |
7 |
|
8 |
dev-libs/ncnn: add 20210525 |
9 |
|
10 |
ebuild updates: |
11 |
- respect $(get_libdir) |
12 |
- build shared library over static (this new version also exports |
13 |
additional symbols needed by waifu2x-ncnn-vulkan for shared linking) |
14 |
- install more docs |
15 |
- add IUSE for tools and vulkan |
16 |
- add ZLIB license for *_mathfun.h |
17 |
- add temporary workaround for bug 730468 |
18 |
- scrubbed previous patch and added upstream issue link (still needed) |
19 |
|
20 |
Closes: https://bugs.gentoo.org/730468 |
21 |
Signed-off-by: Ionen Wolkens <sudinave <AT> gmail.com> |
22 |
Signed-off-by: Piotr Karbowski <slashbeast <AT> gentoo.org> |
23 |
|
24 |
dev-libs/ncnn/Manifest | 1 + |
25 |
dev-libs/ncnn/files/ncnn-fix-glslang-include.patch | 10 +-- |
26 |
dev-libs/ncnn/metadata.xml | 4 ++ |
27 |
dev-libs/ncnn/ncnn-20210525.ebuild | 76 ++++++++++++++++++++++ |
28 |
4 files changed, 84 insertions(+), 7 deletions(-) |
29 |
|
30 |
diff --git a/dev-libs/ncnn/Manifest b/dev-libs/ncnn/Manifest |
31 |
index e72cd830e5e..6bb71095c01 100644 |
32 |
--- a/dev-libs/ncnn/Manifest |
33 |
+++ b/dev-libs/ncnn/Manifest |
34 |
@@ -2,3 +2,4 @@ DIST ncnn-20200226.tar.gz 10363010 BLAKE2B 3f5e22ecffc7d36d7babb8c316eb95785f60b |
35 |
DIST ncnn-20200413.tar.gz 10520160 BLAKE2B 10fc59f3a09d1a6b21a6c73b87dabd450279d2c30923b15266461360c6a63b7cc58f91e33c6563752161de3ca067098ed4f2d22963410fe3f72a8affbd39172e SHA512 3f3610f94cbfa6072347857675865b3b21e4cb330a3b889214e7e8cf6e7a558451979ee4ba727c28fc5919a38b27d3b0288dfbd1bfa06d92d3677b4035b019fd |
36 |
DIST ncnn-20200727.tar.gz 10989866 BLAKE2B 27ec105d4ea24b1bcccfb64074f47332515112b7fed7b6f833c6d3fd846542f14248254d076e3d1e63eb16cedb51d16dd156890ca805f4160d7e6ceb3de1b46a SHA512 122653ee4fcf6e45665154ff6014eb3291d48174ec153b27ccb9013bd705a81e664e4c4ad94df5cb3ea661891115929562db45c7c714747fb6f7673b09a16b68 |
37 |
DIST ncnn-20210322.tar.gz 11339362 BLAKE2B 26848f8c6598c98e10e62717bf4aa86f803b425848bdeebd7dacd752f57174e4c3a7fe56d309cafa150be7cb80176fbd8f487c9fe79bc957e29157b1781fe849 SHA512 78862bdbba3ae4127d856f514ea37903098e8a9e827ccbdc85faa498d8a343b4c404465b7f55d368f2ea867063340f33facf286c2bad6a0587b903ba8bbf2394 |
38 |
+DIST ncnn-20210525.tar.gz 11578821 BLAKE2B 1b6dc67cb89e4761c6de256c8854c3969c553159c11713d9bbbe04abd027e9439ffb694e8129da4d965807d1ec326d643c71c00ee1f032dbf4c2271c2699ceb2 SHA512 5d919b6830f5a75c751d64476f5bf2b9b71ced1cee29e4156c4f01a9d7d8833dfdf8420747c55979c5b39b29fd63b5bf4bc3d27b756a617ef39f4e2ce4da2f93 |
39 |
|
40 |
diff --git a/dev-libs/ncnn/files/ncnn-fix-glslang-include.patch b/dev-libs/ncnn/files/ncnn-fix-glslang-include.patch |
41 |
index bd96a79e175..00eb01f03fc 100644 |
42 |
--- a/dev-libs/ncnn/files/ncnn-fix-glslang-include.patch |
43 |
+++ b/dev-libs/ncnn/files/ncnn-fix-glslang-include.patch |
44 |
@@ -1,13 +1,9 @@ |
45 |
-diff --git a/src/gpu.cpp b/src/gpu.cpp |
46 |
-index ce1306c..468cd03 100644 |
47 |
+Needed to use system's glslang rather than bundled. |
48 |
+https://github.com/Tencent/ncnn/issues/2622 |
49 |
--- a/src/gpu.cpp |
50 |
+++ b/src/gpu.cpp |
51 |
-@@ -21,7 +21,7 @@ |
52 |
- #include <vulkan/vulkan.h> |
53 |
- |
54 |
+@@ -23,3 +23,3 @@ |
55 |
#include "glslang/SPIRV/GlslangToSpv.h" |
56 |
-#include "glslang/glslang/Public/ShaderLang.h" |
57 |
+#include "glslang/Public/ShaderLang.h" |
58 |
|
59 |
- #include "command.h" |
60 |
- #include "layer.h" |
61 |
|
62 |
diff --git a/dev-libs/ncnn/metadata.xml b/dev-libs/ncnn/metadata.xml |
63 |
index 5f85797b979..93b23a68d96 100644 |
64 |
--- a/dev-libs/ncnn/metadata.xml |
65 |
+++ b/dev-libs/ncnn/metadata.xml |
66 |
@@ -9,6 +9,10 @@ |
67 |
<email>sudinave@×××××.com</email> |
68 |
<name>Ionen Wolkens</name> |
69 |
</maintainer> |
70 |
+ <use> |
71 |
+ <flag name="tools">Enable installation of various tools in addition to the library</flag> |
72 |
+ <flag name="vulkan">Enable vulkan compute support</flag> |
73 |
+ </use> |
74 |
<upstream> |
75 |
<remote-id type="github">Tencent/ncnn</remote-id> |
76 |
</upstream> |
77 |
|
78 |
diff --git a/dev-libs/ncnn/ncnn-20210525.ebuild b/dev-libs/ncnn/ncnn-20210525.ebuild |
79 |
new file mode 100644 |
80 |
index 00000000000..efac9e4e581 |
81 |
--- /dev/null |
82 |
+++ b/dev-libs/ncnn/ncnn-20210525.ebuild |
83 |
@@ -0,0 +1,76 @@ |
84 |
+# Copyright 1999-2021 Gentoo Authors |
85 |
+# Distributed under the terms of the GNU General Public License v2 |
86 |
+ |
87 |
+EAPI=7 |
88 |
+ |
89 |
+inherit cmake |
90 |
+ |
91 |
+DESCRIPTION="High-performance neural network inference framework" |
92 |
+HOMEPAGE="https://github.com/Tencent/ncnn" |
93 |
+SRC_URI="https://github.com/Tencent/ncnn/archive/${PV}.tar.gz -> ${P}.tar.gz" |
94 |
+ |
95 |
+LICENSE="BSD ZLIB" |
96 |
+SLOT="0" |
97 |
+KEYWORDS="~amd64 ~x86" |
98 |
+IUSE="tools +vulkan" |
99 |
+ |
100 |
+# Need the static library to run tests: |
101 |
+# -DNCNN_BUILD_TESTS=ON, -DNCNN_SHARED_LIB=OFF, USE=-vulkan (skip GPU) |
102 |
+RESTRICT="test" |
103 |
+ |
104 |
+RDEPEND=" |
105 |
+ dev-util/glslang |
106 |
+ tools? ( dev-libs/protobuf:= ) |
107 |
+ vulkan? ( media-libs/vulkan-loader )" |
108 |
+DEPEND=" |
109 |
+ ${RDEPEND} |
110 |
+ vulkan? ( dev-util/vulkan-headers )" |
111 |
+ |
112 |
+PATCHES=( |
113 |
+ "${FILESDIR}"/${PN}-fix-glslang-include.patch |
114 |
+) |
115 |
+DOCS=( README.md docs/. ) |
116 |
+ |
117 |
+src_prepare() { |
118 |
+ cmake_src_prepare |
119 |
+ |
120 |
+ sed -i "/DESTINATION/s| lib| $(get_libdir)|" src/CMakeLists.txt || die |
121 |
+ |
122 |
+ # Workaround build issues on AVX without AVX2 (bug #730468) |
123 |
+ # This can be removed if CXXFLAGS="-mavx -mno-avx2" builds after a bump. |
124 |
+ find src -type f -exec sed -i s/__AVX__/__AVX2__/g {} + || die |
125 |
+} |
126 |
+ |
127 |
+src_configure() { |
128 |
+ local mycmakeargs=( |
129 |
+ -DCMAKE_SKIP_RPATH=ON # for tools |
130 |
+ -DGLSLANG_TARGET_DIR="${ESYSROOT}"/usr/$(get_libdir)/cmake |
131 |
+ -DNCNN_BUILD_EXAMPLES=OFF |
132 |
+ -DNCNN_BUILD_TOOLS=$(usex tools) |
133 |
+ -DNCNN_PYTHON=OFF # missing portalocker, and nothing needs this for now |
134 |
+ -DNCNN_SHARED_LIB=ON |
135 |
+ -DNCNN_SYSTEM_GLSLANG=ON |
136 |
+ -DNCNN_VERSION=${PV} # avoids libncnn.so.*.%Y%m%d (build date) |
137 |
+ -DNCNN_VULKAN=$(usex vulkan) |
138 |
+ ) |
139 |
+ |
140 |
+ cmake_src_configure |
141 |
+} |
142 |
+ |
143 |
+src_install() { |
144 |
+ cmake_src_install |
145 |
+ |
146 |
+ if use tools; then |
147 |
+ local tools=( |
148 |
+ caffe/caffe2ncnn |
149 |
+ darknet/darknet2ncnn |
150 |
+ mxnet/mxnet2ncnn |
151 |
+ ncnn2mem |
152 |
+ ncnnmerge |
153 |
+ ncnnoptimize |
154 |
+ onnx/onnx2ncnn |
155 |
+ quantize/{ncnn2int8,ncnn2table} |
156 |
+ ) |
157 |
+ dobin "${tools[@]/#/${BUILD_DIR}/tools/}" |
158 |
+ fi |
159 |
+} |