| 1 | # Copyright 1999-2005 Gentoo Foundation |
1 | # Copyright 1999-2005 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/libtool.eclass,v 1.65 2006/03/30 12:29:23 flameeyes Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/libtool.eclass,v 1.66 2006/04/02 16:00:30 flameeyes Exp $ |
| 4 | # |
4 | # |
| 5 | # Author: Martin Schlemmer <azarah@gentoo.org> |
5 | # Author: Martin Schlemmer <azarah@gentoo.org> |
| 6 | # |
6 | # |
| 7 | # This eclass patches ltmain.sh distributed with libtoolized packages with the |
7 | # This eclass patches ltmain.sh distributed with libtoolized packages with the |
| 8 | # relink and portage patch among others |
8 | # relink and portage patch among others |
| … | |
… | |
| 84 | local ret=1 |
84 | local ret=1 |
| 85 | local file=$1 |
85 | local file=$1 |
| 86 | local patch_set=$2 |
86 | local patch_set=$2 |
| 87 | local patch_dir= |
87 | local patch_dir= |
| 88 | local rem_int_dep=$3 |
88 | local rem_int_dep=$3 |
| 89 | local version= |
|
|
| 90 | local ltmain_sh=$1 |
|
|
| 91 | |
|
|
| 92 | [[ ${file} == *"/configure" ]] && ltmain_sh=${ELT_LTMAIN_SH} |
|
|
| 93 | version=$(ELT_libtool_version "${ltmain_sh}") |
|
|
| 94 | |
89 | |
| 95 | if [[ -n ${patch_set} ]] ; then |
90 | if [[ -n ${patch_set} ]] ; then |
| 96 | if [[ -d ${ELT_PATCH_DIR}/${patch_set} ]] ; then |
91 | if [[ -d ${ELT_PATCH_DIR}/${patch_set} ]] ; then |
| 97 | patch_dir="${ELT_PATCH_DIR}/${patch_set}" |
92 | patch_dir="${ELT_PATCH_DIR}/${patch_set}" |
| 98 | else |
93 | else |
| 99 | return "${ret}" |
94 | return "${ret}" |
| 100 | fi |
95 | fi |
| 101 | |
96 | |
| 102 | if [[ ${version} == "0" ]] ; then |
|
|
| 103 | eerror "Could not get VERSION for ${file##*/}!" |
|
|
| 104 | die "Could not get VERSION for ${file##*/}!" |
|
|
| 105 | fi |
|
|
| 106 | |
|
|
| 107 | # Go through the patches in reverse order (large to small) |
97 | # Go through the patches in reverse order (large to small) |
| 108 | for x in $(ls -d "${patch_dir}"/* 2> /dev/null | grep -v 'CVS' | sort -r) ; do |
98 | for x in $(ls -d "${patch_dir}"/* 2> /dev/null | grep -v 'CVS' | sort -r) ; do |
| 109 | if [[ -n ${x} && -f ${x} ]] ; then |
99 | if [[ -n ${x} && -f ${x} ]] ; then |
| 110 | local ltver=$(VER_to_int "${version}") |
|
|
| 111 | local ptver=$(VER_to_int "${x##*/}") |
|
|
| 112 | |
|
|
| 113 | # If libtool version smaller than patch version, skip patch. |
|
|
| 114 | [[ ${ltver} -lt ${ptver} ]] && continue |
|
|
| 115 | # For --remove-internal-dep ... |
100 | # For --remove-internal-dep ... |
| 116 | if [[ -n ${rem_int_dep} ]] ; then |
101 | if [[ -n ${rem_int_dep} ]] ; then |
| 117 | # For replace @REM_INT_DEP@ with what was passed |
102 | # For replace @REM_INT_DEP@ with what was passed |
| 118 | # to --remove-internal-dep |
103 | # to --remove-internal-dep |
| 119 | sed -e "s|@REM_INT_DEP@|${rem_int_dep}|g" ${x} > \ |
104 | sed -e "s|@REM_INT_DEP@|${rem_int_dep}|g" ${x} > \ |