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.88 2010/05/11 04:45:48 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 >/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= |
… | |
… | |
373 | if [[ ${do_portage} == "yes" ]] ; then |
368 | if [[ ${do_portage} == "yes" ]] ; then |
374 | # Stupid test to see if its already applied ... |
369 | # Stupid test to see if its already applied ... |
375 | if [[ -z $(grep 'We do not want portage' "${x}/ltmain.sh") ]] ; then |
370 | if [[ -z $(grep 'We do not want portage' "${x}/ltmain.sh") ]] ; then |
376 | echo |
371 | echo |
377 | eerror "Portage patch requested, but failed to apply!" |
372 | eerror "Portage patch requested, but failed to apply!" |
378 | eerror "Please bug azarah or vapier to add proper patch." |
373 | eerror "Please file a bug report to add a proper patch." |
379 | die "Portage patch requested, but failed to apply!" |
374 | die "Portage patch requested, but failed to apply!" |
380 | fi |
375 | fi |
381 | else |
376 | else |
382 | if [[ -n $(grep 'We do not want portage' "${x}/ltmain.sh") ]] ; then |
377 | if [[ -n $(grep 'We do not want portage' "${x}/ltmain.sh") ]] ; then |
383 | # ewarn " Portage patch seems to be already applied." |
378 | # ewarn " Portage patch seems to be already applied." |
… | |
… | |
388 | eval $(grep -e '^[[:space:]]*VERSION=' "${x}/ltmain.sh"); \ |
383 | eval $(grep -e '^[[:space:]]*VERSION=' "${x}/ltmain.sh"); \ |
389 | echo "${VERSION}") |
384 | echo "${VERSION}") |
390 | |
385 | |
391 | echo |
386 | echo |
392 | eerror "Portage patch failed to apply (ltmain.sh version ${version})!" |
387 | eerror "Portage patch failed to apply (ltmain.sh version ${version})!" |
393 | eerror "Please bug azarah or vapier to add proper patch." |
388 | eerror "Please file a bug report to add a proper patch." |
394 | die "Portage patch failed to apply!" |
389 | die "Portage patch failed to apply!" |
395 | fi |
390 | fi |
396 | # We do not want to run libtoolize ... |
391 | # We do not want to run libtoolize ... |
397 | ELT_APPLIED_PATCHES="portage" |
392 | ELT_APPLIED_PATCHES="portage" |
398 | fi |
393 | fi |