blob: 97396d627809d77c34332dc25b3265664b49a5f5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit cmake
DESCRIPTION="Neural network model for language identification"
HOMEPAGE="https://github.com/google/cld3"
MY_PV="b48dc46512566f5a2d41118c8c1116c4f96dc661"
SRC_URI="https://github.com/google/cld3/archive/${MY_PV}.tar.gz -> ${P}.tar.gz"
S="${WORKDIR}/${PN}-${MY_PV}"
LICENSE="Apache-2.0"
SLOT="0/${PV}"
KEYWORDS="amd64 ~loong"
RDEPEND="
dev-cpp/abseil-cpp:=
dev-libs/protobuf:=
"
DEPEND="${RDEPEND}"
src_prepare() {
# None of the added compiler flags make sense or are future-proof
sed -e '/add_definitions(/d' \
-i CMakeLists.txt || die
# Specify the c++ standard through cmake's heurestics instead
cat >> CMakeLists.txt <<- 'EOF' || die
set(CMAKE_CXX_STANDARD 17)
EOF
# Link with the right libraries for the tests
cat >> CMakeLists.txt <<- 'EOF' || die
target_link_libraries(cld3
protobuf-lite
absl_log_internal_check_op
absl_log_internal_message
)
EOF
# Let cmake actually know about the tests
cat >> CMakeLists.txt <<- 'EOF' || die
include(CTest)
add_test(NAME language_identifier_main COMMAND language_identifier_main)
add_test(NAME getonescriptspan_test COMMAND getonescriptspan_test)
add_test(NAME language_identifier_features_test COMMAND language_identifier_features_test)
EOF
# Install the library
cat >> CMakeLists.txt <<- 'EOF' || die
include(GNUInstallDirs)
install(TARGETS cld3)
install(FILES
src/base.h
src/casts.h
src/embedding_feature_extractor.h
src/embedding_network.h
src/embedding_network_params.h
src/feature_extractor.h
src/feature_types.h
src/float16.h
src/lang_id_nn_params.h
src/language_identifier_features.h
src/nnet_language_identifier.h
src/registry.h
src/sentence_features.h
src/task_context.h
src/task_context_params.h
src/utils.h
src/workspace.h
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/cld3")
install(FILES
src/script_span/generated_ulscript.h
src/script_span/getonescriptspan.h
src/script_span/integral_types.h
src/script_span/offsetmap.h
src/script_span/stringpiece.h
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/cld3/script_span")
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/cld_3/protos/feature_extractor.pb.h"
"${CMAKE_CURRENT_BINARY_DIR}/cld_3/protos/sentence.pb.h"
"${CMAKE_CURRENT_BINARY_DIR}/cld_3/protos/task_spec.pb.h"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/cld3/cld_3/protos")
EOF
cmake_src_prepare
}
|