@@ -283,7 +283,7 @@ opt_core() {
283
283
fi
284
284
done
285
285
else
286
- if [ ! -z " $META " ]
286
+ if [ -n " $META " ]
287
287
then
288
288
OP=" $OP =<$META >"
289
289
fi
@@ -317,7 +317,7 @@ envopt() {
317
317
fi
318
318
319
319
# If script or environment provided a value, save it.
320
- if [ ! -z " $VV " ]
320
+ if [ -n " $VV " ]
321
321
then
322
322
putvar $V
323
323
fi
@@ -601,7 +601,9 @@ valopt llvm-root "" "set LLVM root"
601
601
valopt python " " " set path to python"
602
602
valopt jemalloc-root " " " set directory where libjemalloc_pic.a is located"
603
603
valopt build " ${DEFAULT_BUILD} " " GNUs ./configure syntax LLVM build triple"
604
- valopt android-cross-path " /opt/ndk_standalone" " Android NDK standalone path"
604
+ valopt android-cross-path " /opt/ndk_standalone" " Android NDK standalone path (deprecated)"
605
+ valopt arm-linux-androideabi-ndk " " " arm-linux-androideabi NDK standalone path"
606
+ valopt aarch64-linux-android-ndk " " " aarch64-linux-android NDK standalone path"
605
607
valopt release-channel " dev" " the name of the release channel to build"
606
608
valopt musl-root " /usr/local" " MUSL root installation directory"
607
609
@@ -767,7 +769,7 @@ probe CFG_LLDB lldb
767
769
# On MacOS X, invoking `javac` pops up a dialog if the JDK is not
768
770
# installed. Since `javac` is only used if `antlr4` is available,
769
771
# probe for it only in this case.
770
- if [ ! -z " $CFG_ANTLR4 " ]
772
+ if [ -n " $CFG_ANTLR4 " ]
771
773
then
772
774
probe CFG_JAVAC javac
773
775
fi
@@ -786,14 +788,14 @@ then
786
788
fi
787
789
fi
788
790
789
- if [ ! -z " $CFG_GDB " ]
791
+ if [ -n " $CFG_GDB " ]
790
792
then
791
793
# Store GDB's version
792
794
CFG_GDB_VERSION=$( $CFG_GDB --version 2> /dev/null | head -1)
793
795
putvar CFG_GDB_VERSION
794
796
fi
795
797
796
- if [ ! -z " $CFG_LLDB " ]
798
+ if [ -n " $CFG_LLDB " ]
797
799
then
798
800
# Store LLDB's version
799
801
CFG_LLDB_VERSION=$( $CFG_LLDB --version 2> /dev/null | head -1)
@@ -819,7 +821,7 @@ step_msg "looking for target specific programs"
819
821
820
822
probe CFG_ADB adb
821
823
822
- if [ ! -z " $CFG_PANDOC " ]
824
+ if [ -n " $CFG_PANDOC " ]
823
825
then
824
826
# Extract "MAJOR MINOR" from Pandoc's version number
825
827
PV_MAJOR_MINOR=$( pandoc --version | grep ' ^pandoc' |
845
847
BIN_SUF=.exe
846
848
fi
847
849
848
- if [ ! -z " $CFG_ENABLE_LOCAL_RUST " ]
850
+ if [ -n " $CFG_ENABLE_LOCAL_RUST " ]
849
851
then
850
852
system_rustc=$( which rustc)
851
853
if [ -f ${CFG_LOCAL_RUST_ROOT} /bin/rustc${BIN_SUF} ]
930
932
931
933
# Okay, at this point, we have made up our minds about whether we are
932
934
# going to force CFG_ENABLE_CLANG or not; save the setting if so.
933
- if [ ! -z " $CFG_ENABLE_CLANG " ]
935
+ if [ -n " $CFG_ENABLE_CLANG " ]
934
936
then
935
937
putvar CFG_ENABLE_CLANG
936
938
fi
937
939
938
940
# Same with jemalloc. save the setting here.
939
- if [ ! -z " $CFG_DISABLE_JEMALLOC " ]
941
+ if [ -n " $CFG_DISABLE_JEMALLOC " ]
940
942
then
941
943
putvar CFG_DISABLE_JEMALLOC
942
944
fi
943
945
944
- if [ ! -z " $CFG_LLVM_ROOT " -a -z " $CFG_DISABLE_LLVM_VERSION_CHECK " -a -e " $CFG_LLVM_ROOT /bin/llvm-config" ]
946
+ if [ -n " $CFG_LLVM_ROOT " -a -z " $CFG_DISABLE_LLVM_VERSION_CHECK " -a -e " $CFG_LLVM_ROOT /bin/llvm-config" ]
945
947
then
946
948
step_msg " using custom LLVM at $CFG_LLVM_ROOT "
947
949
970
972
# CFG_ENABLE_CLANG is set, that indicates that we are opting into
971
973
# running such safeguards.
972
974
973
- if [ ! -z " $CC " ]
975
+ if [ -n " $CC " ]
974
976
then
975
977
msg " skipping compiler inference steps; using provided CC=$CC "
976
978
CFG_CC=" $CC "
983
985
putvar CFG_USING_CLANG
984
986
fi
985
987
else
986
- if [ ! -z " $CFG_ENABLE_CLANG " ]
988
+ if [ -n " $CFG_ENABLE_CLANG " ]
987
989
then
988
990
if [ -z " $CFG_CLANG " ]
989
991
then
997
999
fi
998
1000
fi
999
1001
1000
- if [ ! -z " $CFG_ENABLE_CLANG " ]
1002
+ if [ -n " $CFG_ENABLE_CLANG " ]
1001
1003
then
1002
1004
case " $CC " in
1003
1005
(' ' |* clang)
@@ -1013,7 +1015,7 @@ then
1013
1015
CFG_CLANG_VERSION=$( echo $CFG_CLANG_REPORTED_VERSION | sed ' s/.*version \(.*\) .*/\1/' )
1014
1016
fi
1015
1017
1016
- if [ ! -z " $CFG_OSX_CLANG_VERSION " ]
1018
+ if [ -n " $CFG_OSX_CLANG_VERSION " ]
1017
1019
then
1018
1020
case $CFG_OSX_CLANG_VERSION in
1019
1021
(7.0* )
@@ -1042,7 +1044,7 @@ then
1042
1044
esac
1043
1045
fi
1044
1046
1045
- if [ ! -z " $CFG_ENABLE_CCACHE " ]
1047
+ if [ -n " $CFG_ENABLE_CCACHE " ]
1046
1048
then
1047
1049
if [ -z " $CFG_CCACHE " ]
1048
1050
then
@@ -1112,20 +1114,24 @@ do
1112
1114
fi
1113
1115
1114
1116
case $i in
1115
- arm-linux-androideabi)
1116
-
1117
- if [ ! -f $CFG_ANDROID_CROSS_PATH /bin/arm-linux-androideabi-gcc ]
1118
- then
1119
- err " NDK $CFG_ANDROID_CROSS_PATH /bin/arm-linux-androideabi-gcc not found"
1120
- fi
1121
- if [ ! -f $CFG_ANDROID_CROSS_PATH /bin/arm-linux-androideabi-g++ ]
1122
- then
1123
- err " NDK $CFG_ANDROID_CROSS_PATH /bin/arm-linux-androideabi-g++ not found"
1124
- fi
1125
- if [ ! -f $CFG_ANDROID_CROSS_PATH /bin/arm-linux-androideabi-ar ]
1117
+ * android* )
1118
+ upper_snake_target=$( echo " $i " | tr ' [:lower:]' ' [:upper:]' | tr ' \-' ' \_' )
1119
+ eval ndk=\$ " CFG_${upper_snake_target} _NDK"
1120
+ if [ -z " $ndk " ]
1126
1121
then
1127
- err " NDK $CFG_ANDROID_CROSS_PATH /bin/arm-linux-androideabi-ar not found"
1122
+ ndk=$CFG_ANDROID_CROSS_PATH
1123
+ eval " CFG_${upper_snake_target} _NDK" =$CFG_ANDROID_CROSS_PATH
1124
+ warn " generic/default Android NDK option is deprecated (use --$i -ndk option instead)"
1128
1125
fi
1126
+
1127
+ # Perform a basic sanity check of the NDK
1128
+ for android_ndk_tool in " $ndk /bin/$i -gcc" " $ndk /bin/$i -g++" " $ndk /bin/$i -ar"
1129
+ do
1130
+ if [ ! -f $android_ndk_tool ]
1131
+ then
1132
+ err " NDK tool $android_ndk_tool not found (bad or missing --$i -ndk option?)"
1133
+ fi
1134
+ done
1129
1135
;;
1130
1136
1131
1137
arm-apple-darwin)
@@ -1177,8 +1183,13 @@ do
1177
1183
# INCLUDE and LIB variables for MSVC so we can set those in the
1178
1184
# build system as well.
1179
1185
install=$( reg QUERY \
1180
- ' HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\12 .0' \
1186
+ ' HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\14 .0' \
1181
1187
-v InstallDir)
1188
+ if [ -z " $install " ]; then
1189
+ install=$( reg QUERY \
1190
+ ' HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\12.0' \
1191
+ -v InstallDir)
1192
+ fi
1182
1193
need_ok " couldn't find visual studio install root"
1183
1194
CFG_MSVC_ROOT=$( echo " $install " | grep InstallDir | sed ' s/.*REG_SZ[ ]*//' )
1184
1195
CFG_MSVC_ROOT=$( dirname " $CFG_MSVC_ROOT " )
1199
1210
;;
1200
1211
esac
1201
1212
bindir=" ${CFG_MSVC_ROOT} /VC/bin"
1202
- if [ ! -z " $msvc_part " ]; then
1213
+ if [ -n " $msvc_part " ]; then
1203
1214
bindir=" $bindir /$msvc_part "
1204
1215
fi
1205
1216
eval CFG_MSVC_BINDIR_$bits =" \" $bindir \" "
1229
1240
esac
1230
1241
done
1231
1242
1232
- if [ ! -z " $CFG_PERF " ]
1243
+ if [ -n " $CFG_PERF " ]
1233
1244
then
1234
1245
HAVE_PERF_LOGFD=` $CFG_PERF stat --log-fd 2>&1 | grep ' unknown option' `
1235
1246
if [ -z " $HAVE_PERF_LOGFD " ];
@@ -1339,11 +1350,11 @@ then
1339
1350
" ${CFG_GIT} " submodule init
1340
1351
1341
1352
# Disable submodules that we're not using
1342
- if [ ! -z " ${CFG_LLVM_ROOT} " ]; then
1353
+ if [ -n " ${CFG_LLVM_ROOT} " ]; then
1343
1354
msg " git: submodule deinit src/llvm"
1344
1355
" ${CFG_GIT} " submodule deinit src/llvm
1345
1356
fi
1346
- if [ ! -z " ${CFG_JEMALLOC_ROOT} " ]; then
1357
+ if [ -n " ${CFG_JEMALLOC_ROOT} " ]; then
1347
1358
msg " git: submodule deinit src/jemalloc"
1348
1359
" ${CFG_GIT} " submodule deinit src/jemalloc
1349
1360
fi
1390
1401
if [ -z $CFG_LLVM_ROOT ]
1391
1402
then
1392
1403
LLVM_BUILD_DIR=${CFG_BUILD_DIR} $t /llvm
1393
- if [ ! -z " $CFG_DISABLE_OPTIMIZE_LLVM " ]
1404
+ if [ -n " $CFG_DISABLE_OPTIMIZE_LLVM " ]
1394
1405
then
1395
1406
LLVM_DBG_OPTS=" --enable-debug-symbols --disable-optimized"
1396
1407
# Just use LLVM straight from its build directory to
1446
1457
msg " configuring LLVM for $t with cmake"
1447
1458
1448
1459
CMAKE_ARGS=" -DLLVM_INCLUDE_TESTS=OFF"
1449
- if [ ! -z " $CFG_DISABLE_OPTIMIZE_LLVM " ]; then
1460
+ if [ -n " $CFG_DISABLE_OPTIMIZE_LLVM " ]; then
1450
1461
CMAKE_ARGS=" $CMAKE_ARGS -DCMAKE_BUILD_TYPE=Debug"
1451
1462
else
1452
1463
CMAKE_ARGS=" $CMAKE_ARGS -DCMAKE_BUILD_TYPE=Release"
@@ -1460,12 +1471,22 @@ do
1460
1471
1461
1472
msg " configuring LLVM with:"
1462
1473
msg " $CMAKE_ARGS "
1474
+ case " $CFG_MSVC_ROOT " in
1475
+ * 14.0* )
1476
+ generator=" Visual Studio 14 2015"
1477
+ ;;
1478
+ * 12.0* )
1479
+ generator=" Visual Studio 12 2013"
1480
+ ;;
1481
+ * )
1482
+ err " can't determine generator for LLVM cmake"
1483
+ ;;
1484
+ esac
1463
1485
case " $t " in
1464
1486
x86_64-* )
1465
- generator=" Visual Studio 12 2013 Win64"
1487
+ generator=" $generator Win64"
1466
1488
;;
1467
1489
i686-* )
1468
- generator=" Visual Studio 12 2013"
1469
1490
;;
1470
1491
* )
1471
1492
err " can only build LLVM for x86 platforms"
1538
1559
1539
1560
(* )
1540
1561
msg " inferring LLVM_CXX/CC from CXX/CC = $CXX /$CC "
1541
- if [ ! -z " $CFG_ENABLE_CCACHE " ]
1562
+ if [ -n " $CFG_ENABLE_CCACHE " ]
1542
1563
then
1543
1564
if [ -z " $CFG_CCACHE " ]
1544
1565
then
@@ -1667,25 +1688,26 @@ putvar CFG_HOST
1667
1688
putvar CFG_TARGET
1668
1689
putvar CFG_LIBDIR_RELATIVE
1669
1690
putvar CFG_DISABLE_MANAGE_SUBMODULES
1670
- putvar CFG_ANDROID_CROSS_PATH
1691
+ putvar CFG_AARCH64_LINUX_ANDROID_NDK
1692
+ putvar CFG_ARM_LINUX_ANDROIDEABI_NDK
1671
1693
putvar CFG_MANDIR
1672
1694
1673
1695
# Avoid spurious warnings from clang by feeding it original source on
1674
1696
# ccache-miss rather than preprocessed input.
1675
- if [ ! -z " $CFG_ENABLE_CCACHE " ] && [ ! -z " $CFG_USING_CLANG " ]
1697
+ if [ -n " $CFG_ENABLE_CCACHE " ] && [ -n " $CFG_USING_CLANG " ]
1676
1698
then
1677
1699
CFG_CCACHE_CPP2=1
1678
1700
putvar CFG_CCACHE_CPP2
1679
1701
fi
1680
1702
1681
- if [ ! -z " $CFG_ENABLE_CCACHE " ]
1703
+ if [ -n " $CFG_ENABLE_CCACHE " ]
1682
1704
then
1683
1705
CFG_CCACHE_BASEDIR=${CFG_SRC_DIR}
1684
1706
putvar CFG_CCACHE_BASEDIR
1685
1707
fi
1686
1708
1687
1709
1688
- if [ ! -z $BAD_PANDOC ]
1710
+ if [ -n $BAD_PANDOC ]
1689
1711
then
1690
1712
CFG_PANDOC=
1691
1713
putvar CFG_PANDOC
0 commit comments