| 1 | # Copyright 1999-2007 Gentoo Foundation |
1 | # Copyright 1999-2007 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.85 2010/03/12 08:17:40 haubi Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/libtool.eclass,v 1.86 2010/04/14 02:13:54 vapier Exp $ |
| 4 | # |
4 | # |
| 5 | # Maintainer: base-system@gentoo.org |
5 | # Maintainer: base-system@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 |
| … | |
… | |
| 74 | # |
74 | # |
| 75 | # Run through the patches in $2 and see if any |
75 | # Run through the patches in $2 and see if any |
| 76 | # apply to $1 ... |
76 | # apply to $1 ... |
| 77 | # |
77 | # |
| 78 | ELT_walk_patches() { |
78 | ELT_walk_patches() { |
| 79 | local x= |
79 | local patch |
| 80 | local y= |
|
|
| 81 | local ret=1 |
80 | local ret=1 |
| 82 | local file=$1 |
81 | local file=$1 |
| 83 | local patch_set=$2 |
82 | local patch_set=$2 |
| 84 | local patch_dir= |
83 | local patch_dir="${ELT_PATCH_DIR}/${patch_set}" |
| 85 | local rem_int_dep=$3 |
84 | local rem_int_dep=$3 |
| 86 | |
85 | |
| 87 | if [[ -n ${patch_set} ]] ; then |
86 | [[ -z ${patch_set} ]] && return 1 |
| 88 | if [[ -d ${ELT_PATCH_DIR}/${patch_set} ]] ; then |
87 | [[ ! -d ${patch_dir} ]] && return 1 |
| 89 | patch_dir="${ELT_PATCH_DIR}/${patch_set}" |
88 | |
| 90 | else |
89 | pushd "${ELT_PATCH_DIR}" >/dev/null |
| 91 | return "${ret}" |
90 | |
|
|
91 | # Go through the patches in reverse order (newer version to older) |
|
|
92 | for patch in $(find "${patch_set}" -maxdepth 1 -type f | LC_ALL=C sort -r) ; do |
|
|
93 | # For --remove-internal-dep ... |
|
|
94 | if [[ -n ${rem_int_dep} ]] ; then |
|
|
95 | # For replace @REM_INT_DEP@ with what was passed |
|
|
96 | # to --remove-internal-dep |
|
|
97 | local tmp="${T}/$$.rem_int_deps.patch" |
|
|
98 | sed -e "s|@REM_INT_DEP@|${rem_int_dep}|g" "${patch}" > "${tmp}" |
|
|
99 | patch=${tmp} |
| 92 | fi |
100 | fi |
| 93 | |
101 | |
| 94 | # Go through the patches in reverse order (large to small) |
|
|
| 95 | for x in $(ls -d "${patch_dir}"/* 2> /dev/null | grep -v 'CVS' | sort -r) ; do |
|
|
| 96 | if [[ -n ${x} && -f ${x} ]] ; then |
|
|
| 97 | # For --remove-internal-dep ... |
|
|
| 98 | if [[ -n ${rem_int_dep} ]] ; then |
|
|
| 99 | # For replace @REM_INT_DEP@ with what was passed |
|
|
| 100 | # to --remove-internal-dep |
|
|
| 101 | sed -e "s|@REM_INT_DEP@|${rem_int_dep}|g" ${x} > \ |
|
|
| 102 | "${T}/$$.rem_int_deps.patch" |
|
|
| 103 | |
|
|
| 104 | x="${T}/$$.rem_int_deps.patch" |
|
|
| 105 | fi |
|
|
| 106 | |
|
|
| 107 | if ELT_try_and_apply_patch "${file}" "${x}" ; then |
102 | if ELT_try_and_apply_patch "${file}" "${patch}" ; then |
|
|
103 | # Break to unwind w/popd rather than return directly |
| 108 | ret=0 |
104 | ret=0 |
| 109 | break |
105 | break |
| 110 | fi |
|
|
| 111 | fi |
106 | fi |
| 112 | done |
107 | done |
| 113 | fi |
|
|
| 114 | |
108 | |
|
|
109 | popd "${patch_dir}" >/dev/null |
| 115 | return "${ret}" |
110 | return ${ret} |
| 116 | } |
111 | } |
| 117 | |
112 | |
| 118 | elibtoolize() { |
113 | elibtoolize() { |
| 119 | local x= |
114 | local x= |
| 120 | local y= |
115 | local y= |