summaryrefslogtreecommitdiffstats
path: root/meta/files/toolchain-shar-extract.sh
diff options
context:
space:
mode:
Diffstat (limited to 'meta/files/toolchain-shar-extract.sh')
-rw-r--r--meta/files/toolchain-shar-extract.sh59
1 files changed, 54 insertions, 5 deletions
diff --git a/meta/files/toolchain-shar-extract.sh b/meta/files/toolchain-shar-extract.sh
index 66c017f50d..ccc4f4e1ac 100644
--- a/meta/files/toolchain-shar-extract.sh
+++ b/meta/files/toolchain-shar-extract.sh
@@ -3,14 +3,32 @@
[ -z "$ENVCLEANED" ] && exec /usr/bin/env -i ENVCLEANED=1 HOME="$HOME" \
LC_ALL=en_US.UTF-8 \
TERM=$TERM \
+ ICECC_PATH="$ICECC_PATH" \
http_proxy="$http_proxy" https_proxy="$https_proxy" ftp_proxy="$ftp_proxy" \
no_proxy="$no_proxy" all_proxy="$all_proxy" GIT_PROXY_COMMAND="$GIT_PROXY_COMMAND" "$0" "$@"
[ -f /etc/environment ] && . /etc/environment
export PATH=`echo "$PATH" | sed -e 's/:\.//' -e 's/::/:/'`
+tweakpath () {
+ case ":${PATH}:" in
+ *:"$1":*)
+ ;;
+ *)
+ PATH=$PATH:$1
+ esac
+}
+
+# Some systems don't have /usr/sbin or /sbin in the cleaned environment PATH but we make need it
+# for the system's host tooling checks
+tweakpath /usr/sbin
+tweakpath /sbin
+
INST_ARCH=$(uname -m | sed -e "s/i[3-6]86/ix86/" -e "s/x86[-_]64/x86_64/")
SDK_ARCH=$(echo @SDK_ARCH@ | sed -e "s/i[3-6]86/ix86/" -e "s/x86[-_]64/x86_64/")
+INST_GCC_VER=$(gcc --version | sed -ne 's/.* \([0-9]\+\.[0-9]\+\)\.[0-9]\+.*/\1/p')
+SDK_GCC_VER='@SDK_GCC_VER@'
+
verlte () {
[ "$1" = "`printf "$1\n$2" | sort -V | head -n1`" ]
}
@@ -28,7 +46,7 @@ fi
if [ "$INST_ARCH" != "$SDK_ARCH" ]; then
# Allow for installation of ix86 SDK on x86_64 host
if [ "$INST_ARCH" != x86_64 -o "$SDK_ARCH" != ix86 ]; then
- echo "Error: Installation machine not supported!"
+ echo "Error: Incompatible SDK installer! Your host is $INST_ARCH and this SDK was built for $SDK_ARCH hosts."
exit 1
fi
fi
@@ -95,7 +113,16 @@ done
payload_offset=$(($(grep -na -m1 "^MARKER:$" $0|cut -d':' -f1) + 1))
if [ "$listcontents" = "1" ] ; then
- tail -n +$payload_offset $0| tar tvJ || exit 1
+ if [ @SDK_ARCHIVE_TYPE@ = "zip" ]; then
+ tail -n +$payload_offset $0 > sdk.zip
+ if unzip -l sdk.zip;then
+ rm sdk.zip
+ else
+ rm sdk.zip && exit 1
+ fi
+ else
+ tail -n +$payload_offset $0| tar tvJ || exit 1
+ fi
exit
fi
@@ -112,6 +139,11 @@ fi
# SDK_EXTENSIBLE is exposed from the SDK_PRE_INSTALL_COMMAND above
if [ "$SDK_EXTENSIBLE" = "1" ]; then
DEFAULT_INSTALL_DIR="@SDKEXTPATH@"
+ if [ "$INST_GCC_VER" = '4.8' -a "$SDK_GCC_VER" = '4.9' ] || [ "$INST_GCC_VER" = '4.8' -a "$SDK_GCC_VER" = '' ] || \
+ [ "$INST_GCC_VER" = '4.9' -a "$SDK_GCC_VER" = '' ]; then
+ echo "Error: Incompatible SDK installer! Your host gcc version is $INST_GCC_VER and this SDK was built by gcc higher version."
+ exit 1
+ fi
fi
if [ "$target_sdk_dir" = "" ]; then
@@ -162,11 +194,11 @@ fi
if [ -e "$target_sdk_dir/environment-setup-@REAL_MULTIMACH_TARGET_SYS@" ]; then
echo "The directory \"$target_sdk_dir\" already contains a SDK for this architecture."
- printf "If you continue, existing files will be overwritten! Proceed[y/N]? "
+ printf "If you continue, existing files will be overwritten! Proceed [y/N]? "
default_answer="n"
else
- printf "You are about to install the SDK to \"$target_sdk_dir\". Proceed[Y/n]? "
+ printf "You are about to install the SDK to \"$target_sdk_dir\". Proceed [Y/n]? "
default_answer="y"
fi
@@ -209,7 +241,16 @@ if [ ! -x $target_sdk_dir -o ! -w $target_sdk_dir -o ! -r $target_sdk_dir ]; the
fi
printf "Extracting SDK..."
-tail -n +$payload_offset $0| $SUDO_EXEC tar xJ -C $target_sdk_dir --checkpoint=.2500 $EXTRA_TAR_OPTIONS || exit 1
+if [ @SDK_ARCHIVE_TYPE@ = "zip" ]; then
+ tail -n +$payload_offset $0 > sdk.zip
+ if $SUDO_EXEC unzip $EXTRA_TAR_OPTIONS sdk.zip -d $target_sdk_dir;then
+ rm sdk.zip
+ else
+ rm sdk.zip && exit 1
+ fi
+else
+ tail -n +$payload_offset $0| $SUDO_EXEC tar xJ -C $target_sdk_dir --checkpoint=.2500 $EXTRA_TAR_OPTIONS || exit 1
+fi
echo "done"
printf "Setting it up..."
@@ -237,6 +278,14 @@ if [ $savescripts = 0 ] ; then
$SUDO_EXEC rm -f ${env_setup_script%/*}/relocate_sdk.py ${env_setup_script%/*}/relocate_sdk.sh
fi
+# Execute post-relocation script
+post_relocate="$target_sdk_dir/post-relocate-setup.sh"
+if [ -e "$post_relocate" ]; then
+ $SUDO_EXEC sed -e "s:@SDKPATH@:$target_sdk_dir:g" -i $post_relocate
+ $SUDO_EXEC /bin/sh $post_relocate "$target_sdk_dir" "@SDKPATH@"
+ $SUDO_EXEC rm -f $post_relocate
+fi
+
echo "SDK has been successfully set up and is ready to be used."
echo "Each time you wish to use the SDK in a new shell session, you need to source the environment setup script e.g."
for env_setup_script in `ls $target_sdk_dir/environment-setup-*`; do