I attach here a proposed new function for eutils.eclass. Review 
requested. Thanks to zlin and igli for initial review and suggestions 
on #gentoo-dev-help.
-- 
/PA
--- /usr/portage/eclass/eutils.eclass	2008-09-28 07:06:15.000000000 +0200
+++ eutils1.eclass	2008-11-06 22:22:51.000000000 +0100
@@ -1805,5 +1805,37 @@
 		) || die
 	else
 		newbin "${tmpwrapper}" "${wrapper}" || die
 	fi
 }
+
+# @FUNCTION: epunt_la_files
+# @USAGE: [dir to scan]
+# @DESCRIPTION:
+# .la files can cause many unpleasantries when they disappear,
+# forcing rebuilds of seemingly unrelated packages.
+# This function removes the .la files from [dir to scan], "${D}" if not set.
+# A good time to start punting .la files may be when a .so bump happens,
+# so dependent packages do not have to be rebuilt twice.
+#
+# See also:
+# bug 245889
+# http://blog.flameeyes.eu/2008/07/02/again-about-la-files-or-why-should-they-be-killed-off-sooner-rather-than-later
+
+epunt_la_files() {
+	debug-print-function $FUNCNAME "$@"
+	local TARGET=$1
+	[ -z "${TARGET}" ] && TARGET="${D}"
+
+	# If this is a non-ELF system, chances are good that the .la files will be needed.
+	if type -P scanelf &> /dev/null
+	then
+		debug-print "Scanelf found, proceeding..."
+		ebegin "Removing useless .la files"
+		find "${TARGET}" -name '*.la' '(' -type l -o -type f ')' -exec rm -f '{}' '+'
+		eend 0
+	else
+		debug-print "scanelf not found, this appears to be a non-ELF system."
+		debug-print "non-ELF systems are likely to need .la files."
+		debug-print ".la files not removed from ${TARGET}"
+	fi
+}

Attachment: signature.asc
Description: This is a digitally signed message part.



Reply via email to