From 2f42941389334ac859da78638aee0860de32ae9e Mon Sep 17 00:00:00 2001 From: Jules Villard Date: Wed, 10 Feb 2016 08:13:32 -0800 Subject: [PATCH] make sure shasum is installed before running f-c-p/clang/setup.sh Summary: public Because we ran `./configure` *after* checking if clang was to be compiled, we could fail mysteriously if `shasum` was not present. Now, we fail at the `./configure` step with a clear error message. closes #275 Reviewed By: akotulski Differential Revision: D2921841 fb-gh-sync-id: b8edd8b shipit-source-id: b8edd8b --- build-infer.sh | 70 +++++++++++++++++++++++--------------------------- 1 file changed, 32 insertions(+), 38 deletions(-) diff --git a/build-infer.sh b/build-infer.sh index ae5787ada..2b9b089fd 100755 --- a/build-infer.sh +++ b/build-infer.sh @@ -118,36 +118,6 @@ if [ "$BUILD_JAVA" = "yes" ]; then fi if [ "$BUILD_CLANG" = "yes" ]; then TARGETS+=" clang" - if ! facebook-clang-plugins/clang/setup.sh --only-check-install; then - echo "" - echo " Warning: you are not using a release of Infer. The C and" - echo " Objective-C analyses require a custom clang to be compiled" - echo " now. This step takes ~30-60 minutes, possibly more." - echo "" - echo " To speed this along, you are encouraged to use a release of" - echo " Infer instead:" - echo "" - echo " http://fbinfer.com/docs/getting-started.html" - echo "" - echo " If you are only interested in analyzing Java programs, simply" - echo " run this script with only the \"java\" argument:" - echo "" - echo " $0 java" - echo "" - - confirm="n" - printf "Are you sure you want to compile clang? (y/N) " - if [ "$INTERACTIVE" = "no" ]; then - confirm="y" - echo "$confirm" - else - read confirm - fi - - if [ "x$confirm" != "xy" ]; then - exit 0 - fi - fi fi CONFIGURE_ARGS= @@ -158,15 +128,39 @@ if [ "$BUILD_JAVA" = "no" ]; then CONFIGURE_ARGS+=" --disable-java-analyzers" fi -echo -echo " *************************" -echo " ** **" -echo " ** Building Infer **" -echo " ** **" -echo " *************************" -echo - ./configure $CONFIGURE_ARGS + +if [ "$BUILD_CLANG" = "yes" ] && ! facebook-clang-plugins/clang/setup.sh --only-check-install; then + echo "" + echo " Warning: you are not using a release of Infer. The C and" + echo " Objective-C analyses require a custom clang to be compiled" + echo " now. This step takes ~30-60 minutes, possibly more." + echo "" + echo " To speed this along, you are encouraged to use a release of" + echo " Infer instead:" + echo "" + echo " http://fbinfer.com/docs/getting-started.html" + echo "" + echo " If you are only interested in analyzing Java programs, simply" + echo " run this script with only the \"java\" argument:" + echo "" + echo " $0 java" + echo "" + + confirm="n" + printf "Are you sure you want to compile clang? (y/N) " + if [ "$INTERACTIVE" = "no" ]; then + confirm="y" + echo "$confirm" + else + read confirm + fi + + if [ "x$confirm" != "xy" ]; then + exit 0 + fi +fi + make -j $TARGETS || ( echo echo ' compilation failure; you can try running'