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