summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2011-10-03 04:04:46 +0000
committerMike Frysinger <vapier@gentoo.org>2011-10-03 04:04:46 +0000
commit9f65ac0a8793a520d7c7cbc14bab8d1a41dd3b9f (patch)
tree14eb237345e948ece0beccf30d9ccf942df69906 /eclass
parentVersion bump and multilib overhaul. (diff)
downloadgentoo-2-9f65ac0a8793a520d7c7cbc14bab8d1a41dd3b9f.tar.gz
gentoo-2-9f65ac0a8793a520d7c7cbc14bab8d1a41dd3b9f.tar.bz2
gentoo-2-9f65ac0a8793a520d7c7cbc14bab8d1a41dd3b9f.zip
clean up patch applying a bit, and add support for @GENTOO_LIBDIR@ replacements in patches
Diffstat (limited to 'eclass')
-rw-r--r--eclass/libtool.eclass50
1 files changed, 28 insertions, 22 deletions
diff --git a/eclass/libtool.eclass b/eclass/libtool.eclass
index 5a7a2fa966d3..c6a06b99e6b4 100644
--- a/eclass/libtool.eclass
+++ b/eclass/libtool.eclass
@@ -1,6 +1,6 @@
-# Copyright 1999-2010 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/libtool.eclass,v 1.93 2011/06/10 16:17:57 flameeyes Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/libtool.eclass,v 1.94 2011/10/03 04:04:46 vapier Exp $
# @ECLASS: libtool.eclass
# @MAINTAINER:
@@ -16,7 +16,7 @@
DESCRIPTION="Based on the ${ECLASS} eclass"
-inherit toolchain-funcs
+inherit multilib toolchain-funcs
ELT_PATCH_DIR="${ECLASSDIR}/ELT-patches"
@@ -27,17 +27,22 @@ ELT_try_and_apply_patch() {
local ret=0
local file=$1
local patch=$2
+ local src=$3
+ local disp="${src} patch"
+ local log="${T}/elibtool.log"
- echo -e "\nTrying $(basename "$(dirname "${patch}")")-${patch##*/}.patch on ${file}" \
- >> "${T}/elibtool.log" 2>&1
+ if [[ -z ${__ELT_NOTED_TMP} ]] ; then
+ __ELT_NOTED_TMP=true
+ printf 'temp patch: %s\n' "${patch}" > "${log}"
+ fi
+ printf '\nTrying %s\n' "${disp}" >> "${log}"
# We only support patchlevel of 0 - why worry if its static patches?
- if patch -p0 --dry-run "${file}" "${patch}" >> "${T}/elibtool.log" 2>&1 ; then
- einfo " Applying $(basename "$(dirname "${patch}")")-${patch##*/}.patch ..."
- patch -p0 -g0 --no-backup-if-mismatch "${file}" "${patch}" \
- >> "${T}/elibtool.log" 2>&1
+ if patch -p0 --dry-run "${file}" "${patch}" >> "${log}" 2>&1 ; then
+ einfo " Applying ${disp} ..."
+ patch -p0 -g0 --no-backup-if-mismatch "${file}" "${patch}" >> "${log}" 2>&1
ret=$?
- export ELT_APPLIED_PATCHES="${ELT_APPLIED_PATCHES} ${patch##*/}"
+ export ELT_APPLIED_PATCHES="${ELT_APPLIED_PATCHES} ${src}"
else
ret=1
fi
@@ -61,7 +66,7 @@ ELT_libtool_version() {
# apply to $1 ...
#
ELT_walk_patches() {
- local patch
+ local patch tmp
local ret=1
local file=$1
local patch_set=$2
@@ -71,20 +76,21 @@ ELT_walk_patches() {
[[ -z ${patch_set} ]] && return 1
[[ ! -d ${patch_dir} ]] && return 1
- pushd "${ELT_PATCH_DIR}" >/dev/null
+ # Allow patches to use @GENTOO_LIBDIR@ replacements
+ local sed_args=( -e "s:@GENTOO_LIBDIR@:$(get_libdir):g" )
+ if [[ -n ${rem_int_dep} ]] ; then
+ # replace @REM_INT_DEP@ with what was passed
+ # to --remove-internal-dep
+ sed_args+=( -e "s|@REM_INT_DEP@|${rem_int_dep}|g" )
+ fi
+
+ pushd "${ELT_PATCH_DIR}" >/dev/null || die
# Go through the patches in reverse order (newer version to older)
for patch in $(find "${patch_set}" -maxdepth 1 -type f | LC_ALL=C sort -r) ; do
- # For --remove-internal-dep ...
- if [[ -n ${rem_int_dep} ]] ; then
- # For replace @REM_INT_DEP@ with what was passed
- # to --remove-internal-dep
- local tmp="${T}/$$.rem_int_deps.patch"
- sed -e "s|@REM_INT_DEP@|${rem_int_dep}|g" "${patch}" > "${tmp}"
- patch=${tmp}
- fi
-
- if ELT_try_and_apply_patch "${file}" "${patch}" ; then
+ tmp="${T}/libtool-elt.patch"
+ sed "${sed_args[@]}" "${patch}" > "${tmp}" || die
+ if ELT_try_and_apply_patch "${file}" "${tmp}" "${patch}" ; then
# Break to unwind w/popd rather than return directly
ret=0
break