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

Diff of /eclass/libtool.eclass

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

Revision 1.51 Revision 1.55
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.51 2005/09/02 09:35:17 azarah Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/libtool.eclass,v 1.55 2005/09/04 18:40:48 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
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"
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"
119 local deptoremove= 124 local deptoremove=
120 local my_dirlist= 125 local my_dirlist=
121 local elt_patches="portage relink max_cmd_len sed test tmp" 126 local elt_patches="portage relink max_cmd_len sed test tmp \
127 uclibc-conf uclibc-ltconf"
122 local start_dir="${PWD}" 128 local start_dir="${PWD}"
123 129
124 my_dirlist="$(ELT_find_ltmain_sh)" 130 my_dirlist="$(ELT_find_ltmain_sh)"
131
132 [[ ${CHOST} == *"-freebsd"* ]] && \
133 elt_patches="${elt_patches} fbsd-conf"
125 134
126 for x in "$@" ; do 135 for x in "$@" ; do
127 case "${x}" in 136 case "${x}" in
128 "--portage") 137 "--portage")
129 # Only apply portage patch, and don't 138 # Only apply portage patch, and don't
174 fi 183 fi
175 184
176 for x in ${my_dirlist} ; do 185 for x in ${my_dirlist} ; do
177 local tmp=$(echo "${x}" | sed -e "s|${WORKDIR}||") 186 local tmp=$(echo "${x}" | sed -e "s|${WORKDIR}||")
178 export ELT_APPLIED_PATCHES= 187 export ELT_APPLIED_PATCHES=
188 export ELT_LTMAIN_SH="${x}/ltmain.sh"
189
190 [[ -f ${x}/.elibtoolized ]] && continue
179 191
180 cd ${x} 192 cd ${x}
181 einfo "Running elibtoolize in: $(echo "/${tmp}" | sed -e 's|//|/|g; s|^/||')" 193 einfo "Running elibtoolize in: $(echo "/${tmp}" | sed -e 's|//|/|g; s|^/||')"
182 194
183 for y in ${elt_patches} ; do 195 for y in ${elt_patches} ; do
197 ;; 209 ;;
198 "max_cmd_len") 210 "max_cmd_len")
199 # Do not apply if $max_cmd_len is not used ... 211 # Do not apply if $max_cmd_len is not used ...
200 if [[ -n $(grep 'max_cmd_len' "${x}/ltmain.sh") ]] ; then 212 if [[ -n $(grep 'max_cmd_len' "${x}/ltmain.sh") ]] ; then
201 ELT_walk_patches "${x}/ltmain.sh" "${y}" 213 ELT_walk_patches "${x}/ltmain.sh" "${y}"
214 ret=$?
215 fi
216 ;;
217 "uclibc-conf")
218 if [[ -e ${x}/configure ]] && \
219 grep 'Transform linux' "${x}/configure" > /dev/null ; then
220 ELT_walk_patches "${x}/configure" "${y}"
221 ret=$?
222 # ltmain.sh and co might be in a subdirectory ...
223 elif [[ ! -e ${x}/configure && -e ${x}/../configure ]] && \
224 grep 'Transform linux' "${x}/../configure" > /dev/null ; then
225 ELT_walk_patches "${x}/../configure" "${y}"
226 ret=$?
227 fi
228 ;;
229 "uclibc-ltconf")
230 if [[ -e ${x}/ltconfig ]] ; then
231 ELT_walk_patches "${x}/ltconfig" "${y}"
232 ret=$?
233 fi
234 ;;
235 "fbsd-conf")
236 if [[ -e ${x}/configure ]] && \
237 grep 'version_type=freebsd-' "${x}/configure" > /dev/null ; then
238 ELT_walk_patches "${x}/configure" "${y}"
239 ret=$?
240 # ltmain.sh and co might be in a subdirectory ...
241 elif [[ ! -e ${x}/configure && -e ${x}/../configure ]] && \
242 grep 'version_type=freebsd-' "${x}/../configure" > /dev/null ; then
243 ELT_walk_patches "${x}/../configure" "${y}"
202 ret=$? 244 ret=$?
203 fi 245 fi
204 ;; 246 ;;
205 *) 247 *)
206 ELT_walk_patches "${x}/ltmain.sh" "${y}" 248 ELT_walk_patches "${x}/ltmain.sh" "${y}"
242 fi 284 fi
243 # We do not want to run libtoolize ... 285 # We do not want to run libtoolize ...
244 ELT_APPLIED_PATCHES="portage" 286 ELT_APPLIED_PATCHES="portage"
245 fi 287 fi
246 ;; 288 ;;
289 "uclibc-"*)
290 [[ ${CHOST} == *"-uclibc" ]] && \
291 ewarn " uClibc patch set '${y}' failed to apply!"
292 ;;
293 "fbsd-"*)
294 [[ ${CHOST} == *"-freebsd"* ]] && \
295 eerror " FreeBSD patch set '${y}' failed to apply!"
296 die "FreeBSD patch set '${y}' failed to apply!"
297 ;;
247 esac 298 esac
248 fi 299 fi
300 done
249 301
250 if [[ -z ${ELT_APPLIED_PATCHES} ]] ; then 302 if [[ -z ${ELT_APPLIED_PATCHES} ]] ; then
251 if [[ ${do_portage} == "no" && \ 303 if [[ ${do_portage} == "no" && \
252 ${do_reversedeps} == "no" && \ 304 ${do_reversedeps} == "no" && \
253 ${do_only_patches} == "no" && \ 305 ${do_only_patches} == "no" && \
254 ${deptoremove} == "" ]] 306 ${deptoremove} == "" ]]
255 then 307 then
256 ewarn "Cannot apply any patches, please file a bug about this" 308 ewarn "Cannot apply any patches, please file a bug about this"
257 break 309 break
258 310
259 # Sometimes ltmain.sh is in a subdirectory ... 311 # Sometimes ltmain.sh is in a subdirectory ...
260 if [[ ! -f ${x}/configure.in && ! -f ${x}/configure.ac ]] ; then 312 if [[ ! -f ${x}/configure.in && ! -f ${x}/configure.ac ]] ; then
261 if [[ -f ${x}/../configure.in || -f ${x}/../configure.ac ]] ; then 313 if [[ -f ${x}/../configure.in || -f ${x}/../configure.ac ]] ; then
262 cd "${x}"/../ 314 cd "${x}"/../
263 fi 315 fi
264 fi
265
266 if type -p libtoolize &> /dev/null ; then
267 ewarn "Cannot apply any patches, running libtoolize..."
268 libtoolize --copy --force
269 fi
270 cd "${x}"
271 break
272 fi 316 fi
317
318 if type -p libtoolize &> /dev/null ; then
319 ewarn "Cannot apply any patches, running libtoolize..."
320 libtoolize --copy --force
321 fi
322 cd "${x}"
323 break
273 fi 324 fi
274 done 325 fi
326
327 [[ -f ${x}/libtool ]] && rm -f "${x}/libtool"
328
329 touch "${x}/.elibtoolized"
275 done 330 done
276 331
277 if [[ -f libtool ]] ; then
278 rm -f libtool
279 fi
280
281 cd "${start_dir}" 332 cd "${start_dir}"
282
283 uclibctoolize
284} 333}
285 334
286uclibctoolize() { 335uclibctoolize() {
287 [[ -n ${NO_UCLIBCTOOLIZE} ]] && return 0 336 ewarn "uclibctoolize() is depreciated, please just use libtoolize()!"
288 337 elibtoolize
289 local errmsg=""
290 [[ ${CTARGET:-${CHOST}} == *-uclibc ]] \
291 && errmsg="PLEASE CHECK" \
292 || errmsg="Already patched"
293 local targets=""
294 local x
295
296 if [[ -z $* ]] ; then
297 targets=$(find ${S} -name configure -o -name ltconfig)
298 fi
299
300 einfo "Applying uClibc/libtool patches ..."
301 for x in ${targets} ; do
302 [[ ! -s ${x} ]] && continue
303 case ${x##*/} in
304 configure)
305 if grep 'Transform linux' "${x}" > /dev/null ; then
306 ebegin " Fixing \${S}${x/${S}}"
307 patch -p0 "${x}" "${ELT_PATCH_DIR}/uclibc/configure.patch" > /dev/null
308 eend $? "${errmsg} ${x}"
309 fi
310 ;;
311
312 ltconfig)
313 local ver=$(grep '^VERSION=' ${x})
314 ver=${ver/VERSION=}
315 [[ ${ver:0:3} == "1.4" ]] && ver="1.3" # 1.4 and 1.3 are compat
316 ebegin " Fixing \${S}${x/${S}}"
317 patch -p0 "${x}" "${ELT_PATCH_DIR}/uclibc/ltconfig-${ver:0:3}.patch" > /dev/null
318 eend $? "${errmsg} ${x}"
319 ;;
320 esac
321 done
322} 338}
323 339
324darwintoolize() { 340darwintoolize() {
325 local targets="" 341 local targets=""
326 local x 342 local x

Legend:
Removed from v.1.51  
changed lines
  Added in v.1.55

  ViewVC Help
Powered by ViewVC 1.1.20