| 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.14 2011/09/16 15:33:19 mgorny Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/autotools-utils.eclass,v 1.15 2011/09/16 15:37:41 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> |
| … | |
… | |
| 147 | |
147 | |
| 148 | local f |
148 | local f |
| 149 | find "${D}" -type f -name '*.la' -print0 | while read -r -d '' f; do |
149 | find "${D}" -type f -name '*.la' -print0 | while read -r -d '' f; do |
| 150 | local shouldnotlink=$(sed -ne '/^shouldnotlink=yes$/p' "${f}") |
150 | local shouldnotlink=$(sed -ne '/^shouldnotlink=yes$/p' "${f}") |
| 151 | local archivefile=${f/%.la/.a} |
151 | local archivefile=${f/%.la/.a} |
|
|
152 | [[ "${f}" != "${archivefile}" ]] || die 'regex sanity check failed' |
| 152 | |
153 | |
| 153 | # Keep .la files when: |
154 | # Keep .la files when: |
| 154 | # - they have shouldnotlink=yes - likely plugins, |
155 | # - they have shouldnotlink=yes - likely plugins, |
| 155 | # - respective static archive exists. |
156 | # - respective static archive exists. |
| 156 | if [[ "$1" == 'all' || ( -z ${shouldnotlink} && ! -f ${archivefile} ) ]]; then |
157 | if [[ "$1" == 'all' || ( -z ${shouldnotlink} && ! -f ${archivefile} ) ]]; then |
| 157 | einfo "Removing unnecessary ${f#${D%/}}" |
158 | einfo "Removing unnecessary ${f#${D%/}}" |
| 158 | rm -f "${f}" |
159 | rm -f "${f}" || die |
| 159 | fi |
160 | fi |
| 160 | |
161 | |
| 161 | # Remove static libs we're not supposed to link against |
162 | # Remove static libs we're not supposed to link against |
| 162 | if [[ -n ${shouldnotlink} ]]; then |
163 | if [[ ${shouldnotlink} ]]; then |
| 163 | local remove=${f/%.la/.a} |
|
|
| 164 | [[ "${f}" != "${remove}" ]] || die 'regex sanity check failed' |
|
|
| 165 | einfo "Removing unnecessary ${remove#${D%/}}" |
164 | einfo "Removing unnecessary ${archivefile#${D%/}}" |
| 166 | rm -f "${remove}" |
165 | rm -f "${archivefile}" || die |
| 167 | fi |
166 | fi |
| 168 | done |
167 | done |
| 169 | } |
168 | } |
| 170 | |
169 | |
| 171 | # @FUNCTION: autotools-utils_src_prepare |
170 | # @FUNCTION: autotools-utils_src_prepare |