1 |
commit: 230b73a28e5f00a504768182f4ba01b9bc507bd7 |
2 |
Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Sep 8 16:13:24 2019 +0000 |
4 |
Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Dec 24 20:41:54 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=230b73a2 |
7 |
|
8 |
kde5.eclass: Add fallbacks in case of KDE_AUTODEPS=false |
9 |
|
10 |
ECM_KDEINSTALLDIRS, KDE_DEBUG, KDE_TEST were found to be in use even |
11 |
with KDE_AUTODEPS disabled. |
12 |
|
13 |
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org> |
14 |
|
15 |
eclass/kde5.eclass | 109 +++++++++++++++++++++++++++++++++++++++++++++++++++-- |
16 |
1 file changed, 106 insertions(+), 3 deletions(-) |
17 |
|
18 |
diff --git a/eclass/kde5.eclass b/eclass/kde5.eclass |
19 |
index 91435167ac3..538c2479384 100644 |
20 |
--- a/eclass/kde5.eclass |
21 |
+++ b/eclass/kde5.eclass |
22 |
@@ -33,7 +33,7 @@ if [[ -z ${KDE_ORG_NAME} ]]; then |
23 |
KDE_ORG_NAME=${KMNAME:=$PN} |
24 |
fi |
25 |
|
26 |
-inherit kde.org kde5-functions xdg |
27 |
+inherit flag-o-matic kde.org kde5-functions xdg |
28 |
|
29 |
# @ECLASS-VARIABLE: KDE_AUTODEPS |
30 |
# @DESCRIPTION: |
31 |
@@ -156,6 +156,27 @@ esac |
32 |
case ${KDE_AUTODEPS} in |
33 |
false) |
34 |
inherit cmake-utils |
35 |
+ # @ECLASS-VARIABLE: ECM_KDEINSTALLDIRS |
36 |
+ # @DESCRIPTION: |
37 |
+ # If set to "false", do nothing. |
38 |
+ # For any other value, assume the package is using KDEInstallDirs macro and switch |
39 |
+ # KDE_INSTALL_USE_QT_SYS_PATHS to ON. |
40 |
+ : ${ECM_KDEINSTALLDIRS:=true} |
41 |
+ |
42 |
+ case ${KDE_DEBUG} in |
43 |
+ false) ;; |
44 |
+ *) |
45 |
+ IUSE+=" debug" |
46 |
+ ;; |
47 |
+ esac |
48 |
+ |
49 |
+ case ${KDE_TEST} in |
50 |
+ false) ;; |
51 |
+ *) |
52 |
+ IUSE+=" test" |
53 |
+ DEPEND+=" test? ( dev-qt/qttest:5 )" |
54 |
+ ;; |
55 |
+ esac |
56 |
;; |
57 |
*) |
58 |
# all packages need breeze/oxygen icons for basic iconset, bug #564838 |
59 |
@@ -174,12 +195,47 @@ case ${KDE_AUTODEPS} in |
60 |
[[ -z ${ECM_PO_DIRS} ]] && ECM_PO_DIRS=${KDE_PO_DIRS} |
61 |
[[ -z ${ECM_QTHELP} ]] && ECM_QTHELP=${KDE_QTHELP} |
62 |
[[ -z ${ECM_TEST} ]] && ECM_TEST=${KDE_TEST} |
63 |
+ [[ -z ${KFMIN} ]] && KFMIN=${FRAMEWORKS_MINIMAL} |
64 |
inherit ecm |
65 |
;; |
66 |
esac |
67 |
|
68 |
EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare src_configure src_compile src_test src_install pkg_preinst pkg_postinst pkg_postrm |
69 |
|
70 |
+# @FUNCTION: _kde5_strip_handbook_translations |
71 |
+# @INTERNAL |
72 |
+# @DESCRIPTION: |
73 |
+# If LINGUAS is defined, enable only the requested translations when required. |
74 |
+_kde5_strip_handbook_translations() { |
75 |
+ if ! [[ -v LINGUAS ]]; then |
76 |
+ return |
77 |
+ fi |
78 |
+ |
79 |
+ local lang po |
80 |
+ for po in ${ECM_PO_DIRS}; do |
81 |
+ if [[ -d ${po} ]] ; then |
82 |
+ pushd ${po} > /dev/null || die |
83 |
+ local lang |
84 |
+ for lang in *; do |
85 |
+ if [[ -e ${lang} ]] && ! has ${lang/.po/} ${LINGUAS} ; then |
86 |
+ case ${lang} in |
87 |
+ cmake_modules | \ |
88 |
+ CMakeLists.txt | \ |
89 |
+ ${PN}.pot) ;; |
90 |
+ *) rm -r ${lang} || die ;; |
91 |
+ esac |
92 |
+ if [[ -e CMakeLists.txt ]] ; then |
93 |
+ cmake_comment_add_subdirectory ${lang} |
94 |
+ sed -e "/add_subdirectory([[:space:]]*${lang}\/.*[[:space:]]*)/d" \ |
95 |
+ -i CMakeLists.txt || die |
96 |
+ fi |
97 |
+ fi |
98 |
+ done |
99 |
+ popd > /dev/null || die |
100 |
+ fi |
101 |
+ done |
102 |
+} |
103 |
+ |
104 |
# @FUNCTION: kde5_pkg_pretend |
105 |
# @DESCRIPTION: |
106 |
# Checks if the active compiler meets the minimum version requirements. |
107 |
@@ -218,7 +274,26 @@ kde5_src_unpack() { |
108 |
kde5_src_prepare() { |
109 |
debug-print-function ${FUNCNAME} "$@" |
110 |
case ${KDE_AUTODEPS} in |
111 |
- false) cmake-utils_src_prepare ;; |
112 |
+ false) |
113 |
+ cmake-utils_src_prepare |
114 |
+ |
115 |
+ _kde5_strip_handbook_translations |
116 |
+ |
117 |
+ # only build unit tests when required |
118 |
+ if ! { in_iuse test && use test; } ; then |
119 |
+ if [[ ${KDE_TEST} = forceoptional ]] ; then |
120 |
+ punt_bogus_dep Qt5 Test |
121 |
+ # if forceoptional, also cover non-kde categories |
122 |
+ cmake_comment_add_subdirectory autotests test tests |
123 |
+ elif [[ ${CATEGORY} = kde-frameworks || ${CATEGORY} = kde-plasma || ${CATEGORY} = kde-apps ]] ; then |
124 |
+ cmake_comment_add_subdirectory autotests test tests |
125 |
+ fi |
126 |
+ fi |
127 |
+ # in frameworks, tests = manual tests so never build them |
128 |
+ if [[ ${CATEGORY} = kde-frameworks ]] && [[ ${PN} != extra-cmake-modules ]]; then |
129 |
+ cmake_comment_add_subdirectory tests |
130 |
+ fi |
131 |
+ ;; |
132 |
*) ecm_src_prepare ;; |
133 |
esac |
134 |
|
135 |
@@ -244,7 +319,35 @@ kde5_src_prepare() { |
136 |
kde5_src_configure() { |
137 |
debug-print-function ${FUNCNAME} "$@" |
138 |
case ${KDE_AUTODEPS} in |
139 |
- false) cmake-utils_src_configure ;; |
140 |
+ false) |
141 |
+ # we rely on cmake-utils.eclass to append -DNDEBUG too |
142 |
+ if in_iuse debug && ! use debug; then |
143 |
+ append-cppflags -DQT_NO_DEBUG |
144 |
+ fi |
145 |
+ |
146 |
+ local cmakeargs |
147 |
+ |
148 |
+ if in_iuse test && ! use test ; then |
149 |
+ cmakeargs+=( -DBUILD_TESTING=OFF ) |
150 |
+ |
151 |
+ if [[ ${KDE_TEST} = optional ]] ; then |
152 |
+ cmakeargs+=( -DCMAKE_DISABLE_FIND_PACKAGE_Qt5Test=ON ) |
153 |
+ fi |
154 |
+ fi |
155 |
+ if [[ ${ECM_KDEINSTALLDIRS} != false ]] ; then |
156 |
+ cmakeargs+=( |
157 |
+ # install mkspecs in the same directory as qt stuff |
158 |
+ -DKDE_INSTALL_USE_QT_SYS_PATHS=ON |
159 |
+ # move handbook outside of doc dir, bug 667138 |
160 |
+ -DKDE_INSTALL_DOCBUNDLEDIR="${EPREFIX}/usr/share/help" |
161 |
+ ) |
162 |
+ fi |
163 |
+ |
164 |
+ # allow the ebuild to override what we set here |
165 |
+ mycmakeargs=("${cmakeargs[@]}" "${mycmakeargs[@]}") |
166 |
+ |
167 |
+ cmake-utils_src_configure |
168 |
+ ;; |
169 |
*) ecm_src_configure ;; |
170 |
esac |
171 |
} |