diff mbox series

[2/2] build.sh: support compiler with path prefix

Message ID 20210111030704.5761-2-lizhijian@cn.fujitsu.com
State Accepted
Headers show
Series [1/2] build.sh: Remove deprecated CROSS_COMPILE | expand

Commit Message

Li Zhijian Jan. 11, 2021, 3:07 a.m. UTC
Previously, specify a compiler with path prefix will lead to a error
like below:
ltp$ ./build.sh -t cross -c /opt/gcc-4.9.3-64-gnu/bin/mips64el-linux-gcc
...
It was created by ltp configure LTP_VERSION, which was
generated by GNU Autoconf 2.69.  Invocation command line was

  $ ./configure --with-open-posix-testsuite --with-realtime-testsuite --prefix=/home/lizj/ltp-install --host=/opt/gcc-4.9.3-64-gnu/bin/mips64el-linux
...
 #define VERSION "LTP_VERSION"

configure: exit 1

Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
---
 build.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/build.sh b/build.sh
index 602ca419e..1ec6a51d8 100755
--- a/build.sh
+++ b/build.sh
@@ -57,7 +57,7 @@  build_native()
 
 build_cross()
 {
-	local host="${CC%-gcc}"
+	local host=$(basename "${CC%-gcc}")
 	if [ "$host" = "gcc" ]; then
 		echo "Invalid CC variable for cross compilation: $CC (clang not supported)" >&2
 		exit 1