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

Diff of /eclass/libtool.eclass

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

Revision 1.50 Revision 1.56
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.50 2005/07/11 15:08:06 swegener Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/libtool.eclass,v 1.56 2005/09/04 20:23:42 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"
114 local x= 119 local x=
115 local y= 120 local y=
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"
124 local do_uclibc="yes"
119 local deptoremove= 125 local deptoremove=
120 local my_dirlist= 126 local my_dirlist=
121 local elt_patches="portage relink max_cmd_len sed test tmp" 127 local elt_patches="portage relink max_cmd_len sed test tmp"
122 local start_dir="${PWD}" 128 local start_dir="${PWD}"
123 129
156 else 162 else
157 my_dirlist= 163 my_dirlist=
158 fi 164 fi
159 ;; 165 ;;
160 "--no-uclibc") 166 "--no-uclibc")
161 NO_UCLIBCTOOLIZE=1 167 do_uclibc="no"
162 ;; 168 ;;
163 *) 169 *)
164 eerror "Invalid elibtoolize option: $x" 170 eerror "Invalid elibtoolize option: $x"
165 die "elibtoolize called with $x ??" 171 die "elibtoolize called with $x ??"
166 esac 172 esac
167 done 173 done
168 174
175 [[ ${do_uclibc} == "yes" ]] && \
176 elt_patches="${elt_patches} uclibc-conf uclibc-ltconf"
177
178 [[ ${CHOST} == *"-freebsd"* ]] && \
179 elt_patches="${elt_patches} fbsd-conf"
180
169 if use ppc-macos ; then 181 if use ppc-macos ; then
182 local opts
183 [[ -f Makefile.am ]] && opts="--automake"
170 glibtoolize --copy --force 184 glibtoolize --copy --force ${opts}
171 darwintoolize 185 darwintoolize
172 fi 186 fi
173 187
174 for x in ${my_dirlist} ; do 188 for x in ${my_dirlist} ; do
175 local tmp=$(echo "${x}" | sed -e "s|${S}||") 189 local tmp=$(echo "${x}" | sed -e "s|${WORKDIR}||")
176 export ELT_APPLIED_PATCHES= 190 export ELT_APPLIED_PATCHES=
191 export ELT_LTMAIN_SH="${x}/ltmain.sh"
192
193 [[ -f ${x}/.elibtoolized ]] && continue
177 194
178 cd ${x} 195 cd ${x}
179 einfo "Patching \${S}$(echo "/${tmp}/ltmain.sh" | sed -e 's|//|/|g') ..." 196 einfo "Running elibtoolize in: $(echo "/${tmp}" | sed -e 's|//|/|g; s|^/||')"
180 197
181 for y in ${elt_patches} ; do 198 for y in ${elt_patches} ; do
182 local ret=0 199 local ret=0
183 200
184 case "${y}" in 201 case "${y}" in
195 ;; 212 ;;
196 "max_cmd_len") 213 "max_cmd_len")
197 # Do not apply if $max_cmd_len is not used ... 214 # Do not apply if $max_cmd_len is not used ...
198 if [[ -n $(grep 'max_cmd_len' "${x}/ltmain.sh") ]] ; then 215 if [[ -n $(grep 'max_cmd_len' "${x}/ltmain.sh") ]] ; then
199 ELT_walk_patches "${x}/ltmain.sh" "${y}" 216 ELT_walk_patches "${x}/ltmain.sh" "${y}"
217 ret=$?
218 fi
219 ;;
220 "uclibc-conf")
221 if [[ -e ${x}/configure ]] && \
222 grep 'Transform linux' "${x}/configure" > /dev/null ; then
223 ELT_walk_patches "${x}/configure" "${y}"
224 ret=$?
225 # ltmain.sh and co might be in a subdirectory ...
226 elif [[ ! -e ${x}/configure && -e ${x}/../configure ]] && \
227 grep 'Transform linux' "${x}/../configure" > /dev/null ; then
228 ELT_walk_patches "${x}/../configure" "${y}"
229 ret=$?
230 fi
231 ;;
232 "uclibc-ltconf")
233 if [[ -e ${x}/ltconfig ]] ; then
234 ELT_walk_patches "${x}/ltconfig" "${y}"
235 ret=$?
236 fi
237 ;;
238 "fbsd-conf")
239 if [[ -e ${x}/configure ]] && \
240 grep 'version_type=freebsd-' "${x}/configure" > /dev/null ; then
241 ELT_walk_patches "${x}/configure" "${y}"
242 ret=$?
243 # ltmain.sh and co might be in a subdirectory ...
244 elif [[ ! -e ${x}/configure && -e ${x}/../configure ]] && \
245 grep 'version_type=freebsd-' "${x}/../configure" > /dev/null ; then
246 ELT_walk_patches "${x}/../configure" "${y}"
200 ret=$? 247 ret=$?
201 fi 248 fi
202 ;; 249 ;;
203 *) 250 *)
204 ELT_walk_patches "${x}/ltmain.sh" "${y}" 251 ELT_walk_patches "${x}/ltmain.sh" "${y}"
224 eerror "Portage patch requested, but failed to apply!" 271 eerror "Portage patch requested, but failed to apply!"
225 die "Portage patch requested, but failed to apply!" 272 die "Portage patch requested, but failed to apply!"
226 fi 273 fi
227 else 274 else
228 if [[ -n $(grep 'We do not want portage' "${x}/ltmain.sh") ]] ; then 275 if [[ -n $(grep 'We do not want portage' "${x}/ltmain.sh") ]] ; then
229 ewarn " Portage patch seems to be already applied." 276 # ewarn " Portage patch seems to be already applied."
230 ewarn " Please verify that it is not needed." 277 # ewarn " Please verify that it is not needed."
278 :
231 else 279 else
232 local version=$( \ 280 local version=$( \
233 eval $(grep -e '^[[:space:]]*VERSION=' "${x}/ltmain.sh"); \ 281 eval $(grep -e '^[[:space:]]*VERSION=' "${x}/ltmain.sh"); \
234 echo "${VERSION}") 282 echo "${VERSION}")
235 283
239 fi 287 fi
240 # We do not want to run libtoolize ... 288 # We do not want to run libtoolize ...
241 ELT_APPLIED_PATCHES="portage" 289 ELT_APPLIED_PATCHES="portage"
242 fi 290 fi
243 ;; 291 ;;
292 "uclibc-"*)
293 [[ ${CHOST} == *"-uclibc" ]] && \
294 ewarn " uClibc patch set '${y}' failed to apply!"
295 ;;
296 "fbsd-"*)
297 [[ ${CHOST} == *"-freebsd"* ]] && \
298 eerror " FreeBSD patch set '${y}' failed to apply!"
299 die "FreeBSD patch set '${y}' failed to apply!"
300 ;;
244 esac 301 esac
245 fi 302 fi
303 done
246 304
247 if [[ -z ${ELT_APPLIED_PATCHES} ]] ; then 305 if [[ -z ${ELT_APPLIED_PATCHES} ]] ; then
248 if [[ ${do_portage} == "no" && \ 306 if [[ ${do_portage} == "no" && \
249 ${do_reversedeps} == "no" && \ 307 ${do_reversedeps} == "no" && \
250 ${do_only_patches} == "no" && \ 308 ${do_only_patches} == "no" && \
251 ${deptoremove} == "" ]] 309 ${deptoremove} == "" ]]
252 then 310 then
253 ewarn "Cannot apply any patches, please file a bug about this" 311 ewarn "Cannot apply any patches, please file a bug about this"
254 break 312 break
255 313
256 # Sometimes ltmain.sh is in a subdirectory ... 314 # Sometimes ltmain.sh is in a subdirectory ...
257 if [[ ! -f ${x}/configure.in && ! -f ${x}/configure.ac ]] ; then 315 if [[ ! -f ${x}/configure.in && ! -f ${x}/configure.ac ]] ; then
258 if [[ -f ${x}/../configure.in || -f ${x}/../configure.ac ]] ; then 316 if [[ -f ${x}/../configure.in || -f ${x}/../configure.ac ]] ; then
259 cd "${x}"/../ 317 cd "${x}"/../
260 fi 318 fi
261 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 319 fi
320
321 if type -p libtoolize &> /dev/null ; then
322 ewarn "Cannot apply any patches, running libtoolize..."
323 libtoolize --copy --force
324 fi
325 cd "${x}"
326 break
270 fi 327 fi
271 done 328 fi
329
330 [[ -f ${x}/libtool ]] && rm -f "${x}/libtool"
331
332 touch "${x}/.elibtoolized"
272 done 333 done
273 334
274 if [[ -f libtool ]] ; then
275 rm -f libtool
276 fi
277
278 cd "${start_dir}" 335 cd "${start_dir}"
279
280 uclibctoolize
281} 336}
282 337
283uclibctoolize() { 338uclibctoolize() {
284 [[ -n ${NO_UCLIBCTOOLIZE} ]] && return 0 339 ewarn "uclibctoolize() is depreciated, please just use libtoolize()!"
285 340 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} 341}
320 342
321darwintoolize() { 343darwintoolize() {
322 local targets="" 344 local targets=""
323 local x 345 local x

Legend:
Removed from v.1.50  
changed lines
  Added in v.1.56

  ViewVC Help
Powered by ViewVC 1.1.20