1 |
commit: 76bc068be542c46ac73264a306c78a1ac8142003 |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Oct 26 11:32:26 2020 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Oct 26 16:48:40 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=76bc068b |
7 |
|
8 |
llvm.org.eclass: Add manpage build/install utilities |
9 |
|
10 |
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> |
11 |
|
12 |
eclass/llvm.org.eclass | 47 +++++++++++++++++++++++++++++++++++++++++++++++ |
13 |
1 file changed, 47 insertions(+) |
14 |
|
15 |
diff --git a/eclass/llvm.org.eclass b/eclass/llvm.org.eclass |
16 |
index ec2c73c7276..c6f4d2a56c1 100644 |
17 |
--- a/eclass/llvm.org.eclass |
18 |
+++ b/eclass/llvm.org.eclass |
19 |
@@ -82,6 +82,13 @@ inherit multiprocessing |
20 |
# @DESCRIPTION: |
21 |
# List of additional components needed for tests. |
22 |
|
23 |
+# @ECLASS-VARIABLE: LLVM_MANPAGES |
24 |
+# @DEFAULT_UNSET |
25 |
+# @DESCRIPTION: |
26 |
+# Set to 'build', include the dependency on dev-python/sphinx to build |
27 |
+# the manpages. If set to 'pregenerated', fetch and install |
28 |
+# pregenerated manpages from the archive. |
29 |
+ |
30 |
|
31 |
# == global scope logic == |
32 |
|
33 |
@@ -118,6 +125,26 @@ llvm.org_set_globals() { |
34 |
RESTRICT+=" !test? ( test )" |
35 |
fi |
36 |
|
37 |
+ case ${LLVM_MANPAGES:-__unset__} in |
38 |
+ __unset__) |
39 |
+ # no manpage support |
40 |
+ ;; |
41 |
+ build) |
42 |
+ IUSE+=" doc" |
43 |
+ # NB: this is not always the correct dep but it does no harm |
44 |
+ BDEPEND+=" dev-python/sphinx" |
45 |
+ ;; |
46 |
+ pregenerated) |
47 |
+ IUSE+=" doc" |
48 |
+ SRC_URI+=" |
49 |
+ !doc? ( |
50 |
+ https://dev.gentoo.org/~mgorny/dist/llvm/llvm-${PV}-manpages.tar.bz2 |
51 |
+ )" |
52 |
+ ;; |
53 |
+ *) |
54 |
+ die "Invalid LLVM_MANPAGES=${LLVM_MANPAGES}" |
55 |
+ esac |
56 |
+ |
57 |
# === useful defaults for cmake-based packages === |
58 |
|
59 |
# least intrusive of all |
60 |
@@ -204,3 +231,23 @@ llvm.org_src_prepare() { |
61 |
get_lit_flags() { |
62 |
echo "-vv;-j;${LIT_JOBS:-$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)")}" |
63 |
} |
64 |
+ |
65 |
+# @FUNCTION: llvm_are_manpages_built |
66 |
+# @DESCRIPTION: |
67 |
+# Return true (0) if manpages are going to be built from source, |
68 |
+# false (1) if preinstalled manpages will be used. |
69 |
+llvm_are_manpages_built() { |
70 |
+ use doc || [[ ${LLVM_MANPAGES} == build ]] |
71 |
+} |
72 |
+ |
73 |
+# @FUNCTION: llvm_install_manpages |
74 |
+# @DESCRIPTION: |
75 |
+# Install pregenerated manpages if available. No-op otherwise. |
76 |
+llvm_install_manpages() { |
77 |
+ # install pre-generated manpages |
78 |
+ if ! llvm_are_manpages_built; then |
79 |
+ # (doman does not support custom paths) |
80 |
+ insinto "/usr/lib/llvm/${SLOT}/share/man/man1" |
81 |
+ doins "${WORKDIR}/llvm-${PV}-manpages/${LLVM_COMPONENTS[0]}"/*.1 |
82 |
+ fi |
83 |
+} |