kde-plasma/breeze-gtk: x86 stable wrt bug #613144
[gentoo.git] / eclass / qt4-r2.eclass
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 # @ECLASS: qt4-r2.eclass
5 # @MAINTAINER:
6 # qt@gentoo.org
7 # @BLURB: Eclass for Qt4-based packages, second edition.
8 # @DESCRIPTION:
9 # This eclass contains various functions that may be useful when
10 # dealing with packages using Qt4 libraries. Supports only EAPIs
11 # 2, 3, 4, and 5. Use qmake-utils.eclass in EAPI 6 and later.
12
13 case ${EAPI} in
14         2|3|4|5) : ;;
15         6) die "qt4-r2.eclass is banned in EAPI 6 and later" ;;
16         *) die "qt4-r2.eclass: unsupported EAPI=${EAPI:-0}" ;;
17 esac
18
19 inherit base eutils qmake-utils
20
21 export XDG_CONFIG_HOME="${T}"
22
23 # @ECLASS-VARIABLE: DOCS
24 # @DEFAULT_UNSET
25 # @DESCRIPTION:
26 # Array containing documents passed to dodoc command.
27 # Paths can be absolute or relative to ${S}.
28 #
29 # Example: DOCS=( ChangeLog README "${WORKDIR}/doc_folder/" )
30
31 # @ECLASS-VARIABLE: HTML_DOCS
32 # @DEFAULT_UNSET
33 # @DESCRIPTION:
34 # Array containing documents passed to dohtml command.
35 # Paths can be absolute or relative to ${S}.
36 #
37 # Example: HTML_DOCS=( "doc/document.html" "${WORKDIR}/html_folder/" )
38
39 # @ECLASS-VARIABLE: LANGS
40 # @DEFAULT_UNSET
41 # @DESCRIPTION:
42 # In case your Qt4 application provides various translations, use this variable
43 # to specify them in order to populate "linguas_*" IUSE automatically. Make sure
44 # that you set this variable before inheriting qt4-r2 eclass.
45 #
46 # Example: LANGS="de el it ja"
47 for x in ${LANGS}; do
48         IUSE+=" linguas_${x}"
49 done
50
51 # @ECLASS-VARIABLE: LANGSLONG
52 # @DEFAULT_UNSET
53 # @DESCRIPTION:
54 # Same as LANGS, but this variable is for LINGUAS that must be in long format.
55 # Remember to set this variable before inheriting qt4-r2 eclass.
56 # Look at ${PORTDIR}/profiles/desc/linguas.desc for details.
57 #
58 # Example: LANGSLONG="en_GB ru_RU"
59 for x in ${LANGSLONG}; do
60         IUSE+=" linguas_${x%_*}"
61 done
62 unset x
63
64 # @ECLASS-VARIABLE: PATCHES
65 # @DEFAULT_UNSET
66 # @DESCRIPTION:
67 # Array variable containing all the patches to be applied. This variable
68 # is expected to be defined in the global scope of ebuilds. Make sure to
69 # specify the full path. This variable is used in src_prepare phase.
70 #
71 # Example:
72 # @CODE
73 # PATCHES=(
74 #       "${FILESDIR}/mypatch.patch"
75 #       "${FILESDIR}/mypatch2.patch"
76 # )
77 # @CODE
78
79 # @FUNCTION: qt4-r2_src_unpack
80 # @DESCRIPTION:
81 # Default src_unpack function for packages that depend on qt4. If you have to
82 # override src_unpack in your ebuild (probably you don't need to), call
83 # qt4-r2_src_unpack in it.
84 qt4-r2_src_unpack() {
85         debug-print-function $FUNCNAME "$@"
86
87         base_src_unpack "$@"
88 }
89
90 # @FUNCTION: qt4-r2_src_prepare
91 # @DESCRIPTION:
92 # Default src_prepare function for packages that depend on qt4. If you have to
93 # override src_prepare in your ebuild, you should call qt4-r2_src_prepare in it,
94 # otherwise autopatcher will not work!
95 qt4-r2_src_prepare() {
96         debug-print-function $FUNCNAME "$@"
97
98         base_src_prepare "$@"
99 }
100
101 # @FUNCTION: qt4-r2_src_configure
102 # @DESCRIPTION:
103 # Default src_configure function for packages that depend on qt4. If you have to
104 # override src_configure in your ebuild, call qt4-r2_src_configure in it.
105 qt4-r2_src_configure() {
106         debug-print-function $FUNCNAME "$@"
107
108         local project_file=$(qmake-utils_find_pro_file)
109
110         if [[ -n ${project_file} ]]; then
111                 eqmake4 "${project_file}"
112         else
113                 base_src_configure "$@"
114         fi
115 }
116
117 # @FUNCTION: qt4-r2_src_compile
118 # @DESCRIPTION:
119 # Default src_compile function for packages that depend on qt4. If you have to
120 # override src_compile in your ebuild (probably you don't need to), call
121 # qt4-r2_src_compile in it.
122 qt4-r2_src_compile() {
123         debug-print-function $FUNCNAME "$@"
124
125         base_src_compile "$@"
126 }
127
128 # @FUNCTION: qt4-r2_src_install
129 # @DESCRIPTION:
130 # Default src_install function for qt4-based packages. Installs compiled code,
131 # and documentation (via DOCS and HTML_DOCS variables).
132 qt4-r2_src_install() {
133         debug-print-function $FUNCNAME "$@"
134
135         base_src_install INSTALL_ROOT="${D}" "$@"
136         einstalldocs
137 }
138
139 EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_install