Gentoo Logo
Gentoo Spaceship




Note: Due to technical difficulties, the Archives are currently not up to date. GMANE provides an alternative service for most mailing lists.
c.f. bug 424647
List Archive: gentoo-dev
Navigation:
Lists: gentoo-dev: < Prev By Thread Next > < Prev By Date Next >
Headers:
To: gentoo-dev@g.o
From: Michał Górny <mgorny@g.o>
Subject: [PATCH autotools-utils 7/9] Drop 'empty' .la files as well (those lacking libs & flags).
Date: Tue, 13 Sep 2011 16:10:31 +0200
---
 eclass/autotools-utils.eclass |   22 ++++++++++++++++------
 1 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/eclass/autotools-utils.eclass b/eclass/autotools-utils.eclass
index 48b39cb..9d7e134 100644
--- a/eclass/autotools-utils.eclass
+++ b/eclass/autotools-utils.eclass
@@ -162,18 +162,28 @@ remove_libtool_files() {
 		local archivefile=${f/%.la/.a}
 		[[ "${f}" != "${archivefile}" ]] || die 'regex sanity check failed'
 
-		# Remove static libs we're not supposed to link against
+		# Remove static libs we're not supposed to link against.
 		if [[ ${shouldnotlink} ]]; then
 			einfo "Removing unnecessary ${archivefile#${D%/}}"
 			rm -f "${archivefile}" || die
-			# We're never going to remove the .la file.
+			# The .la file may be used by a module loader, so avoid removing it
+			# unless explicitly requested.
 			[[ ${removing_all} ]] || continue
 		fi
 
-		# Keep .la files when:
-		# - they have shouldnotlink=yes - likely plugins (handled above),
-		# - respective static archive exists.
-		if [[ ${removing_all} || ! -f ${archivefile} ]]; then
+		# Remove .la files when:
+		# - user explicitly wants us to remove all .la files,
+		# - respective static archive doesn't exist,
+		# - they don't provide any new information (no libs & no flags).
+		local removing
+		if [[ ${removing_all} ]]; then removing=1
+		elif [[ ! -f ${archivefile} ]]; then removing=1
+		elif [[ ! $(sed -n -e \
+			"s/^\(dependency_libs\|inherited_linker_flags\)='\(.*\)'$/\2/p" \
+			"${f}") ]]; then removing=1
+		fi
+
+		if [[ ${removing} ]]; then
 			einfo "Removing unnecessary ${f#${D%/}}"
 			rm -f "${f}" || die
 		fi
-- 
1.7.6.1



References:
[PATCH] autotools-utils.eclass: punt unnecessary .la files even w/ USE=static-libs.
-- Michał Górny
[PATCH autotools-utils 1/9] Fix handling whitespace in filenames when looking for .la files.
-- Michał Górny
Navigation:
Lists: gentoo-dev: < Prev By Thread Next > < Prev By Date Next >
Previous by thread:
[PATCH autotools-utils 3/9] For .la removal, look for static archives rather than USE=static-libs.
Next by thread:
[PATCH autotools-utils 4/9] Clean up & simplify la removal code a little.
Previous by date:
[PATCH autotools-utils 3/9] For .la removal, look for static archives rather than USE=static-libs.
Next by date:
[PATCH autotools-utils 4/9] Clean up & simplify la removal code a little.


Updated Jun 23, 2012

Summary: Archive of the gentoo-dev mailing list.

Donate to support our development efforts.

Copyright 2001-2013 Gentoo Foundation, Inc. Questions, Comments? Contact us.