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 3/9] For .la removal, look for static archives rather than USE=static-libs.
Date: Tue, 13 Sep 2011 16:10:27 +0200
---
 eclass/autotools-utils.eclass |   25 +++++++++++++------------
 1 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/eclass/autotools-utils.eclass b/eclass/autotools-utils.eclass
index 31d228b..ab8650f 100644
--- a/eclass/autotools-utils.eclass
+++ b/eclass/autotools-utils.eclass
@@ -132,13 +132,13 @@ _check_build_dir() {
 }
 
 # @FUNCTION: remove_libtool_files
-# @USAGE: [all|none]
+# @USAGE: [all]
 # @DESCRIPTION:
 # Determines unnecessary libtool files (.la) and libtool static archives (.a)
 # and removes them from installation image.
+#
 # To unconditionally remove all libtool files, pass 'all' as argument.
-# To leave all libtool files alone, pass 'none' as argument.
-# Unnecessary static archives are removed in any case.
+# Otherwise, libtool archives required for static linking will be preserved.
 #
 # In most cases it's not necessary to manually invoke this function.
 # See autotools-utils_src_install for reference.
@@ -147,14 +147,17 @@ remove_libtool_files() {
 
 	local f
 	find "${D}" -type f -name '*.la' -print0 | while read -r -d '' f; do
-		# Keep only .la files with shouldnotlink=yes - likely plugins
 		local shouldnotlink=$(sed -ne '/^shouldnotlink=yes$/p' "${f}")
-		if [[  "$1" == 'all' || -z ${shouldnotlink} ]]; then
-			if [[ "$1" != 'none' ]]; then
-				einfo "Removing unnecessary ${f#${D%/}}"
-				rm -f "${f}"
-			fi
+		local archivefile=${f/%.la/.a}
+
+		# Keep .la files when:
+		# - they have shouldnotlink=yes - likely plugins,
+		# - respective static archive exists.
+		if [[ "$1" == 'all' || ( -z ${shouldnotlink} && ! -f ${archivefile} ) ]]; then
+			einfo "Removing unnecessary ${f#${D%/}}"
+			rm -f "${f}"
 		fi
+
 		# Remove static libs we're not supposed to link against
 		if [[ -n ${shouldnotlink} ]]; then
 			local remove=${f/%.la/.a}
@@ -245,9 +248,7 @@ autotools-utils_src_install() {
 	popd > /dev/null
 
 	# Remove libtool files and unnecessary static libs
-	local args
-	has static-libs ${IUSE//+} && ! use static-libs || args='none'
-	remove_libtool_files ${args}
+	remove_libtool_files
 }
 
 # @FUNCTION: autotools-utils_src_test
-- 
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 8/9] Remove static libs covered by .pc files as well.
Next by thread:
[PATCH autotools-utils 7/9] Drop 'empty' .la files as well (those lacking libs & flags).
Previous by date:
[PATCH autotools-utils 8/9] Remove static libs covered by .pc files as well.
Next by date:
[PATCH autotools-utils 7/9] Drop 'empty' .la files as well (those lacking libs & flags).


Updated Jun 29, 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.