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

Diff of /eclass/libtool.eclass

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

Revision 1.58 Revision 1.62
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.58 2005/09/04 20:45:57 azarah Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/libtool.eclass,v 1.62 2005/12/07 22:50:05 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
45 local ret=0 45 local ret=0
46 local file=$1 46 local file=$1
47 local patch=$2 47 local patch=$2
48 48
49 # We only support patchlevel of 0 - why worry if its static patches? 49 # We only support patchlevel of 0 - why worry if its static patches?
50 if patch -p0 --dry-run "${file}" < "${patch}" &> "${T}/elibtool.log" ; then 50 if patch -p0 --dry-run "${file}" "${patch}" &> "${T}/elibtool.log" ; then
51 einfo " Applying $(basename "$(dirname "${patch}")")-${patch##*/}.patch ..." 51 einfo " Applying $(basename "$(dirname "${patch}")")-${patch##*/}.patch ..."
52 patch -p0 "${file}" < "${patch}" &> "${T}/elibtool.log" 52 patch -p0 -g0 --no-backup-if-mismatch "${file}" "${patch}" \
53 &> "${T}/elibtool.log"
53 ret=$? 54 ret=$?
54 export ELT_APPLIED_PATCHES="${ELT_APPLIED_PATCHES} ${patch##*/}" 55 export ELT_APPLIED_PATCHES="${ELT_APPLIED_PATCHES} ${patch##*/}"
55 else 56 else
56 ret=1 57 ret=1
57 fi 58 fi
58 59
59 return "${ret}" 60 return "${ret}"
61}
62
63#
64# Get string version of ltmain.sh or ltconfig (passed as $1)
65#
66ELT_libtool_version() {
67 local ltmain_sh=$1
68 local version=
69
70 version=$(eval $(grep -e '^[[:space:]]*VERSION=' "${ltmain_sh}"); \
71 echo "${VERSION}")
72 [[ -z ${version} ]] && version="0"
73
74 echo "${version}"
60} 75}
61 76
62# 77#
63# Run through the patches in $2 and see if any 78# Run through the patches in $2 and see if any
64# apply to $1 ... 79# apply to $1 ...
73 local rem_int_dep=$3 88 local rem_int_dep=$3
74 local version= 89 local version=
75 local ltmain_sh=$1 90 local ltmain_sh=$1
76 91
77 [[ ${file} == *"/configure" ]] && ltmain_sh=${ELT_LTMAIN_SH} 92 [[ ${file} == *"/configure" ]] && ltmain_sh=${ELT_LTMAIN_SH}
78 version=$(eval $(grep -e '^[[:space:]]*VERSION=' "${ltmain_sh}"); \ 93 version=$(ELT_libtool_version "${ltmain_sh}")
79 echo "${VERSION}")
80 94
81 if [[ -n ${patch_set} ]] ; then 95 if [[ -n ${patch_set} ]] ; then
82 if [[ -d ${ELT_PATCH_DIR}/${patch_set} ]] ; then 96 if [[ -d ${ELT_PATCH_DIR}/${patch_set} ]] ; then
83 patch_dir="${ELT_PATCH_DIR}/${patch_set}" 97 patch_dir="${ELT_PATCH_DIR}/${patch_set}"
84 else 98 else
85 return "${ret}" 99 return "${ret}"
86 fi 100 fi
87 101
88 if [[ -z ${version} ]] ; then 102 if [[ ${version} == "0" ]] ; then
89 eerror "Could not get VERSION for ${file##*/}!" 103 eerror "Could not get VERSION for ${file##*/}!"
90 die "Could not get VERSION for ${file##*/}!" 104 die "Could not get VERSION for ${file##*/}!"
91 fi 105 fi
92 106
93 # Go through the patches in reverse order (large to small) 107 # Go through the patches in reverse order (large to small)
94 for x in $(ls -d "${patch_dir}"/* 2> /dev/null | sort -r) ; do 108 for x in $(ls -d "${patch_dir}"/* 2> /dev/null | grep -v 'CVS' | sort -r) ; do
95 if [[ -n ${x} && -f ${x} ]] ; then 109 if [[ -n ${x} && -f ${x} ]] ; then
96 local ltver=$(VER_to_int "${version}") 110 local ltver=$(VER_to_int "${version}")
97 local ptver=$(VER_to_int "${x##*/}") 111 local ptver=$(VER_to_int "${x##*/}")
98 112
99 # If libtool version smaller than patch version, skip patch. 113 # If libtool version smaller than patch version, skip patch.
179 elt_patches="${elt_patches} uclibc-conf uclibc-ltconf" 193 elt_patches="${elt_patches} uclibc-conf uclibc-ltconf"
180 194
181 [[ ${CHOST} == *"-freebsd"* ]] && \ 195 [[ ${CHOST} == *"-freebsd"* ]] && \
182 elt_patches="${elt_patches} fbsd-conf" 196 elt_patches="${elt_patches} fbsd-conf"
183 197
184 if use ppc-macos ; then 198 if useq ppc-macos ; then
185 local opts 199 local opts
186 [[ -f Makefile.am ]] && opts="--automake" 200 [[ -f Makefile.am ]] && opts="--automake"
187 glibtoolize --copy --force ${opts} 201 glibtoolize --copy --force ${opts}
188 darwintoolize 202
203 elt_patches="${elt_patches} darwin-ltconf darwin-ltmain"
189 fi 204 fi
190 205
191 for x in ${my_dirlist} ; do 206 for x in ${my_dirlist} ; do
192 local tmp=$(echo "${x}" | sed -e "s|${WORKDIR}||") 207 local tmp=$(echo "${x}" | sed -e "s|${WORKDIR}||")
193 export ELT_APPLIED_PATCHES= 208 export ELT_APPLIED_PATCHES=
231 ELT_walk_patches "${x}/../configure" "${y}" 246 ELT_walk_patches "${x}/../configure" "${y}"
232 ret=$? 247 ret=$?
233 fi 248 fi
234 ;; 249 ;;
235 "uclibc-ltconf") 250 "uclibc-ltconf")
251 # Newer libtoolize clears ltconfig, as not used anymore
236 if [[ -e ${x}/ltconfig ]] ; then 252 if [[ -s ${x}/ltconfig ]] ; then
237 ELT_walk_patches "${x}/ltconfig" "${y}" 253 ELT_walk_patches "${x}/ltconfig" "${y}"
238 ret=$? 254 ret=$?
239 fi 255 fi
240 ;; 256 ;;
241 "fbsd-conf") 257 "fbsd-conf")
248 -n $(grep 'version_type=freebsd-' "${x}/../configure") ]] ; then 264 -n $(grep 'version_type=freebsd-' "${x}/../configure") ]] ; then
249 ELT_walk_patches "${x}/../configure" "${y}" 265 ELT_walk_patches "${x}/../configure" "${y}"
250 ret=$? 266 ret=$?
251 fi 267 fi
252 ;; 268 ;;
269 "darwin-ltconf")
270 # Newer libtoolize clears ltconfig, as not used anymore
271 if [[ -s ${x}/ltconfig ]] ; then
272 ELT_walk_patches "${x}/ltconfig" "${y}"
273 ret=$?
274 fi
275 ;;
253 *) 276 *)
254 ELT_walk_patches "${x}/ltmain.sh" "${y}" 277 ELT_walk_patches "${x}/ltmain.sh" "${y}"
255 ret=$? 278 ret=$?
256 ;; 279 ;;
257 esac 280 esac
258 281
259 if [[ ${ret} -ne 0 ]] ; then 282 if [[ ${ret} -ne 0 ]] ; then
260 case ${y} in 283 case ${y} in
261 "relink") 284 "relink")
285 local version=$(ELT_libtool_version "${x}/ltmain.sh")
262 # Critical patch, but could be applied ... 286 # Critical patch, but could be applied ...
287 # FIXME: Still need a patch for ltmain.sh > 1.4.0
263 if [[ -z $(grep 'inst_prefix_dir' "${x}/ltmain.sh") ]] ; then 288 if [[ -z $(grep 'inst_prefix_dir' "${x}/ltmain.sh") && \
289 $(VER_to_int "${version}") -ge $(VER_to_int "1.4.0") ]] ; then
264 ewarn " Could not apply relink.patch!" 290 ewarn " Could not apply relink.patch!"
265 fi 291 fi
266 ;; 292 ;;
267 "portage") 293 "portage")
268 # Critical patch - for this one we abort, as it can really 294 # Critical patch - for this one we abort, as it can really
295 "uclibc-"*) 321 "uclibc-"*)
296 [[ ${CHOST} == *"-uclibc" ]] && \ 322 [[ ${CHOST} == *"-uclibc" ]] && \
297 ewarn " uClibc patch set '${y}' failed to apply!" 323 ewarn " uClibc patch set '${y}' failed to apply!"
298 ;; 324 ;;
299 "fbsd-"*) 325 "fbsd-"*)
300 [[ ${CHOST} == *"-freebsd"* ]] && \ 326 if [[ ${CHOST} == *"-freebsd"* ]] ; then
327 if [[ -z $(grep 'Handle Gentoo/FreeBSD as it was Linux' "${x}/configure") ]]; then
301 eerror " FreeBSD patch set '${y}' failed to apply!" 328 eerror " FreeBSD patch set '${y}' failed to apply!"
302 die "FreeBSD patch set '${y}' failed to apply!" 329 die "FreeBSD patch set '${y}' failed to apply!"
330 fi
331 fi
332 ;;
333 "darwin-"*)
334 useq ppc-macos && \
335 ewarn " Darwin patch set '${y}' failed to apply!"
303 ;; 336 ;;
304 esac 337 esac
305 fi 338 fi
306 done 339 done
307 340
337 370
338 cd "${start_dir}" 371 cd "${start_dir}"
339} 372}
340 373
341uclibctoolize() { 374uclibctoolize() {
342 ewarn "uclibctoolize() is depreciated, please just use libtoolize()!" 375 ewarn "uclibctoolize() is depreciated, please just use elibtoolize()!"
343 elibtoolize 376 elibtoolize
344} 377}
345 378
346darwintoolize() { 379darwintoolize() {
347 local targets="" 380 ewarn "darwintoolize() is depreciated, please just use elibtoolize()!"
348 local x 381 elibtoolize
349
350 if [[ -z $* ]] ; then
351 targets=$(find ${S} -name ltmain.sh -o -name ltconfig)
352 fi
353
354 einfo "Applying Darwin/libtool patches ..."
355 for x in ${targets} ; do
356 [[ ! -s ${x} ]] && continue
357 case ${x##*/} in
358 ltmain.sh|ltconfig)
359 local ver=$(grep '^VERSION=' ${x})
360 ver=${ver/VERSION=}
361 if [[ ${ver:0:3} == "1.4" || ${ver:0:3} == "1.5" ]] ; then
362 ver="1.3" # 1.4, 1.5 and 1.3 are compat
363 fi
364
365 ebegin " Fixing \${S}${x/${S}}"
366 patch -p0 "${x}" "${ELT_PATCH_DIR}/darwin/${x##*/}-${ver:0:3}.patch" > /dev/null
367 eend $? "PLEASE CHECK ${x}"
368 ;;
369 esac
370 done
371} 382}
372 383
373# char *VER_major(string) 384# char *VER_major(string)
374# 385#
375# Return the Major (X of X.Y.Z) version 386# Return the Major (X of X.Y.Z) version

Legend:
Removed from v.1.58  
changed lines
  Added in v.1.62

  ViewVC Help
Powered by ViewVC 1.1.20