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

Diff of /eclass/libtool.eclass

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

Revision 1.56 Revision 1.57
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.56 2005/09/04 20:23:42 azarah Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/libtool.eclass,v 1.57 2005/09/04 20:35: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
41# 41#
42# See if we can apply $2 on $1, and if so, do it 42# See if we can apply $2 on $1, and if so, do it
43# 43#
44ELT_try_and_apply_patch() { 44ELT_try_and_apply_patch() {
45 local ret=0 45 local ret=0
46 local file=$1
46 local patch="$2" 47 local patch=$2
47 48
48 # 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?
49 if patch -p0 --dry-run $1 < ${patch} &> ${T}/elibtool.log ; then 50 if patch -p0 --dry-run "${file}" < "${patch}" &> "${T}/elibtool.log" ; then
50 einfo " Applying $(basename "$(dirname "${patch}")")-${patch##*/}.patch ..." 51 einfo " Applying $(basename "$(dirname "${patch}")")-${patch##*/}.patch ..."
51 patch -p0 $1 < ${patch} &>${T}/elibtool.log 52 patch -p0 "${file}" < "${patch}" &> "${T}/elibtool.log"
52 ret=$? 53 ret=$?
53 export ELT_APPLIED_PATCHES="${ELT_APPLIED_PATCHES} ${patch##*/}" 54 export ELT_APPLIED_PATCHES="${ELT_APPLIED_PATCHES} ${patch##*/}"
54 else 55 else
55 ret=1 56 ret=1
56 fi 57 fi
57 58
58 return ${ret} 59 return "${ret}"
59} 60}
60 61
61# 62#
62# Run through the patches in $2 and see if any 63# Run through the patches in $2 and see if any
63# apply to $1 ... 64# apply to $1 ...
64# 65#
65ELT_walk_patches() { 66ELT_walk_patches() {
66 local x= 67 local x=
67 local y= 68 local y=
68 local ret=1 69 local ret=1
70 local file=$1
71 local patch_set=$2
69 local patch_dir= 72 local patch_dir=
73 local rem_int_dep=$3
70 local version= 74 local version=
71 local ltmain_sh=$1 75 local ltmain_sh=$1
72 76
73 [[ $1 == *"/configure" ]] && ltmain_sh=${ELT_LTMAIN_SH} 77 [[ ${file} == *"/configure" ]] && ltmain_sh=${ELT_LTMAIN_SH}
74 version=$(eval $(grep -e '^[[:space:]]*VERSION=' "${ltmain_sh}"); \ 78 version=$(eval $(grep -e '^[[:space:]]*VERSION=' "${ltmain_sh}"); \
75 echo "${VERSION}") 79 echo "${VERSION}")
76 80
77 if [[ -n $2 ]] ; then 81 if [[ -n ${patch_set} ]] ; then
78 if [[ -d ${ELT_PATCH_DIR}/$2 ]] ; then 82 if [[ -d ${ELT_PATCH_DIR}/${patch_set} ]] ; then
79 patch_dir="${ELT_PATCH_DIR}/$2" 83 patch_dir="${ELT_PATCH_DIR}/${patch_set}"
80 else 84 else
81 return ${ret} 85 return "${ret}"
82 fi 86 fi
83 87
84 if [[ -z ${version} ]] ; then 88 if [[ -z ${version} ]] ; then
85 eerror "Could not get VERSION for ${1##*/}!" 89 eerror "Could not get VERSION for ${file##*/}!"
86 die "Could not get VERSION for ${1##*/}!" 90 die "Could not get VERSION for ${file##*/}!"
87 fi 91 fi
88 92
89 # Go through the patches in reverse order (large to small) 93 # Go through the patches in reverse order (large to small)
90 for x in $(ls -d "${patch_dir}"/* 2> /dev/null | sort -r) ; do 94 for x in $(ls -d "${patch_dir}"/* 2> /dev/null | sort -r) ; do
91 if [[ -n ${x} && -f ${x} ]] ; then 95 if [[ -n ${x} && -f ${x} ]] ; then
93 local ptver=$(VER_to_int "${x##*/}") 97 local ptver=$(VER_to_int "${x##*/}")
94 98
95 # If libtool version smaller than patch version, skip patch. 99 # If libtool version smaller than patch version, skip patch.
96 [[ ${ltver} -lt ${ptver} ]] && continue 100 [[ ${ltver} -lt ${ptver} ]] && continue
97 # For --remove-internal-dep ... 101 # For --remove-internal-dep ...
98 if [[ -n $3 ]] ; then 102 if [[ -n ${rem_int_dep} ]] ; then
99 # For replace @REM_INT_DEP@ with what was passed 103 # For replace @REM_INT_DEP@ with what was passed
100 # to --remove-internal-dep 104 # to --remove-internal-dep
101 sed -e "s|@REM_INT_DEP@|$3|g" ${x} > \ 105 sed -e "s|@REM_INT_DEP@|${rem_int_dep}|g" ${x} > \
102 ${T}/$$.rem_int_deps.patch 106 "${T}/$$.rem_int_deps.patch"
103 107
104 x="${T}/$$.rem_int_deps.patch" 108 x="${T}/$$.rem_int_deps.patch"
105 fi 109 fi
106 110
107 if ELT_try_and_apply_patch "$1" "${x}" ; then 111 if ELT_try_and_apply_patch "${file}" "${x}" ; then
108 ret=0 112 ret=0
109 break 113 break
110 fi 114 fi
111 fi 115 fi
112 done 116 done
113 fi 117 fi
114 118
115 return ${ret} 119 return "${ret}"
116} 120}
117 121
118elibtoolize() { 122elibtoolize() {
119 local x= 123 local x=
120 local y= 124 local y=
123 local do_only_patches="no" 127 local do_only_patches="no"
124 local do_uclibc="yes" 128 local do_uclibc="yes"
125 local deptoremove= 129 local deptoremove=
126 local my_dirlist= 130 local my_dirlist=
127 local elt_patches="portage relink max_cmd_len sed test tmp" 131 local elt_patches="portage relink max_cmd_len sed test tmp"
128 local start_dir="${PWD}" 132 local start_dir=${PWD}
129 133
130 my_dirlist="$(ELT_find_ltmain_sh)" 134 my_dirlist=$(ELT_find_ltmain_sh)
131 135
132 for x in "$@" ; do 136 for x in "$@" ; do
133 case "${x}" in 137 case "${x}" in
134 "--portage") 138 "--portage")
135 # Only apply portage patch, and don't 139 # Only apply portage patch, and don't
147 do_only_patches="yes" 151 do_only_patches="yes"
148 ;; 152 ;;
149 "^--remove-internal-dep="*) 153 "^--remove-internal-dep="*)
150 # We will replace @REM_INT_DEP@ with what is needed 154 # We will replace @REM_INT_DEP@ with what is needed
151 # in ELT_walk_patches() ... 155 # in ELT_walk_patches() ...
152 deptoremove="$(echo "${x}" | sed -e 's|--remove-internal-dep=||')" 156 deptoremove=$(echo "${x}" | sed -e 's|--remove-internal-dep=||')
153 157
154 # Add the patch for this ... 158 # Add the patch for this ...
155 [ -n "${deptoremove}" ] && elt_patches="${elt_patches} rem-int-dep" 159 [[ -n ${deptoremove} ]] && elt_patches="${elt_patches} rem-int-dep"
156 ;; 160 ;;
157 "--shallow") 161 "--shallow")
158 # Only patch the ltmain.sh in ${S} 162 # Only patch the ltmain.sh in ${S}
159 if [ -f "${S}/ltmain.sh" ] 163 if [[ -f ${S}/ltmain.sh ]] ; then
160 then
161 my_dirlist="${S}" 164 my_dirlist=${S}
162 else 165 else
163 my_dirlist= 166 my_dirlist=
164 fi 167 fi
165 ;; 168 ;;
166 "--no-uclibc") 169 "--no-uclibc")
167 do_uclibc="no" 170 do_uclibc="no"
168 ;; 171 ;;
169 *) 172 *)
170 eerror "Invalid elibtoolize option: $x" 173 eerror "Invalid elibtoolize option: ${x}"
171 die "elibtoolize called with $x ??" 174 die "elibtoolize called with ${x} ??"
172 esac 175 esac
173 done 176 done
174 177
175 [[ ${do_uclibc} == "yes" ]] && \ 178 [[ ${do_uclibc} == "yes" ]] && \
176 elt_patches="${elt_patches} uclibc-conf uclibc-ltconf" 179 elt_patches="${elt_patches} uclibc-conf uclibc-ltconf"
373# 376#
374VER_major() { 377VER_major() {
375 [[ -z $1 ]] && return 1 378 [[ -z $1 ]] && return 1
376 379
377 local VER=$@ 380 local VER=$@
378 echo ${VER%%[^[:digit:]]*} 381 echo "${VER%%[^[:digit:]]*}"
379} 382}
380 383
381# char *VER_minor(string) 384# char *VER_minor(string)
382# 385#
383# Return the Minor (Y of X.Y.Z) version 386# Return the Minor (Y of X.Y.Z) version
385VER_minor() { 388VER_minor() {
386 [[ -z $1 ]] && return 1 389 [[ -z $1 ]] && return 1
387 390
388 local VER=$@ 391 local VER=$@
389 VER=${VER#*.} 392 VER=${VER#*.}
390 echo ${VER%%[^[:digit:]]*} 393 echo "${VER%%[^[:digit:]]*}"
391} 394}
392 395
393# char *VER_micro(string) 396# char *VER_micro(string)
394# 397#
395# Return the Micro (Z of X.Y.Z) version. 398# Return the Micro (Z of X.Y.Z) version.
397VER_micro() { 400VER_micro() {
398 [[ -z $1 ]] && return 1 401 [[ -z $1 ]] && return 1
399 402
400 local VER=$@ 403 local VER=$@
401 VER=${VER#*.*.} 404 VER=${VER#*.*.}
402 echo ${VER%%[^[:digit:]]*} 405 echo "${VER%%[^[:digit:]]*}"
403} 406}
404 407
405# int VER_to_int(string) 408# int VER_to_int(string)
406# 409#
407# Convert a string type version (2.4.0) to an int (132096) 410# Convert a string type version (2.4.0) to an int (132096)

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

  ViewVC Help
Powered by ViewVC 1.1.20