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

Diff of /eclass/libtool.eclass

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

Revision 1.49 Revision 1.53
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.49 2005/07/06 20:23:20 agriffis Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/libtool.eclass,v 1.53 2005/09/02 21:12:09 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
20 20
21ELIBTOOL_VERSION="2.0.2" 21ELIBTOOL_VERSION="2.0.2"
22 22
23ELT_PATCH_DIR="${PORTDIR}/eclass/ELT-patches" 23ELT_PATCH_DIR="${PORTDIR}/eclass/ELT-patches"
24ELT_APPLIED_PATCHES= 24ELT_APPLIED_PATCHES=
25ELT_LTMAIN_SH=
25 26
26# 27#
27# Returns all the directories containing ltmain.sh 28# Returns all the directories containing ltmain.sh
28# 29#
29ELT_find_ltmain_sh() { 30ELT_find_ltmain_sh() {
64ELT_walk_patches() { 65ELT_walk_patches() {
65 local x= 66 local x=
66 local y= 67 local y=
67 local ret=1 68 local ret=1
68 local patch_dir= 69 local patch_dir=
70 local version=
71 local ltmain_sh=$1
72
73 [[ $1 == *"/configure" ]] && ltmain_sh=${ELT_LTMAIN_SH}
69 local version=$(eval $(grep -e '^[[:space:]]*VERSION=' $1); \ 74 version=$(eval $(grep -e '^[[:space:]]*VERSION=' "${ltmain_sh}"); \
70 echo "${VERSION}") 75 echo "${VERSION}")
71 76
72 if [[ -n $2 ]] ; then 77 if [[ -n $2 ]] ; then
73 if [[ -d ${ELT_PATCH_DIR}/$2 ]] ; then 78 if [[ -d ${ELT_PATCH_DIR}/$2 ]] ; then
74 patch_dir="${ELT_PATCH_DIR}/$2" 79 patch_dir="${ELT_PATCH_DIR}/$2"
84 # Go through the patches in reverse order (large to small) 89 # Go through the patches in reverse order (large to small)
85 for x in $(ls -d "${patch_dir}"/* 2> /dev/null | sort -r) ; do 90 for x in $(ls -d "${patch_dir}"/* 2> /dev/null | sort -r) ; do
86 if [[ -n ${x} && -f ${x} ]] ; then 91 if [[ -n ${x} && -f ${x} ]] ; then
87 local ltver=$(VER_to_int "${version}") 92 local ltver=$(VER_to_int "${version}")
88 local ptver=$(VER_to_int "${x##*/}") 93 local ptver=$(VER_to_int "${x##*/}")
89 94
90 # If libtool version smaller than patch version, skip patch. 95 # If libtool version smaller than patch version, skip patch.
91 [[ ${ltver} -lt ${ptver} ]] && continue 96 [[ ${ltver} -lt ${ptver} ]] && continue
92 # For --remove-internal-dep ... 97 # For --remove-internal-dep ...
93 if [[ -n $3 ]] ; then 98 if [[ -n $3 ]] ; then
94 # For replace @REM_INT_DEP@ with what was passed 99 # For replace @REM_INT_DEP@ with what was passed
116 local do_portage="no" 121 local do_portage="no"
117 local do_reversedeps="no" 122 local do_reversedeps="no"
118 local do_only_patches="no" 123 local do_only_patches="no"
119 local deptoremove= 124 local deptoremove=
120 local my_dirlist= 125 local my_dirlist=
121 local elt_patches="portage relink max_cmd_len sed test tmp" 126 local elt_patches="portage relink max_cmd_len sed test tmp \
127 uclibc-conf uclibc-ltconf"
122 local start_dir="${PWD}" 128 local start_dir="${PWD}"
123 129
124 my_dirlist="$(ELT_find_ltmain_sh)" 130 my_dirlist="$(ELT_find_ltmain_sh)"
125 131
126 for x in "$@" ; do 132 for x in "$@" ; do
165 die "elibtoolize called with $x ??" 171 die "elibtoolize called with $x ??"
166 esac 172 esac
167 done 173 done
168 174
169 if use ppc-macos ; then 175 if use ppc-macos ; then
176 local opts
177 [[ -f Makefile.am ]] && opts="--automake"
170 glibtoolize --copy --force 178 glibtoolize --copy --force ${opts}
171 darwintoolize 179 darwintoolize
172 fi 180 fi
173 181
174 for x in ${my_dirlist} ; do 182 for x in ${my_dirlist} ; do
175 local tmp=$(echo "${x}" | sed -e "s|${S}||") 183 local tmp=$(echo "${x}" | sed -e "s|${WORKDIR}||")
176 export ELT_APPLIED_PATCHES= 184 export ELT_APPLIED_PATCHES=
185 export ELT_LTMAIN_SH="${x}/ltmain.sh"
186
187 [[ -f ${x}/.elibtoolized ]] && continue
177 188
178 cd ${x} 189 cd ${x}
179 einfo "Patching \${S}$(echo "/${tmp}/ltmain.sh" | sed -e 's|//|/|g') ..." 190 einfo "Running elibtoolize in: $(echo "/${tmp}" | sed -e 's|//|/|g; s|^/||')"
180 191
181 for y in ${elt_patches} ; do 192 for y in ${elt_patches} ; do
182 local ret=0 193 local ret=0
183 194
184 case "${y}" in 195 case "${y}" in
195 ;; 206 ;;
196 "max_cmd_len") 207 "max_cmd_len")
197 # Do not apply if $max_cmd_len is not used ... 208 # Do not apply if $max_cmd_len is not used ...
198 if [[ -n $(grep 'max_cmd_len' "${x}/ltmain.sh") ]] ; then 209 if [[ -n $(grep 'max_cmd_len' "${x}/ltmain.sh") ]] ; then
199 ELT_walk_patches "${x}/ltmain.sh" "${y}" 210 ELT_walk_patches "${x}/ltmain.sh" "${y}"
211 ret=$?
212 fi
213 ;;
214 "uclibc-conf")
215 if [[ -e ${x}/configure ]] && \
216 grep 'Transform linux' "${x}/configure" > /dev/null ; then
217 ELT_walk_patches "${x}/configure" "${y}"
218 ret=$?
219 # ltmain.sh and co might be in a subdirectory ...
220 elif [[ ! -e ${x}/configure && -e ${x}/../configure ]] && \
221 grep 'Transform linux' "${x}/../configure" > /dev/null ; then
222 ELT_walk_patches "${x}/../configure" "${y}"
223 ret=$?
224 fi
225 ;;
226 "uclibc-ltconf")
227 if [[ -e ${x}/ltconfig ]] ; then
228 ELT_walk_patches "${x}/ltconfig" "${y}"
200 ret=$? 229 ret=$?
201 fi 230 fi
202 ;; 231 ;;
203 *) 232 *)
204 ELT_walk_patches "${x}/ltmain.sh" "${y}" 233 ELT_walk_patches "${x}/ltmain.sh" "${y}"
224 eerror "Portage patch requested, but failed to apply!" 253 eerror "Portage patch requested, but failed to apply!"
225 die "Portage patch requested, but failed to apply!" 254 die "Portage patch requested, but failed to apply!"
226 fi 255 fi
227 else 256 else
228 if [[ -n $(grep 'We do not want portage' "${x}/ltmain.sh") ]] ; then 257 if [[ -n $(grep 'We do not want portage' "${x}/ltmain.sh") ]] ; then
229 ewarn " Portage patch seems to be already applied." 258 # ewarn " Portage patch seems to be already applied."
230 ewarn " Please verify that it is not needed." 259 # ewarn " Please verify that it is not needed."
260 :
231 else 261 else
232 local version=$( \ 262 local version=$( \
233 eval $(grep -e '^[[:space:]]*VERSION=' "${x}/ltmain.sh"); \ 263 eval $(grep -e '^[[:space:]]*VERSION=' "${x}/ltmain.sh"); \
234 echo "${VERSION}") 264 echo "${VERSION}")
235 265
239 fi 269 fi
240 # We do not want to run libtoolize ... 270 # We do not want to run libtoolize ...
241 ELT_APPLIED_PATCHES="portage" 271 ELT_APPLIED_PATCHES="portage"
242 fi 272 fi
243 ;; 273 ;;
274 "uclibc-"*)
275 [[ ${CHOST} == *"-uclibc" ]] && \
276 ewarn " uClibc patch set '${y}' failed to apply!"
277 ;;
244 esac 278 esac
245 fi 279 fi
280 done
246 281
247 if [[ -z ${ELT_APPLIED_PATCHES} ]] ; then 282 if [[ -z ${ELT_APPLIED_PATCHES} ]] ; then
248 if [[ ${do_portage} == "no" && \ 283 if [[ ${do_portage} == "no" && \
249 ${do_reversedeps} == "no" && \ 284 ${do_reversedeps} == "no" && \
250 ${do_only_patches} == "no" && \ 285 ${do_only_patches} == "no" && \
251 ${deptoremove} == "" ]] 286 ${deptoremove} == "" ]]
252 then 287 then
253 ewarn "Cannot apply any patches, please file a bug about this" 288 ewarn "Cannot apply any patches, please file a bug about this"
254 break 289 break
255 290
256 # Sometimes ltmain.sh is in a subdirectory ... 291 # Sometimes ltmain.sh is in a subdirectory ...
257 if [[ ! -f ${x}/configure.in && ! -f ${x}/configure.ac ]] ; then 292 if [[ ! -f ${x}/configure.in && ! -f ${x}/configure.ac ]] ; then
258 if [[ -f ${x}/../configure.in || -f ${x}/../configure.ac ]] ; then 293 if [[ -f ${x}/../configure.in || -f ${x}/../configure.ac ]] ; then
259 cd "${x}"/../ 294 cd "${x}"/../
260 fi
261 fi 295 fi
262
263 if type -p libtoolize &> /dev/null ; then
264 ewarn "Cannot apply any patches, running libtoolize..."
265 libtoolize --copy --force
266 fi
267 cd "${x}"
268 break
269 fi 296 fi
297
298 if type -p libtoolize &> /dev/null ; then
299 ewarn "Cannot apply any patches, running libtoolize..."
300 libtoolize --copy --force
301 fi
302 cd "${x}"
303 break
270 fi 304 fi
271 done 305 fi
306
307 [[ -f ${x}/libtool ]] && rm -f "${x}/libtool"
308
309 touch "${x}/.elibtoolized"
272 done 310 done
273 311
274 if [[ -f libtool ]] ; then
275 rm -f libtool
276 fi
277
278 cd "${start_dir}" 312 cd "${start_dir}"
279
280 uclibctoolize
281} 313}
282 314
283uclibctoolize() { 315uclibctoolize() {
284 [[ -n ${NO_UCLIBCTOOLIZE} ]] && return 0 316 ewarn "uclibctoolize() is depreciated, please just use libtoolize()!"
285 317 elibtoolize
286 local errmsg=""
287 [[ ${CTARGET:-${CHOST}} == *-uclibc ]] \
288 && errmsg="PLEASE CHECK" \
289 || errmsg="Already patched"
290 local targets=""
291 local x
292
293 if [[ -z $* ]] ; then
294 targets=$(find ${S} -name configure -o -name ltconfig)
295 fi
296
297 einfo "Applying uClibc/libtool patches ..."
298 for x in ${targets} ; do
299 [[ ! -s ${x} ]] && continue
300 case ${x##*/} in
301 configure)
302 if grep 'Transform linux' "${x}" > /dev/null ; then
303 ebegin " Fixing \${S}${x/${S}}"
304 patch -p0 "${x}" "${ELT_PATCH_DIR}/uclibc/configure.patch" > /dev/null
305 eend $? "${errmsg} ${x}"
306 fi
307 ;;
308
309 ltconfig)
310 local ver=$(grep '^VERSION=' ${x})
311 ver=${ver/VERSION=}
312 [[ ${ver:0:3} == "1.4" ]] && ver="1.3" # 1.4 and 1.3 are compat
313 ebegin " Fixing \${S}${x/${S}}"
314 patch -p0 "${x}" "${ELT_PATCH_DIR}/uclibc/ltconfig-${ver:0:3}.patch" > /dev/null
315 eend $? "${errmsg} ${x}"
316 ;;
317 esac
318 done
319} 318}
320 319
321darwintoolize() { 320darwintoolize() {
322 local targets="" 321 local targets=""
323 local x 322 local x

Legend:
Removed from v.1.49  
changed lines
  Added in v.1.53

  ViewVC Help
Powered by ViewVC 1.1.20