/[gentoo-x86]/eclass/libtool.eclass
Gentoo

Diff of /eclass/libtool.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.92 Revision 1.95
1# Copyright 1999-2010 Gentoo Foundation 1# Copyright 1999-2011 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.92 2011/06/10 10:14:21 flameeyes Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/libtool.eclass,v 1.95 2011/11/14 17:08:49 vapier Exp $
4 4
5# @ECLASS: libtool.eclass 5# @ECLASS: libtool.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# base-system@gentoo.org 7# base-system@gentoo.org
8# @BLURB: quickly update bundled libtool code 8# @BLURB: quickly update bundled libtool code
14# generated libtool files. We do not run the libtoolize program because that 14# generated libtool files. We do not run the libtoolize program because that
15# requires a regeneration of the main autotool files in order to work properly. 15# requires a regeneration of the main autotool files in order to work properly.
16 16
17DESCRIPTION="Based on the ${ECLASS} eclass" 17DESCRIPTION="Based on the ${ECLASS} eclass"
18 18
19inherit toolchain-funcs 19inherit multilib toolchain-funcs
20 20
21ELT_PATCH_DIR="${ECLASSDIR}/ELT-patches" 21ELT_PATCH_DIR="${ECLASSDIR}/ELT-patches"
22 22
23# 23#
24# See if we can apply $2 on $1, and if so, do it 24# See if we can apply $2 on $1, and if so, do it
25# 25#
26ELT_try_and_apply_patch() { 26ELT_try_and_apply_patch() {
27 local ret=0 27 local ret=0
28 local file=$1 28 local file=$1
29 local patch=$2 29 local patch=$2
30 local src=$3
31 local disp="${src} patch"
32 local log="${T}/elibtool.log"
30 33
31 echo -e "\nTrying $(basename "$(dirname "${patch}")")-${patch##*/}.patch on ${file}" \ 34 if [[ -z ${__ELT_NOTED_TMP} ]] ; then
32 &>> "${T}/elibtool.log" 35 __ELT_NOTED_TMP=true
36 printf 'temp patch: %s\n' "${patch}" > "${log}"
37 fi
38 printf '\nTrying %s\n' "${disp}" >> "${log}"
33 39
34 # We only support patchlevel of 0 - why worry if its static patches? 40 # We only support patchlevel of 0 - why worry if its static patches?
35 if patch -p0 --dry-run "${file}" "${patch}" &>> "${T}/elibtool.log" ; then 41 if patch -p0 --dry-run "${file}" "${patch}" >> "${log}" 2>&1 ; then
36 einfo " Applying $(basename "$(dirname "${patch}")")-${patch##*/}.patch ..." 42 einfo " Applying ${disp} ..."
37 patch -p0 -g0 --no-backup-if-mismatch "${file}" "${patch}" \ 43 patch -p0 -g0 --no-backup-if-mismatch "${file}" "${patch}" >> "${log}" 2>&1
38 &>> "${T}/elibtool.log"
39 ret=$? 44 ret=$?
40 export ELT_APPLIED_PATCHES="${ELT_APPLIED_PATCHES} ${patch##*/}" 45 export ELT_APPLIED_PATCHES="${ELT_APPLIED_PATCHES} ${src}"
41 else 46 else
42 ret=1 47 ret=1
43 fi 48 fi
44 49
45 return "${ret}" 50 return "${ret}"
59# 64#
60# Run through the patches in $2 and see if any 65# Run through the patches in $2 and see if any
61# apply to $1 ... 66# apply to $1 ...
62# 67#
63ELT_walk_patches() { 68ELT_walk_patches() {
64 local patch 69 local patch tmp
65 local ret=1 70 local ret=1
66 local file=$1 71 local file=$1
67 local patch_set=$2 72 local patch_set=$2
68 local patch_dir="${ELT_PATCH_DIR}/${patch_set}" 73 local patch_dir="${ELT_PATCH_DIR}/${patch_set}"
69 local rem_int_dep=$3 74 local rem_int_dep=$3
70 75
71 [[ -z ${patch_set} ]] && return 1 76 [[ -z ${patch_set} ]] && return 1
72 [[ ! -d ${patch_dir} ]] && return 1 77 [[ ! -d ${patch_dir} ]] && return 1
73 78
79 # Allow patches to use @GENTOO_LIBDIR@ replacements
80 local sed_args=( -e "s:@GENTOO_LIBDIR@:$(get_libdir):g" )
81 if [[ -n ${rem_int_dep} ]] ; then
82 # replace @REM_INT_DEP@ with what was passed
83 # to --remove-internal-dep
84 sed_args+=( -e "s|@REM_INT_DEP@|${rem_int_dep}|g" )
85 fi
86
74 pushd "${ELT_PATCH_DIR}" >/dev/null 87 pushd "${ELT_PATCH_DIR}" >/dev/null || die
75 88
76 # Go through the patches in reverse order (newer version to older) 89 # Go through the patches in reverse order (newer version to older)
77 for patch in $(find "${patch_set}" -maxdepth 1 -type f | LC_ALL=C sort -r) ; do 90 for patch in $(find "${patch_set}" -maxdepth 1 -type f | LC_ALL=C sort -r) ; do
78 # For --remove-internal-dep ... 91 tmp="${T}/libtool-elt.patch"
79 if [[ -n ${rem_int_dep} ]] ; then 92 sed "${sed_args[@]}" "${patch}" > "${tmp}" || die
80 # For replace @REM_INT_DEP@ with what was passed
81 # to --remove-internal-dep
82 local tmp="${T}/$$.rem_int_deps.patch"
83 sed -e "s|@REM_INT_DEP@|${rem_int_dep}|g" "${patch}" > "${tmp}"
84 patch=${tmp}
85 fi
86
87 if ELT_try_and_apply_patch "${file}" "${patch}" ; then 93 if ELT_try_and_apply_patch "${file}" "${tmp}" "${patch}" ; then
88 # Break to unwind w/popd rather than return directly 94 # Break to unwind w/popd rather than return directly
89 ret=0 95 ret=0
90 break 96 break
91 fi 97 fi
92 done 98 done
111 local do_reversedeps="no" 117 local do_reversedeps="no"
112 local do_only_patches="no" 118 local do_only_patches="no"
113 local do_uclibc="yes" 119 local do_uclibc="yes"
114 local deptoremove= 120 local deptoremove=
115 local do_shallow="no" 121 local do_shallow="no"
122 local force="false"
116 local elt_patches="install-sh ltmain portage relink max_cmd_len sed test tmp cross as-needed" 123 local elt_patches="install-sh ltmain portage relink max_cmd_len sed test tmp cross as-needed"
117 124
118 for x in "$@" ; do 125 for x in "$@" ; do
119 case ${x} in 126 case ${x} in
120 --portage) 127 --portage)
144 # Only patch the ltmain.sh in ${S} 151 # Only patch the ltmain.sh in ${S}
145 do_shallow="yes" 152 do_shallow="yes"
146 ;; 153 ;;
147 --no-uclibc) 154 --no-uclibc)
148 do_uclibc="no" 155 do_uclibc="no"
156 ;;
157 --force)
158 force="true"
149 ;; 159 ;;
150 *) 160 *)
151 eerror "Invalid elibtoolize option: ${x}" 161 eerror "Invalid elibtoolize option: ${x}"
152 die "elibtoolize called with ${x} ??" 162 die "elibtoolize called with ${x} ??"
153 esac 163 esac
178 188
179 local d p 189 local d p
180 for d in "$@" ; do 190 for d in "$@" ; do
181 export ELT_APPLIED_PATCHES= 191 export ELT_APPLIED_PATCHES=
182 192
183 [[ -f ${d}/.elibtoolized ]] && continue 193 if [[ -f ${d}/.elibtoolized ]] ; then
194 ${force} || continue
195 fi
184 196
185 einfo "Running elibtoolize in: ${d#${WORKDIR}/}/" 197 einfo "Running elibtoolize in: ${d#${WORKDIR}/}/"
198 if [[ -f ${d}/.elibtoolized ]] ; then
199 ewarn " We've already been run in this tree; you should"
200 ewarn " avoid this if possible (perhaps by filing a bug)"
201 fi
186 202
187 for p in ${elt_patches} ; do 203 for p in ${elt_patches} ; do
188 local ret=0 204 local ret=0
189 205
190 case ${p} in 206 case ${p} in

Legend:
Removed from v.1.92  
changed lines
  Added in v.1.95

  ViewVC Help
Powered by ViewVC 1.1.20