Skip to content

Commit 435a199

Browse files
Do not reset CFLAGS when configuring software for target
configure for target software has been invoked `./configure CFLAGS=$CFLAGS_FOR_TARGET`, however if CFLAGS_FOR_TARGET is empty, then that cause reset CFLAGS to be empty as well, therefore default CFLAGS of package will be never used, which often leads to software compiled without optimizations and debug symbols. Signed-off-by: Anton Kolesov <[email protected]>
1 parent e0011d7 commit 435a199

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

arc-init.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,14 @@ configure_for_arc() {
460460

461461
local srcdir=$1
462462
local triplet=$2
463+
464+
# Cannto do a simple "CFLAGS=$CFLAGS_FOR_TARGET, because if latter is empty
465+
# that would reset CFLAGS unnecessarily.
466+
local cflags=
467+
if [ "$CFLAGS_FOR_TARGET" ]
468+
then
469+
cflags="CFLAGS=$CFLAGS_FOR_TARGET"
470+
fi
463471
shift 2
464472

465473
# --prefix must correspond to prefix on *target* system, not where it will
@@ -471,7 +479,7 @@ configure_for_arc() {
471479
if ! $srcdir/configure --prefix=/usr --host=$triplet \
472480
--with-pkgversion="$UCLIBC_TOOLS_VERSION"\
473481
--with-bugurl="$ARC_COMMON_BUGURL" \
474-
CFLAGS="$CFLAGS_FOR_TARGET" $* \
482+
$cflags $* \
475483
>> "$logfile" 2>&1
476484
then
477485
echo "ERROR: failed while configuring."

0 commit comments

Comments
 (0)