abstracted kernel compiler, this is for bsd branches

This commit is contained in:
inxi-svn 2014-05-01 21:53:56 +00:00
parent d5604c821e
commit 47a5a34cb5

48
inxi
View file

@ -4967,17 +4967,6 @@ get_dmesg_boot_data()
eval $LOGFE
}
get_gcc_kernel_version()
{
# note that we use gawk to get the last part because beta, alpha, git versions can be non-numeric
local gccVersion=''
if [[ -e /proc/version ]];then
gccVersion=$( grep -Eio 'gcc[[:space:]]*version[[:space:]]*([^ \t]*)' /proc/version 2>/dev/null | gawk '{print $3}' )
fi
echo $gccVersion
}
get_gcc_system_version()
{
eval $LOGFS
@ -5954,6 +5943,31 @@ get_init_data()
eval $LOGFE
}
get_kernel_compiler_version()
{
# note that we use gawk to get the last part because beta, alpha, git versions can be non-numeric
local compiler_version='' compiler_type=''
if [[ -e /proc/version ]];then
compiler_version=$( grep -Eio 'gcc[[:space:]]*version[[:space:]]*([^ \t]*)' /proc/version 2>/dev/null | gawk '{print $3}' )
if [[ -n $compiler_version ]];then
compiler_type='gcc'
fi
elif [[ $BSD_TYPE == 'darwin-bsd' ]];then
if type -p gcc &>/dev/null;then
compiler_version=$( get_program_version 'gcc' 'Apple[[:space:]]LLVM' '4' )
if [[ -n $compiler_version ]];then
compiler_type='LLVM'
fi
fi
fi
if [[ -n $compiler_version ]];then
compiler_version="$compiler_type-$compiler_version"
fi
echo $compiler_version
}
get_kernel_version()
{
eval $LOGFS
@ -10232,7 +10246,7 @@ print_info_data()
local processes=$(( $( wc -l <<< "$Ps_aux_Data" ) - 1 ))
local up_time="$( get_uptime )"
local patch_version_number=$( get_patch_version_string )
local gcc_string='' gcc_installed='' gcc_others='' closing_data=''
local gcc_installed='' gcc_others='' closing_data=''
if [[ -z $memory ]];then
memory='N/A'
@ -11782,7 +11796,7 @@ print_system_data()
local host_name=$HOSTNAME
local current_kernel=$( get_kernel_version )
local distro="$( get_distro_data )"
local tty_session=''
local tty_session='' compiler_string=''
# I think these will work, maybe, if logged in as root and in X
if [[ $B_RUNNING_IN_DISPLAY == 'true' ]];then
@ -11823,9 +11837,9 @@ print_system_data()
fi
fi
if [[ $B_EXTRA_DATA == 'true' ]];then
gcc_string=$( get_gcc_kernel_version )
if [[ -n $gcc_string ]];then
gcc_string=" ${C1}gcc$SEP3${C2} $gcc_string"
compiler_string=$( get_kernel_compiler_version )
if [[ -n $compiler_string ]];then
compiler_string=" ${C1}${compiler_string%%-*}$SEP3${C2} ${compiler_string#*-}"
fi
fi
# check for 64 bit first
@ -11834,7 +11848,7 @@ print_system_data()
else
bits="32"
fi
bits=" ($bits bit$gcc_string)"
bits=" ($bits bit$compiler_string)"
if [[ $B_SHOW_HOST == 'true' ]];then
if [[ -z $HOSTNAME ]];then
if [[ -n $( type p hostname ) ]];then