summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2013-05-15 19:01:36 +0000
committerMichał Górny <mgorny@gentoo.org>2013-05-15 19:01:36 +0000
commit21396bd18b80ec39a4197c5f753f8f8d2f675c09 (patch)
tree2553a0191b5e3d136bcbe58b4f411dac61f497bc /eclass
parentVersion bump thanks to Eric F. GARIOUD <eric-f.garioud@wanadoo.fr>. Remove ol... (diff)
downloadgentoo-2-21396bd18b80ec39a4197c5f753f8f8d2f675c09.tar.gz
gentoo-2-21396bd18b80ec39a4197c5f753f8f8d2f675c09.tar.bz2
gentoo-2-21396bd18b80ec39a4197c5f753f8f8d2f675c09.zip
prune_libtool_files: do not remove .la files which are not libtool files. Fixes bug #468380.
Diffstat (limited to 'eclass')
-rw-r--r--eclass/ChangeLog6
-rw-r--r--eclass/eutils.eclass119
2 files changed, 69 insertions, 56 deletions
diff --git a/eclass/ChangeLog b/eclass/ChangeLog
index 7525a50cb537..29ed039c3a9d 100644
--- a/eclass/ChangeLog
+++ b/eclass/ChangeLog
@@ -1,6 +1,10 @@
# ChangeLog for eclass directory
# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.824 2013/05/15 05:42:09 dirtyepic Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.825 2013/05/15 19:01:36 mgorny Exp $
+
+ 15 May 2013; Michał Górny <mgorny@gentoo.org> eutils.eclass:
+ prune_libtool_files: do not remove .la files which are not libtool files.
+ Fixes bug #468380.
15 May 2013; Ryan Hill <dirtyepic@gentoo.org> toolchain.eclass:
Explicitly disable lto in 4.5 to stop configure from helpfully re-enabling it
diff --git a/eclass/eutils.eclass b/eclass/eutils.eclass
index 04e99e35dff8..4f15742ad775 100644
--- a/eclass/eutils.eclass
+++ b/eclass/eutils.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.417 2013/04/25 18:38:02 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.418 2013/05/15 19:01:36 mgorny Exp $
# @ECLASS: eutils.eclass
# @MAINTAINER:
@@ -1458,11 +1458,12 @@ prune_libtool_files() {
local archivefile=${f/%.la/.a}
[[ ${f} != ${archivefile} ]] || die 'regex sanity check failed'
-
local reason pkgconfig_scanned
+ local snotlink=$(sed -n -e 's:^shouldnotlink=::p' "${f}")
+
+ if [[ ${snotlink} == yes ]]; then
- # Remove static libs we're not supposed to link against.
- if grep -q '^shouldnotlink=yes$' "${f}"; then
+ # Remove static libs we're not supposed to link against.
if [[ -f ${archivefile} ]]; then
einfo "Removing unnecessary ${archivefile#${D%/}} (static plugin)"
queue+=( "${archivefile}" )
@@ -1474,62 +1475,70 @@ prune_libtool_files() {
reason='module'
fi
- # Remove .la files when:
- # - user explicitly wants us to remove all .la files,
- # - respective static archive doesn't exist,
- # - they are covered by a .pc file already,
- # - they don't provide any new information (no libs & no flags).
-
- elif [[ ${removing_all} ]]; then
- reason='requested'
- elif [[ ! -f ${archivefile} ]]; then
- reason='no static archive'
- elif [[ ! $(sed -nre \
- "s/^(dependency_libs|inherited_linker_flags)='(.*)'$/\2/p" \
- "${f}") ]]; then
- reason='no libs & flags'
- else
- if [[ ! ${pkgconfig_scanned} ]]; then
- # Create a list of all .pc-covered libs.
- local pc_libs=()
- if [[ ! ${removing_all} ]]; then
- local pc
- local tf=${T}/prune-lt-files.pc
- local pkgconf=$(tc-getPKG_CONFIG)
-
- while IFS= read -r -d '' pc; do # for all .pc files
- local arg libs
-
- # Use pkg-config if available (and works),
- # fallback to sed.
- if ${pkgconf} --exists "${pc}" &>/dev/null; then
- sed -e '/^Requires:/d' "${pc}" > "${tf}"
- libs=$(${pkgconf} --libs "${tf}")
- else
- libs=$(sed -ne 's/^Libs://p' "${pc}")
- fi
-
- for arg in ${libs}; do
- if [[ ${arg} == -l* ]]; then
- if [[ ${arg} == '*$*' ]]; then
- eqawarn "${FUNCNAME}: variable substitution likely failed in ${pc}"
- eqawarn "(arg: ${arg})"
- eqawarn "Most likely, you need to add virtual/pkgconfig to DEPEND."
+ elif [[ ${snotlink} == no ]]; then
+
+ # A valid .la file must have a valid 'shouldnotlink='.
+ # That assumption helps us avoid removing random files
+ # which match '*.la', see bug #468380.
+
+ # Remove .la files when:
+ # - user explicitly wants us to remove all .la files,
+ # - respective static archive doesn't exist,
+ # - they are covered by a .pc file already,
+ # - they don't provide any new information (no libs & no flags).
+
+ if [[ ${removing_all} ]]; then
+ reason='requested'
+ elif [[ ! -f ${archivefile} ]]; then
+ reason='no static archive'
+ elif [[ ! $(sed -nre \
+ "s/^(dependency_libs|inherited_linker_flags)='(.*)'$/\2/p" \
+ "${f}") ]]; then
+ reason='no libs & flags'
+ else
+ if [[ ! ${pkgconfig_scanned} ]]; then
+ # Create a list of all .pc-covered libs.
+ local pc_libs=()
+ if [[ ! ${removing_all} ]]; then
+ local pc
+ local tf=${T}/prune-lt-files.pc
+ local pkgconf=$(tc-getPKG_CONFIG)
+
+ while IFS= read -r -d '' pc; do # for all .pc files
+ local arg libs
+
+ # Use pkg-config if available (and works),
+ # fallback to sed.
+ if ${pkgconf} --exists "${pc}" &>/dev/null; then
+ sed -e '/^Requires:/d' "${pc}" > "${tf}"
+ libs=$(${pkgconf} --libs "${tf}")
+ else
+ libs=$(sed -ne 's/^Libs://p' "${pc}")
+ fi
+
+ for arg in ${libs}; do
+ if [[ ${arg} == -l* ]]; then
+ if [[ ${arg} == '*$*' ]]; then
+ eqawarn "${FUNCNAME}: variable substitution likely failed in ${pc}"
+ eqawarn "(arg: ${arg})"
+ eqawarn "Most likely, you need to add virtual/pkgconfig to DEPEND."
+ fi
+
+ pc_libs+=( lib${arg#-l}.la )
fi
+ done
+ done < <(find "${D}" -type f -name '*.pc' -print0)
- pc_libs+=( lib${arg#-l}.la )
- fi
- done
- done < <(find "${D}" -type f -name '*.pc' -print0)
+ rm -f "${tf}"
+ fi
- rm -f "${tf}"
- fi
+ pkgconfig_scanned=1
+ fi # pkgconfig_scanned
- pkgconfig_scanned=1
- fi
+ has "${f##*/}" "${pc_libs[@]}" && reason='covered by .pc'
+ fi # removal due to .pc
- has "${f##*/}" "${pc_libs[@]}" && reason='covered by .pc'
- fi
+ fi # shouldnotlink==no
if [[ ${reason} ]]; then
einfo "Removing unnecessary ${f#${D%/}} (${reason})"