bump(eclass): Update eclasses used by toolchain ebuilds.

Sync with upstream, but only a small set of eclasses just to reduce the
chance of surprises. A full sync of all eclasses will come later.
This commit is contained in:
Michael Marineau 2013-07-10 16:21:55 -04:00
parent a53048e9f4
commit 01b830e31b
30 changed files with 1502 additions and 536 deletions

View File

@ -1,9 +0,0 @@
--- configure
+++ configure
@@ -4678,5 +4688,5 @@
hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
- archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+ archive_expsym_cmds="\$CC"' -o $output_objdir/$realname ${wl}-soname "${wl}$soname" $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag"
else
if test "$host_cpu" = ia64; then
hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'

View File

@ -1,10 +0,0 @@
--- configure
+++ configure
@@ -2508,6 +2508,6 @@
hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath"
- archive_expsym_cmds_CXX="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+ archive_expsym_cmds_CXX="\$CC"' -o $output_objdir/$realname ${wl}-soname "${wl}$soname" $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag"
else
if test "$host_cpu" = ia64; then
hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib'

View File

@ -1,10 +0,0 @@
--- configure
+++ configure
@@ -1029,6 +1029,7 @@
# instead of lib<name>.a to let people know that these are not
# typical AIX shared libraries.
library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+ soname_spec='${libname}${release}${shared_ext}$major(shr.o)'
else
# We preserve .a as extension for shared libraries through AIX4.2
# and later when we are not doing run time linking.

View File

@ -1,11 +0,0 @@
--- configure
+++ configure
@@ -4606,7 +4606,7 @@
else
export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
fi
- aix_use_runtimelinking=no
+ aix_use_runtimelinking=yes
# Test if we are trying to use run time linking or normal
# AIX style linking. If -brtl is somewhere in LDFLAGS, we

View File

@ -1,11 +0,0 @@
--- configure
+++ configure
@@ -2436,7 +2436,7 @@
exp_sym_flag='-Bexport'
no_entry_flag=""
else
- aix_use_runtimelinking=no
+ aix_use_runtimelinking=yes
# Test if we are trying to use run time linking or normal
# AIX style linking. If -brtl is somewhere in LDFLAGS, we

View File

@ -1,10 +0,0 @@
--- configure
+++ configure
@@ -1156,6 +1156,7 @@
# instead of lib<name>.a to let people know that these are not
# typical AIX shared libraries.
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major(shr.o)'
else
# We preserve .a as extension for shared libraries through AIX4.2
# and later when we are not doing run time linking.

View File

@ -5,7 +5,7 @@
hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
- archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+ archive_expsym_cmds='eval `echo "$soname" | sed -e "s,^,filenam=,; s,(, membnam=,; s,\.o),,"`~rm -f -r $output_objdir/$filenam.d~mkdir -p $output_objdir/$filenam.d~$CC -o $output_objdir/$filenam.d/$membnam.o $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags -shared $wl-G'$allow_undefined_flag $wl'$exp_sym_flag':$export_symbols~$STRIP -e $output_objdir/$filenam.d/$membnam.o~( echo "#! $soname"; if test $membnam = shr_64; then echo "# 64"; else echo "# 32"; fi; cat $export_symbols ) > $output_objdir/$filenam.d/$membnam.imp~$AR $AR_FLAGS $output_objdir/$filenam $output_objdir/$filenam.d/$membnam.o $output_objdir/$filenam.d/$membnam.imp~rm -f -r $output_objdir/$filenam.d' + archive_expsym_cmds='eval `echo "$soname" | sed -e "s,^,filenam=,; s,(, membnam=,; s,\.o),,"`~rm -f -r $output_objdir/$filenam.d~mkdir -p $output_objdir/$filenam.d~$CC -o $output_objdir/$filenam.d/$membnam.o $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags -shared $wl-G$allow_undefined_flag $wl'$exp_sym_flag':$export_symbols~$STRIP -e $output_objdir/$filenam.d/$membnam.o~( echo "#! $soname"; if test $membnam = shr_64; then echo "# 64"; else echo "# 32"; fi; cat $export_symbols ) > $output_objdir/$filenam.d/$membnam.imp~$AR $AR_FLAGS $output_objdir/$filenam $output_objdir/$filenam.d/$membnam.o $output_objdir/$filenam.d/$membnam.imp~rm -f -r $output_objdir/$filenam.d'
else else
if test "$host_cpu" = ia64; then if test "$host_cpu" = ia64; then
hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'

View File

@ -1,11 +0,0 @@
--- configure
+++ configure
@@ -4622,7 +4622,7 @@
if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
- archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+ archive_expsym_cmds='$CC -o $output_objdir/$realname ${wl}-soname "${wl}$soname" $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
else
if test "$host_cpu" = ia64; then
hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'

View File

@ -1,11 +0,0 @@
--- configure
+++ configure
@@ -5567,7 +5567,7 @@
hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath"
- archive_expsym_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+ archive_expsym_cmds_CXX='$CC -o $output_objdir/$realname ${wl}-soname "${wl}$soname" $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
else
if test "$host_cpu" = ia64; then
hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib'

View File

@ -1,11 +0,0 @@
--- configure
+++ configure
@@ -5488,7 +5488,7 @@
exp_sym_flag='-Bexport'
no_entry_flag=""
else
- aix_use_runtimelinking=no
+ aix_use_runtimelinking=yes
# Test if we are trying to use run time linking or normal
# AIX style linking. If -brtl is somewhere in LDFLAGS, we

View File

@ -1,3 +1,16 @@
In Gentoo Prefix we go by Apple's convention to give modules the .bundle
extension.
http://developer.apple.com/documentation/DeveloperTools/Conceptual/XcodeBuildSystem/500-Linking/bs_linking.html
(Above link was removed by Apple, the link below contains a copy:
http://disanji.net/iOS_Doc/#documentation/DeveloperTools/Conceptual/XcodeBuildSystem/500-Linking/bs_linking.html,
in case it disappears also, the relevant quote:
Bundle. Bundles are executable files that can be loaded at runtime by
other products. Plug-ins are implemented using bundles. The term bundle
in this context refers to the binary itself, not to a structured
hierarchy. Bundles have the .bundle extension; for example,
MyBundle.bundle.)
--- configure.orig 2009-05-22 12:05:31 +0200 --- configure.orig 2009-05-22 12:05:31 +0200
+++ configure 2009-05-22 12:05:39 +0200 +++ configure 2009-05-22 12:05:39 +0200
@@ -15461,7 +15461,7 @@ @@ -15461,7 +15461,7 @@

View File

@ -1,3 +1,16 @@
In Gentoo Prefix we go by Apple's convention to give modules the .bundle
extension.
http://developer.apple.com/documentation/DeveloperTools/Conceptual/XcodeBuildSystem/500-Linking/bs_linking.html
(Above link was removed by Apple, the link below contains a copy:
http://disanji.net/iOS_Doc/#documentation/DeveloperTools/Conceptual/XcodeBuildSystem/500-Linking/bs_linking.html,
in case it disappears also, the relevant quote:
Bundle. Bundles are executable files that can be loaded at runtime by
other products. Plug-ins are implemented using bundles. The term bundle
in this context refers to the binary itself, not to a structured
hierarchy. Bundles have the .bundle extension; for example,
MyBundle.bundle.)
--- configure --- configure
+++ configure +++ configure
@@ -10570,7 +10570,7 @@ @@ -10570,7 +10570,7 @@

View File

@ -1,3 +1,16 @@
In Gentoo Prefix we go by Apple's convention to give modules the .bundle
extension.
http://developer.apple.com/documentation/DeveloperTools/Conceptual/XcodeBuildSystem/500-Linking/bs_linking.html
(Above link was removed by Apple, the link below contains a copy:
http://disanji.net/iOS_Doc/#documentation/DeveloperTools/Conceptual/XcodeBuildSystem/500-Linking/bs_linking.html,
in case it disappears also, the relevant quote:
Bundle. Bundles are executable files that can be loaded at runtime by
other products. Plug-ins are implemented using bundles. The term bundle
in this context refers to the binary itself, not to a structured
hierarchy. Bundles have the .bundle extension; for example,
MyBundle.bundle.)
--- configure --- configure
+++ configure +++ configure
@@ -12172,11 +12172,11 @@ @@ -12172,11 +12172,11 @@

View File

@ -1,3 +1,16 @@
In Gentoo Prefix we go by Apple's convention to give modules the .bundle
extension.
http://developer.apple.com/documentation/DeveloperTools/Conceptual/XcodeBuildSystem/500-Linking/bs_linking.html
(Above link was removed by Apple, the link below contains a copy:
http://disanji.net/iOS_Doc/#documentation/DeveloperTools/Conceptual/XcodeBuildSystem/500-Linking/bs_linking.html,
in case it disappears also, the relevant quote:
Bundle. Bundles are executable files that can be loaded at runtime by
other products. Plug-ins are implemented using bundles. The term bundle
in this context refers to the binary itself, not to a structured
hierarchy. Bundles have the .bundle extension; for example,
MyBundle.bundle.)
--- configure --- configure
+++ configure +++ configure
@@ -11455,11 +11455,11 @@ @@ -11455,11 +11455,11 @@

View File

@ -0,0 +1,13 @@
--- a/configure
+++ b/configure
@@ -5148,8 +5148,8 @@
else
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check
-See \`config.log' for more details" "$LINENO" 5; }
+$as_echo "See \`config.log' for more details." >&5;
+$ac_echo "C++ sucks, ignoring ..." >&5; }
fi
ac_ext=c

View File

@ -1,5 +1,5 @@
--- configure.orig 2004-12-07 21:34:23.205172545 +0000 --- a/configure
+++ configure 2004-12-07 21:37:17.726654782 +0000 +++ b/configure
@@ -5148,10 +5148,8 @@ @@ -5148,10 +5148,8 @@
: :
else else

View File

@ -0,0 +1,45 @@
https://bugs.gentoo.org/465558
From a4629ebff263dcb2e05feb9e41df649ea5ce3f78 Mon Sep 17 00:00:00 2001
From: Peter Rosin <peda@lysator.liu.se>
Date: Sun, 28 Apr 2013 09:16:56 +0200
Subject: [PATCH] libtool: break all the way out when a good nm is found
The current code tries to locate a compatible nm tool. It starts with
a prefixed nm tool (great!) and includes a plain nm too (that's fine).
The problem is that the code searches for the prefixed nm before the
plain nm (normally fine), but doesn't break once it has found a valid
match, and the plain nm ends up the winner.
Report and analysis by Mike Frysinger.
* m4/libtool.m4 (LT_PATH_NM): Break all the way out on a good match.
Signed-off-by: Peter Rosin <peda@lysator.liu.se>
---
m4/libtool.m4 | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/m4/libtool.m4 b/m4/libtool.m4
index 3f50b0c..d7013c5 100644
--- a/m4/libtool.m4
+++ b/m4/libtool.m4
@@ -3397,13 +3397,13 @@ else
case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
*/dev/null* | *'Invalid file or object type'*)
lt_cv_path_NM="$tmp_nm -B"
- break
+ break 2
;;
*)
case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
*/dev/null*)
lt_cv_path_NM="$tmp_nm -p"
- break
+ break 2
;;
*)
lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
--
1.8.2.1

View File

@ -1,6 +1,6 @@
# Copyright 1999-2012 Gentoo Foundation # Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2 # Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.409 2012/10/23 21:09:39 mgorny Exp $ # $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.424 2013/06/21 23:57:03 vapier Exp $
# @ECLASS: eutils.eclass # @ECLASS: eutils.eclass
# @MAINTAINER: # @MAINTAINER:
@ -146,6 +146,77 @@ estack_pop() {
eval unset ${__estack_name}\[${__estack_i}\] eval unset ${__estack_name}\[${__estack_i}\]
} }
# @FUNCTION: evar_push
# @USAGE: <variable to save> [more vars to save]
# @DESCRIPTION:
# This let's you temporarily modify a variable and then restore it (including
# set vs unset semantics). Arrays are not supported at this time.
#
# This is meant for variables where using `local` does not work (such as
# exported variables, or only temporarily changing things in a func).
#
# For example:
# @CODE
# evar_push LC_ALL
# export LC_ALL=C
# ... do some stuff that needs LC_ALL=C set ...
# evar_pop
#
# # You can also save/restore more than one var at a time
# evar_push BUTTERFLY IN THE SKY
# ... do stuff with the vars ...
# evar_pop # This restores just one var, SKY
# ... do more stuff ...
# evar_pop 3 # This pops the remaining 3 vars
# @CODE
evar_push() {
local var val
for var ; do
[[ ${!var+set} == "set" ]] \
&& val=${!var} \
|| val="${___ECLASS_ONCE_EUTILS}"
estack_push evar "${var}" "${val}"
done
}
# @FUNCTION: evar_push_set
# @USAGE: <variable to save> [new value to store]
# @DESCRIPTION:
# This is a handy shortcut to save and temporarily set a variable. If a value
# is not specified, the var will be unset.
evar_push_set() {
local var=$1
evar_push ${var}
case $# in
1) unset ${var} ;;
2) printf -v "${var}" '%s' "$2" ;;
*) die "${FUNCNAME}: incorrect # of args: $*" ;;
esac
}
# @FUNCTION: evar_pop
# @USAGE: [number of vars to restore]
# @DESCRIPTION:
# Restore the variables to the state saved with the corresponding
# evar_push call. See that function for more details.
evar_pop() {
local cnt=${1:-bad}
case $# in
0) cnt=1 ;;
1) isdigit "${cnt}" || die "${FUNCNAME}: first arg must be a number: $*" ;;
*) die "${FUNCNAME}: only accepts one arg: $*" ;;
esac
local var val
while (( cnt-- )) ; do
estack_pop evar val || die "${FUNCNAME}: unbalanced push"
estack_pop evar var || die "${FUNCNAME}: unbalanced push"
[[ ${val} == "${___ECLASS_ONCE_EUTILS}" ]] \
&& unset ${var} \
|| printf -v "${var}" '%s' "${val}"
done
}
# @FUNCTION: eshopts_push # @FUNCTION: eshopts_push
# @USAGE: [options to `set` or `shopt`] # @USAGE: [options to `set` or `shopt`]
# @DESCRIPTION: # @DESCRIPTION:
@ -218,6 +289,18 @@ eumask_pop() {
umask ${s} || die "${FUNCNAME}: sanity: could not restore umask: ${s}" umask ${s} || die "${FUNCNAME}: sanity: could not restore umask: ${s}"
} }
# @FUNCTION: isdigit
# @USAGE: <number> [more numbers]
# @DESCRIPTION:
# Return true if all arguments are numbers.
isdigit() {
local d
for d ; do
[[ ${d:-bad} == *[!0-9]* ]] && return 1
done
return 0
}
# @VARIABLE: EPATCH_SOURCE # @VARIABLE: EPATCH_SOURCE
# @DESCRIPTION: # @DESCRIPTION:
# Default directory to search for patches. # Default directory to search for patches.
@ -261,6 +344,11 @@ EPATCH_MULTI_MSG="Applying various patches (bugfixes/updates) ..."
# Only require patches to match EPATCH_SUFFIX rather than the extended # Only require patches to match EPATCH_SUFFIX rather than the extended
# arch naming style. # arch naming style.
EPATCH_FORCE="no" EPATCH_FORCE="no"
# @VARIABLE: EPATCH_USER_EXCLUDE
# @DEFAULT_UNSET
# @DESCRIPTION:
# List of patches not to apply. Note this is only file names,
# and not the full path. Globs accepted.
# @FUNCTION: epatch # @FUNCTION: epatch
# @USAGE: [options] [patches] [dirs of patches] # @USAGE: [options] [patches] [dirs of patches]
@ -339,8 +427,11 @@ epatch() {
local EPATCH_SUFFIX=$1 local EPATCH_SUFFIX=$1
elif [[ -d $1 ]] ; then elif [[ -d $1 ]] ; then
# Some people like to make dirs of patches w/out suffixes (vim) # We have to force sorting to C so that the wildcard expansion is consistent #471666.
evar_push_set LC_COLLATE C
# Some people like to make dirs of patches w/out suffixes (vim).
set -- "$1"/*${EPATCH_SUFFIX:+."${EPATCH_SUFFIX}"} set -- "$1"/*${EPATCH_SUFFIX:+."${EPATCH_SUFFIX}"}
evar_pop
elif [[ -f ${EPATCH_SOURCE}/$1 ]] ; then elif [[ -f ${EPATCH_SOURCE}/$1 ]] ; then
# Re-use EPATCH_SOURCE as a search dir # Re-use EPATCH_SOURCE as a search dir
@ -405,6 +496,15 @@ epatch() {
local ex local ex
for ex in ${EPATCH_EXCLUDE} ; do for ex in ${EPATCH_EXCLUDE} ; do
if [[ ${patchname} == ${ex} ]] ; then if [[ ${patchname} == ${ex} ]] ; then
einfo " Skipping ${patchname} due to EPATCH_EXCLUDE ..."
eshopts_pop
continue 2
fi
done
for ex in ${EPATCH_USER_EXCLUDE} ; do
if [[ ${patchname} == ${ex} ]] ; then
einfo " Skipping ${patchname} due to EPATCH_USER_EXCLUDE ..."
eshopts_pop eshopts_pop
continue 2 continue 2
fi fi
@ -462,15 +562,23 @@ epatch() {
# Similar reason, but with relative paths. # Similar reason, but with relative paths.
local rel_paths=$(egrep -n '^[-+]{3} [^ ]*[.][.]/' "${PATCH_TARGET}") local rel_paths=$(egrep -n '^[-+]{3} [^ ]*[.][.]/' "${PATCH_TARGET}")
if [[ -n ${rel_paths} ]] ; then if [[ -n ${rel_paths} ]] ; then
eqawarn "QA Notice: Your patch uses relative paths '../'." echo
eqawarn " In the future this will cause a failure." eerror "Rejected Patch: ${patchname} !"
eqawarn "${rel_paths}" eerror " ( ${PATCH_TARGET} )"
eerror
eerror "Your patch uses relative paths '../':"
eerror "${rel_paths}"
echo
die "you need to fix the relative paths in patch"
fi fi
# Dynamically detect the correct -p# ... i'm lazy, so shoot me :/ # Dynamically detect the correct -p# ... i'm lazy, so shoot me :/
local patch_cmd local patch_cmd
# Handle aliased patch command #404447 #461568
local patch="patch"
eval $(alias patch 2>/dev/null | sed 's:^alias ::')
while [[ ${count} -lt 5 ]] ; do while [[ ${count} -lt 5 ]] ; do
patch_cmd="${BASH_ALIASES[patch]:-patch} -p${count} ${EPATCH_OPTS}" patch_cmd="${patch} -p${count} ${EPATCH_OPTS}"
# Generate some useful debug info ... # Generate some useful debug info ...
( (
@ -1269,10 +1377,19 @@ epunt_cxx() {
local dir=$1 local dir=$1
[[ -z ${dir} ]] && dir=${S} [[ -z ${dir} ]] && dir=${S}
ebegin "Removing useless C++ checks" ebegin "Removing useless C++ checks"
local f local f p any_found
find "${dir}" -name configure | while read f ; do while IFS= read -r -d '' f; do
patch --no-backup-if-mismatch -p0 "${f}" "${PORTDIR}/eclass/ELT-patches/nocxx/nocxx.patch" > /dev/null for p in "${PORTDIR}"/eclass/ELT-patches/nocxx/*.patch ; do
done if patch --no-backup-if-mismatch -p1 "${f}" "${p}" >/dev/null ; then
any_found=1
break
fi
done
done < <(find "${dir}" -name configure -print0)
if [[ -z ${any_found} ]]; then
eqawarn "epunt_cxx called unnecessarily (no C++ checks to punt)."
fi
eend 0 eend 0
} }
@ -1286,21 +1403,25 @@ epunt_cxx() {
make_wrapper() { make_wrapper() {
local wrapper=$1 bin=$2 chdir=$3 libdir=$4 path=$5 local wrapper=$1 bin=$2 chdir=$3 libdir=$4 path=$5
local tmpwrapper=$(emktemp) local tmpwrapper=$(emktemp)
# We don't want to quote ${bin} so that people can pass complex
# things as $bin ... "./someprog --args" (
cat << EOF > "${tmpwrapper}" echo '#!/bin/sh'
#!/bin/sh [[ -n ${chdir} ]] && printf 'cd "%s"\n' "${chdir}"
cd "${chdir:-.}" if [[ -n ${libdir} ]] ; then
if [ -n "${libdir}" ] ; then cat <<-EOF
if [ "\${LD_LIBRARY_PATH+set}" = "set" ] ; then if [ "\${LD_LIBRARY_PATH+set}" = "set" ] ; then
export LD_LIBRARY_PATH="\${LD_LIBRARY_PATH}:${libdir}" export LD_LIBRARY_PATH="\${LD_LIBRARY_PATH}:${libdir}"
else else
export LD_LIBRARY_PATH="${libdir}" export LD_LIBRARY_PATH="${libdir}"
fi
EOF
fi fi
fi # We don't want to quote ${bin} so that people can pass complex
exec ${bin} "\$@" # things as ${bin} ... "./someprog --args"
EOF printf 'exec %s "$@"\n' "${bin}"
) > "${tmpwrapper}"
chmod go+rx "${tmpwrapper}" chmod go+rx "${tmpwrapper}"
if [[ -n ${path} ]] ; then if [[ -n ${path} ]] ; then
( (
exeinto "${path}" exeinto "${path}"
@ -1401,8 +1522,9 @@ fi
# that they should not be linked to, i.e. whenever these files # that they should not be linked to, i.e. whenever these files
# correspond to plugins. # correspond to plugins.
# #
# Note: if your package installs both static libraries and .pc files, # Note: if your package installs both static libraries and .pc files
# you need to add pkg-config to your DEPEND. # which use variable substitution for -l flags, you need to add
# pkg-config to your DEPEND.
prune_libtool_files() { prune_libtool_files() {
debug-print-function ${FUNCNAME} "$@" debug-print-function ${FUNCNAME} "$@"
@ -1426,12 +1548,20 @@ prune_libtool_files() {
while IFS= read -r -d '' f; do # for all .la files while IFS= read -r -d '' f; do # for all .la files
local archivefile=${f/%.la/.a} local archivefile=${f/%.la/.a}
# The following check is done by libtool itself.
# It helps us avoid removing random files which match '*.la',
# see bug #468380.
if ! sed -n -e '/^# Generated by .*libtool/q0;4q1' "${f}"; then
continue
fi
[[ ${f} != ${archivefile} ]] || die 'regex sanity check failed' [[ ${f} != ${archivefile} ]] || die 'regex sanity check failed'
local reason pkgconfig_scanned local reason pkgconfig_scanned
local snotlink=$(sed -n -e 's:^shouldnotlink=::p' "${f}")
# Remove static libs we're not supposed to link against. if [[ ${snotlink} == yes ]]; then
if grep -q '^shouldnotlink=yes$' "${f}"; then
# Remove static libs we're not supposed to link against.
if [[ -f ${archivefile} ]]; then if [[ -f ${archivefile} ]]; then
einfo "Removing unnecessary ${archivefile#${D%/}} (static plugin)" einfo "Removing unnecessary ${archivefile#${D%/}} (static plugin)"
queue+=( "${archivefile}" ) queue+=( "${archivefile}" )
@ -1443,46 +1573,66 @@ prune_libtool_files() {
reason='module' reason='module'
fi fi
# Remove .la files when:
# - user explicitly wants us to remove all .la files,
# - respective static archive doesn't exist,
# - they are covered by a .pc file already,
# - they don't provide any new information (no libs & no flags).
elif [[ ${removing_all} ]]; then
reason='requested'
elif [[ ! -f ${archivefile} ]]; then
reason='no static archive'
elif [[ ! $(sed -nre \
"s/^(dependency_libs|inherited_linker_flags)='(.*)'$/\2/p" \
"${f}") ]]; then
reason='no libs & flags'
else else
if [[ ! ${pkgconfig_scanned} ]]; then
# Create a list of all .pc-covered libs.
local pc_libs=()
if [[ ! ${removing_all} ]]; then
local pc
local tf=${T}/prune-lt-files.pc
local pkgconf=$(tc-getPKG_CONFIG)
while IFS= read -r -d '' pc; do # for all .pc files # Remove .la files when:
local arg # - user explicitly wants us to remove all .la files,
# - respective static archive doesn't exist,
# - they are covered by a .pc file already,
# - they don't provide any new information (no libs & no flags).
sed -e '/^Requires:/d' "${pc}" > "${tf}" if [[ ${removing_all} ]]; then
for arg in $("${pkgconf}" --libs "${tf}"); do reason='requested'
[[ ${arg} == -l* ]] && pc_libs+=( lib${arg#-l}.la ) elif [[ ! -f ${archivefile} ]]; then
done reason='no static archive'
done < <(find "${D}" -type f -name '*.pc' -print0) elif [[ ! $(sed -nre \
"s/^(dependency_libs|inherited_linker_flags)='(.*)'$/\2/p" \
"${f}") ]]; then
reason='no libs & flags'
else
if [[ ! ${pkgconfig_scanned} ]]; then
# Create a list of all .pc-covered libs.
local pc_libs=()
if [[ ! ${removing_all} ]]; then
local pc
local tf=${T}/prune-lt-files.pc
local pkgconf=$(tc-getPKG_CONFIG)
rm -f "${tf}" while IFS= read -r -d '' pc; do # for all .pc files
fi local arg libs
pkgconfig_scanned=1 # Use pkg-config if available (and works),
fi # fallback to sed.
if ${pkgconf} --exists "${pc}" &>/dev/null; then
sed -e '/^Requires:/d' "${pc}" > "${tf}"
libs=$(${pkgconf} --libs "${tf}")
else
libs=$(sed -ne 's/^Libs://p' "${pc}")
fi
has "${f##*/}" "${pc_libs[@]}" && reason='covered by .pc' for arg in ${libs}; do
fi if [[ ${arg} == -l* ]]; then
if [[ ${arg} == '*$*' ]]; then
eqawarn "${FUNCNAME}: variable substitution likely failed in ${pc}"
eqawarn "(arg: ${arg})"
eqawarn "Most likely, you need to add virtual/pkgconfig to DEPEND."
fi
pc_libs+=( lib${arg#-l}.la )
fi
done
done < <(find "${D}" -type f -name '*.pc' -print0)
rm -f "${tf}"
fi
pkgconfig_scanned=1
fi # pkgconfig_scanned
has "${f##*/}" "${pc_libs[@]}" && reason='covered by .pc'
fi # removal due to .pc
fi # shouldnotlink==no
if [[ ${reason} ]]; then if [[ ${reason} ]]; then
einfo "Removing unnecessary ${f#${D%/}} (${reason})" einfo "Removing unnecessary ${f#${D%/}} (${reason})"

View File

@ -1,6 +1,6 @@
# Copyright 1999-2012 Gentoo Foundation # Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2 # Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/gnuconfig.eclass,v 1.34 2012/09/15 16:16:53 zmedico Exp $ # $Header: /var/cvsroot/gentoo-x86/eclass/gnuconfig.eclass,v 1.35 2013/05/22 06:03:08 vapier Exp $
# #
# THIS ECLASS IS DEAD: It has been integrated into portage # THIS ECLASS IS DEAD: It has been integrated into portage
# #
@ -87,15 +87,13 @@ gnuconfig_do_update() {
# this searches the standard locations for the newest config.{sub|guess}, and # this searches the standard locations for the newest config.{sub|guess}, and
# returns the directory where they can be found. # returns the directory where they can be found.
gnuconfig_findnewest() { gnuconfig_findnewest() {
local locations=" local locations=(
/usr/share/misc/config.sub
/usr/share/gnuconfig/config.sub /usr/share/gnuconfig/config.sub
/usr/share/automake-1.9/config.sub /usr/share/automake*/config.sub
/usr/share/automake-1.8/config.sub
/usr/share/automake-1.7/config.sub
/usr/share/automake-1.6/config.sub
/usr/share/automake-1.5/config.sub
/usr/share/automake-1.4/config.sub
/usr/share/libtool/config.sub /usr/share/libtool/config.sub
" )
grep -s '^timestamp' ${locations} | sort -n -t\' -k2 | tail -n 1 | sed 's,/config.sub:.*$,,' grep -s '^timestamp' "${locations[@]}" | \
sort -r -n -t\' -k2 | \
sed -n '1{s,/config.sub:.*$,,;p;q}'
} }

View File

@ -1,6 +1,6 @@
# Copyright 1999-2012 Gentoo Foundation # Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2 # Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/kernel-2.eclass,v 1.277 2012/06/24 17:52:38 mpagano Exp $ # $Header: /var/cvsroot/gentoo-x86/eclass/kernel-2.eclass,v 1.284 2013/04/29 22:14:23 tomwij Exp $
# Description: kernel.eclass rewrite for a clean base regarding the 2.6 # Description: kernel.eclass rewrite for a clean base regarding the 2.6
# series of kernel with back-compatibility for 2.4 # series of kernel with back-compatibility for 2.4
@ -69,6 +69,11 @@
# UNIPATCH_STRICTORDER - if this is set places patches into directories of # UNIPATCH_STRICTORDER - if this is set places patches into directories of
# order, so they are applied in the order passed # order, so they are applied in the order passed
# Changing any other variable in this eclass is not supported; you can request
# for additional variables to be added by contacting the current maintainer.
# If you do change them, there is a chance that we will not fix resulting bugs;
# that of course does not mean we're not willing to help.
inherit eutils toolchain-funcs versionator multilib inherit eutils toolchain-funcs versionator multilib
EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_test src_install pkg_preinst pkg_postinst pkg_postrm EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_test src_install pkg_preinst pkg_postinst pkg_postrm
@ -121,18 +126,18 @@ handle_genpatches() {
# for > 3.0 kernels, handle genpatches tarball name # for > 3.0 kernels, handle genpatches tarball name
# genpatches for 3.0 and 3.0.1 might be named # genpatches for 3.0 and 3.0.1 might be named
# genpatches-3.0-1.base.tar.bz2 and genpatches-3.0-2.base.tar.bz2 # genpatches-3.0-1.base.tar.xz and genpatches-3.0-2.base.tar.xz
# respectively. Handle this. # respectively. Handle this.
for i in ${K_WANT_GENPATCHES} ; do for i in ${K_WANT_GENPATCHES} ; do
if [[ ${KV_MAJOR} -ge 3 ]]; then if [[ ${KV_MAJOR} -ge 3 ]]; then
if [[ ${#OKV_ARRAY[@]} -ge 3 ]]; then if [[ ${#OKV_ARRAY[@]} -ge 3 ]]; then
tarball="genpatches-${KV_MAJOR}.${KV_MINOR}-${K_GENPATCHES_VER}.${i}.tar.bz2" tarball="genpatches-${KV_MAJOR}.${KV_MINOR}-${K_GENPATCHES_VER}.${i}.tar.xz"
else else
tarball="genpatches-${KV_MAJOR}.${KV_PATCH}-${K_GENPATCHES_VER}.${i}.tar.bz2" tarball="genpatches-${KV_MAJOR}.${KV_PATCH}-${K_GENPATCHES_VER}.${i}.tar.xz"
fi fi
else else
tarball="genpatches-${OKV}-${K_GENPATCHES_VER}.${i}.tar.bz2" tarball="genpatches-${OKV}-${K_GENPATCHES_VER}.${i}.tar.xz"
fi fi
debug-print "genpatches tarball: $tarball" debug-print "genpatches tarball: $tarball"
GENPATCHES_URI="${GENPATCHES_URI} mirror://gentoo/${tarball}" GENPATCHES_URI="${GENPATCHES_URI} mirror://gentoo/${tarball}"
@ -232,12 +237,12 @@ detect_version() {
if [[ ${#OKV_ARRAY[@]} -ge 3 ]] && [[ ${KV_MAJOR} -ge 3 ]]; then if [[ ${#OKV_ARRAY[@]} -ge 3 ]] && [[ ${KV_MAJOR} -ge 3 ]]; then
# handle non genpatch using sources correctly # handle non genpatch using sources correctly
if [[ -z ${K_WANT_GENPATCHES} && -z ${K_GENPATCHES_VER} && ${KV_PATCH} -gt 0 ]]; then if [[ -z ${K_WANT_GENPATCHES} && -z ${K_GENPATCHES_VER} && ${KV_PATCH} -gt 0 ]]; then
KERNEL_URI="${KERNEL_BASE_URI}/patch-${OKV}.bz2" KERNEL_URI="${KERNEL_BASE_URI}/patch-${OKV}.xz"
UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${CKV}.bz2" UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${CKV}.xz"
fi fi
KERNEL_URI="${KERNEL_URI} ${KERNEL_BASE_URI}/linux-${KV_MAJOR}.${KV_MINOR}.tar.bz2" KERNEL_URI="${KERNEL_URI} ${KERNEL_BASE_URI}/linux-${KV_MAJOR}.${KV_MINOR}.tar.xz"
else else
KERNEL_URI="${KERNEL_BASE_URI}/linux-${OKV}.tar.bz2" KERNEL_URI="${KERNEL_BASE_URI}/linux-${OKV}.tar.xz"
fi fi
RELEASE=${CKV/${OKV}} RELEASE=${CKV/${OKV}}
@ -291,9 +296,9 @@ detect_version() {
else else
OKV="${KV_MAJOR}.${KV_PATCH}" OKV="${KV_MAJOR}.${KV_PATCH}"
fi fi
KERNEL_URI="${KERNEL_BASE_URI}/patch-${CKV}.bz2 KERNEL_URI="${KERNEL_BASE_URI}/patch-${CKV}.xz
${KERNEL_BASE_URI}/linux-${OKV}.tar.bz2" ${KERNEL_BASE_URI}/linux-${OKV}.tar.xz"
UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${CKV}.bz2" UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${CKV}.xz"
fi fi
# We need to set this using OKV, but we need to set it before we do any # We need to set this using OKV, but we need to set it before we do any
@ -308,30 +313,30 @@ detect_version() {
# for example: # for example:
# CKV="2.6.11_rc3_pre2" # CKV="2.6.11_rc3_pre2"
# will pull: # will pull:
# linux-2.6.10.tar.bz2 & patch-2.6.11-rc3.bz2 & patch-2.6.11-rc3-git2.bz2 # linux-2.6.10.tar.xz & patch-2.6.11-rc3.xz & patch-2.6.11-rc3-git2.xz
if [[ ${KV_MAJOR}${KV_MINOR} -eq 26 ]]; then if [[ ${KV_MAJOR}${KV_MINOR} -eq 26 ]]; then
if [[ ${RELEASETYPE} == -rc ]] || [[ ${RELEASETYPE} == -pre ]]; then if [[ ${RELEASETYPE} == -rc ]] || [[ ${RELEASETYPE} == -pre ]]; then
OKV="${KV_MAJOR}.${KV_MINOR}.$((${KV_PATCH} - 1))" OKV="${KV_MAJOR}.${KV_MINOR}.$((${KV_PATCH} - 1))"
KERNEL_URI="${KERNEL_BASE_URI}/testing/patch-${CKV//_/-}.bz2 KERNEL_URI="${KERNEL_BASE_URI}/testing/patch-${CKV//_/-}.xz
${KERNEL_BASE_URI}/linux-${OKV}.tar.bz2" ${KERNEL_BASE_URI}/linux-${OKV}.tar.xz"
UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${CKV//_/-}.bz2" UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${CKV//_/-}.xz"
fi fi
if [[ ${RELEASETYPE} == -git ]]; then if [[ ${RELEASETYPE} == -git ]]; then
KERNEL_URI="${KERNEL_BASE_URI}/snapshots/patch-${OKV}${RELEASE}.bz2 KERNEL_URI="${KERNEL_BASE_URI}/snapshots/patch-${OKV}${RELEASE}.xz
${KERNEL_BASE_URI}/linux-${OKV}.tar.bz2" ${KERNEL_BASE_URI}/linux-${OKV}.tar.xz"
UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${OKV}${RELEASE}.bz2" UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${OKV}${RELEASE}.xz"
fi fi
if [[ ${RELEASETYPE} == -rc-git ]]; then if [[ ${RELEASETYPE} == -rc-git ]]; then
OKV="${KV_MAJOR}.${KV_MINOR}.$((${KV_PATCH} - 1))" OKV="${KV_MAJOR}.${KV_MINOR}.$((${KV_PATCH} - 1))"
KERNEL_URI="${KERNEL_BASE_URI}/snapshots/patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${RELEASE}.bz2 KERNEL_URI="${KERNEL_BASE_URI}/snapshots/patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${RELEASE}.xz
${KERNEL_BASE_URI}/testing/patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${RELEASE/-git*}.bz2 ${KERNEL_BASE_URI}/testing/patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${RELEASE/-git*}.xz
${KERNEL_BASE_URI}/linux-${OKV}.tar.bz2" ${KERNEL_BASE_URI}/linux-${OKV}.tar.xz"
UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${RELEASE/-git*}.bz2 ${DISTDIR}/patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${RELEASE}.bz2" UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${RELEASE/-git*}.xz ${DISTDIR}/patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${RELEASE}.xz"
fi fi
else else
if [[ ${RELEASETYPE} == -rc ]] || [[ ${RELEASETYPE} == -pre ]]; then if [[ ${RELEASETYPE} == -rc ]] || [[ ${RELEASETYPE} == -pre ]]; then
@ -341,15 +346,15 @@ detect_version() {
KV_PATCH_ARR=(${KV_PATCH//\./ }) KV_PATCH_ARR=(${KV_PATCH//\./ })
OKV="${KV_MAJOR}.$((${KV_PATCH_ARR} - 1))" OKV="${KV_MAJOR}.$((${KV_PATCH_ARR} - 1))"
fi fi
KERNEL_URI="${KERNEL_BASE_URI}/testing/patch-${CKV//_/-}.bz2 KERNEL_URI="${KERNEL_BASE_URI}/testing/patch-${CKV//_/-}.xz
${KERNEL_BASE_URI}/linux-${OKV}.tar.bz2" ${KERNEL_BASE_URI}/linux-${OKV}.tar.xz"
UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${CKV//_/-}.bz2" UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${CKV//_/-}.xz"
fi fi
if [[ ${RELEASETYPE} == -git ]]; then if [[ ${RELEASETYPE} == -git ]]; then
KERNEL_URI="${KERNEL_BASE_URI}/snapshots/patch-${OKV}${RELEASE}.bz2 KERNEL_URI="${KERNEL_BASE_URI}/snapshots/patch-${OKV}${RELEASE}.xz
${KERNEL_BASE_URI}/linux-${OKV}.tar.bz2" ${KERNEL_BASE_URI}/linux-${OKV}.tar.xz"
UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${OKV}${RELEASE}.bz2" UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${OKV}${RELEASE}.xz"
fi fi
if [[ ${RELEASETYPE} == -rc-git ]]; then if [[ ${RELEASETYPE} == -rc-git ]]; then
@ -359,11 +364,11 @@ detect_version() {
KV_PATCH_ARR=(${KV_PATCH//\./ }) KV_PATCH_ARR=(${KV_PATCH//\./ })
OKV="${KV_MAJOR}.$((${KV_PATCH_ARR} - 1))" OKV="${KV_MAJOR}.$((${KV_PATCH_ARR} - 1))"
fi fi
KERNEL_URI="${KERNEL_BASE_URI}/snapshots/patch-${KV_MAJOR}.${KV_PATCH}${RELEASE}.bz2 KERNEL_URI="${KERNEL_BASE_URI}/snapshots/patch-${KV_MAJOR}.${KV_PATCH}${RELEASE}.xz
${KERNEL_BASE_URI}/testing/patch-${KV_MAJOR}.${KV_PATCH}${RELEASE/-git*}.bz2 ${KERNEL_BASE_URI}/testing/patch-${KV_MAJOR}.${KV_PATCH}${RELEASE/-git*}.xz
${KERNEL_BASE_URI}/linux-${OKV}.tar.bz2" ${KERNEL_BASE_URI}/linux-${OKV}.tar.xz"
UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${KV_MAJOR}.${KV_PATCH}${RELEASE/-git*}.bz2 ${DISTDIR}/patch-${KV_MAJOR}.${KV_PATCH}${RELEASE}.bz2" UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${KV_MAJOR}.${KV_PATCH}${RELEASE/-git*}.xz ${DISTDIR}/patch-${KV_MAJOR}.${KV_PATCH}${RELEASE}.xz"
fi fi
@ -416,11 +421,12 @@ if [[ ${ETYPE} == sources ]]; then
>=sys-devel/binutils-2.11.90.0.31 )" >=sys-devel/binutils-2.11.90.0.31 )"
RDEPEND="!build? ( >=sys-libs/ncurses-5.2 RDEPEND="!build? ( >=sys-libs/ncurses-5.2
sys-devel/make sys-devel/make
dev-lang/perl )" dev-lang/perl
sys-devel/bc )"
PDEPEND="!build? ( virtual/dev-manager )" PDEPEND="!build? ( virtual/dev-manager )"
SLOT="${PVR}" SLOT="${PVR}"
DESCRIPTION="Sources for the ${KV_MAJOR}.${KV_MINOR:-$KV_PATCH} linux kernel" DESCRIPTION="Sources based on the Linux Kernel."
IUSE="symlink build" IUSE="symlink build"
# Bug #266157, deblob for libre support # Bug #266157, deblob for libre support
@ -458,6 +464,7 @@ if [[ ${ETYPE} == sources ]]; then
DEBLOB_URI="${DEBLOB_HOMEPAGE}/${DEBLOB_URI_PATH}/${DEBLOB_A}" DEBLOB_URI="${DEBLOB_HOMEPAGE}/${DEBLOB_URI_PATH}/${DEBLOB_A}"
HOMEPAGE="${HOMEPAGE} ${DEBLOB_HOMEPAGE}" HOMEPAGE="${HOMEPAGE} ${DEBLOB_HOMEPAGE}"
DEPEND+=" deblob? ( =dev-lang/python-2* )"
KERNEL_URI="${KERNEL_URI} KERNEL_URI="${KERNEL_URI}
deblob? ( deblob? (
${DEBLOB_URI} ${DEBLOB_URI}
@ -550,9 +557,9 @@ universal_unpack() {
cd "${WORKDIR}" cd "${WORKDIR}"
if [[ ${#OKV_ARRAY[@]} -ge 3 ]] && [[ ${KV_MAJOR} -ge 3 ]]; then if [[ ${#OKV_ARRAY[@]} -ge 3 ]] && [[ ${KV_MAJOR} -ge 3 ]]; then
unpack linux-${KV_MAJOR}.${KV_MINOR}.tar.bz2 unpack linux-${KV_MAJOR}.${KV_MINOR}.tar.xz
else else
unpack linux-${OKV}.tar.bz2 unpack linux-${OKV}.tar.xz
fi fi
if [[ -d "linux" ]]; then if [[ -d "linux" ]]; then
@ -665,9 +672,9 @@ compile_headers_tweak_config() {
# install functions # install functions
#============================================================== #==============================================================
install_universal() { install_universal() {
#fix silly permissions in tarball # Fix silly permissions in tarball
cd "${WORKDIR}" cd "${WORKDIR}"
chown -R root:0 * >& /dev/null chown -R 0:0 * >& /dev/null
chmod -R a+r-w+X,u+w * chmod -R a+r-w+X,u+w *
cd ${OLDPWD} cd ${OLDPWD}
} }
@ -734,6 +741,12 @@ install_sources() {
fi fi
mv ${WORKDIR}/linux* "${D}"/usr/src mv ${WORKDIR}/linux* "${D}"/usr/src
if [[ -n "${UNIPATCH_DOCS}" ]] ; then
for i in ${UNIPATCH_DOCS}; do
dodoc "${T}"/${i}
done
fi
} }
# pkg_preinst functions # pkg_preinst functions
@ -983,12 +996,12 @@ unipatch() {
if [ -z "${PATCH_DEPTH}" ]; then PATCH_DEPTH=0; fi if [ -z "${PATCH_DEPTH}" ]; then PATCH_DEPTH=0; fi
ebegin "Applying ${i/*\//} (-p${PATCH_DEPTH}+)"
while [ ${PATCH_DEPTH} -lt 5 ]; do while [ ${PATCH_DEPTH} -lt 5 ]; do
echo "Attempting Dry-run:" >> ${STDERR_T} echo "Attempting Dry-run:" >> ${STDERR_T}
echo "cmd: patch -p${PATCH_DEPTH} --no-backup-if-mismatch --dry-run -f < ${i}" >> ${STDERR_T} echo "cmd: patch -p${PATCH_DEPTH} --no-backup-if-mismatch --dry-run -f < ${i}" >> ${STDERR_T}
echo "=======================================================" >> ${STDERR_T} echo "=======================================================" >> ${STDERR_T}
if [ $(patch -p${PATCH_DEPTH} --no-backup-if-mismatch --dry-run -f < ${i} >> ${STDERR_T}) $? -eq 0 ]; then if [ $(patch -p${PATCH_DEPTH} --no-backup-if-mismatch --dry-run -f < ${i} >> ${STDERR_T}) $? -eq 0 ]; then
ebegin "Applying ${i/*\//} (-p${PATCH_DEPTH})"
echo "Attempting patch:" > ${STDERR_T} echo "Attempting patch:" > ${STDERR_T}
echo "cmd: patch -p${PATCH_DEPTH} --no-backup-if-mismatch -f < ${i}" >> ${STDERR_T} echo "cmd: patch -p${PATCH_DEPTH} --no-backup-if-mismatch -f < ${i}" >> ${STDERR_T}
echo "=======================================================" >> ${STDERR_T} echo "=======================================================" >> ${STDERR_T}
@ -1001,28 +1014,38 @@ unipatch() {
eerror "Failed to apply patch ${i/*\//}" eerror "Failed to apply patch ${i/*\//}"
eerror "Please attach ${STDERR_T} to any bug you may post." eerror "Please attach ${STDERR_T} to any bug you may post."
eshopts_pop eshopts_pop
die "Failed to apply ${i/*\//}" die "Failed to apply ${i/*\//} on patch depth ${PATCH_DEPTH}."
fi fi
else else
PATCH_DEPTH=$((${PATCH_DEPTH} + 1)) PATCH_DEPTH=$((${PATCH_DEPTH} + 1))
fi fi
done done
if [ ${PATCH_DEPTH} -eq 5 ]; then if [ ${PATCH_DEPTH} -eq 5 ]; then
eend 1 eerror "Failed to dry-run patch ${i/*\//}"
eerror "Please attach ${STDERR_T} to any bug you may post." eerror "Please attach ${STDERR_T} to any bug you may post."
eshopts_pop eshopts_pop
die "Unable to dry-run patch." die "Unable to dry-run patch on any patch depth lower than 5."
fi fi
done done
done done
# This is a quick, and kind of nasty hack to deal with UNIPATCH_DOCS which # When genpatches is used, we want to install 0000_README which documents
# sit in KPATCH_DIR's. This is handled properly in the unipatch rewrite, # the patches that were used; such that the user can see them, bug #301478.
# which is why I'm not taking too much time over this. if [[ ! -z ${K_WANT_GENPATCHES} ]] ; then
UNIPATCH_DOCS="${UNIPATCH_DOCS} 0000_README"
fi
# When files listed in UNIPATCH_DOCS are found in KPATCH_DIR's, we copy it
# to the temporary directory and remember them in UNIPATCH_DOCS to install
# them during the install phase.
local tmp local tmp
for i in ${UNIPATCH_DOCS}; do for x in ${KPATCH_DIR}; do
tmp="${tmp} ${i//*\/}" for i in ${UNIPATCH_DOCS}; do
cp -f ${i} "${T}"/ if [[ -f "${x}/${i}" ]] ; then
tmp="${tmp} ${i}"
cp -f "${x}/${i}" "${T}"/
fi
done
done done
UNIPATCH_DOCS="${tmp}" UNIPATCH_DOCS="${tmp}"
@ -1150,11 +1173,11 @@ kernel-2_src_unpack() {
if [[ -n ${KV_MINOR} && ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH} < 2.6.27 ]] if [[ -n ${KV_MINOR} && ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH} < 2.6.27 ]]
then then
sed -i \ sed -i \
-e 's|TOUT := .tmp_gas_check|TOUT := $(T).tmp_gas_check|' \ -e 's|TOUT := .tmp_gas_check|TOUT := $(T).tmp_gas_check|' \
"${S}"/arch/ppc/Makefile "${S}"/arch/ppc/Makefile
else else
sed -i \ sed -i \
-e 's|TOUT := .tmp_gas_check|TOUT := $(T).tmp_gas_check|' \ -e 's|TOUT := .tmp_gas_check|TOUT := $(T).tmp_gas_check|' \
"${S}"/arch/powerpc/Makefile "${S}"/arch/powerpc/Makefile
fi fi
} }
@ -1165,8 +1188,7 @@ kernel-2_src_compile() {
if [[ $K_DEBLOB_AVAILABLE == 1 ]] && use deblob ; then if [[ $K_DEBLOB_AVAILABLE == 1 ]] && use deblob ; then
echo ">>> Running deblob script ..." echo ">>> Running deblob script ..."
sh "${T}/${DEBLOB_A}" --force || \ EPYTHON="python2" sh "${T}/${DEBLOB_A}" --force || die "Deblob script failed to run!!!"
die "Deblob script failed to run!!!"
fi fi
} }

View File

@ -1,6 +1,6 @@
# Copyright 1999-2012 Gentoo Foundation # Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2 # Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/libtool.eclass,v 1.102 2012/09/15 16:16:53 zmedico Exp $ # $Header: /var/cvsroot/gentoo-x86/eclass/libtool.eclass,v 1.106 2013/05/11 11:17:58 aballier Exp $
# @ECLASS: libtool.eclass # @ECLASS: libtool.eclass
# @MAINTAINER: # @MAINTAINER:
@ -49,6 +49,15 @@ ELT_try_and_apply_patch() {
fi fi
printf '\nTrying %s\n' "${disp}" >> "${log}" printf '\nTrying %s\n' "${disp}" >> "${log}"
if [[ ! -e ${file} ]] ; then
echo "File not found: ${file}" >> "${log}"
return 1
fi
# Save file for permission restoration. `patch` sometimes resets things.
# Ideally we'd want 'stat -c %a', but stat is highly non portable and we are
# guaranted to have GNU find, so use that instead.
local perms="$(find ${file} -maxdepth 0 -printf '%m')"
# We only support patchlevel of 0 - why worry if its static patches? # We only support patchlevel of 0 - why worry if its static patches?
if patch -p0 --dry-run "${file}" "${patch}" >> "${log}" 2>&1 ; then if patch -p0 --dry-run "${file}" "${patch}" >> "${log}" 2>&1 ; then
einfo " Applying ${disp} ..." einfo " Applying ${disp} ..."
@ -58,6 +67,7 @@ ELT_try_and_apply_patch() {
else else
ret=1 ret=1
fi fi
chmod "${perms}" "${file}"
return "${ret}" return "${ret}"
} }
@ -132,7 +142,7 @@ elibtoolize() {
local deptoremove= local deptoremove=
local do_shallow="no" local do_shallow="no"
local force="false" local force="false"
local elt_patches="install-sh ltmain portage relink max_cmd_len sed test tmp cross as-needed" local elt_patches="install-sh ltmain portage relink max_cmd_len sed test tmp cross as-needed target-nm"
for x in "$@" ; do for x in "$@" ; do
case ${x} in case ${x} in
@ -350,6 +360,10 @@ elibtoolize() {
ret=0 ret=0
fi fi
;; ;;
target-nm)
ELT_walk_patches "${d}/configure" "${p}"
ret=$?
;;
install-sh) install-sh)
ELT_walk_patches "${d}/install-sh" "${p}" ELT_walk_patches "${d}/install-sh" "${p}"
ret=$? ret=$?

View File

@ -0,0 +1,295 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/multibuild.eclass,v 1.12 2013/06/21 10:31:18 mgorny Exp $
# @ECLASS: multibuild
# @MAINTAINER:
# Michał Górny <mgorny@gentoo.org>
# @AUTHOR:
# Author: Michał Górny <mgorny@gentoo.org>
# @BLURB: A generic eclass for building multiple variants of packages.
# @DESCRIPTION:
# The multibuild eclass aims to provide a generic framework for building
# multiple 'variants' of a package (e.g. multilib, Python
# implementations).
case "${EAPI:-0}" in
0|1|2|3)
die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}"
;;
4|5)
;;
*)
die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}"
;;
esac
if [[ ! ${_MULTIBUILD} ]]; then
inherit multiprocessing
# @ECLASS-VARIABLE: MULTIBUILD_VARIANTS
# @DESCRIPTION:
# An array specifying all enabled variants which multibuild_foreach*
# can execute the process for.
#
# In ebuild, it can be set in global scope. Eclasses should set it
# locally in function scope to support nesting properly.
#
# Example:
# @CODE
# python_foreach_impl() {
# local MULTIBUILD_VARIANTS=( python{2_5,2_6,2_7} ... )
# multibuild_foreach_variant python_compile
# }
# @CODE
# @ECLASS-VARIABLE: MULTIBUILD_VARIANT
# @DESCRIPTION:
# The current variant which the function was executed for.
#
# Example value:
# @CODE
# python2_6
# @CODE
# @ECLASS-VARIABLE: MULTIBUILD_ID
# @DESCRIPTION:
# The unique identifier for a multibuild run. In a simple run, it is
# equal to MULTIBUILD_VARIANT. In a nested multibuild environment, it
# contains the complete selection tree.
#
# It can be used to create variant-unique directories and files.
#
# Example value:
# @CODE
# amd64-double
# @CODE
# @ECLASS-VARIABLE: BUILD_DIR
# @DESCRIPTION:
# The current build directory. In global scope, it is supposed
# to contain an 'initial' build directory. If unset, ${S} is used.
#
# multibuild_foreach_variant() sets BUILD_DIR locally
# to variant-specific build directories based on the initial value
# of BUILD_DIR.
#
# Example value:
# @CODE
# ${WORKDIR}/foo-1.3-python2_6
# @CODE
# @FUNCTION: multibuild_foreach_variant
# @USAGE: [<argv>...]
# @DESCRIPTION:
# Run the passed command repeatedly for each of the enabled package
# variants.
#
# Each of the runs will have variant-specific BUILD_DIR set, and output
# teed to a separate log in ${T}.
#
# The function returns 0 if all commands return 0, or the first non-zero
# exit status otherwise. However, it performs all the invocations
# nevertheless. It is preferred to call 'die' inside of the passed
# function.
multibuild_foreach_variant() {
debug-print-function ${FUNCNAME} "${@}"
[[ ${MULTIBUILD_VARIANTS} ]] \
|| die "MULTIBUILD_VARIANTS need to be set"
local bdir=${BUILD_DIR:-${S}}
# Avoid writing outside WORKDIR if S=${WORKDIR}.
[[ ${bdir%%/} == ${WORKDIR%%/} ]] && bdir=${WORKDIR}/build
local prev_id=${MULTIBUILD_ID:+${MULTIBUILD_ID}-}
local ret=0 lret=0 v
debug-print "${FUNCNAME}: initial build_dir = ${bdir}"
for v in "${MULTIBUILD_VARIANTS[@]}"; do
local MULTIBUILD_VARIANT=${v}
local MULTIBUILD_ID=${prev_id}${v}
local BUILD_DIR=${bdir%%/}-${v}
_multibuild_run() {
# find the first non-private command
local i=1
while [[ ${!i} == _* ]]; do
(( i += 1 ))
done
[[ ${i} -le ${#} ]] && einfo "${v}: running ${@:${i}}"
"${@}"
}
_multibuild_run "${@}" \
> >(exec tee -a "${T}/build-${MULTIBUILD_ID}.log") 2>&1
lret=${?}
done
[[ ${ret} -eq 0 && ${lret} -ne 0 ]] && ret=${lret}
return ${ret}
}
# @FUNCTION: multibuild_parallel_foreach_variant
# @USAGE: [<argv>...]
# @DESCRIPTION:
# Run the passed command repeatedly for each of the enabled package
# variants alike multibuild_foreach_variant. Multiple invocations of the command
# will be performed in parallel, up to MULTIBUILD_JOBS tasks.
#
# The function returns 0 if all commands return 0, or the first non-zero
# exit status otherwise. However, it performs all the invocations
# nevertheless. It is preferred to call 'die' inside of the passed
# function.
multibuild_parallel_foreach_variant() {
debug-print-function ${FUNCNAME} "${@}"
local ret lret
_multibuild_parallel() {
(
multijob_child_init
"${@}"
) &
multijob_post_fork
}
local opts
if [[ ${MULTIBUILD_JOBS} ]]; then
opts=-j${MULTIBUILD_JOBS}
else
opts=${MAKEOPTS}
fi
multijob_init "${opts}"
multibuild_foreach_variant _multibuild_parallel "${@}"
ret=${?}
multijob_finish
lret=${?}
[[ ${ret} -eq 0 ]] && ret=${lret}
return ${ret}
}
# @FUNCTION: multibuild_for_best_variant
# @USAGE: [<argv>...]
# @DESCRIPTION:
# Run the passed command once, for the best of the enabled package
# variants.
#
# The run will have a proper, variant-specificBUILD_DIR set, and output
# teed to a separate log in ${T}.
#
# The function returns command exit status.
multibuild_for_best_variant() {
debug-print-function ${FUNCNAME} "${@}"
[[ ${MULTIBUILD_VARIANTS} ]] \
|| die "MULTIBUILD_VARIANTS need to be set"
# bash-4.1 can't handle negative subscripts
local MULTIBUILD_VARIANTS=(
"${MULTIBUILD_VARIANTS[$(( ${#MULTIBUILD_VARIANTS[@]} - 1 ))]}"
)
multibuild_foreach_variant "${@}"
}
# @FUNCTION: multibuild_copy_sources
# @DESCRIPTION:
# Create per-variant copies of source tree. The source tree is assumed
# to be in ${BUILD_DIR}, or ${S} if the former is unset. The copies will
# be placed in directories matching BUILD_DIRs used by
# multibuild_foreach().
multibuild_copy_sources() {
debug-print-function ${FUNCNAME} "${@}"
local _MULTIBUILD_INITIAL_BUILD_DIR=${BUILD_DIR:-${S}}
einfo "Will copy sources from ${_MULTIBUILD_INITIAL_BUILD_DIR}"
_multibuild_create_source_copy() {
einfo "${MULTIBUILD_VARIANT}: copying to ${BUILD_DIR}"
cp -pr "${_MULTIBUILD_INITIAL_BUILD_DIR}" "${BUILD_DIR}" || die
}
multibuild_foreach_variant _multibuild_create_source_copy
}
# @FUNCTION: run_in_build_dir
# @USAGE: <argv>...
# @DESCRIPTION:
# Run the given command in the directory pointed by BUILD_DIR.
run_in_build_dir() {
debug-print-function ${FUNCNAME} "${@}"
local ret
[[ ${#} -ne 0 ]] || die "${FUNCNAME}: no command specified."
[[ ${BUILD_DIR} ]] || die "${FUNCNAME}: BUILD_DIR not set."
pushd "${BUILD_DIR}" >/dev/null || die
"${@}"
ret=${?}
popd >/dev/null || die
return ${ret}
}
# @FUNCTION: multibuild_merge_root
# @USAGE: <src-root> <dest-root>
# @DESCRIPTION:
# Merge the directory tree (fake root) from <src-root> to <dest-root>
# (the real root). Both directories have to be real, absolute paths
# (i.e. including ${D}). Source root will be removed.
#
# This functions uses locking to support merging during parallel
# installs.
multibuild_merge_root() {
local src=${1}
local dest=${2}
local lockfile=${T}/.multibuild_merge_lock
local lockfile_l=${lockfile}.${BASHPID}
local ret
# Lock the install tree for merge. The touch+ln method ensures race
# condition-free locking with maximum portability.
touch "${lockfile_l}" || die
until ln "${lockfile_l}" "${lockfile}" &>/dev/null; do
sleep 1
done
rm "${lockfile_l}" || die
if use userland_BSD; then
# 'cp -a -n' is broken:
# http://www.freebsd.org/cgi/query-pr.cgi?pr=174489
# using tar instead which is universal but terribly slow.
tar -C "${src}" -f - -c . \
| tar -x -f - -C "${dest}"
[[ ${PIPESTATUS[*]} == '0 0' ]]
ret=${?}
elif use userland_GNU; then
# cp works with '-a -n'.
cp -a -l -n "${src}"/. "${dest}"/
ret=${?}
else
die "Unsupported userland (${USERLAND}), please report."
fi
# Remove the lock.
rm "${lockfile}" || die
if [[ ${ret} -ne 0 ]]; then
die "${MULTIBUILD_VARIANT:-(unknown)}: merging image failed."
fi
rm -rf "${src}"
}
_MULTIBUILD=1
fi

View File

@ -1,6 +1,6 @@
# Copyright 1999-2013 Gentoo Foundation # Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2 # Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/multilib-build.eclass,v 1.1 2013/02/01 21:39:50 mgorny Exp $ # $Header: /var/cvsroot/gentoo-x86/eclass/multilib-build.eclass,v 1.14 2013/06/28 02:37:52 mgorny Exp $
# @ECLASS: multilib-build.eclass # @ECLASS: multilib-build.eclass
# @MAINTAINER: # @MAINTAINER:
@ -17,13 +17,13 @@
if [[ ! ${_MULTILIB_BUILD} ]]; then if [[ ! ${_MULTILIB_BUILD} ]]; then
# EAPI=5 is required for meaningful MULTILIB_USEDEP. # EAPI=4 is required for meaningful MULTILIB_USEDEP.
case ${EAPI:-0} in case ${EAPI:-0} in
5) ;; 4|5) ;;
*) die "EAPI=${EAPI} is not supported" ;; *) die "EAPI=${EAPI} is not supported" ;;
esac esac
inherit multilib multiprocessing inherit multibuild multilib
# @ECLASS-VARIABLE: _MULTILIB_FLAGS # @ECLASS-VARIABLE: _MULTILIB_FLAGS
# @INTERNAL # @INTERNAL
@ -32,6 +32,7 @@ inherit multilib multiprocessing
_MULTILIB_FLAGS=( _MULTILIB_FLAGS=(
abi_x86_32:x86 abi_x86_32:x86
abi_x86_64:amd64 abi_x86_64:amd64
abi_x86_x32:x32
) )
# @ECLASS-VARIABLE: MULTILIB_USEDEP # @ECLASS-VARIABLE: MULTILIB_USEDEP
@ -80,11 +81,29 @@ multilib_get_enabled_abis() {
done done
if [[ ! ${found} ]]; then if [[ ! ${found} ]]; then
debug-print "${FUNCNAME}: no ABIs enabled, fallback to ${DEFAULT_ABI}" # ${ABI} can be used to override the fallback (multilib-portage),
echo ${DEFAULT_ABI} # ${DEFAULT_ABI} is the safe fallback.
local abi=${ABI:-${DEFAULT_ABI}}
debug-print "${FUNCNAME}: no ABIs enabled, fallback to ${abi}"
debug-print "${FUNCNAME}: ABI=${ABI}, DEFAULT_ABI=${DEFAULT_ABI}"
echo ${abi}
fi fi
} }
# @FUNCTION: _multilib_multibuild_wrapper
# @USAGE: <argv>...
# @INTERNAL
# @DESCRIPTION:
# Initialize the environment for ABI selected for multibuild.
_multilib_multibuild_wrapper() {
debug-print-function ${FUNCNAME} "${@}"
local ABI=${MULTIBUILD_VARIANT}
multilib_toolchain_setup "${ABI}"
"${@}"
}
# @FUNCTION: multilib_foreach_abi # @FUNCTION: multilib_foreach_abi
# @USAGE: <argv>... # @USAGE: <argv>...
# @DESCRIPTION: # @DESCRIPTION:
@ -95,13 +114,10 @@ multilib_get_enabled_abis() {
# If multilib support is disabled, it just runs the commands. No setup # If multilib support is disabled, it just runs the commands. No setup
# is done. # is done.
multilib_foreach_abi() { multilib_foreach_abi() {
local initial_dir=${BUILD_DIR:-${S}} debug-print-function ${FUNCNAME} "${@}"
local ABI local MULTIBUILD_VARIANTS=( $(multilib_get_enabled_abis) )
for ABI in $(multilib_get_enabled_abis); do multibuild_foreach_variant _multilib_multibuild_wrapper "${@}"
multilib_toolchain_setup "${ABI}"
BUILD_DIR=${initial_dir%%/}-${ABI} "${@}"
done
} }
# @FUNCTION: multilib_parallel_foreach_abi # @FUNCTION: multilib_parallel_foreach_abi
@ -117,24 +133,209 @@ multilib_foreach_abi() {
# #
# Useful for running configure scripts. # Useful for running configure scripts.
multilib_parallel_foreach_abi() { multilib_parallel_foreach_abi() {
local initial_dir=${BUILD_DIR:-${S}} debug-print-function ${FUNCNAME} "${@}"
multijob_init local MULTIBUILD_VARIANTS=( $(multilib_get_enabled_abis) )
multibuild_parallel_foreach_variant _multilib_multibuild_wrapper "${@}"
}
local ABI # @FUNCTION: multilib_for_best_abi
for ABI in $(multilib_get_enabled_abis); do # @USAGE: <argv>...
( # @DESCRIPTION:
multijob_child_init # Runs the given command with setup for the 'best' (usually native) ABI.
multilib_for_best_abi() {
debug-print-function ${FUNCNAME} "${@}"
multilib_toolchain_setup "${ABI}" local MULTIBUILD_VARIANTS=( $(multilib_get_enabled_abis) )
BUILD_DIR=${initial_dir%%/}-${ABI}
"${@}"
) &
multijob_post_fork multibuild_for_best_variant _multilib_multibuild_wrapper "${@}"
}
# @FUNCTION: multilib_check_headers
# @DESCRIPTION:
# Check whether the header files are consistent between ABIs.
#
# This function needs to be called after each ABI's installation phase.
# It obtains the header file checksums and compares them with previous
# runs (if any). Dies if header files differ.
multilib_check_headers() {
_multilib_header_cksum() {
[[ -d ${ED}usr/include ]] && \
find "${ED}"usr/include -type f \
-exec cksum {} + | sort -k2
}
local cksum=$(_multilib_header_cksum)
local cksum_file=${T}/.multilib_header_cksum
if [[ -f ${cksum_file} ]]; then
local cksum_prev=$(< "${cksum_file}")
if [[ ${cksum} != ${cksum_prev} ]]; then
echo "${cksum}" > "${cksum_file}.new"
eerror "Header files have changed between ABIs."
if type -p diff &>/dev/null; then
eerror "$(diff -du "${cksum_file}" "${cksum_file}.new")"
else
eerror "Old checksums in: ${cksum_file}"
eerror "New checksums in: ${cksum_file}.new"
fi
die "Header checksum mismatch, aborting."
fi
else
echo "${cksum}" > "${cksum_file}"
fi
}
# @FUNCTION: multilib_copy_sources
# @DESCRIPTION:
# Create a single copy of the package sources for each enabled ABI.
#
# The sources are always copied from initial BUILD_DIR (or S if unset)
# to ABI-specific build directory matching BUILD_DIR used by
# multilib_foreach_abi().
multilib_copy_sources() {
debug-print-function ${FUNCNAME} "${@}"
local MULTIBUILD_VARIANTS=( $(multilib_get_enabled_abis) )
multibuild_copy_sources
}
# @ECLASS-VARIABLE: MULTILIB_WRAPPED_HEADERS
# @DESCRIPTION:
# A list of headers to wrap for multilib support. The listed headers
# will be moved to a non-standard location and replaced with a file
# including them conditionally to current ABI.
#
# This variable has to be a bash array. Paths shall be relative to
# installation root (${ED}), and name regular files. Recursive wrapping
# is not supported.
#
# Please note that header wrapping is *discouraged*. It is preferred to
# install all headers in a subdirectory of libdir and use pkg-config to
# locate the headers. Some C preprocessors will not work with wrapped
# headers.
#
# Example:
# @CODE
# MULTILIB_WRAPPED_HEADERS=(
# /usr/include/foobar/config.h
# )
# @CODE
# @FUNCTION: multilib_prepare_wrappers
# @USAGE: [<install-root>]
# @DESCRIPTION:
# Perform the preparation of all kinds of wrappers for the current ABI.
# This function shall be called once per each ABI, after installing
# the files to be wrapped.
#
# Takes an optional custom <install-root> from which files will be
# used. If no root is specified, uses ${ED}.
#
# The files to be wrapped are specified using separate variables,
# e.g. MULTILIB_WRAPPED_HEADERS. Those variables shall not be changed
# between the successive calls to multilib_prepare_wrappers
# and multilib_install_wrappers.
#
# After all wrappers are prepared, multilib_install_wrappers shall
# be called to commit them to the installation tree.
multilib_prepare_wrappers() {
debug-print-function ${FUNCNAME} "${@}"
[[ ${#} -le 1 ]] || die "${FUNCNAME}: too many arguments"
local root=${1:-${ED}}
local f
for f in "${MULTILIB_WRAPPED_HEADERS[@]}"; do
# drop leading slash if it's there
f=${f#/}
if [[ ${f} != usr/include/* ]]; then
die "Wrapping headers outside of /usr/include is not supported at the moment."
fi
# and then usr/include
f=${f#usr/include}
local dir=${f%/*}
# $CHOST shall be set by multilib_toolchain_setup
dodir "/tmp/multilib-include/${CHOST}${dir}"
mv "${root}/usr/include${f}" "${ED}/tmp/multilib-include/${CHOST}${dir}/" || die
if [[ ! -f ${ED}/tmp/multilib-include${f} ]]; then
dodir "/tmp/multilib-include${dir}"
# a generic template
cat > "${ED}/tmp/multilib-include${f}" <<_EOF_
/* This file is auto-generated by multilib-build.eclass
* as a multilib-friendly wrapper. For the original content,
* please see the files that are #included below.
*/
#if defined(__x86_64__) /* amd64 */
# if defined(__ILP32__) /* x32 ABI */
# error "abi_x86_x32 not supported by the package."
# else /* 64-bit ABI */
# error "abi_x86_64 not supported by the package."
# endif
#elif defined(__i386__) /* plain x86 */
# error "abi_x86_32 not supported by the package."
#else
# error "No ABI matched, please report a bug to bugs.gentoo.org"
#endif
_EOF_
fi
# XXX: get abi_* directly
local abi_flag
case "${ABI}" in
amd64)
abi_flag=abi_x86_64;;
x86)
abi_flag=abi_x86_32;;
x32)
abi_flag=abi_x86_x32;;
*)
die "Header wrapping for ${ABI} not supported yet";;
esac
# Note: match a space afterwards to avoid collision potential.
sed -e "/${abi_flag} /s&error.*&include <${CHOST}${f}>&" \
-i "${ED}/tmp/multilib-include${f}" || die
done done
}
multijob_finish # @FUNCTION: multilib_install_wrappers
# @USAGE: [<install-root>]
# @DESCRIPTION:
# Install the previously-prepared wrappers. This function shall
# be called once, after all wrappers were prepared.
#
# Takes an optional custom <install-root> to which the wrappers will be
# installed. If no root is specified, uses ${ED}. There is no need to
# use the same root as when preparing the wrappers.
#
# The files to be wrapped are specified using separate variables,
# e.g. MULTILIB_WRAPPED_HEADERS. Those variables shall not be changed
# between the calls to multilib_prepare_wrappers
# and multilib_install_wrappers.
multilib_install_wrappers() {
debug-print-function ${FUNCNAME} "${@}"
[[ ${#} -le 1 ]] || die "${FUNCNAME}: too many arguments"
local root=${1:-${ED}}
if [[ -d "${ED}"/tmp/multilib-include ]]; then
multibuild_merge_root \
"${ED}"/tmp/multilib-include "${root}"/usr/include
# it can fail if something else uses /tmp
rmdir "${ED}"/tmp &>/dev/null
fi
} }
_MULTILIB_BUILD=1 _MULTILIB_BUILD=1

View File

@ -0,0 +1,121 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/multilib-minimal.eclass,v 1.5 2013/06/28 12:42:48 mgorny Exp $
# @ECLASS: multilib-minimal.eclass
# @MAINTAINER:
# Julian Ospald <hasufell@gentoo.org>
# @BLURB: wrapper for multilib builds providing convenient multilib_src_* functions
# @DESCRIPTION:
#
# src_configure, src_compile, src_test and src_install are exported.
#
# Use multilib_src_* instead of src_* which runs this phase for
# all enabled ABIs.
#
# multilib-minimal should _always_ go last in inherit order!
#
# If you want to use in-source builds, then you must run
# multilib_copy_sources at the end of src_prepare!
# Also make sure to set correct variables such as
# ECONF_SOURCE=${S}
#
# If you need generic install rules, use multilib_src_install_all function.
# EAPI=4 is required for meaningful MULTILIB_USEDEP.
case ${EAPI:-0} in
4|5) ;;
*) die "EAPI=${EAPI} is not supported" ;;
esac
inherit multilib-build
EXPORT_FUNCTIONS src_configure src_compile src_test src_install
multilib-minimal_src_configure() {
multilib-minimal_abi_src_configure() {
mkdir -p "${BUILD_DIR}" || die
pushd "${BUILD_DIR}" >/dev/null || die
if declare -f multilib_src_configure >/dev/null ; then
multilib_src_configure
else
default_src_configure
fi
popd >/dev/null || die
}
multilib_foreach_abi multilib-minimal_abi_src_configure
}
multilib-minimal_src_compile() {
multilib-minimal_abi_src_compile() {
pushd "${BUILD_DIR}" >/dev/null || die
if declare -f multilib_src_compile >/dev/null ; then
multilib_src_compile
else
default_src_compile
fi
popd >/dev/null || die
}
multilib_foreach_abi multilib-minimal_abi_src_compile
}
multilib-minimal_src_test() {
multilib-minimal_abi_src_test() {
pushd "${BUILD_DIR}" >/dev/null || die
if declare -f multilib_src_test >/dev/null ; then
multilib_src_test
else
default_src_test
fi
popd >/dev/null || die
}
multilib_foreach_abi multilib-minimal_abi_src_test
}
multilib-minimal_src_install() {
multilib-minimal_abi_src_install() {
pushd "${BUILD_DIR}" >/dev/null || die
if declare -f multilib_src_install >/dev/null ; then
multilib_src_install
else
# default_src_install will not work here as it will
# break handling of DOCS wrt #468092
# so we split up the emake and doc-install part
# this is synced with __eapi4_src_install
if [[ -f Makefile || -f GNUmakefile || -f makefile ]] ; then
emake DESTDIR="${D}" install
fi
fi
# Do multilib magic only when >1 ABI is used.
if [[ ${#MULTIBUILD_VARIANTS[@]} -gt 1 ]]; then
multilib_prepare_wrappers
multilib_check_headers
fi
popd >/dev/null || die
}
multilib_foreach_abi multilib-minimal_abi_src_install
multilib_install_wrappers
if declare -f multilib_src_install_all >/dev/null ; then
multilib_src_install_all
fi
# this is synced with __eapi4_src_install
if ! declare -p DOCS &>/dev/null ; then
local d
for d in README* ChangeLog AUTHORS NEWS TODO CHANGES \
THANKS BUGS FAQ CREDITS CHANGELOG ; do
[[ -s "${d}" ]] && dodoc "${d}"
done
elif [[ $(declare -p DOCS) == "declare -a "* ]] ; then
dodoc "${DOCS[@]}"
else
dodoc ${DOCS}
fi
}

View File

@ -1,6 +1,6 @@
# Copyright 1999-2013 Gentoo Foundation # Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2 # Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/multilib.eclass,v 1.102 2013/01/21 19:22:25 mgorny Exp $ # $Header: /var/cvsroot/gentoo-x86/eclass/multilib.eclass,v 1.103 2013/04/22 01:18:51 vapier Exp $
# @ECLASS: multilib.eclass # @ECLASS: multilib.eclass
# @MAINTAINER: # @MAINTAINER:
@ -397,7 +397,7 @@ multilib_toolchain_setup() {
if [[ ${__DEFAULT_ABI_SAVED} == "true" ]] ; then if [[ ${__DEFAULT_ABI_SAVED} == "true" ]] ; then
for v in CHOST CBUILD AS CC CXX LD PKG_CONFIG_{LIBDIR,PATH} ; do for v in CHOST CBUILD AS CC CXX LD PKG_CONFIG_{LIBDIR,PATH} ; do
vv="__abi_saved_${v}" vv="__abi_saved_${v}"
export ${v}="${!vv}" [[ ${!vv+set} == "set" ]] && export ${v}="${!vv}" || unset ${v}
unset ${vv} unset ${vv}
done done
unset __DEFAULT_ABI_SAVED unset __DEFAULT_ABI_SAVED
@ -408,7 +408,8 @@ multilib_toolchain_setup() {
if [[ ${ABI} != ${DEFAULT_ABI} ]] ; then if [[ ${ABI} != ${DEFAULT_ABI} ]] ; then
# Back that multilib-ass up so we can restore it later # Back that multilib-ass up so we can restore it later
for v in CHOST CBUILD AS CC CXX LD PKG_CONFIG_{LIBDIR,PATH} ; do for v in CHOST CBUILD AS CC CXX LD PKG_CONFIG_{LIBDIR,PATH} ; do
export __abi_saved_${v}="${!v}" vv="__abi_saved_${v}"
[[ ${!v+set} == "set" ]] && export ${vv}="${!v}" || unset ${vv}
done done
export __DEFAULT_ABI_SAVED="true" export __DEFAULT_ABI_SAVED="true"

View File

@ -1,6 +1,6 @@
# Copyright 1999-2011 Gentoo Foundation # Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2 # Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/pax-utils.eclass,v 1.18 2012/04/06 18:03:54 blueness Exp $ # $Header: /var/cvsroot/gentoo-x86/eclass/pax-utils.eclass,v 1.21 2013/05/18 13:43:20 zorry Exp $
# @ECLASS: pax-utils.eclass # @ECLASS: pax-utils.eclass
# @MAINTAINER: # @MAINTAINER:
@ -8,22 +8,27 @@
# @AUTHOR: # @AUTHOR:
# Original Author: Kevin F. Quinn <kevquinn@gentoo.org> # Original Author: Kevin F. Quinn <kevquinn@gentoo.org>
# Modifications for bug #365825, @ ECLASS markup: Anthony G. Basile <blueness@gentoo.org> # Modifications for bug #365825, @ ECLASS markup: Anthony G. Basile <blueness@gentoo.org>
# Modifications for bug #431092: Anthony G. Basile <blueness@gentoo.org>
# @BLURB: functions to provide pax markings # @BLURB: functions to provide pax markings
# @DESCRIPTION: # @DESCRIPTION:
# This eclass provides support for manipulating PaX markings on ELF binaries,
# wrapping the use of the paxctl and scanelf utilities. It decides which to
# use depending on what is installed on the build host, preferring paxctl to
# scanelf. If paxctl is not installed, we fall back to scanelf since it is
# always present. However, currently scanelf doesn't do all that paxctl can.
# #
# To control what markings are made, set PAX_MARKINGS in /etc/make.conf to # This eclass provides support for manipulating PaX markings on ELF binaries,
# contain either "PT" or "none". If PAX_MARKINGS is set to "PT", and the # whether the system is using legacy PT_PAX markings or the newer XATTR_PAX.
# necessary utility is installed, the PT_PAX_FLAGS markings will be made. If # The eclass wraps the use of paxctl-ng, paxctl, set/getattr and scanelf utilities,
# PAX_MARKINGS is set to "none", no markings will be made. # deciding which to use depending on what's installed on the build host, and
# whether we're working with PT_PAX, XATTR_PAX or both.
#
# To control what markings are made, set PAX_MARKINGS in /etc/portage/make.conf
# to contain either "PT", "XT" or "none". The default is to attempt both
# PT_PAX and XATTR_PAX.
if [[ ${___ECLASS_ONCE_PAX_UTILS} != "recur -_+^+_- spank" ]] ; then if [[ ${___ECLASS_ONCE_PAX_UTILS} != "recur -_+^+_- spank" ]] ; then
___ECLASS_ONCE_PAX_UTILS="recur -_+^+_- spank" ___ECLASS_ONCE_PAX_UTILS="recur -_+^+_- spank"
# @ECLASS-VARIABLE: PAX_MARKINGS
# @DESCRIPTION:
# Control which markings are made:
# PT = PT_PAX markings, XT = XATTR_PAX markings
# Default to PT markings. # Default to PT markings.
PAX_MARKINGS=${PAX_MARKINGS:="PT"} PAX_MARKINGS=${PAX_MARKINGS:="PT"}
@ -33,78 +38,136 @@ PAX_MARKINGS=${PAX_MARKINGS:="PT"}
# @DESCRIPTION: # @DESCRIPTION:
# Marks <ELF files> with provided PaX <flags> # Marks <ELF files> with provided PaX <flags>
# #
# Flags are passed directly to the utilities unchanged. Possible flags at the # Flags are passed directly to the utilities unchanged
# time of writing, taken from /sbin/paxctl, are:
# #
# p: disable PAGEEXEC P: enable PAGEEXEC # p: disable PAGEEXEC P: enable PAGEEXEC
# e: disable EMUTRMAP E: enable EMUTRMAP # e: disable EMUTRAMP E: enable EMUTRAMP
# m: disable MPROTECT M: enable MPROTECT # m: disable MPROTECT M: enable MPROTECT
# r: disable RANDMMAP R: enable RANDMMAP # r: disable RANDMMAP R: enable RANDMMAP
# s: disable SEGMEXEC S: enable SEGMEXEC # s: disable SEGMEXEC S: enable SEGMEXEC
# #
# Default flags are 'PeMRS', which are the most restrictive settings. Refer # Default flags are 'PeMRS', which are the most restrictive settings. Refer
# to http://pax.grsecurity.net/ for details on what these flags are all about. # to http://pax.grsecurity.net/ for details on what these flags are all about.
# Do not use the obsolete flag 'x'/'X' which has been deprecated.
# #
# Please confirm any relaxation of restrictions with the Gentoo Hardened team. # Please confirm any relaxation of restrictions with the Gentoo Hardened team.
# Either ask on the gentoo-hardened mailing list, or CC/assign hardened@g.o on # Either ask on the gentoo-hardened mailing list, or CC/assign hardened@g.o on
# the bug report. # the bug report.
pax-mark() { pax-mark() {
local f flags fail=0 failures="" zero_load_alignment
# Ignore '-' characters - in particular so that it doesn't matter if local f # loop over paxables
# the caller prefixes with - local flags # pax flags
flags=${1//-} local pt_fail=0 pt_failures="" # record PT_PAX failures
local xt_fail=0 xt_failures="" # record xattr PAX marking failures
local ret=0 # overal return code of this function
# Only the actual PaX flags and z are accepted
# 1. The leading '-' is optional
# 2. -C -c only make sense for paxctl, but are unnecessary
# because we progressively do -q -qc -qC
# 3. z is allowed for the default
flags="${1//[!zPpEeMmRrSs]}"
[[ "${flags}" ]] || return 0
shift shift
# Try paxctl, then scanelf. paxctl is preferred.
if type -p paxctl > /dev/null && has PT ${PAX_MARKINGS}; then # z = default. For XATTR_PAX, the default is no xattr field at all
# Try paxctl, the upstream supported tool. local dodefault=""
einfo "PT PaX marking -${flags}" [[ "${flags//[!z]}" ]] && dodefault="yes"
_pax_list_files einfo "$@"
for f in "$@"; do if has PT ${PAX_MARKINGS}; then
# First, try modifying the existing PAX_FLAGS header
paxctl -q${flags} "${f}" && continue #First try paxctl -> this might try to create/convert program headers
# Second, try stealing the (unused under PaX) PT_GNU_STACK header if type -p paxctl > /dev/null; then
paxctl -qc${flags} "${f}" && continue einfo "PT PaX marking -${flags} with paxctl"
# Third, try pulling the base down a page, to create space and _pax_list_files einfo "$@"
# insert a PT_GNU_STACK header (works on ET_EXEC) for f in "$@"; do
paxctl -qC${flags} "${f}" && continue # First, try modifying the existing PAX_FLAGS header
# paxctl -q${flags} "${f}" && continue
# prelink is masked on hardened so we wont use this method. # Second, try creating a PT_PAX header (works on ET_EXEC)
# We're working on a new utiity to try to do the same safely. See # Even though this is less safe, most exes need it, eg bug #463170
# http://git.overlays.gentoo.org/gitweb/?p=proj/elfix.git;a=summary paxctl -qC${flags} "${f}" && continue
# # Third, try stealing the (unused under PaX) PT_GNU_STACK header
# Fourth - check if it loads to 0 (probably an ET_DYN) and if so, paxctl -qc${flags} "${f}" && continue
# try rebasing with prelink first to give paxctl some space to pt_fail=1
# grow downwards into. pt_failures="${pt_failures} ${f}"
#if type -p objdump > /dev/null && type -p prelink > /dev/null; then done
# zero_load_alignment=$(objdump -p "${f}" | \
# grep -E '^[[:space:]]*LOAD[[:space:]]*off[[:space:]]*0x0+[[:space:]]' | \ #Next try paxctl-ng -> this will not create/convert any program headers
# sed -e 's/.*align\(.*\)/\1/') elif type -p paxctl-ng > /dev/null && paxctl-ng -L ; then
# if [[ ${zero_load_alignment} != "" ]]; then einfo "PT PaX marking -${flags} with paxctl-ng"
# prelink -r $(( 2*(${zero_load_alignment}) )) && flags="${flags//z}"
# paxctl -qC${flags} "${f}" && continue _pax_list_files einfo "$@"
# fi for f in "$@"; do
#fi [[ ${dodefault} == "yes" ]] && paxctl-ng -L -z "${f}"
fail=1 [[ "${flags}" ]] || continue
failures="${failures} ${f}" paxctl-ng -L -${flags} "${f}" && continue
done pt_fail=1
elif type -p scanelf > /dev/null && [[ ${PAX_MARKINGS} != "none" ]]; then pt_failures="${pt_failures} ${f}"
# Try scanelf, the Gentoo swiss-army knife ELF utility done
# Currently this sets PT if it can, no option to control what it does.
einfo "Fallback PaX marking -${flags}" #Finally fall back on scanelf
_pax_list_files einfo "$@" elif type -p scanelf > /dev/null && [[ ${PAX_MARKINGS} != "none" ]]; then
scanelf -Xxz ${flags} "$@" einfo "Fallback PaX marking -${flags} with scanelf"
elif [[ ${PAX_MARKINGS} != "none" ]]; then _pax_list_files einfo "$@"
# Out of options! scanelf -Xxz ${flags} "$@"
failures="$*"
fail=1 #We failed to set PT_PAX flags
elif [[ ${PAX_MARKINGS} != "none" ]]; then
pt_failures="$*"
pt_fail=1
fi
if [[ ${pt_fail} == 1 ]]; then
elog "Failed to set PT_PAX markings -${flags} for:"
_pax_list_files elog ${pt_failures}
ret=1
fi
fi fi
if [[ ${fail} == 1 ]]; then
ewarn "Failed to set PaX markings -${flags} for:" if has XT ${PAX_MARKINGS}; then
_pax_list_files ewarn ${failures}
ewarn "Executables may be killed by PaX kernels." flags="${flags//z}"
#First try paxctl-ng
if type -p paxctl-ng > /dev/null && paxctl-ng -l ; then
einfo "XT PaX marking -${flags} with paxctl-ng"
_pax_list_files einfo "$@"
for f in "$@"; do
[[ ${dodefault} == "yes" ]] && paxctl-ng -d "${f}"
[[ "${flags}" ]] || continue
paxctl-ng -l -${flags} "${f}" && continue
xt_fail=1
xt_failures="${tx_failures} ${f}"
done
#Next try setfattr
elif type -p setfattr > /dev/null; then
[[ "${flags//[!Ee]}" ]] || flags+="e" # bug 447150
einfo "XT PaX marking -${flags} with setfattr"
_pax_list_files einfo "$@"
for f in "$@"; do
[[ ${dodefault} == "yes" ]] && setfattr -x "user.pax.flags" "${f}"
setfattr -n "user.pax.flags" -v "${flags}" "${f}" && continue
xt_fail=1
xt_failures="${tx_failures} ${f}"
done
#We failed to set XATTR_PAX flags
elif [[ ${PAX_MARKINGS} != "none" ]]; then
xt_failures="$*"
xt_fail=1
fi
if [[ ${xt_fail} == 1 ]]; then
elog "Failed to set XATTR_PAX markings -${flags} for:"
_pax_list_files elog ${xt_failures}
ret=1
fi
fi fi
return ${fail}
# [[ ${ret} == 1 ]] && elog "Executables may be killed by PaX kernels."
return ${ret}
} }
# @FUNCTION: list-paxables # @FUNCTION: list-paxables

View File

@ -1,6 +1,6 @@
# Copyright 1999-2012 Gentoo Foundation # Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2 # Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/toolchain-binutils.eclass,v 1.122 2012/12/23 23:37:26 vapier Exp $ # $Header: /var/cvsroot/gentoo-x86/eclass/toolchain-binutils.eclass,v 1.123 2013/02/09 04:32:48 vapier Exp $
# #
# Maintainer: Toolchain Ninjas <toolchain@gentoo.org> # Maintainer: Toolchain Ninjas <toolchain@gentoo.org>
# #
@ -61,7 +61,7 @@ fi
is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; } is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; }
DESCRIPTION="Tools necessary to build programs" DESCRIPTION="Tools necessary to build programs"
HOMEPAGE="http://sources.redhat.com/binutils/" HOMEPAGE="http://sourceware.org/binutils/"
case ${BTYPE} in case ${BTYPE} in
cvs|git) SRC_URI="" ;; cvs|git) SRC_URI="" ;;

View File

@ -1,6 +1,6 @@
# Copyright 1999-2012 Gentoo Foundation # Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2 # Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/toolchain-funcs.eclass,v 1.120 2012/12/29 05:08:54 vapier Exp $ # $Header: /var/cvsroot/gentoo-x86/eclass/toolchain-funcs.eclass,v 1.121 2013/05/14 20:40:34 vapier Exp $
# @ECLASS: toolchain-funcs.eclass # @ECLASS: toolchain-funcs.eclass
# @MAINTAINER: # @MAINTAINER:
@ -367,7 +367,10 @@ ninj() { [[ ${type} == "kern" ]] && echo $1 || echo $2 ; }
arm*) echo arm;; arm*) echo arm;;
avr*) ninj avr32 avr;; avr*) ninj avr32 avr;;
bfin*) ninj blackfin bfin;; bfin*) ninj blackfin bfin;;
c6x) echo c6x;;
cris*) echo cris;; cris*) echo cris;;
frv) echo frv;;
hexagon) echo hexagon;;
hppa*) ninj parisc hppa;; hppa*) ninj parisc hppa;;
i?86*) i?86*)
# Starting with linux-2.6.24, the 'x86_64' and 'i386' # Starting with linux-2.6.24, the 'x86_64' and 'i386'
@ -381,9 +384,11 @@ ninj() { [[ ${type} == "kern" ]] && echo $1 || echo $2 ; }
;; ;;
ia64*) echo ia64;; ia64*) echo ia64;;
m68*) echo m68k;; m68*) echo m68k;;
metag) echo metag;;
mips*) echo mips;; mips*) echo mips;;
nios2*) echo nios2;; nios2*) echo nios2;;
nios*) echo nios;; nios*) echo nios;;
or32) echo openrisc;;
powerpc*) powerpc*)
# Starting with linux-2.6.15, the 'ppc' and 'ppc64' trees # Starting with linux-2.6.15, the 'ppc' and 'ppc64' trees
# have been unified into simply 'powerpc', but until 2.6.16, # have been unified into simply 'powerpc', but until 2.6.16,
@ -405,6 +410,7 @@ ninj() { [[ ${type} == "kern" ]] && echo $1 || echo $2 ; }
fi fi
;; ;;
s390*) echo s390;; s390*) echo s390;;
score) echo score;;
sh64*) ninj sh64 sh;; sh64*) ninj sh64 sh;;
sh*) echo sh;; sh*) echo sh;;
sparc64*) ninj sparc64 sparc;; sparc64*) ninj sparc64 sparc;;
@ -412,6 +418,7 @@ ninj() { [[ ${type} == "kern" ]] && echo $1 || echo $2 ; }
&& ninj sparc64 sparc \ && ninj sparc64 sparc \
|| echo sparc || echo sparc
;; ;;
tile*) echo tile;;
vax*) echo vax;; vax*) echo vax;;
x86_64*freebsd*) echo amd64;; x86_64*freebsd*) echo amd64;;
x86_64*) x86_64*)
@ -423,6 +430,7 @@ ninj() { [[ ${type} == "kern" ]] && echo $1 || echo $2 ; }
ninj x86_64 amd64 ninj x86_64 amd64
fi fi
;; ;;
xtensa*) echo xtensa;;
# since our usage of tc-arch is largely concerned with # since our usage of tc-arch is largely concerned with
# normalizing inputs for testing ${CTARGET}, let's filter # normalizing inputs for testing ${CTARGET}, let's filter

View File

@ -1,6 +1,6 @@
# Copyright 1999-2013 Gentoo Foundation # Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2 # Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/toolchain.eclass,v 1.568 2013/01/24 01:27:27 vapier Exp $ # $Header: /var/cvsroot/gentoo-x86/eclass/toolchain.eclass,v 1.594 2013/06/17 02:23:45 vapier Exp $
# #
# Maintainer: Toolchain Ninjas <toolchain@gentoo.org> # Maintainer: Toolchain Ninjas <toolchain@gentoo.org>
@ -97,7 +97,7 @@ STDCXX_INCDIR=${TOOLCHAIN_STDCXX_INCDIR:-${LIBPATH}/include/g++-v${GCC_BRANCH_VE
#---->> SLOT+IUSE logic <<---- #---->> SLOT+IUSE logic <<----
IUSE="multislot nls nptl test vanilla" IUSE="multislot nls nptl regression-test vanilla"
if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ; then if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ; then
IUSE+=" altivec cxx fortran" IUSE+=" altivec cxx fortran"
@ -113,8 +113,8 @@ if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ; then
tc_version_is_at_least "4.1" && IUSE+=" libssp objc++" tc_version_is_at_least "4.1" && IUSE+=" libssp objc++"
tc_version_is_at_least "4.2" && IUSE+=" openmp" tc_version_is_at_least "4.2" && IUSE+=" openmp"
tc_version_is_at_least "4.3" && IUSE+=" fixed-point" tc_version_is_at_least "4.3" && IUSE+=" fixed-point"
tc_version_is_at_least "4.4" && IUSE+=" graphite" tc_version_is_at_least "4.6" && IUSE+=" graphite"
[[ ${GCC_BRANCH_VER} == 4.5 ]] && IUSE+=" lto" tc_version_is_at_least "4.6" && IUSE+=" lto"
tc_version_is_at_least "4.7" && IUSE+=" go" tc_version_is_at_least "4.7" && IUSE+=" go"
fi fi
fi fi
@ -144,21 +144,27 @@ if tc_version_is_at_least 4 ; then
if tc_version_is_at_least 4.5 ; then if tc_version_is_at_least 4.5 ; then
RDEPEND+=" >=dev-libs/mpc-0.8.1" RDEPEND+=" >=dev-libs/mpc-0.8.1"
fi fi
in_iuse lto && RDEPEND+=" lto? ( || ( >=dev-libs/elfutils-0.143 dev-libs/libelf ) )"
fi fi
if in_iuse graphite ; then if in_iuse graphite ; then
RDEPEND+=" if tc_version_is_at_least 4.8 ; then
graphite? ( RDEPEND+="
>=dev-libs/cloog-ppl-0.15.10 graphite? (
>=dev-libs/ppl-0.11 >=dev-libs/cloog-0.18.0
)" >=dev-libs/isl-0.11.1
)"
else
RDEPEND+="
graphite? (
>=dev-libs/cloog-ppl-0.15.10
>=dev-libs/ppl-0.11
)"
fi
fi fi
DEPEND="${RDEPEND} DEPEND="${RDEPEND}
>=sys-apps/texinfo-4.8
>=sys-devel/bison-1.875 >=sys-devel/bison-1.875
>=sys-devel/flex-2.5.4 >=sys-devel/flex-2.5.4
test? ( regression-test? (
>=dev-util/dejagnu-1.4.4 >=dev-util/dejagnu-1.4.4
>=sys-devel/autogen-5.5.4 >=sys-devel/autogen-5.5.4
)" )"
@ -209,11 +215,10 @@ S=$(
# can be altered by setting the following: # can be altered by setting the following:
# #
# SNAPSHOT # SNAPSHOT
# If set, this variable signals that we should be using a snapshot # If set, this variable signals that we should be using a snapshot of
# of gcc from ftp://sources.redhat.com/pub/gcc/snapshots/. It is # gcc. It is expected to be in the format "YYYY-MM-DD". Note that if
# expected to be in the format "YYYY-MM-DD". Note that if the ebuild # the ebuild has a _pre suffix, this variable is ignored and the
# has a _pre suffix, this variable is ignored and the prerelease # prerelease tarball is used instead.
# tarball is used instead.
# #
# BRANCH_UPDATE # BRANCH_UPDATE
# If set, this variable signals that we should be using the main # If set, this variable signals that we should be using the main
@ -279,7 +284,7 @@ get_gcc_src_uri() {
if [[ -n ${PRERELEASE} ]] ; then if [[ -n ${PRERELEASE} ]] ; then
GCC_SRC_URI="ftp://gcc.gnu.org/pub/gcc/prerelease-${PRERELEASE}/gcc-${PRERELEASE}.tar.bz2" GCC_SRC_URI="ftp://gcc.gnu.org/pub/gcc/prerelease-${PRERELEASE}/gcc-${PRERELEASE}.tar.bz2"
elif [[ -n ${SNAPSHOT} ]] ; then elif [[ -n ${SNAPSHOT} ]] ; then
GCC_SRC_URI="ftp://sources.redhat.com/pub/gcc/snapshots/${SNAPSHOT}/gcc-${SNAPSHOT}.tar.bz2" GCC_SRC_URI="ftp://gcc.gnu.org/pub/gcc/snapshots/${SNAPSHOT}/gcc-${SNAPSHOT}.tar.bz2"
elif [[ ${PV} != *9999* ]] ; then elif [[ ${PV} != *9999* ]] ; then
GCC_SRC_URI="mirror://gnu/gcc/gcc-${GCC_PV}/gcc-${GCC_RELEASE_VER}.tar.bz2" GCC_SRC_URI="mirror://gnu/gcc/gcc-${GCC_PV}/gcc-${GCC_RELEASE_VER}.tar.bz2"
# we want all branch updates to be against the main release # we want all branch updates to be against the main release
@ -605,6 +610,11 @@ toolchain_pkg_postinst() {
# handling of binpkgs, don't require these to be found # handling of binpkgs, don't require these to be found
cp "${ROOT}/${DATAPATH}"/c{89,99} "${ROOT}"/usr/bin/ 2>/dev/null cp "${ROOT}/${DATAPATH}"/c{89,99} "${ROOT}"/usr/bin/ 2>/dev/null
fi fi
if use regression-test ; then
elog "Testsuite results have been installed into /usr/share/doc/${PF}/testsuite"
echo
fi
} }
toolchain_pkg_postrm() { toolchain_pkg_postrm() {
@ -826,13 +836,13 @@ gcc-abi-map() {
gcc-multilib-configure() { gcc-multilib-configure() {
if ! is_multilib ; then if ! is_multilib ; then
confgcc+=" --disable-multilib" confgcc+=( --disable-multilib )
# Fun times: if we are building for a target that has multiple # Fun times: if we are building for a target that has multiple
# possible ABI formats, and the user has told us to pick one # possible ABI formats, and the user has told us to pick one
# that isn't the default, then not specifying it via the list # that isn't the default, then not specifying it via the list
# below will break that on us. # below will break that on us.
else else
confgcc+=" --enable-multilib" confgcc+=( --enable-multilib )
fi fi
# translate our notion of multilibs into gcc's # translate our notion of multilibs into gcc's
@ -844,7 +854,7 @@ gcc-multilib-configure() {
if [[ -n ${list} ]] ; then if [[ -n ${list} ]] ; then
case ${CTARGET} in case ${CTARGET} in
x86_64*) x86_64*)
tc_version_is_at_least 4.7 && confgcc+=" --with-multilib-list=${list:1}" tc_version_is_at_least 4.7 && confgcc+=( --with-multilib-list=${list:1} )
;; ;;
esac esac
fi fi
@ -855,21 +865,21 @@ gcc-compiler-configure() {
if tc_version_is_at_least "4.0" ; then if tc_version_is_at_least "4.0" ; then
if in_iuse mudflap ; then if in_iuse mudflap ; then
confgcc+=" $(use_enable mudflap libmudflap)" confgcc+=( $(use_enable mudflap libmudflap) )
else else
confgcc+=" --disable-libmudflap" confgcc+=( --disable-libmudflap )
fi fi
if use_if_iuse libssp ; then if use_if_iuse libssp ; then
confgcc+=" --enable-libssp" confgcc+=( --enable-libssp )
else else
export gcc_cv_libc_provides_ssp=yes export gcc_cv_libc_provides_ssp=yes
confgcc+=" --disable-libssp" confgcc+=( --disable-libssp )
fi fi
# If we want hardened support with the newer piepatchset for >=gcc 4.4 # If we want hardened support with the newer piepatchset for >=gcc 4.4
if tc_version_is_at_least 4.4 && want_minispecs ; then if tc_version_is_at_least 4.4 && want_minispecs ; then
confgcc+=" $(use_enable hardened esp)" confgcc+=( $(use_enable hardened esp) )
fi fi
if tc_version_is_at_least "4.2" ; then if tc_version_is_at_least "4.2" ; then
@ -881,14 +891,14 @@ gcc-compiler-configure() {
if ! is_crosscompile || \ if ! is_crosscompile || \
$(tc-getCPP ${CTARGET}) -E - <<<"#include <pthread.h>" >& /dev/null $(tc-getCPP ${CTARGET}) -E - <<<"#include <pthread.h>" >& /dev/null
then then
confgcc+=" $(use_enable openmp libgomp)" confgcc+=( $(use_enable openmp libgomp) )
else else
# Force disable as the configure script can be dumb #359855 # Force disable as the configure script can be dumb #359855
confgcc+=" --disable-libgomp" confgcc+=( --disable-libgomp )
fi fi
else else
# For gcc variants where we don't want openmp (e.g. kgcc) # For gcc variants where we don't want openmp (e.g. kgcc)
confgcc+=" --disable-libgomp" confgcc+=( --disable-libgomp )
fi fi
fi fi
@ -903,108 +913,111 @@ gcc-compiler-configure() {
# #
# This should translate into "/share/gcc-data/${CTARGET}/${GCC_CONFIG_VER}/python" # This should translate into "/share/gcc-data/${CTARGET}/${GCC_CONFIG_VER}/python"
if tc_version_is_at_least "4.4" ; then if tc_version_is_at_least "4.4" ; then
confgcc+=" --with-python-dir=${DATAPATH/$PREFIX/}/python" confgcc+=( --with-python-dir=${DATAPATH/$PREFIX/}/python )
fi fi
fi fi
# Enable build warnings by default with cross-compilers when system # Enable build warnings by default with cross-compilers when system
# paths are included (e.g. via -I flags). # paths are included (e.g. via -I flags).
is_crosscompile && confgcc+=" --enable-poison-system-directories" is_crosscompile && confgcc+=( --enable-poison-system-directories )
# For newer versions of gcc, use the default ("release"), because no # For newer versions of gcc, use the default ("release"), because no
# one (even upstream apparently) tests with it disabled. #317217 # one (even upstream apparently) tests with it disabled. #317217
if tc_version_is_at_least 4 || [[ -n ${GCC_CHECKS_LIST} ]] ; then if tc_version_is_at_least 4 || [[ -n ${GCC_CHECKS_LIST} ]] ; then
confgcc+=" --enable-checking=${GCC_CHECKS_LIST:-release}" confgcc+=( --enable-checking=${GCC_CHECKS_LIST:-release} )
else else
confgcc+=" --disable-checking" confgcc+=( --disable-checking )
fi fi
# GTK+ is preferred over xlib in 3.4.x (xlib is unmaintained # GTK+ is preferred over xlib in 3.4.x (xlib is unmaintained
# right now). Much thanks to <csm@gnu.org> for the heads up. # right now). Much thanks to <csm@gnu.org> for the heads up.
# Travis Tilley <lv@gentoo.org> (11 Jul 2004) # Travis Tilley <lv@gentoo.org> (11 Jul 2004)
if ! is_gcj ; then if ! is_gcj ; then
confgcc+=" --disable-libgcj" confgcc+=( --disable-libgcj )
elif use gtk ; then elif use gtk ; then
confgcc+=" --enable-java-awt=gtk" confgcc+=( --enable-java-awt=gtk )
fi fi
# allow gcc to search for clock funcs in the main C lib. # allow gcc to search for clock funcs in the main C lib.
# if it can't find them, then tough cookies -- we aren't # if it can't find them, then tough cookies -- we aren't
# going to link in -lrt to all C++ apps. #411681 # going to link in -lrt to all C++ apps. #411681
if tc_version_is_at_least 4.4 && is_cxx ; then if tc_version_is_at_least 4.4 && is_cxx ; then
confgcc+=" --enable-libstdcxx-time" confgcc+=( --enable-libstdcxx-time )
fi fi
# newer gcc versions like to bootstrap themselves with C++, # newer gcc versions like to bootstrap themselves with C++,
# so we need to manually disable it ourselves # so we need to manually disable it ourselves
if tc_version_is_at_least 4.7 && ! is_cxx ; then if tc_version_is_at_least 4.7 && ! is_cxx ; then
confgcc+=" --disable-build-with-cxx --disable-build-poststage1-with-cxx" confgcc+=( --disable-build-with-cxx --disable-build-poststage1-with-cxx )
fi fi
# newer gcc's come with libquadmath, but only fortran uses # newer gcc's come with libquadmath, but only fortran uses
# it, so auto punt it when we don't care # it, so auto punt it when we don't care
if tc_version_is_at_least 4.6 && ! is_fortran ; then if tc_version_is_at_least 4.6 && ! is_fortran ; then
confgcc+=" --disable-libquadmath" confgcc+=( --disable-libquadmath )
fi fi
local with_abi_map=() local with_abi_map=()
case $(tc-arch) in case $(tc-arch) in
arm) #264534 #414395 arm) #264534 #414395
local a arm_arch=${CTARGET%%-*} local a arm_arch=${CTARGET%%-*}
# Remove trailing endian variations first: eb el be bl b l # Remove trailing endian variations first: eb el be bl b l
for a in e{b,l} {b,l}e b l ; do for a in e{b,l} {b,l}e b l ; do
if [[ ${arm_arch} == *${a} ]] ; then if [[ ${arm_arch} == *${a} ]] ; then
arm_arch=${arm_arch%${a}} arm_arch=${arm_arch%${a}}
break break
fi
done
# Convert armv7{a,r,m} to armv7-{a,r,m}
[[ ${arm_arch} == armv7? ]] && arm_arch=${arm_arch/7/7-}
# See if this is a valid --with-arch flag
if (srcdir=${S}/gcc target=${CTARGET} with_arch=${arm_arch};
. "${srcdir}"/config.gcc) &>/dev/null
then
confgcc+=" --with-arch=${arm_arch}"
fi fi
done
# Convert armv7{a,r,m} to armv7-{a,r,m}
[[ ${arm_arch} == armv7? ]] && arm_arch=${arm_arch/7/7-}
# See if this is a valid --with-arch flag
if (srcdir=${S}/gcc target=${CTARGET} with_arch=${arm_arch};
. "${srcdir}"/config.gcc) &>/dev/null
then
confgcc+=( --with-arch=${arm_arch} )
fi
# Enable hardvfp # Make default mode thumb for microcontroller classes #418209
if [[ $(tc-is-softfloat) == "no" ]] && \ [[ ${arm_arch} == *-m ]] && confgcc+=( --with-mode=thumb )
[[ ${CTARGET} == armv[67]* ]] && \
tc_version_is_at_least "4.5" # Enable hardvfp
then if [[ $(tc-is-softfloat) == "no" ]] && \
# Follow the new arm hardfp distro standard by default [[ ${CTARGET} == armv[67]* ]] && \
confgcc+=" --with-float=hard" tc_version_is_at_least "4.5"
case ${CTARGET} in then
armv6*) confgcc+=" --with-fpu=vfp" ;; # Follow the new arm hardfp distro standard by default
armv7*) confgcc+=" --with-fpu=vfpv3-d16" ;; confgcc+=( --with-float=hard )
esac case ${CTARGET} in
fi armv6*) confgcc+=( --with-fpu=vfp ) ;;
;; armv7*) confgcc+=( --with-fpu=vfpv3-d16 ) ;;
esac
fi
;;
mips)
# Add --with-abi flags to set default ABI # Add --with-abi flags to set default ABI
mips) confgcc+=( --with-abi=$(gcc-abi-map ${TARGET_DEFAULT_ABI}) )
confgcc+=" --with-abi=$(gcc-abi-map ${TARGET_DEFAULT_ABI})" ;;
;; amd64)
amd64) # drop the older/ABI checks once this get's merged into some
# drop the older/ABI checks once this get's merged into some # version of gcc upstream
# version of gcc upstream if tc_version_is_at_least 4.7 && has x32 $(get_all_abis TARGET) ; then
if tc_version_is_at_least 4.7 && has x32 $(get_all_abis TARGET) ; then confgcc+=( --with-abi=$(gcc-abi-map ${TARGET_DEFAULT_ABI}) )
confgcc+=" --with-abi=$(gcc-abi-map ${TARGET_DEFAULT_ABI})" fi
fi ;;
;; x86)
# Default arch for x86 is normally i386, lets give it a bump # Default arch for x86 is normally i386, lets give it a bump
# since glibc will do so based on CTARGET anyways # since glibc will do so based on CTARGET anyways
x86) confgcc+=( --with-arch=${CTARGET%%-*} )
confgcc+=" --with-arch=${CTARGET%%-*}" ;;
;; hppa)
# Enable sjlj exceptions for backward compatibility on hppa # Enable sjlj exceptions for backward compatibility on hppa
hppa) [[ ${GCCMAJOR} == "3" ]] && confgcc+=( --enable-sjlj-exceptions )
[[ ${GCCMAJOR} == "3" ]] && confgcc+=" --enable-sjlj-exceptions" ;;
;; ppc)
# Set up defaults based on current CFLAGS # Set up defaults based on current CFLAGS
ppc) is-flagq -mfloat-gprs=double && confgcc+=( --enable-e500-double )
is-flagq -mfloat-gprs=double && confgcc+=" --enable-e500-double" [[ ${CTARGET//_/-} == *-e500v2-* ]] && confgcc+=( --enable-e500-double )
[[ ${CTARGET//_/-} == *-e500v2-* ]] && confgcc+=" --enable-e500-double" ;;
;;
esac esac
local GCC_LANG="c" local GCC_LANG="c"
@ -1015,7 +1028,7 @@ gcc-compiler-configure() {
if is_objc || is_objcxx ; then if is_objc || is_objcxx ; then
GCC_LANG+=",objc" GCC_LANG+=",objc"
if tc_version_is_at_least "4.0" ; then if tc_version_is_at_least "4.0" ; then
use objc-gc && confgcc+=" --enable-objc-gc" use objc-gc && confgcc+=( --enable-objc-gc )
fi fi
is_objcxx && GCC_LANG+=",obj-c++" is_objcxx && GCC_LANG+=",obj-c++"
fi fi
@ -1032,97 +1045,94 @@ gcc-compiler-configure() {
# is_ada && GCC_LANG+=",ada" # is_ada && GCC_LANG+=",ada"
einfo "configuring for GCC_LANG: ${GCC_LANG}" einfo "configuring for GCC_LANG: ${GCC_LANG}"
confgcc+=" --enable-languages=${GCC_LANG}" confgcc+=( --enable-languages=${GCC_LANG} )
} }
gcc_do_configure() { gcc_do_configure() {
local confgcc local confgcc=(
# Set configuration based on path variables
# Set configuration based on path variables --prefix="${PREFIX}"
confgcc+=" \ --bindir="${BINPATH}"
--prefix=${PREFIX} \ --includedir="${INCLUDEPATH}"
--bindir=${BINPATH} \ --datadir="${DATAPATH}"
--includedir=${INCLUDEPATH} \ --mandir="${DATAPATH}/man"
--datadir=${DATAPATH} \ --infodir="${DATAPATH}/info"
--mandir=${DATAPATH}/man \ --with-gxx-include-dir="${STDCXX_INCDIR}"
--infodir=${DATAPATH}/info \ )
--with-gxx-include-dir=${STDCXX_INCDIR}"
# On Darwin we need libdir to be set in order to get correct install names # On Darwin we need libdir to be set in order to get correct install names
# for things like libobjc-gnu, libgcj and libfortran. If we enable it on # for things like libobjc-gnu, libgcj and libfortran. If we enable it on
# non-Darwin we screw up the behaviour this eclass relies on. We in # non-Darwin we screw up the behaviour this eclass relies on. We in
# particular need this over --libdir for bug #255315. # particular need this over --libdir for bug #255315.
[[ ${CTARGET} == *-darwin* ]] && \ [[ ${CTARGET} == *-darwin* ]] && \
confgcc+=" --enable-version-specific-runtime-libs" confgcc+=( --enable-version-specific-runtime-libs )
# All our cross-compile logic goes here ! woo ! # All our cross-compile logic goes here ! woo !
confgcc+=" --host=${CHOST}" confgcc+=( --host=${CHOST} )
if is_crosscompile || tc-is-cross-compiler ; then if is_crosscompile || tc-is-cross-compiler ; then
# Straight from the GCC install doc: # Straight from the GCC install doc:
# "GCC has code to correctly determine the correct value for target # "GCC has code to correctly determine the correct value for target
# for nearly all native systems. Therefore, we highly recommend you # for nearly all native systems. Therefore, we highly recommend you
# not provide a configure target when configuring a native compiler." # not provide a configure target when configuring a native compiler."
confgcc+=" --target=${CTARGET}" confgcc+=( --target=${CTARGET} )
fi fi
[[ -n ${CBUILD} ]] && confgcc+=" --build=${CBUILD}" [[ -n ${CBUILD} ]] && confgcc+=( --build=${CBUILD} )
# ppc altivec support # ppc altivec support
confgcc+=" $(use_enable altivec)" confgcc+=( $(use_enable altivec) )
# gcc has fixed-point arithmetic support in 4.3 for mips targets that can # gcc has fixed-point arithmetic support in 4.3 for mips targets that can
# significantly increase compile time by several hours. This will allow # significantly increase compile time by several hours. This will allow
# users to control this feature in the event they need the support. # users to control this feature in the event they need the support.
tc_version_is_at_least "4.3" && confgcc+=" $(use_enable fixed-point)" tc_version_is_at_least "4.3" && confgcc+=( $(use_enable fixed-point) )
# Graphite support was added in 4.4, which depends on external libraries # graphite was added in 4.4 but we only support it in 4.6+ due to external
# for optimizations. Current versions use cloog-ppl (cloog fork with Parma # library issues. 4.6/4.7 uses cloog-ppl which is a fork of CLooG with a
# PPL backend). Sometime in the future we will use upstream cloog with the # PPL backend. 4.8+ uses upstream CLooG with the ISL backend. We install
# ISL backend (note: PPL will still be a requirement). cloog-ppl's include # cloog-ppl into a non-standard location to prevent collisions.
# path was modified to prevent collisions between the two packages (library if tc_version_is_at_least "4.8" ; then
# names are different). confgcc+=( $(use_with graphite cloog) )
# use graphite && confgcc+=( --disable-isl-version-check )
# We disable the PPL version check so we can use >=ppl-0.11. elif tc_version_is_at_least "4.6" ; then
if tc_version_is_at_least "4.4"; then confgcc+=( $(use_with graphite cloog) )
confgcc+=" $(use_with graphite ppl)" confgcc+=( $(use_with graphite ppl) )
confgcc+=" $(use_with graphite cloog)" use graphite && confgcc+=( --with-cloog-include=/usr/include/cloog-ppl )
if use graphite; then use graphite && confgcc+=( --disable-ppl-version-check )
confgcc+=" --disable-ppl-version-check" elif tc_version_is_at_least "4.4" ; then
confgcc+=" --with-cloog-include=/usr/include/cloog-ppl" confgcc+=( --without-cloog )
fi confgcc+=( --without-ppl )
fi fi
# LTO support was added in 4.5, which depends upon elfutils. This allows
# users to enable that option, and pull in the additional library. In 4.6,
# the dependency is no longer required.
if tc_version_is_at_least "4.6" ; then if tc_version_is_at_least "4.6" ; then
confgcc+=" --enable-lto" confgcc+=( $(use_enable lto) )
elif tc_version_is_at_least "4.5" ; then elif tc_version_is_at_least "4.5" ; then
confgcc+=" $(use_enable lto)" confgcc+=( --disable-lto )
fi fi
case $(tc-is-softfloat) in case $(tc-is-softfloat) in
yes) confgcc+=" --with-float=soft" ;; yes) confgcc+=( --with-float=soft ) ;;
softfp) confgcc+=" --with-float=softfp" ;; softfp) confgcc+=( --with-float=softfp ) ;;
*) *)
# If they've explicitly opt-ed in, do hardfloat, # If they've explicitly opt-ed in, do hardfloat,
# otherwise let the gcc default kick in. # otherwise let the gcc default kick in.
[[ ${CTARGET//_/-} == *-hardfloat-* ]] \ [[ ${CTARGET//_/-} == *-hardfloat-* ]] \
&& confgcc+=" --with-float=hard" && confgcc+=( --with-float=hard )
;; ;;
esac esac
# Native Language Support # Native Language Support
if use nls ; then if use nls ; then
confgcc+=" --enable-nls --without-included-gettext" confgcc+=( --enable-nls --without-included-gettext )
else else
confgcc+=" --disable-nls" confgcc+=( --disable-nls )
fi fi
# reasonably sane globals (hopefully) # reasonably sane globals (hopefully)
confgcc+=" \ confgcc+=(
--with-system-zlib \ --with-system-zlib
--enable-obsolete \ --enable-obsolete
--disable-werror \ --disable-werror
--enable-secureplt" --enable-secureplt
)
gcc-compiler-configure || die gcc-compiler-configure || die
@ -1131,90 +1141,113 @@ gcc_do_configure() {
# disable a bunch of features or gcc goes boom # disable a bunch of features or gcc goes boom
local needed_libc="" local needed_libc=""
case ${CTARGET} in case ${CTARGET} in
*-linux) needed_libc=no-fucking-clue;; *-linux) needed_libc=no-fucking-clue;;
*-dietlibc) needed_libc=dietlibc;; *-dietlibc) needed_libc=dietlibc;;
*-elf|*-eabi) needed_libc=newlib;; *-elf|*-eabi) needed_libc=newlib;;
*-freebsd*) needed_libc=freebsd-lib;; *-freebsd*) needed_libc=freebsd-lib;;
*-gnu*) needed_libc=glibc;; *-gnu*) needed_libc=glibc;;
*-klibc) needed_libc=klibc;; *-klibc) needed_libc=klibc;;
*-uclibc*) *-musl*) needed_libc=musl;;
if ! echo '#include <features.h>' | \ *-uclibc*)
$(tc-getCPP ${CTARGET}) -E -dD - 2>/dev/null | \ if ! echo '#include <features.h>' | \
grep -q __HAVE_SHARED__ $(tc-getCPP ${CTARGET}) -E -dD - 2>/dev/null | \
then #291870 grep -q __HAVE_SHARED__
confgcc+=" --disable-shared" then #291870
fi confgcc+=( --disable-shared )
needed_libc=uclibc fi
;; needed_libc=uclibc
*-cygwin) needed_libc=cygwin;; ;;
x86_64-*-mingw*|\ *-cygwin) needed_libc=cygwin;;
*-w64-mingw*) needed_libc=mingw64-runtime;; x86_64-*-mingw*|\
mingw*|*-mingw*) needed_libc=mingw-runtime;; *-w64-mingw*) needed_libc=mingw64-runtime;;
avr) confgcc+=" --enable-shared --disable-threads";; mingw*|*-mingw*) needed_libc=mingw-runtime;;
avr) confgcc+=( --enable-shared --disable-threads );;
esac esac
if [[ -n ${needed_libc} ]] ; then if [[ -n ${needed_libc} ]] ; then
local confgcc_no_libc=( --disable-shared )
tc_version_is_at_least 4.8 && confgcc_no_libc+=( --disable-libatomic )
if ! has_version ${CATEGORY}/${needed_libc} ; then if ! has_version ${CATEGORY}/${needed_libc} ; then
confgcc+=" --disable-shared --disable-threads --without-headers" confgcc+=(
"${confgcc_no_libc[@]}"
--disable-threads
--without-headers
)
elif built_with_use --hidden --missing false ${CATEGORY}/${needed_libc} crosscompile_opts_headers-only ; then elif built_with_use --hidden --missing false ${CATEGORY}/${needed_libc} crosscompile_opts_headers-only ; then
confgcc+=" --disable-shared --with-sysroot=${PREFIX}/${CTARGET}" confgcc+=(
"${confgcc_no_libc[@]}"
--with-sysroot=${PREFIX}/${CTARGET}
)
else else
confgcc+=" --with-sysroot=${PREFIX}/${CTARGET}" confgcc+=( --with-sysroot=${PREFIX}/${CTARGET} )
fi fi
fi fi
tc_version_is_at_least 4.2 && confgcc+=" --disable-bootstrap" tc_version_is_at_least 4.2 && confgcc+=( --disable-bootstrap )
else else
if tc-is-static-only ; then if tc-is-static-only ; then
confgcc+=" --disable-shared" confgcc+=( --disable-shared )
else else
confgcc+=" --enable-shared" confgcc+=( --enable-shared )
fi fi
case ${CHOST} in case ${CHOST} in
mingw*|*-mingw*|*-cygwin) mingw*|*-mingw*|*-cygwin)
confgcc+=" --enable-threads=win32" ;; confgcc+=( --enable-threads=win32 ) ;;
*) *)
confgcc+=" --enable-threads=posix" ;; confgcc+=( --enable-threads=posix ) ;;
esac esac
fi fi
# __cxa_atexit is "essential for fully standards-compliant handling of # __cxa_atexit is "essential for fully standards-compliant handling of
# destructors", but apparently requires glibc. # destructors", but apparently requires glibc.
case ${CTARGET} in case ${CTARGET} in
*-uclibc*) *-uclibc*)
confgcc+=" --disable-__cxa_atexit --enable-target-optspace $(use_enable nptl tls)" confgcc+=(
[[ ${GCCMAJOR}.${GCCMINOR} == 3.3 ]] && confgcc+=" --enable-sjlj-exceptions" --disable-__cxa_atexit
$(use_enable nptl tls)
)
[[ ${GCCMAJOR}.${GCCMINOR} == 3.3 ]] && confgcc+=( --enable-sjlj-exceptions )
if tc_version_is_at_least 3.4 && ! tc_version_is_at_least 4.3 ; then if tc_version_is_at_least 3.4 && ! tc_version_is_at_least 4.3 ; then
confgcc+=" --enable-clocale=uclibc" confgcc+=( --enable-clocale=uclibc )
fi fi
;; ;;
*-elf|*-eabi) *-elf|*-eabi)
confgcc+=" --with-newlib" confgcc+=( --with-newlib )
;; ;;
*-gnu*) *-gnu*)
confgcc+=" --enable-__cxa_atexit" confgcc+=(
confgcc+=" --enable-clocale=gnu" --enable-__cxa_atexit
--enable-clocale=gnu
)
;; ;;
*-freebsd*) *-freebsd*)
confgcc+=" --enable-__cxa_atexit" confgcc+=( --enable-__cxa_atexit )
;; ;;
*-solaris*) *-solaris*)
confgcc+=" --enable-__cxa_atexit" confgcc+=( --enable-__cxa_atexit )
;; ;;
esac esac
tc_version_is_at_least 3.4 || confgcc+=" --disable-libunwind-exceptions" tc_version_is_at_least 3.4 || confgcc+=( --disable-libunwind-exceptions )
# if the target can do biarch (-m32/-m64), enable it. overhead should # if the target can do biarch (-m32/-m64), enable it. overhead should
# be small, and should simplify building of 64bit kernels in a 32bit # be small, and should simplify building of 64bit kernels in a 32bit
# userland by not needing sys-devel/kgcc64. #349405 # userland by not needing sys-devel/kgcc64. #349405
case $(tc-arch) in case $(tc-arch) in
ppc|ppc64) tc_version_is_at_least 3.4 && confgcc+=" --enable-targets=all" ;; ppc|ppc64) tc_version_is_at_least 3.4 && confgcc+=( --enable-targets=all ) ;;
sparc) tc_version_is_at_least 4.4 && confgcc+=" --enable-targets=all" ;; sparc) tc_version_is_at_least 4.4 && confgcc+=( --enable-targets=all ) ;;
amd64|x86) tc_version_is_at_least 4.3 && confgcc+=" --enable-targets=all" ;; amd64|x86) tc_version_is_at_least 4.3 && confgcc+=( --enable-targets=all ) ;;
esac esac
tc_version_is_at_least 4.3 && set -- "$@" \ tc_version_is_at_least 4.3 && confgcc+=(
--with-bugurl=http://bugs.gentoo.org/ \ --with-bugurl=http://bugs.gentoo.org/
--with-pkgversion="${BRANDING_GCC_PKGVERSION}" --with-pkgversion="${BRANDING_GCC_PKGVERSION}"
set -- ${confgcc} "$@" ${EXTRA_ECONF} )
confgcc+=(
"$@"
${EXTRA_ECONF}
)
# Disable gcc info regeneration -- it ships with generated info pages
# already. Our custom version/urls/etc... trigger it. #464008
export gcc_cv_prog_makeinfo_modern=no
# Do not let the X detection get in our way. We know things can be found # Do not let the X detection get in our way. We know things can be found
# via system paths, so no need to hardcode things that'll break multilib. # via system paths, so no need to hardcode things that'll break multilib.
@ -1230,7 +1263,7 @@ gcc_do_configure() {
einfo "DATAPATH: ${DATAPATH}" einfo "DATAPATH: ${DATAPATH}"
einfo "STDCXX_INCDIR: ${STDCXX_INCDIR}" einfo "STDCXX_INCDIR: ${STDCXX_INCDIR}"
echo echo
einfo "Configuring GCC with: ${@//--/\n\t--}" einfo "Configuring GCC with: ${confgcc[@]//--/\n\t--}"
echo echo
# Build in a separate build tree # Build in a separate build tree
@ -1239,8 +1272,8 @@ gcc_do_configure() {
# and now to do the actual configuration # and now to do the actual configuration
addwrite /dev/zero addwrite /dev/zero
echo "${S}"/configure "$@" echo "${S}"/configure "${confgcc[@]}"
"${S}"/configure "$@" || die "failed to run configure" "${S}"/configure "${confgcc[@]}" || die "failed to run configure"
# return to whatever directory we were in before # return to whatever directory we were in before
popd > /dev/null popd > /dev/null
@ -1278,10 +1311,6 @@ toolchain_death_notice() {
# Travis Tilley <lv@gentoo.org> (04 Sep 2004) # Travis Tilley <lv@gentoo.org> (04 Sep 2004)
# #
gcc_do_make() { gcc_do_make() {
# Fix for libtool-portage.patch
local OLDS=${S}
S=${WORKDIR}/build
# Set make target to $1 if passed # Set make target to $1 if passed
[[ -n $1 ]] && GCC_MAKE_TARGET=$1 [[ -n $1 ]] && GCC_MAKE_TARGET=$1
# default target # default target
@ -1320,7 +1349,7 @@ gcc_do_make() {
BOOT_CFLAGS=${BOOT_CFLAGS-"$(get_abi_CFLAGS ${TARGET_DEFAULT_ABI}) ${CFLAGS}"} BOOT_CFLAGS=${BOOT_CFLAGS-"$(get_abi_CFLAGS ${TARGET_DEFAULT_ABI}) ${CFLAGS}"}
fi fi
pushd "${WORKDIR}"/build pushd "${WORKDIR}"/build >/dev/null
emake \ emake \
LDFLAGS="${LDFLAGS}" \ LDFLAGS="${LDFLAGS}" \
@ -1344,11 +1373,12 @@ gcc_do_make() {
fi fi
fi fi
popd popd >/dev/null
} }
# This is mostly a stub function to be overwritten in an ebuild # This is mostly a stub function to be overwritten in an ebuild
gcc_do_filter_flags() { gcc_do_filter_flags() {
strip-flags strip-flags
# In general gcc does not like optimization, and add -O2 where # In general gcc does not like optimization, and add -O2 where
@ -1398,8 +1428,13 @@ gcc_do_filter_flags() {
;; ;;
esac esac
# Compile problems with these (bug #6641 among others)... case ${GCC_BRANCH_VER} in
#filter-flags "-fno-exceptions -fomit-frame-pointer -fforce-addr" 4.6)
# https://bugs.gentoo.org/411333
# https://bugs.gentoo.org/466454
replace-cpu-flags c3-2 pentium2 pentium3 pentium3m pentium-m i686
;;
esac
# CFLAGS logic (verified with 3.4.3): # CFLAGS logic (verified with 3.4.3):
# CFLAGS: # CFLAGS:
@ -1466,8 +1501,10 @@ toolchain_src_compile() {
} }
toolchain_src_test() { toolchain_src_test() {
cd "${WORKDIR}"/build if use regression-test ; then
emake -k check || ewarn "check failed and that sucks :(" cd "${WORKDIR}"/build
emake -k check
fi
} }
toolchain_src_install() { toolchain_src_install() {
@ -1475,20 +1512,28 @@ toolchain_src_install() {
cd "${WORKDIR}"/build cd "${WORKDIR}"/build
# Do allow symlinks in private gcc include dir as this can break the build # Do allow symlinks in private gcc include dir as this can break the build
find gcc/include*/ -type l -print0 | xargs -0 rm -f find gcc/include*/ -type l -delete
# Copy over the info pages. We disabled their generation earlier, but the
# build system only expects to install out of the build dir, not the source. #464008
mkdir -p gcc/doc
for x in "${S}"/gcc/doc/*.info* ; do
if [[ -f ${x} ]] ; then
cp "${x}" gcc/doc/ || die
fi
done
# Remove generated headers, as they can cause things to break # Remove generated headers, as they can cause things to break
# (ncurses, openssl, etc). # (ncurses, openssl, etc).
for x in $(find gcc/include*/ -name '*.h') ; do while read x ; do
grep -q 'It has been auto-edited by fixincludes from' "${x}" \ grep -q 'It has been auto-edited by fixincludes from' "${x}" \
&& rm -f "${x}" && rm -f "${x}"
done done < <(find gcc/include*/ -name '*.h')
# Do the 'make install' from the build directory # Do the 'make install' from the build directory
S=${WORKDIR}/build \ S=${WORKDIR}/build \
emake -j1 DESTDIR="${D}" install || die emake -j1 DESTDIR="${D}" install || die
# Punt some tools which are really only useful while building gcc # Punt some tools which are really only useful while building gcc
find "${D}" -name install-tools -prune -type d -exec rm -rf "{}" \; find "${D}" -name install-tools -prune -type d -exec rm -rf "{}" \;
# This one comes with binutils # This one comes with binutils
find "${D}" -name libiberty.a -exec rm -f "{}" \; find "${D}" -name libiberty.a -delete
# Move the libraries to the proper location # Move the libraries to the proper location
gcc_movelibs gcc_movelibs
@ -1571,7 +1616,7 @@ toolchain_src_install() {
find "${D}" -depth -type d -delete 2>/dev/null find "${D}" -depth -type d -delete 2>/dev/null
# install testsuite results # install testsuite results
if use test; then if use regression-test; then
docinto testsuite docinto testsuite
find "${WORKDIR}"/build -type f -name "*.sum" -print0 | xargs -0 dodoc find "${WORKDIR}"/build -type f -name "*.sum" -print0 | xargs -0 dodoc
find "${WORKDIR}"/build -type f -path "*/testsuite/*.log" -print0 \ find "${WORKDIR}"/build -type f -path "*/testsuite/*.log" -print0 \
@ -1941,26 +1986,30 @@ setup_multilib_osdirnames() {
# this only makes sense for some Linux targets # this only makes sense for some Linux targets
case ${CTARGET} in case ${CTARGET} in
x86_64*-linux*) config="i386" ;; x86_64*-linux*) config="i386" ;;
powerpc64*-linux*) config="rs6000" ;; powerpc64*-linux*) config="rs6000" ;;
sparc64*-linux*) config="sparc" ;; sparc64*-linux*) config="sparc" ;;
s390x*-linux*) config="s390" ;; s390x*-linux*) config="s390" ;;
*) return 0 ;; *) return 0 ;;
esac esac
config+="/t-linux64" config+="/t-linux64"
local sed_args=()
if tc_version_is_at_least 4.6 ; then
sed_args+=( -e 's:$[(]call if_multiarch[^)]*[)]::g' )
fi
if [[ ${SYMLINK_LIB} == "yes" ]] ; then if [[ ${SYMLINK_LIB} == "yes" ]] ; then
einfo "updating multilib directories to be: ${libdirs}" einfo "updating multilib directories to be: ${libdirs}"
if tc_version_is_at_least 4.7 ; then if tc_version_is_at_least 4.6.4 || tc_version_is_at_least 4.7 ; then
set -- -e '/^MULTILIB_OSDIRNAMES.*lib32/s:[$][(]if.*):../lib32:' sed_args+=( -e '/^MULTILIB_OSDIRNAMES.*lib32/s:[$][(]if.*):../lib32:' )
else else
set -- -e "/^MULTILIB_OSDIRNAMES/s:=.*:= ${libdirs}:" sed_args+=( -e "/^MULTILIB_OSDIRNAMES/s:=.*:= ${libdirs}:" )
fi fi
else else
einfo "using upstream multilib; disabling lib32 autodetection" einfo "using upstream multilib; disabling lib32 autodetection"
set -- -r -e 's:[$][(]if.*,(.*)[)]:\1:' sed_args+=( -r -e 's:[$][(]if.*,(.*)[)]:\1:' )
fi fi
sed -i "$@" "${S}"/gcc/config/${config} || die sed -i "${sed_args[@]}" "${S}"/gcc/config/${config} || die
} }
# make sure the libtool archives have libdir set to where they actually # make sure the libtool archives have libdir set to where they actually

View File

@ -1,6 +1,6 @@
# Copyright 1999-2012 Gentoo Foundation # Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2 # Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/unpacker.eclass,v 1.10 2012/08/22 01:41:12 ottxor Exp $ # $Header: /var/cvsroot/gentoo-x86/eclass/unpacker.eclass,v 1.13 2013/04/10 14:47:49 jer Exp $
# @ECLASS: unpacker.eclass # @ECLASS: unpacker.eclass
# @MAINTAINER: # @MAINTAINER:
@ -178,7 +178,7 @@ unpack_makeself() {
local skip=0 local skip=0
exe=tail exe=tail
case ${ver} in case ${ver} in
1.5.*|1.6.0-nv) # tested 1.5.{3,4,5} ... guessing 1.5.x series is same 1.5.*|1.6.0-nv*) # tested 1.5.{3,4,5} ... guessing 1.5.x series is same
skip=$(grep -a ^skip= "${src}" | cut -d= -f2) skip=$(grep -a ^skip= "${src}" | cut -d= -f2)
;; ;;
2.0|2.0.1) 2.0|2.0.1)
@ -234,6 +234,9 @@ unpack_makeself() {
compress*) compress*)
eval ${exe} | gunzip | tar --no-same-owner -xf - eval ${exe} | gunzip | tar --no-same-owner -xf -
;; ;;
XZ*)
eval ${exe} | unxz | tar --no-same-owner -xf -
;;
*) *)
eerror "Unknown filetype \"${filetype}\" ?" eerror "Unknown filetype \"${filetype}\" ?"
false false
@ -274,6 +277,10 @@ unpack_deb() {
fi fi
unpacker ./data.tar* unpacker ./data.tar*
# Clean things up #458658. No one seems to actually care about
# these, so wait until someone requests to do something else ...
rm -f debian-binary {control,data}.tar*
} }
# @FUNCTION: unpack_cpio # @FUNCTION: unpack_cpio
@ -295,6 +302,23 @@ unpack_cpio() {
fi fi
} }
# @FUNCTION: unpack_zip
# @USAGE: <zip file>
# @DESCRIPTION:
# Unpack zip archives.
# This function ignores all non-fatal errors (i.e. warnings).
# That is useful for zip archives with extra crap attached
# (e.g. self-extracting archives).
unpack_zip() {
[[ $# -eq 1 ]] || die "Usage: ${FUNCNAME} <file>"
local zip=$(find_unpackable_file "$1")
unpack_banner "${zip}"
unzip -qo "${zip}"
[[ $? -le 1 ]] || die "unpacking ${zip} failed (arch=unpack_zip)"
}
# @FUNCTION: _unpacker # @FUNCTION: _unpacker
# @USAGE: <one archive to unpack> # @USAGE: <one archive to unpack>
# @INTERNAL # @INTERNAL
@ -346,6 +370,8 @@ _unpacker() {
arch="unpack_makeself" arch="unpack_makeself"
fi fi
;; ;;
*.zip)
arch="unpack_zip" ;;
esac esac
# finally do the unpack # finally do the unpack
@ -410,6 +436,8 @@ unpacker_src_uri_depends() {
d="app-arch/p7zip" ;; d="app-arch/p7zip" ;;
*.xz) *.xz)
d="app-arch/xz-utils" ;; d="app-arch/xz-utils" ;;
*.zip)
d="app-arch/unzip" ;;
esac esac
deps+=" ${d}" deps+=" ${d}"
done done