/[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.96
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.96 2011/11/18 17:32:14 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
12# 12#
13# Note, this eclass does not require libtool as it only applies patches to 13# Note, this eclass does not require libtool as it only applies patches to
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
17# If an overlay has eclass overrides, but doesn't actually override the
18# libtool.eclass, we'll have ECLASSDIR pointing to the active overlay's
19# eclass/ dir, but libtool.eclass is still in the main Gentoo tree. So
20# add a check to locate the ELT-patches/ regardless of what's going on.
21ECLASSDIR_LOCAL=${BASH_SOURCE[0]%/*}
22elt_patch_dir() {
23 local d="${ECLASSDIR}/ELT-patches"
24 if [[ ! -d ${d} ]] ; then
25 d="${ECLASSDIR_LOCAL}/ELT-patches"
26 fi
27 echo "${d}"
28}
29
17DESCRIPTION="Based on the ${ECLASS} eclass" 30DESCRIPTION="Based on the ${ECLASS} eclass"
18 31
19inherit toolchain-funcs 32inherit multilib toolchain-funcs
20
21ELT_PATCH_DIR="${ECLASSDIR}/ELT-patches"
22 33
23# 34#
24# See if we can apply $2 on $1, and if so, do it 35# See if we can apply $2 on $1, and if so, do it
25# 36#
26ELT_try_and_apply_patch() { 37ELT_try_and_apply_patch() {
27 local ret=0 38 local ret=0
28 local file=$1 39 local file=$1
29 local patch=$2 40 local patch=$2
41 local src=$3
42 local disp="${src} patch"
43 local log="${T}/elibtool.log"
30 44
31 echo -e "\nTrying $(basename "$(dirname "${patch}")")-${patch##*/}.patch on ${file}" \ 45 if [[ -z ${__ELT_NOTED_TMP} ]] ; then
32 &>> "${T}/elibtool.log" 46 __ELT_NOTED_TMP=true
47 printf 'temp patch: %s\n' "${patch}" > "${log}"
48 fi
49 printf '\nTrying %s\n' "${disp}" >> "${log}"
33 50
34 # We only support patchlevel of 0 - why worry if its static patches? 51 # We only support patchlevel of 0 - why worry if its static patches?
35 if patch -p0 --dry-run "${file}" "${patch}" &>> "${T}/elibtool.log" ; then 52 if patch -p0 --dry-run "${file}" "${patch}" >> "${log}" 2>&1 ; then
36 einfo " Applying $(basename "$(dirname "${patch}")")-${patch##*/}.patch ..." 53 einfo " Applying ${disp} ..."
37 patch -p0 -g0 --no-backup-if-mismatch "${file}" "${patch}" \ 54 patch -p0 -g0 --no-backup-if-mismatch "${file}" "${patch}" >> "${log}" 2>&1
38 &>> "${T}/elibtool.log"
39 ret=$? 55 ret=$?
40 export ELT_APPLIED_PATCHES="${ELT_APPLIED_PATCHES} ${patch##*/}" 56 export ELT_APPLIED_PATCHES="${ELT_APPLIED_PATCHES} ${src}"
41 else 57 else
42 ret=1 58 ret=1
43 fi 59 fi
44 60
45 return "${ret}" 61 return "${ret}"
59# 75#
60# Run through the patches in $2 and see if any 76# Run through the patches in $2 and see if any
61# apply to $1 ... 77# apply to $1 ...
62# 78#
63ELT_walk_patches() { 79ELT_walk_patches() {
64 local patch 80 local patch tmp
65 local ret=1 81 local ret=1
66 local file=$1 82 local file=$1
67 local patch_set=$2 83 local patch_set=$2
68 local patch_dir="${ELT_PATCH_DIR}/${patch_set}" 84 local patch_dir="$(elt_patch_dir)/${patch_set}"
69 local rem_int_dep=$3 85 local rem_int_dep=$3
70 86
71 [[ -z ${patch_set} ]] && return 1 87 [[ -z ${patch_set} ]] && return 1
72 [[ ! -d ${patch_dir} ]] && return 1 88 [[ ! -d ${patch_dir} ]] && return 1
73 89
74 pushd "${ELT_PATCH_DIR}" >/dev/null 90 # Allow patches to use @GENTOO_LIBDIR@ replacements
91 local sed_args=( -e "s:@GENTOO_LIBDIR@:$(get_libdir):g" )
92 if [[ -n ${rem_int_dep} ]] ; then
93 # replace @REM_INT_DEP@ with what was passed
94 # to --remove-internal-dep
95 sed_args+=( -e "s|@REM_INT_DEP@|${rem_int_dep}|g" )
96 fi
97
98 pushd "$(elt_patch_dir)" >/dev/null || die
75 99
76 # Go through the patches in reverse order (newer version to older) 100 # 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 101 for patch in $(find "${patch_set}" -maxdepth 1 -type f | LC_ALL=C sort -r) ; do
78 # For --remove-internal-dep ... 102 tmp="${T}/libtool-elt.patch"
79 if [[ -n ${rem_int_dep} ]] ; then 103 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 104 if ELT_try_and_apply_patch "${file}" "${tmp}" "${patch}" ; then
88 # Break to unwind w/popd rather than return directly 105 # Break to unwind w/popd rather than return directly
89 ret=0 106 ret=0
90 break 107 break
91 fi 108 fi
92 done 109 done
111 local do_reversedeps="no" 128 local do_reversedeps="no"
112 local do_only_patches="no" 129 local do_only_patches="no"
113 local do_uclibc="yes" 130 local do_uclibc="yes"
114 local deptoremove= 131 local deptoremove=
115 local do_shallow="no" 132 local do_shallow="no"
133 local force="false"
116 local elt_patches="install-sh ltmain portage relink max_cmd_len sed test tmp cross as-needed" 134 local elt_patches="install-sh ltmain portage relink max_cmd_len sed test tmp cross as-needed"
117 135
118 for x in "$@" ; do 136 for x in "$@" ; do
119 case ${x} in 137 case ${x} in
120 --portage) 138 --portage)
144 # Only patch the ltmain.sh in ${S} 162 # Only patch the ltmain.sh in ${S}
145 do_shallow="yes" 163 do_shallow="yes"
146 ;; 164 ;;
147 --no-uclibc) 165 --no-uclibc)
148 do_uclibc="no" 166 do_uclibc="no"
167 ;;
168 --force)
169 force="true"
149 ;; 170 ;;
150 *) 171 *)
151 eerror "Invalid elibtoolize option: ${x}" 172 eerror "Invalid elibtoolize option: ${x}"
152 die "elibtoolize called with ${x} ??" 173 die "elibtoolize called with ${x} ??"
153 esac 174 esac
178 199
179 local d p 200 local d p
180 for d in "$@" ; do 201 for d in "$@" ; do
181 export ELT_APPLIED_PATCHES= 202 export ELT_APPLIED_PATCHES=
182 203
183 [[ -f ${d}/.elibtoolized ]] && continue 204 if [[ -f ${d}/.elibtoolized ]] ; then
205 ${force} || continue
206 fi
184 207
185 einfo "Running elibtoolize in: ${d#${WORKDIR}/}/" 208 einfo "Running elibtoolize in: ${d#${WORKDIR}/}/"
209 if [[ -f ${d}/.elibtoolized ]] ; then
210 ewarn " We've already been run in this tree; you should"
211 ewarn " avoid this if possible (perhaps by filing a bug)"
212 fi
186 213
187 for p in ${elt_patches} ; do 214 for p in ${elt_patches} ; do
188 local ret=0 215 local ret=0
189 216
190 case ${p} in 217 case ${p} in

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

  ViewVC Help
Powered by ViewVC 1.1.20