Gentoo Archives: gentoo-dev

From: heroxbd@g.o
To: gentoo-dev@l.g.o
Cc: Benda Xu <heroxbd@g.o>
Subject: [gentoo-dev] [RFC, PATCH] db.eclass: support Prefix
Date: Mon, 20 Nov 2017 03:28:21
Message-Id: 20171120032801.24491-1-heroxbd@gentoo.org
1 From: Benda Xu <heroxbd@g.o>
2
3 ROOT and D are replaced with EROOT and ED.
4 ---
5 eclass/db.eclass | 30 ++++++++++++++++++------------
6 1 file changed, 18 insertions(+), 12 deletions(-)
7
8 diff --git a/eclass/db.eclass b/eclass/db.eclass
9 index c46c431ea9c..0c0d0ef14cd 100644
10 --- a/eclass/db.eclass
11 +++ b/eclass/db.eclass
12 @@ -17,7 +17,8 @@ DEPEND="test? ( >=dev-lang/tcl-8.4 )"
13 RDEPEND=""
14
15 db_fix_so() {
16 - LIB="${ROOT}/usr/$(get_libdir)"
17 + has "${EAPI:-0}" 0 1 2 && ! use prefix && EROOT="${ROOT}"
18 + LIB="${EROOT}/usr/$(get_libdir)"
19
20 cd "${LIB}"
21
22 @@ -50,7 +51,7 @@ db_fix_so() {
23
24 # do the same for headers now
25 # but since there are only two of them, just overwrite them
26 - cd "${ROOT}"/usr/include
27 + cd "${EROOT}"/usr/include
28 target=`find . -maxdepth 1 -type d -name 'db[0-9]*' | sort -n |cut -d/ -f2- | tail -n1`
29 if [ -n "${target}" ] && [ -e "${target}/db.h" ] && ( ! [[ -e db.h ]] || [[ -h db.h ]] ); then
30 einfo "Creating db.h symlinks to ${target}"
31 @@ -67,19 +68,21 @@ db_fix_so() {
32 }
33
34 db_src_install_doc() {
35 + has "${EAPI:-0}" 0 1 2 && ! use prefix && ED="${D}"
36 # not everybody wants this wad of documentation as it is primarily API docs
37 if use doc; then
38 dodir /usr/share/doc/${PF}/html
39 - mv "${D}"/usr/docs/* "${D}"/usr/share/doc/${PF}/html/
40 - rm -rf "${D}"/usr/docs
41 + mv "${ED}"/usr/docs/* "${ED}"/usr/share/doc/${PF}/html/
42 + rm -rf "${ED}"/usr/docs
43 else
44 - rm -rf "${D}"/usr/docs
45 + rm -rf "${ED}"/usr/docs
46 fi
47
48 db_src_install_examples
49 }
50
51 db_src_install_examples() {
52 + has "${EAPI:-0}" 0 1 2 && ! use prefix && ED="${D}"
53 if use examples ; then
54 local langs="c cxx stl"
55 [[ "${IUSE/java}" != "${IUSE}" ]] \
56 @@ -90,15 +93,16 @@ db_src_install_examples() {
57 src="${S}/../examples_${i}/"
58 if [ -f "${src}" ]; then
59 dodir "${destdir}"
60 - cp -ra "${src}" "${D}${destdir}/"
61 + cp -ra "${src}" "${ED}${destdir}/"
62 fi
63 done
64 fi
65 }
66
67 db_src_install_usrbinslot() {
68 + has "${EAPI:-0}" 0 1 2 && ! use prefix && ED="${D}"
69 # slot all program names to avoid overwriting
70 - for fname in "${D}"/usr/bin/db*
71 + for fname in "${ED}"/usr/bin/db*
72 do
73 dn="$(dirname "${fname}")"
74 bn="$(basename "${fname}")"
75 @@ -109,18 +113,20 @@ db_src_install_usrbinslot() {
76 }
77
78 db_src_install_headerslot() {
79 + has "${EAPI:-0}" 0 1 2 && ! use prefix && ED="${D}"
80 # install all headers in a slotted location
81 dodir /usr/include/db${SLOT}
82 - mv "${D}"/usr/include/*.h "${D}"/usr/include/db${SLOT}/
83 + mv "${ED}"/usr/include/*.h "${ED}"/usr/include/db${SLOT}/
84 }
85
86 db_src_install_usrlibcleanup() {
87 - LIB="${D}/usr/$(get_libdir)"
88 + has "${EAPI:-0}" 0 1 2 && ! use prefix && ED="${D}"
89 + LIB="${ED}/usr/$(get_libdir)"
90 # Clean out the symlinks so that they will not be recorded in the
91 # contents (bug #60732)
92
93 - if [ "${D}" = "" ]; then
94 - die "Calling clean_links while \$D not defined"
95 + if [ "${ED}" = "" ]; then
96 + die "Calling clean_links while \$ED not defined"
97 fi
98
99 if [ -e "${LIB}"/libdb.a ] && [ ! -e "${LIB}"/libdb-${SLOT}.a ]; then
100 @@ -139,7 +145,7 @@ db_src_install_usrlibcleanup() {
101 find "${LIB}" -maxdepth 1 -type l -name 'libdb[1._-]*a' -exec rm \{} \;
102
103 rm -f \
104 - "${D}"/usr/include/{db,db_185}.h \
105 + "${ED}"/usr/include/{db,db_185}.h \
106 "${LIB}"/libdb{,_{cxx,sql,stl,java,tcl}}.a
107 }
108
109 --
110 2.15.0

Replies

Subject Author
Re: [gentoo-dev] [RFC, PATCH] db.eclass: support Prefix Benda Xu <heroxbd@g.o>