1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
5 # @ECLASS: leechcraft.eclass
7 # leechcraft@gentoo.org
11 # @BLURB: Common functions and setup utilities for the LeechCraft app
13 # The leechcraft eclass contains a common set of functions and steps
14 # needed to build LeechCraft core or its plugins.
16 # Though this eclass seems to be small at the moment, it seems like a
17 # good idea to make all plugins inherit from it, since all plugins
18 # have mostly the same configuring/build process.
20 # Thanks for original eclass to Andrian Nord <NightNord@niifaq.ru>.
22 # Only EAPI >1 supported
26 0|1|2|3) die "EAPI not supported, bug ebuild mantainer" ;;
27 *) die "Unknown EAPI, bug eclass maintainers" ;;
30 inherit cmake-utils toolchain-funcs versionator
32 if [[ ${PV} == 9999 ]]; then
33 EGIT_REPO_URI="git://github.com/0xd34df00d/leechcraft.git
34 https://github.com/0xd34df00d/leechcraft.git"
35 EGIT_PROJECT="leechcraft"
39 DEPEND="app-arch/xz-utils"
40 SRC_URI="http://dist.leechcraft.org/LeechCraft/${PV}/leechcraft-${PV}.tar.xz"
41 S="${WORKDIR}/leechcraft-${PV}"
44 HOMEPAGE="http://leechcraft.org/"
47 # @ECLASS-VARIABLE: LEECHCRAFT_PLUGIN_CATEGORY
50 # Set this to the category of the plugin, if any.
51 : ${LEECHCRAFT_PLUGIN_CATEGORY:=}
53 if [[ "${LEECHCRAFT_PLUGIN_CATEGORY}" ]]; then
54 CMAKE_USE_DIR="${S}"/src/plugins/${LEECHCRAFT_PLUGIN_CATEGORY}/${PN#lc-}
55 elif [[ ${PN} != lc-core ]]; then
56 CMAKE_USE_DIR="${S}"/src/plugins/${PN#lc-}
58 CMAKE_USE_DIR="${S}"/src
61 EXPORT_FUNCTIONS "pkg_pretend"
63 # @FUNCTION: leechcraft_pkg_pretend
65 # Determine active compiler version and refuse to build
66 # if it is not satisfied at least to minimal version,
67 # supported by upstream developers
68 leechcraft_pkg_pretend() {
69 debug-print-function ${FUNCNAME} "$@"
71 # 0.5.85 and later requires at least gcc 4.6
72 if [[ ${MERGE_TYPE} != binary ]]; then
73 [[ $(gcc-major-version) -lt 4 ]] || \
74 ( [[ $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 6 ]] ) \
75 && die "Sorry, but gcc 4.6 or higher is required."
77 if version_is_at_least 0.6.66 || ( [[ ${PN} == lc-monocle ]] && version_is_at_least 0.6.65 ); then
78 # 0.6.65 monocle and all later plugins require at least gcc 4.8
79 if [[ ${MERGE_TYPE} != binary ]]; then
80 [[ $(gcc-major-version) -lt 4 ]] || \
81 ( [[ $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 8 ]] ) \
82 && die "Sorry, but gcc 4.8 or higher is required."