1 # Copyright 1999-2018 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # This is a common location for functions that aid the use of sys-libs/db
5 # Bugs: maintainer-needed@gentoo.org
7 # multilib is used for get_libname in all EAPI
9 0|1|2|3|4|5|6) inherit eapi7-ver multilib ;;
10 *) inherit multilib ;;
13 #Convert a version to a db slot
16 eerror "Function db_ver_to_slot needs one argument" >&2
17 eerror "args given:" >&2
20 eerror " - \"$@\"" >&2
24 # 5.0.x uses 5.0 as slot value, so this replacement will break it;
25 # older sys-libs/db might have been using this but it's no longer
26 # the case, so make it work for latest rather than older stuff.
31 #Find the version that correspond to the given atom
33 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
35 eerror "Function db_findver needs one argument" >&2
36 eerror "args given:" >&2
39 eerror " - \"$@\"" >&2
44 PKG="$(best_version $1)"
45 VER="$(ver_cut 1-2 "${PKG/*db-/}")"
46 if [ -d "${EPREFIX}"/usr/include/db$(db_ver_to_slot "$VER") ]; then
47 #einfo "Found db version ${VER}" >&2
55 # Get the include dir for berkeley db.
56 # This function has two modes. Without any arguments it will give the best
57 # version available. With arguments that form the versions of db packages
58 # to test for, it will aim to find the library corresponding to it.
61 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
63 VER="$(db_findver sys-libs/db)" || return 1
64 VER="$(db_ver_to_slot "$VER")"
65 echo "include version ${VER}" >&2
66 if [ -d "${EPREFIX}/usr/include/db${VER}" ]; then
67 echo -n "${EPREFIX}/usr/include/db${VER}"
70 eerror "sys-libs/db package requested, but headers not found" >&2
77 if VER=$(db_findver "=sys-libs/db-${x}*") &&
78 [ -d "${EPREFIX}/usr/include/db$(db_ver_to_slot $VER)" ]; then
79 echo -n "${EPREFIX}/usr/include/db$(db_ver_to_slot $VER)"
83 eerror "No suitable db version found"
89 # Get the library name for berkeley db. Something like "db-4.2" will be the
90 # outcome. This function has two modes. Without any arguments it will give
91 # the best version available. With arguments that form the versions of db
92 # packages to test for, it will aim to find the library corresponding to it.
95 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
97 VER="$(db_findver sys-libs/db)" || return 1
98 if [ -e "${EPREFIX}/usr/$(get_libdir)/libdb-${VER}$(get_libname)" ]; then
102 eerror "sys-libs/db package requested, but library not found" >&2
109 if VER=$(db_findver "=sys-libs/db-${x}*"); then
110 if [ -e "${EPREFIX}/usr/$(get_libdir)/libdb-${VER}$(get_libname)" ]; then
116 eerror "No suitable db version found" >&2