public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [RFC, PATCH] db.eclass: support Prefix
@ 2017-11-20  3:28 heroxbd
  2017-11-26  1:06 ` Benda Xu
  0 siblings, 1 reply; 2+ messages in thread
From: heroxbd @ 2017-11-20  3:28 UTC (permalink / raw
  To: gentoo-dev; +Cc: Benda Xu

From: Benda Xu <heroxbd@gentoo.org>

  ROOT and D are replaced with EROOT and ED.
---
 eclass/db.eclass | 30 ++++++++++++++++++------------
 1 file changed, 18 insertions(+), 12 deletions(-)

diff --git a/eclass/db.eclass b/eclass/db.eclass
index c46c431ea9c..0c0d0ef14cd 100644
--- a/eclass/db.eclass
+++ b/eclass/db.eclass
@@ -17,7 +17,8 @@ DEPEND="test? ( >=dev-lang/tcl-8.4 )"
 RDEPEND=""
 
 db_fix_so() {
-	LIB="${ROOT}/usr/$(get_libdir)"
+	has "${EAPI:-0}" 0 1 2 && ! use prefix && EROOT="${ROOT}"
+	LIB="${EROOT}/usr/$(get_libdir)"
 
 	cd "${LIB}"
 
@@ -50,7 +51,7 @@ db_fix_so() {
 
 	# do the same for headers now
 	# but since there are only two of them, just overwrite them
-	cd "${ROOT}"/usr/include
+	cd "${EROOT}"/usr/include
 	target=`find . -maxdepth 1 -type d -name 'db[0-9]*' | sort -n |cut -d/ -f2- | tail -n1`
 	if [ -n "${target}" ] && [ -e "${target}/db.h" ] && ( ! [[ -e db.h ]] || [[ -h db.h ]] ); then
 		einfo "Creating db.h symlinks to ${target}"
@@ -67,19 +68,21 @@ db_fix_so() {
 }
 
 db_src_install_doc() {
+	has "${EAPI:-0}" 0 1 2 && ! use prefix && ED="${D}"
 	# not everybody wants this wad of documentation as it is primarily API docs
 	if use doc; then
 		dodir /usr/share/doc/${PF}/html
-		mv "${D}"/usr/docs/* "${D}"/usr/share/doc/${PF}/html/
-		rm -rf "${D}"/usr/docs
+		mv "${ED}"/usr/docs/* "${ED}"/usr/share/doc/${PF}/html/
+		rm -rf "${ED}"/usr/docs
 	else
-		rm -rf "${D}"/usr/docs
+		rm -rf "${ED}"/usr/docs
 	fi
 
 	db_src_install_examples
 }
 
 db_src_install_examples() {
+	has "${EAPI:-0}" 0 1 2 && ! use prefix && ED="${D}"
 	if use examples ; then
 		local langs="c cxx stl"
 		[[ "${IUSE/java}" != "${IUSE}" ]] \
@@ -90,15 +93,16 @@ db_src_install_examples() {
 			src="${S}/../examples_${i}/"
 			if [ -f "${src}" ]; then
 				dodir "${destdir}"
-				cp -ra "${src}" "${D}${destdir}/"
+				cp -ra "${src}" "${ED}${destdir}/"
 			fi
 		done
 	fi
 }
 
 db_src_install_usrbinslot() {
+	has "${EAPI:-0}" 0 1 2 && ! use prefix && ED="${D}"
 	# slot all program names to avoid overwriting
-	for fname in "${D}"/usr/bin/db*
+	for fname in "${ED}"/usr/bin/db*
 	do
 		dn="$(dirname "${fname}")"
 		bn="$(basename "${fname}")"
@@ -109,18 +113,20 @@ db_src_install_usrbinslot() {
 }
 
 db_src_install_headerslot() {
+	has "${EAPI:-0}" 0 1 2 && ! use prefix && ED="${D}"
 	# install all headers in a slotted location
 	dodir /usr/include/db${SLOT}
-	mv "${D}"/usr/include/*.h "${D}"/usr/include/db${SLOT}/
+	mv "${ED}"/usr/include/*.h "${ED}"/usr/include/db${SLOT}/
 }
 
 db_src_install_usrlibcleanup() {
-	LIB="${D}/usr/$(get_libdir)"
+	has "${EAPI:-0}" 0 1 2 && ! use prefix && ED="${D}"
+	LIB="${ED}/usr/$(get_libdir)"
 	# Clean out the symlinks so that they will not be recorded in the
 	# contents (bug #60732)
 
-	if [ "${D}" = "" ]; then
-		die "Calling clean_links while \$D not defined"
+	if [ "${ED}" = "" ]; then
+		die "Calling clean_links while \$ED not defined"
 	fi
 
 	if [ -e "${LIB}"/libdb.a ] && [ ! -e "${LIB}"/libdb-${SLOT}.a ]; then
@@ -139,7 +145,7 @@ db_src_install_usrlibcleanup() {
 	find "${LIB}" -maxdepth 1 -type l -name 'libdb[1._-]*a' -exec rm \{} \;
 
 	rm -f \
-		"${D}"/usr/include/{db,db_185}.h \
+		"${ED}"/usr/include/{db,db_185}.h \
 		"${LIB}"/libdb{,_{cxx,sql,stl,java,tcl}}.a
 }
 
-- 
2.15.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [gentoo-dev] [RFC, PATCH] db.eclass: support Prefix
  2017-11-20  3:28 [gentoo-dev] [RFC, PATCH] db.eclass: support Prefix heroxbd
@ 2017-11-26  1:06 ` Benda Xu
  0 siblings, 0 replies; 2+ messages in thread
From: Benda Xu @ 2017-11-26  1:06 UTC (permalink / raw
  To: gentoo-dev

Committed, thanks a lot!

Benda


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-11-26  1:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-20  3:28 [gentoo-dev] [RFC, PATCH] db.eclass: support Prefix heroxbd
2017-11-26  1:06 ` Benda Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox