1 | # Copyright 1999-2004 Gentoo Technologies, Inc. |
1 | # Copyright 1999-2004 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.25 2004/02/11 19:33:14 azarah Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/libtool.eclass,v 1.31 2004/09/22 20:04:27 vapier 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 |
9 | |
9 | |
10 | ECLASS="libtool" |
10 | ECLASS="libtool" |
11 | INHERITED="${INHERITED} ${ECLASS}" |
11 | INHERITED="${INHERITED} ${ECLASS}" |
12 | |
12 | |
13 | newdepend "!bootstrap? ( sys-devel/libtool )" |
13 | DEPEND="!bootstrap? ( sys-devel/libtool )" |
14 | |
14 | |
15 | DESCRIPTION="Based on the ${ECLASS} eclass" |
15 | DESCRIPTION="Based on the ${ECLASS} eclass" |
16 | |
16 | |
17 | ELIBTOOL_VERSION="2.0.1" |
17 | ELIBTOOL_VERSION="2.0.1" |
18 | |
18 | |
… | |
… | |
25 | # |
25 | # |
26 | ELT_find_ltmain_sh() { |
26 | ELT_find_ltmain_sh() { |
27 | local x= |
27 | local x= |
28 | local dirlist= |
28 | local dirlist= |
29 | |
29 | |
30 | for x in $(find "${S}" -name 'ltmain.sh') |
30 | for x in $(find "${S}" -name 'ltmain.sh') |
31 | do |
31 | do |
32 | dirlist="${dirlist} ${x%/*}" |
32 | dirlist="${dirlist} ${x%/*}" |
33 | done |
33 | done |
34 | |
34 | |
35 | echo "${dirlist}" |
35 | echo "${dirlist}" |
36 | } |
36 | } |
37 | |
37 | |
38 | # |
38 | # |
39 | # See if we can apply $2 on $1, and if so, do it |
39 | # See if we can apply $2 on $1, and if so, do it |
40 | # |
40 | # |
… | |
… | |
72 | then |
72 | then |
73 | patch_dir="${ELT_PATCH_DIR}/$2" |
73 | patch_dir="${ELT_PATCH_DIR}/$2" |
74 | else |
74 | else |
75 | return ${ret} |
75 | return ${ret} |
76 | fi |
76 | fi |
77 | |
77 | |
78 | for x in $(ls -d "${patch_dir}"/* 2>/dev/null) |
78 | for x in $(ls -d "${patch_dir}"/* 2>/dev/null) |
79 | do |
79 | do |
80 | if [ -n "${x}" -a -f "${x}" ] |
80 | if [ -n "${x}" -a -f "${x}" ] |
81 | then |
81 | then |
82 | # For --remove-internal-dep ... |
82 | # For --remove-internal-dep ... |
… | |
… | |
84 | then |
84 | then |
85 | # For replace @REM_INT_DEP@ with what was passed |
85 | # For replace @REM_INT_DEP@ with what was passed |
86 | # to --remove-internal-dep |
86 | # to --remove-internal-dep |
87 | sed -e "s|@REM_INT_DEP@|$3|g" ${x} > \ |
87 | sed -e "s|@REM_INT_DEP@|$3|g" ${x} > \ |
88 | ${T}/$$.rem_int_deps.patch |
88 | ${T}/$$.rem_int_deps.patch |
89 | |
89 | |
90 | x="${T}/$$.rem_int_deps.patch" |
90 | x="${T}/$$.rem_int_deps.patch" |
91 | fi |
91 | fi |
92 | |
92 | |
93 | if ELT_try_and_apply_patch "$1" "${x}" |
93 | if ELT_try_and_apply_patch "$1" "${x}" |
94 | then |
94 | then |
95 | ret=0 |
95 | ret=0 |
96 | break |
96 | break |
97 | fi |
97 | fi |
… | |
… | |
109 | local do_reversedeps="no" |
109 | local do_reversedeps="no" |
110 | local do_only_patches="no" |
110 | local do_only_patches="no" |
111 | local deptoremove= |
111 | local deptoremove= |
112 | local my_dirlist= |
112 | local my_dirlist= |
113 | local elt_patches="portage relink max_cmd_len sed test tmp" |
113 | local elt_patches="portage relink max_cmd_len sed test tmp" |
|
|
114 | local start_dir="${PWD}" |
114 | |
115 | |
115 | my_dirlist="$(ELT_find_ltmain_sh)" |
116 | my_dirlist="$(ELT_find_ltmain_sh)" |
116 | |
117 | |
117 | for x in $* |
118 | for x in "$@" |
118 | do |
119 | do |
119 | case "${x}" in |
120 | case "${x}" in |
120 | "--portage") |
121 | "--portage") |
121 | # Only apply portage patch, and don't |
122 | # Only apply portage patch, and don't |
122 | # 'libtoolize --copy --force' if all patches fail. |
123 | # 'libtoolize --copy --force' if all patches fail. |
… | |
… | |
154 | |
155 | |
155 | for x in ${my_dirlist} |
156 | for x in ${my_dirlist} |
156 | do |
157 | do |
157 | local tmp="$(echo "${x}" | sed -e "s|${S}||")" |
158 | local tmp="$(echo "${x}" | sed -e "s|${S}||")" |
158 | export ELT_APPLIED_PATCHES= |
159 | export ELT_APPLIED_PATCHES= |
159 | |
160 | |
160 | cd ${x} |
161 | cd ${x} |
161 | einfo "Patching \${S}$(echo "/${tmp}/ltmain.sh" | sed -e 's|//|/|g')..." |
162 | einfo "Patching \${S}$(echo "/${tmp}/ltmain.sh" | sed -e 's|//|/|g')..." |
162 | |
163 | |
163 | for y in ${elt_patches} |
164 | for y in ${elt_patches} |
164 | do |
165 | do |
… | |
… | |
188 | *) |
189 | *) |
189 | ELT_walk_patches "${x}/ltmain.sh" "${y}" |
190 | ELT_walk_patches "${x}/ltmain.sh" "${y}" |
190 | ret=$? |
191 | ret=$? |
191 | ;; |
192 | ;; |
192 | esac |
193 | esac |
193 | |
194 | |
194 | if [ "${ret}" -ne 0 ] |
195 | if [ "${ret}" -ne 0 ] |
195 | then |
196 | then |
196 | case ${y} in |
197 | case ${y} in |
197 | "relink") |
198 | "relink") |
198 | # Critical patch, but could be applied ... |
199 | # Critical patch, but could be applied ... |
… | |
… | |
252 | if [ -f libtool ] |
253 | if [ -f libtool ] |
253 | then |
254 | then |
254 | rm -f libtool |
255 | rm -f libtool |
255 | fi |
256 | fi |
256 | |
257 | |
257 | # We need to change the pwd back to $S, as we may be called in |
258 | cd "${start_dir}" |
258 | # src_compile() |
|
|
259 | cd ${S} |
|
|
260 | } |
|
|
261 | |
259 | |
|
|
260 | uclibctoolize |
|
|
261 | } |
|
|
262 | |
|
|
263 | uclibctoolize() { |
|
|
264 | local targets="" |
|
|
265 | local x |
|
|
266 | |
|
|
267 | if [ -z "$@" ] ; then |
|
|
268 | targets="$(find ${S} -name configure)" |
|
|
269 | fi |
|
|
270 | |
|
|
271 | einfo "Applying uClibc/libtool patches ..." |
|
|
272 | for x in ${targets} ; do |
|
|
273 | case $(basename "${x}") in |
|
|
274 | configure) |
|
|
275 | if grep 'Transform linux' "${x}" >/dev/null ; then |
|
|
276 | ebegin " Fixing \${S}${x/${S}}" |
|
|
277 | patch -p0 "${x}" "${ELT_PATCH_DIR}/uclibc/configure.patch" > /dev/null |
|
|
278 | eend $? "PLEASE CHECK ${x}" |
|
|
279 | fi |
|
|
280 | ;; |
|
|
281 | |
|
|
282 | ltconfig) |
|
|
283 | local ver="$(grep '^VERSION=' ${x})" |
|
|
284 | ver="${ver/VERSION=}" |
|
|
285 | ebegin " Fixing \${S}${x/${S}}" |
|
|
286 | patch -p0 "${x}" "${ELT_PATCH_DIR}/uclibc/ltconfig-${ver:0:3}.patch" > /dev/null |
|
|
287 | eend $? "PLEASE CHECK ${x}" |
|
|
288 | ;; |
|
|
289 | esac |
|
|
290 | done |
|
|
291 | } |