| 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.42 2005/01/31 03:02:13 vapier Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/libtool.eclass,v 1.43 2005/02/27 20:29:04 azarah 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 |
| … | |
… | |
| 66 | ELT_walk_patches() { |
66 | ELT_walk_patches() { |
| 67 | local x= |
67 | local x= |
| 68 | local y= |
68 | local y= |
| 69 | local ret=1 |
69 | local ret=1 |
| 70 | local patch_dir= |
70 | local patch_dir= |
|
|
71 | local version=$(eval $(grep -e '^[[:space:]]*VERSION=' $1); echo "${VERSION}") |
| 71 | |
72 | |
| 72 | if [[ -n $2 ]] ; then |
73 | if [[ -n $2 ]] ; then |
| 73 | if [[ -d ${ELT_PATCH_DIR}/$2 ]] ; then |
74 | if [[ -d ${ELT_PATCH_DIR}/$2 ]] ; then |
| 74 | patch_dir="${ELT_PATCH_DIR}/$2" |
75 | patch_dir="${ELT_PATCH_DIR}/$2" |
| 75 | else |
76 | else |
| 76 | return ${ret} |
77 | return ${ret} |
| 77 | fi |
78 | fi |
| 78 | |
79 | |
|
|
80 | # First check a version specific patch, if not check major.minor* |
|
|
81 | for y in ${version} $(echo "${version}" | cut -d. -f1,2) ; do |
|
|
82 | [[ -z ${y} ]] && continue |
| 79 | for x in $(ls -d "${patch_dir}"/* 2> /dev/null) ; do |
83 | for x in $(ls -d "${patch_dir}/${y}"* 2> /dev/null) ; do |
| 80 | if [[ -n ${x} && -f ${x} ]] ; then |
84 | if [[ -n ${x} && -f ${x} ]] ; then |
| 81 | # For --remove-internal-dep ... |
85 | # For --remove-internal-dep ... |
| 82 | if [[ -n $3 ]] ; then |
86 | if [[ -n $3 ]] ; then |
| 83 | # For replace @REM_INT_DEP@ with what was passed |
87 | # For replace @REM_INT_DEP@ with what was passed |
| 84 | # to --remove-internal-dep |
88 | # to --remove-internal-dep |
| 85 | sed -e "s|@REM_INT_DEP@|$3|g" ${x} > \ |
89 | sed -e "s|@REM_INT_DEP@|$3|g" ${x} > \ |
| 86 | ${T}/$$.rem_int_deps.patch |
90 | ${T}/$$.rem_int_deps.patch |
| 87 | |
91 | |
| 88 | x="${T}/$$.rem_int_deps.patch" |
92 | x="${T}/$$.rem_int_deps.patch" |
|
|
93 | fi |
|
|
94 | |
|
|
95 | if ELT_try_and_apply_patch "$1" "${x}" ; then |
|
|
96 | ret=0 |
|
|
97 | break |
|
|
98 | fi |
| 89 | fi |
99 | fi |
|
|
100 | done |
|
|
101 | done |
| 90 | |
102 | |
|
|
103 | # If still nothing, try the rest. |
|
|
104 | if [[ ${ret} -eq 1 ]]; then |
|
|
105 | for x in $(ls -d "${patch_dir}"/* 2> /dev/null) ; do |
|
|
106 | if [[ -n ${x} && -f ${x} ]] ; then |
|
|
107 | # For --remove-internal-dep ... |
|
|
108 | if [[ -n $3 ]] ; then |
|
|
109 | # For replace @REM_INT_DEP@ with what was passed |
|
|
110 | # to --remove-internal-dep |
|
|
111 | sed -e "s|@REM_INT_DEP@|$3|g" ${x} > \ |
|
|
112 | ${T}/$$.rem_int_deps.patch |
|
|
113 | |
|
|
114 | x="${T}/$$.rem_int_deps.patch" |
|
|
115 | fi |
|
|
116 | |
| 91 | if ELT_try_and_apply_patch "$1" "${x}" ; then |
117 | if ELT_try_and_apply_patch "$1" "${x}" ; then |
| 92 | ret=0 |
118 | ret=0 |
| 93 | break |
119 | break |
|
|
120 | fi |
| 94 | fi |
121 | fi |
| 95 | fi |
|
|
| 96 | done |
122 | done |
|
|
123 | fi |
| 97 | fi |
124 | fi |
| 98 | |
125 | |
| 99 | return ${ret} |
126 | return ${ret} |
| 100 | } |
127 | } |
| 101 | |
128 | |