| 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.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 |
| … | |
… | |
| 102 | eerror "Could not get VERSION for ${file##*/}!" |
103 | eerror "Could not get VERSION for ${file##*/}!" |
| 103 | die "Could not get VERSION for ${file##*/}!" |
104 | die "Could not get VERSION for ${file##*/}!" |
| 104 | fi |
105 | fi |
| 105 | |
106 | |
| 106 | # Go through the patches in reverse order (large to small) |
107 | # Go through the patches in reverse order (large to small) |
| 107 | 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 |
| 108 | if [[ -n ${x} && -f ${x} ]] ; then |
109 | if [[ -n ${x} && -f ${x} ]] ; then |
| 109 | local ltver=$(VER_to_int "${version}") |
110 | local ltver=$(VER_to_int "${version}") |
| 110 | local ptver=$(VER_to_int "${x##*/}") |
111 | local ptver=$(VER_to_int "${x##*/}") |
| 111 | |
112 | |
| 112 | # If libtool version smaller than patch version, skip patch. |
113 | # If libtool version smaller than patch version, skip patch. |
| … | |
… | |
| 192 | elt_patches="${elt_patches} uclibc-conf uclibc-ltconf" |
193 | elt_patches="${elt_patches} uclibc-conf uclibc-ltconf" |
| 193 | |
194 | |
| 194 | [[ ${CHOST} == *"-freebsd"* ]] && \ |
195 | [[ ${CHOST} == *"-freebsd"* ]] && \ |
| 195 | elt_patches="${elt_patches} fbsd-conf" |
196 | elt_patches="${elt_patches} fbsd-conf" |
| 196 | |
197 | |
| 197 | if use ppc-macos ; then |
198 | if useq ppc-macos ; then |
| 198 | local opts |
199 | local opts |
| 199 | [[ -f Makefile.am ]] && opts="--automake" |
200 | [[ -f Makefile.am ]] && opts="--automake" |
| 200 | glibtoolize --copy --force ${opts} |
201 | glibtoolize --copy --force ${opts} |
| 201 | darwintoolize |
202 | |
|
|
203 | elt_patches="${elt_patches} darwin-ltconf darwin-ltmain" |
| 202 | fi |
204 | fi |
| 203 | |
205 | |
| 204 | for x in ${my_dirlist} ; do |
206 | for x in ${my_dirlist} ; do |
| 205 | local tmp=$(echo "${x}" | sed -e "s|${WORKDIR}||") |
207 | local tmp=$(echo "${x}" | sed -e "s|${WORKDIR}||") |
| 206 | export ELT_APPLIED_PATCHES= |
208 | export ELT_APPLIED_PATCHES= |
| … | |
… | |
| 244 | ELT_walk_patches "${x}/../configure" "${y}" |
246 | ELT_walk_patches "${x}/../configure" "${y}" |
| 245 | ret=$? |
247 | ret=$? |
| 246 | fi |
248 | fi |
| 247 | ;; |
249 | ;; |
| 248 | "uclibc-ltconf") |
250 | "uclibc-ltconf") |
|
|
251 | # Newer libtoolize clears ltconfig, as not used anymore |
| 249 | if [[ -e ${x}/ltconfig ]] ; then |
252 | if [[ -s ${x}/ltconfig ]] ; then |
| 250 | ELT_walk_patches "${x}/ltconfig" "${y}" |
253 | ELT_walk_patches "${x}/ltconfig" "${y}" |
| 251 | ret=$? |
254 | ret=$? |
| 252 | fi |
255 | fi |
| 253 | ;; |
256 | ;; |
| 254 | "fbsd-conf") |
257 | "fbsd-conf") |
| … | |
… | |
| 258 | ret=$? |
261 | ret=$? |
| 259 | # ltmain.sh and co might be in a subdirectory ... |
262 | # ltmain.sh and co might be in a subdirectory ... |
| 260 | elif [[ ! -e ${x}/configure && -e ${x}/../configure && \ |
263 | elif [[ ! -e ${x}/configure && -e ${x}/../configure && \ |
| 261 | -n $(grep 'version_type=freebsd-' "${x}/../configure") ]] ; then |
264 | -n $(grep 'version_type=freebsd-' "${x}/../configure") ]] ; then |
| 262 | ELT_walk_patches "${x}/../configure" "${y}" |
265 | ELT_walk_patches "${x}/../configure" "${y}" |
|
|
266 | ret=$? |
|
|
267 | fi |
|
|
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}" |
| 263 | ret=$? |
273 | ret=$? |
| 264 | fi |
274 | fi |
| 265 | ;; |
275 | ;; |
| 266 | *) |
276 | *) |
| 267 | ELT_walk_patches "${x}/ltmain.sh" "${y}" |
277 | ELT_walk_patches "${x}/ltmain.sh" "${y}" |
| … | |
… | |
| 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' "${x}/configure") ]]; then |
| 317 | eerror " FreeBSD patch set '${y}' failed to apply!" |
328 | eerror " FreeBSD patch set '${y}' failed to apply!" |
| 318 | 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!" |
| 319 | ;; |
336 | ;; |
| 320 | esac |
337 | esac |
| 321 | fi |
338 | fi |
| 322 | done |
339 | done |
| 323 | |
340 | |
| … | |
… | |
| 353 | |
370 | |
| 354 | cd "${start_dir}" |
371 | cd "${start_dir}" |
| 355 | } |
372 | } |
| 356 | |
373 | |
| 357 | uclibctoolize() { |
374 | uclibctoolize() { |
| 358 | ewarn "uclibctoolize() is depreciated, please just use libtoolize()!" |
375 | ewarn "uclibctoolize() is depreciated, please just use elibtoolize()!" |
| 359 | elibtoolize |
376 | elibtoolize |
| 360 | } |
377 | } |
| 361 | |
378 | |
| 362 | darwintoolize() { |
379 | darwintoolize() { |
| 363 | local targets="" |
380 | ewarn "darwintoolize() is depreciated, please just use elibtoolize()!" |
| 364 | local x |
381 | 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 | } |
382 | } |
| 388 | |
383 | |
| 389 | # char *VER_major(string) |
384 | # char *VER_major(string) |
| 390 | # |
385 | # |
| 391 | # Return the Major (X of X.Y.Z) version |
386 | # Return the Major (X of X.Y.Z) version |