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

Diff of /eclass/libtool.eclass

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

Revision 1.59 Revision 1.72
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.59 2005/09/05 22:23:10 azarah Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/libtool.eclass,v 1.72 2006/05/09 17:50:17 flameeyes 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
18 18
19DESCRIPTION="Based on the ${ECLASS} eclass" 19DESCRIPTION="Based on the ${ECLASS} eclass"
20 20
21ELIBTOOL_VERSION="2.0.2" 21ELIBTOOL_VERSION="2.0.2"
22 22
23ELT_PATCH_DIR="${PORTDIR}/eclass/ELT-patches" 23ELT_PATCH_DIR="${ECLASSDIR}/ELT-patches"
24ELT_APPLIED_PATCHES= 24ELT_APPLIED_PATCHES=
25ELT_LTMAIN_SH= 25ELT_LTMAIN_SH=
26 26
27# 27#
28# Returns all the directories containing ltmain.sh 28# Returns all the directories containing ltmain.sh
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
83 local ret=1 84 local ret=1
84 local file=$1 85 local file=$1
85 local patch_set=$2 86 local patch_set=$2
86 local patch_dir= 87 local patch_dir=
87 local rem_int_dep=$3 88 local rem_int_dep=$3
88 local version=
89 local ltmain_sh=$1
90
91 [[ ${file} == *"/configure" ]] && ltmain_sh=${ELT_LTMAIN_SH}
92 version=$(ELT_libtool_version "${ltmain_sh}")
93 89
94 if [[ -n ${patch_set} ]] ; then 90 if [[ -n ${patch_set} ]] ; then
95 if [[ -d ${ELT_PATCH_DIR}/${patch_set} ]] ; then 91 if [[ -d ${ELT_PATCH_DIR}/${patch_set} ]] ; then
96 patch_dir="${ELT_PATCH_DIR}/${patch_set}" 92 patch_dir="${ELT_PATCH_DIR}/${patch_set}"
97 else 93 else
98 return "${ret}" 94 return "${ret}"
99 fi 95 fi
100 96
101 if [[ ${version} == "0" ]] ; then
102 eerror "Could not get VERSION for ${file##*/}!"
103 die "Could not get VERSION for ${file##*/}!"
104 fi
105
106 # Go through the patches in reverse order (large to small) 97 # Go through the patches in reverse order (large to small)
107 for x in $(ls -d "${patch_dir}"/* 2> /dev/null | sort -r) ; do 98 for x in $(ls -d "${patch_dir}"/* 2> /dev/null | grep -v 'CVS' | sort -r) ; do
108 if [[ -n ${x} && -f ${x} ]] ; then 99 if [[ -n ${x} && -f ${x} ]] ; then
109 local ltver=$(VER_to_int "${version}")
110 local ptver=$(VER_to_int "${x##*/}")
111
112 # If libtool version smaller than patch version, skip patch.
113 [[ ${ltver} -lt ${ptver} ]] && continue
114 # For --remove-internal-dep ... 100 # For --remove-internal-dep ...
115 if [[ -n ${rem_int_dep} ]] ; then 101 if [[ -n ${rem_int_dep} ]] ; then
116 # For replace @REM_INT_DEP@ with what was passed 102 # For replace @REM_INT_DEP@ with what was passed
117 # to --remove-internal-dep 103 # to --remove-internal-dep
118 sed -e "s|@REM_INT_DEP@|${rem_int_dep}|g" ${x} > \ 104 sed -e "s|@REM_INT_DEP@|${rem_int_dep}|g" ${x} > \
190 176
191 [[ ${do_uclibc} == "yes" ]] && \ 177 [[ ${do_uclibc} == "yes" ]] && \
192 elt_patches="${elt_patches} uclibc-conf uclibc-ltconf" 178 elt_patches="${elt_patches} uclibc-conf uclibc-ltconf"
193 179
194 [[ ${CHOST} == *"-freebsd"* ]] && \ 180 [[ ${CHOST} == *"-freebsd"* ]] && \
195 elt_patches="${elt_patches} fbsd-conf" 181 elt_patches="${elt_patches} fbsd-conf fbsd-ltconf"
196 182
197 if use ppc-macos ; then 183 if useq ppc-macos ; then
198 local opts 184 local opts
199 [[ -f Makefile.am ]] && opts="--automake" 185 [[ -f Makefile.am ]] && opts="--automake"
200 glibtoolize --copy --force ${opts} 186 glibtoolize --copy --force ${opts}
201 darwintoolize 187
188 elt_patches="${elt_patches} darwin-ltconf darwin-ltmain"
202 fi 189 fi
203 190
204 for x in ${my_dirlist} ; do 191 for x in ${my_dirlist} ; do
205 local tmp=$(echo "${x}" | sed -e "s|${WORKDIR}||") 192 local tmp=$(echo "${x}" | sed -e "s|${WORKDIR}||")
206 export ELT_APPLIED_PATCHES= 193 export ELT_APPLIED_PATCHES=
213 200
214 for y in ${elt_patches} ; do 201 for y in ${elt_patches} ; do
215 local ret=0 202 local ret=0
216 203
217 case "${y}" in 204 case "${y}" in
205 "portage")
206 # Stupid test to see if its already applied ...
207 if [[ -z $(grep 'We do not want portage' "${x}/ltmain.sh") ]] ; then
208 ELT_walk_patches "${x}/ltmain.sh" "${y}"
209 ret=$?
210 fi
211 ;;
218 "rem-int-dep") 212 "rem-int-dep")
219 ELT_walk_patches "${x}/ltmain.sh" "${y}" "${deptoremove}" 213 ELT_walk_patches "${x}/ltmain.sh" "${y}" "${deptoremove}"
220 ret=$? 214 ret=$?
221 ;; 215 ;;
222 "fix-relink") 216 "fix-relink")
244 ELT_walk_patches "${x}/../configure" "${y}" 238 ELT_walk_patches "${x}/../configure" "${y}"
245 ret=$? 239 ret=$?
246 fi 240 fi
247 ;; 241 ;;
248 "uclibc-ltconf") 242 "uclibc-ltconf")
243 # Newer libtoolize clears ltconfig, as not used anymore
249 if [[ -e ${x}/ltconfig ]] ; then 244 if [[ -s ${x}/ltconfig ]] ; then
250 ELT_walk_patches "${x}/ltconfig" "${y}" 245 ELT_walk_patches "${x}/ltconfig" "${y}"
251 ret=$? 246 ret=$?
252 fi 247 fi
253 ;; 248 ;;
254 "fbsd-conf") 249 "fbsd-conf")
258 ret=$? 253 ret=$?
259 # ltmain.sh and co might be in a subdirectory ... 254 # ltmain.sh and co might be in a subdirectory ...
260 elif [[ ! -e ${x}/configure && -e ${x}/../configure && \ 255 elif [[ ! -e ${x}/configure && -e ${x}/../configure && \
261 -n $(grep 'version_type=freebsd-' "${x}/../configure") ]] ; then 256 -n $(grep 'version_type=freebsd-' "${x}/../configure") ]] ; then
262 ELT_walk_patches "${x}/../configure" "${y}" 257 ELT_walk_patches "${x}/../configure" "${y}"
258 ret=$?
259 fi
260 ;;
261 "fbsd-ltconf")
262 if [[ -s ${x}/ltconfig ]] ; then
263 ELT_walk_patches "${x}/ltconfig" "${y}"
264 ret=$?
265 fi
266 ;;
267 "darwin-ltconf")
268 # Newer libtoolize clears ltconfig, as not used anymore
269 if [[ -s ${x}/ltconfig ]] ; then
270 ELT_walk_patches "${x}/ltconfig" "${y}"
263 ret=$? 271 ret=$?
264 fi 272 fi
265 ;; 273 ;;
266 *) 274 *)
267 ELT_walk_patches "${x}/ltmain.sh" "${y}" 275 ELT_walk_patches "${x}/ltmain.sh" "${y}"
286 if [[ ${do_portage} == "yes" ]] ; then 294 if [[ ${do_portage} == "yes" ]] ; then
287 # Stupid test to see if its already applied ... 295 # Stupid test to see if its already applied ...
288 if [[ -z $(grep 'We do not want portage' "${x}/ltmain.sh") ]] ; then 296 if [[ -z $(grep 'We do not want portage' "${x}/ltmain.sh") ]] ; then
289 echo 297 echo
290 eerror "Portage patch requested, but failed to apply!" 298 eerror "Portage patch requested, but failed to apply!"
299 eerror "Please bug azarah or vapier to add proper patch."
291 die "Portage patch requested, but failed to apply!" 300 die "Portage patch requested, but failed to apply!"
292 fi 301 fi
293 else 302 else
294 if [[ -n $(grep 'We do not want portage' "${x}/ltmain.sh") ]] ; then 303 if [[ -n $(grep 'We do not want portage' "${x}/ltmain.sh") ]] ; then
295 # ewarn " Portage patch seems to be already applied." 304 # ewarn " Portage patch seems to be already applied."
300 eval $(grep -e '^[[:space:]]*VERSION=' "${x}/ltmain.sh"); \ 309 eval $(grep -e '^[[:space:]]*VERSION=' "${x}/ltmain.sh"); \
301 echo "${VERSION}") 310 echo "${VERSION}")
302 311
303 echo 312 echo
304 eerror "Portage patch failed to apply (ltmain.sh version ${version})!" 313 eerror "Portage patch failed to apply (ltmain.sh version ${version})!"
314 eerror "Please bug azarah or vapier to add proper patch."
305 die "Portage patch failed to apply!" 315 die "Portage patch failed to apply!"
306 fi 316 fi
307 # We do not want to run libtoolize ... 317 # We do not want to run libtoolize ...
308 ELT_APPLIED_PATCHES="portage" 318 ELT_APPLIED_PATCHES="portage"
309 fi 319 fi
311 "uclibc-"*) 321 "uclibc-"*)
312 [[ ${CHOST} == *"-uclibc" ]] && \ 322 [[ ${CHOST} == *"-uclibc" ]] && \
313 ewarn " uClibc patch set '${y}' failed to apply!" 323 ewarn " uClibc patch set '${y}' failed to apply!"
314 ;; 324 ;;
315 "fbsd-"*) 325 "fbsd-"*)
316 [[ ${CHOST} == *"-freebsd"* ]] && \ 326 if [[ ${CHOST} == *"-freebsd"* ]] ; then
327 if [[ -z $(grep 'Handle Gentoo/FreeBSD as it was Linux' \
328 "${x}/configure" "${x}/../configure" 2>/dev/null) ]]; then
317 eerror " FreeBSD patch set '${y}' failed to apply!" 329 eerror " FreeBSD patch set '${y}' failed to apply!"
318 die "FreeBSD patch set '${y}' failed to apply!" 330 die "FreeBSD patch set '${y}' failed to apply!"
331 fi
332 fi
333 ;;
334 "darwin-"*)
335 useq ppc-macos && \
336 ewarn " Darwin patch set '${y}' failed to apply!"
319 ;; 337 ;;
320 esac 338 esac
321 fi 339 fi
322 done 340 done
323 341
353 371
354 cd "${start_dir}" 372 cd "${start_dir}"
355} 373}
356 374
357uclibctoolize() { 375uclibctoolize() {
358 ewarn "uclibctoolize() is depreciated, please just use libtoolize()!" 376 ewarn "uclibctoolize() is depreciated, please just use elibtoolize()!"
359 elibtoolize 377 elibtoolize
360} 378}
361 379
362darwintoolize() { 380darwintoolize() {
363 local targets="" 381 ewarn "darwintoolize() is depreciated, please just use elibtoolize()!"
364 local x 382 elibtoolize
365
366 if [[ -z $* ]] ; then
367 targets=$(find ${S} -name ltmain.sh -o -name ltconfig)
368 fi
369
370 einfo "Applying Darwin/libtool patches ..."
371 for x in ${targets} ; do
372 [[ ! -s ${x} ]] && continue
373 case ${x##*/} in
374 ltmain.sh|ltconfig)
375 local ver=$(grep '^VERSION=' ${x})
376 ver=${ver/VERSION=}
377 if [[ ${ver:0:3} == "1.4" || ${ver:0:3} == "1.5" ]] ; then
378 ver="1.3" # 1.4, 1.5 and 1.3 are compat
379 fi
380
381 ebegin " Fixing \${S}${x/${S}}"
382 patch -p0 "${x}" "${ELT_PATCH_DIR}/darwin/${x##*/}-${ver:0:3}.patch" > /dev/null
383 eend $? "PLEASE CHECK ${x}"
384 ;;
385 esac
386 done
387} 383}
388 384
389# char *VER_major(string) 385# char *VER_major(string)
390# 386#
391# Return the Major (X of X.Y.Z) version 387# Return the Major (X of X.Y.Z) version

Legend:
Removed from v.1.59  
changed lines
  Added in v.1.72

  ViewVC Help
Powered by ViewVC 1.1.20