/[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.74
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.74 2007/03/01 18:48:02 grobian 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 [[ ${CHOST} == *"-darwin"* ]] && \
198 local opts 184 elt_patches="${elt_patches} darwin-ltconf darwin-ltmain"
199 [[ -f Makefile.am ]] && opts="--automake"
200 glibtoolize --copy --force ${opts}
201 darwintoolize
202 fi
203 185
204 for x in ${my_dirlist} ; do 186 for x in ${my_dirlist} ; do
205 local tmp=$(echo "${x}" | sed -e "s|${WORKDIR}||") 187 local tmp=$(echo "${x}" | sed -e "s|${WORKDIR}||")
206 export ELT_APPLIED_PATCHES= 188 export ELT_APPLIED_PATCHES=
207 export ELT_LTMAIN_SH="${x}/ltmain.sh" 189 export ELT_LTMAIN_SH="${x}/ltmain.sh"
213 195
214 for y in ${elt_patches} ; do 196 for y in ${elt_patches} ; do
215 local ret=0 197 local ret=0
216 198
217 case "${y}" in 199 case "${y}" in
200 "portage")
201 # Stupid test to see if its already applied ...
202 if [[ -z $(grep 'We do not want portage' "${x}/ltmain.sh") ]] ; then
203 ELT_walk_patches "${x}/ltmain.sh" "${y}"
204 ret=$?
205 fi
206 ;;
218 "rem-int-dep") 207 "rem-int-dep")
219 ELT_walk_patches "${x}/ltmain.sh" "${y}" "${deptoremove}" 208 ELT_walk_patches "${x}/ltmain.sh" "${y}" "${deptoremove}"
220 ret=$? 209 ret=$?
221 ;; 210 ;;
222 "fix-relink") 211 "fix-relink")
244 ELT_walk_patches "${x}/../configure" "${y}" 233 ELT_walk_patches "${x}/../configure" "${y}"
245 ret=$? 234 ret=$?
246 fi 235 fi
247 ;; 236 ;;
248 "uclibc-ltconf") 237 "uclibc-ltconf")
238 # Newer libtoolize clears ltconfig, as not used anymore
249 if [[ -e ${x}/ltconfig ]] ; then 239 if [[ -s ${x}/ltconfig ]] ; then
250 ELT_walk_patches "${x}/ltconfig" "${y}" 240 ELT_walk_patches "${x}/ltconfig" "${y}"
251 ret=$? 241 ret=$?
252 fi 242 fi
253 ;; 243 ;;
254 "fbsd-conf") 244 "fbsd-conf")
258 ret=$? 248 ret=$?
259 # ltmain.sh and co might be in a subdirectory ... 249 # ltmain.sh and co might be in a subdirectory ...
260 elif [[ ! -e ${x}/configure && -e ${x}/../configure && \ 250 elif [[ ! -e ${x}/configure && -e ${x}/../configure && \
261 -n $(grep 'version_type=freebsd-' "${x}/../configure") ]] ; then 251 -n $(grep 'version_type=freebsd-' "${x}/../configure") ]] ; then
262 ELT_walk_patches "${x}/../configure" "${y}" 252 ELT_walk_patches "${x}/../configure" "${y}"
253 ret=$?
254 fi
255 ;;
256 "fbsd-ltconf")
257 if [[ -s ${x}/ltconfig ]] ; then
258 ELT_walk_patches "${x}/ltconfig" "${y}"
259 ret=$?
260 fi
261 ;;
262 "darwin-ltconf")
263 # Newer libtoolize clears ltconfig, as not used anymore
264 if [[ -s ${x}/ltconfig ]] ; then
265 ELT_walk_patches "${x}/ltconfig" "${y}"
263 ret=$? 266 ret=$?
264 fi 267 fi
265 ;; 268 ;;
266 *) 269 *)
267 ELT_walk_patches "${x}/ltmain.sh" "${y}" 270 ELT_walk_patches "${x}/ltmain.sh" "${y}"
286 if [[ ${do_portage} == "yes" ]] ; then 289 if [[ ${do_portage} == "yes" ]] ; then
287 # Stupid test to see if its already applied ... 290 # Stupid test to see if its already applied ...
288 if [[ -z $(grep 'We do not want portage' "${x}/ltmain.sh") ]] ; then 291 if [[ -z $(grep 'We do not want portage' "${x}/ltmain.sh") ]] ; then
289 echo 292 echo
290 eerror "Portage patch requested, but failed to apply!" 293 eerror "Portage patch requested, but failed to apply!"
294 eerror "Please bug azarah or vapier to add proper patch."
291 die "Portage patch requested, but failed to apply!" 295 die "Portage patch requested, but failed to apply!"
292 fi 296 fi
293 else 297 else
294 if [[ -n $(grep 'We do not want portage' "${x}/ltmain.sh") ]] ; then 298 if [[ -n $(grep 'We do not want portage' "${x}/ltmain.sh") ]] ; then
295 # ewarn " Portage patch seems to be already applied." 299 # ewarn " Portage patch seems to be already applied."
300 eval $(grep -e '^[[:space:]]*VERSION=' "${x}/ltmain.sh"); \ 304 eval $(grep -e '^[[:space:]]*VERSION=' "${x}/ltmain.sh"); \
301 echo "${VERSION}") 305 echo "${VERSION}")
302 306
303 echo 307 echo
304 eerror "Portage patch failed to apply (ltmain.sh version ${version})!" 308 eerror "Portage patch failed to apply (ltmain.sh version ${version})!"
309 eerror "Please bug azarah or vapier to add proper patch."
305 die "Portage patch failed to apply!" 310 die "Portage patch failed to apply!"
306 fi 311 fi
307 # We do not want to run libtoolize ... 312 # We do not want to run libtoolize ...
308 ELT_APPLIED_PATCHES="portage" 313 ELT_APPLIED_PATCHES="portage"
309 fi 314 fi
311 "uclibc-"*) 316 "uclibc-"*)
312 [[ ${CHOST} == *"-uclibc" ]] && \ 317 [[ ${CHOST} == *"-uclibc" ]] && \
313 ewarn " uClibc patch set '${y}' failed to apply!" 318 ewarn " uClibc patch set '${y}' failed to apply!"
314 ;; 319 ;;
315 "fbsd-"*) 320 "fbsd-"*)
316 [[ ${CHOST} == *"-freebsd"* ]] && \ 321 if [[ ${CHOST} == *"-freebsd"* ]] ; then
322 if [[ -z $(grep 'Handle Gentoo/FreeBSD as it was Linux' \
323 "${x}/configure" "${x}/../configure" 2>/dev/null) ]]; then
317 eerror " FreeBSD patch set '${y}' failed to apply!" 324 eerror " FreeBSD patch set '${y}' failed to apply!"
318 die "FreeBSD patch set '${y}' failed to apply!" 325 die "FreeBSD patch set '${y}' failed to apply!"
326 fi
327 fi
328 ;;
329 "darwin-"*)
330 [[ ${CHOST} == *"-darwin"* ]] && \
331 ewarn " Darwin patch set '${y}' failed to apply!"
319 ;; 332 ;;
320 esac 333 esac
321 fi 334 fi
322 done 335 done
323 336
353 366
354 cd "${start_dir}" 367 cd "${start_dir}"
355} 368}
356 369
357uclibctoolize() { 370uclibctoolize() {
358 ewarn "uclibctoolize() is depreciated, please just use libtoolize()!" 371 ewarn "uclibctoolize() is depreciated, please just use elibtoolize()!"
359 elibtoolize 372 elibtoolize
360} 373}
361 374
362darwintoolize() { 375darwintoolize() {
363 local targets="" 376 ewarn "darwintoolize() is depreciated, please just use elibtoolize()!"
364 local x 377 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} 378}
388 379
389# char *VER_major(string) 380# char *VER_major(string)
390# 381#
391# Return the Major (X of X.Y.Z) version 382# Return the Major (X of X.Y.Z) version

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

  ViewVC Help
Powered by ViewVC 1.1.20