From 251a64d1bf61be4d75a82b7824dfac9282467b08 Mon Sep 17 00:00:00 2001 From: Ilya Palachev Date: Tue, 12 Aug 2014 15:59:48 +0400 Subject: [PATCH] Fix wrapper script of cross ld executable This patch is intended to fix build issues that were ontained during the total rebuild of clone of Tizen:Common project. We have obtained several build issues during the build of packages gumd, libsolv and glibc -- because of some mistakes in wrapper scripts. Now they're fixed by: 1. Removing ( ) construction that caused always-true return value from the script (this caused some bugs during ./configure run for some packages) 2. Removing "exec" command, because otherwise we cannnot launch native ld is cross ld fails. 3. Parsing command line option string and removing option "--sysroot" from it -- when we're calling native ld instead of cross ld 4. Adding "exit $?" command to avoid second launch of ld binary Change-Id: Iaf60eaed9ae215b12eaa6a229190a71adb1562c8 Signed-off-by: Ilya Palachev --- packaging/qemu-accel-aarch64.spec | 5 +++-- packaging/qemu-accel-armv7l.spec | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/packaging/qemu-accel-aarch64.spec b/packaging/qemu-accel-aarch64.spec index e369d6b..ec8ce99 100644 --- a/packaging/qemu-accel-aarch64.spec +++ b/packaging/qemu-accel-aarch64.spec @@ -328,11 +328,12 @@ if [ -n "$LD_LIBRARY_PATH" ]; then fi for i in "$@"; do if [ "${i:0:10}" = "--sysroot=" ]; then - exec -a "$0" %{our_path}/usr/aarch64-tizen-linux/bin/ld.real "$@" + %{our_path}/usr/aarch64-tizen-linux/bin/ld.real "$@" || /usr/bin/qemu-aarch64 /usr/aarch64-tizen-linux/bin/ld -L/usr/lib/gcc/aarch64-tizen-linux/%{gcc_version_dot}/ `echo "$@" | sed -e "s#%{our_path}##;s#--sysroot=[^[:space:]]\+# #g"` + exit $? fi done -%{our_path}/usr/aarch64-tizen-linux/bin/ld.real --sysroot=/ "$@" || ( /usr/bin/qemu-aarch64 /usr/aarch64-tizen-linux/bin/ld -L/usr/lib/gcc/aarch64-tizen-linux/%{gcc_version_dot}/ `echo "$@" | sed -e "s#%{our_path}##"` ; echo "Running native ld, because cross ld has failed with the following error: " ) +%{our_path}/usr/aarch64-tizen-linux/bin/ld.real --sysroot=/ "$@" || /usr/bin/qemu-aarch64 /usr/aarch64-tizen-linux/bin/ld -L/usr/lib/gcc/aarch64-tizen-linux/%{gcc_version_dot}/ `echo "$@" | sed -e "s#%{our_path}##;s#--sysroot=[^[:space:]]\+# #g"` ' > %{buildroot}%{our_path}/usr/aarch64-tizen-linux/bin/ld chmod +x %{buildroot}%{our_path}/usr/aarch64-tizen-linux/bin/ld diff --git a/packaging/qemu-accel-armv7l.spec b/packaging/qemu-accel-armv7l.spec index d8b86bd..43f8067 100644 --- a/packaging/qemu-accel-armv7l.spec +++ b/packaging/qemu-accel-armv7l.spec @@ -194,7 +194,7 @@ do echo '#!/bin/bash if [ "$LIBRARY_PATH" ]; then mv %{our_path}{,.bkp} - exec /usr/bin/qemu-arm /usr/bin/'${compiler}' "$@" + exec /usr/bin/qemu-arm /usr/bin/'${compiler}' "$@" fi exec -a /usr/bin/'${compiler}' %{our_path}/usr/bin/'${compiler}'.real "$@" -B%{our_path}/usr/armv7l-tizen-linux-gnueabi/bin -B%{our_path}/%{_libdir}/gcc/armv7l-tizen-linux-gnueabi/%{gcc_version_dot} ' > %{buildroot}%{our_path}/usr/bin/${compiler} @@ -234,11 +234,12 @@ if [ -n "$LD_LIBRARY_PATH" ]; then fi for i in "$@"; do if [ "${i:0:10}" = "--sysroot=" ]; then - exec -a "$0" %{our_path}/usr/arm-tizen-linux-gnueabi/bin/ld.real "$@" + %{our_path}/usr/arm-tizen-linux-gnueabi/bin/ld.real "$@" || /usr/bin/qemu-arm /usr/armv7l-tizen-linux-gnueabi/bin/ld -L/usr/lib/gcc/armv7l-tizen-linux-gnueabi/%{gcc_version_dot}/ `echo "$@" | sed -e "s#%{our_path}##;s#--sysroot=[^[:space:]]\+# #g"` + exit $? fi done -%{our_path}/usr/arm-tizen-linux-gnueabi/bin/ld.real --sysroot=/ "$@" || ( /usr/bin/qemu-arm /usr/armv7l-tizen-linux-gnueabi/bin/ld -L/usr/lib/gcc/armv7l-tizen-linux-gnueabi/4.9/ `echo "$@" | sed -e "s#%{our_path}##"` ; echo "Running native ld, because cross ld has failed with the following error: " ) +%{our_path}/usr/arm-tizen-linux-gnueabi/bin/ld.real --sysroot=/ "$@" || /usr/bin/qemu-arm /usr/armv7l-tizen-linux-gnueabi/bin/ld -L/usr/lib/gcc/armv7l-tizen-linux-gnueabi/%{gcc_version_dot}/ `echo "$@" | sed -e "s#%{our_path}##;s#--sysroot=[^[:space:]]\+# #g"` ' > %{buildroot}%{our_path}/usr/arm-tizen-linux-gnueabi/bin/ld chmod +x %{buildroot}%{our_path}/usr/arm-tizen-linux-gnueabi/bin/ld -- 2.7.4