1 | # Copyright 1999-2010 Gentoo Foundation |
1 | # Copyright 1999-2010 Gentoo Foundation |
2 | # Distributed under the terms of the GNU General Public License v2 |
2 | # Distributed under the terms of the GNU General Public License v2 |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/autotools-utils.eclass,v 1.16 2011/09/16 15:37:59 mgorny Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/autotools-utils.eclass,v 1.17 2011/09/16 15:38:13 mgorny Exp $ |
4 | |
4 | |
5 | # @ECLASS: autotools-utils.eclass |
5 | # @ECLASS: autotools-utils.eclass |
6 | # @MAINTAINER: |
6 | # @MAINTAINER: |
7 | # Maciej Mrozowski <reavertm@gentoo.org> |
7 | # Maciej Mrozowski <reavertm@gentoo.org> |
8 | # Michał Górny <mgorny@gentoo.org> |
8 | # Michał Górny <mgorny@gentoo.org> |
… | |
… | |
160 | find "${D}" -type f -name '*.la' -print0 | while read -r -d '' f; do |
160 | find "${D}" -type f -name '*.la' -print0 | while read -r -d '' f; do |
161 | local shouldnotlink=$(sed -ne '/^shouldnotlink=yes$/p' "${f}") |
161 | local shouldnotlink=$(sed -ne '/^shouldnotlink=yes$/p' "${f}") |
162 | local archivefile=${f/%.la/.a} |
162 | local archivefile=${f/%.la/.a} |
163 | [[ "${f}" != "${archivefile}" ]] || die 'regex sanity check failed' |
163 | [[ "${f}" != "${archivefile}" ]] || die 'regex sanity check failed' |
164 | |
164 | |
165 | # Keep .la files when: |
|
|
166 | # - they have shouldnotlink=yes - likely plugins, |
|
|
167 | # - respective static archive exists. |
|
|
168 | if [[ ${removing_all} || ( -z ${shouldnotlink} && ! -f ${archivefile} ) ]]; then |
|
|
169 | einfo "Removing unnecessary ${f#${D%/}}" |
|
|
170 | rm -f "${f}" || die |
|
|
171 | fi |
|
|
172 | |
|
|
173 | # Remove static libs we're not supposed to link against |
165 | # Remove static libs we're not supposed to link against |
174 | if [[ ${shouldnotlink} ]]; then |
166 | if [[ ${shouldnotlink} ]]; then |
175 | einfo "Removing unnecessary ${archivefile#${D%/}}" |
167 | einfo "Removing unnecessary ${archivefile#${D%/}}" |
176 | rm -f "${archivefile}" || die |
168 | rm -f "${archivefile}" || die |
|
|
169 | # We're never going to remove the .la file. |
|
|
170 | [[ ${removing_all} ]] || continue |
|
|
171 | fi |
|
|
172 | |
|
|
173 | # Keep .la files when: |
|
|
174 | # - they have shouldnotlink=yes - likely plugins (handled above), |
|
|
175 | # - respective static archive exists. |
|
|
176 | if [[ ${removing_all} || ! -f ${archivefile} ]]; then |
|
|
177 | einfo "Removing unnecessary ${f#${D%/}}" |
|
|
178 | rm -f "${f}" || die |
177 | fi |
179 | fi |
178 | done |
180 | done |
179 | } |
181 | } |
180 | |
182 | |
181 | # @FUNCTION: autotools-utils_src_prepare |
183 | # @FUNCTION: autotools-utils_src_prepare |