From f6abcfe67620f8fdceae89cc4ba0451c37a3ef9d Mon Sep 17 00:00:00 2001 From: Ariya Hidayat Date: Sat, 10 Nov 2012 00:09:25 -0800 Subject: [PATCH] Ask for a confirmation before initiating the build. Although it is mentioned in http://phantomjs.org/build.html, many people are not aware this, they compile from source (even if a binary package is available) and get shocked to realize the build takes ages. The build script is thus modified to give the initial warning. Unattended build is still possible, just use --confirm flag. http://code.google.com/p/phantomjs/issues/detail?id=862 --- build.sh | 29 +++++++++++++++++++++++++++++ deploy/build-and-package.sh | 2 +- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 24a8a1e5..44a1d91e 100755 --- a/build.sh +++ b/build.sh @@ -4,6 +4,7 @@ set -e QT_CFG='' +BUILD_CONFIRM=0 COMPILE_JOBS=1 MAKEFLAGS_JOBS='' @@ -43,9 +44,13 @@ until [ -z "$1" ]; do shift COMPILE_JOBS=$1 shift;; + "--confirm") + BUILD_CONFIRM=1 + shift;; "--help") echo "Usage: $0 [--qt-config CONFIG] [--jobs NUM]" echo + echo " --confirm Silently confirm the build." echo " --qt-config CONFIG Specify extra config options to be used when configuring Qt" echo " --jobs NUM How many parallel compile jobs to use. Defaults to 4." echo @@ -57,6 +62,30 @@ until [ -z "$1" ]; do esac done + +if [[ "$BUILD_CONFIRM" -eq 0 ]]; then +cat << EOF +---------------------------------------- + WARNING +---------------------------------------- + +Building PhantomJS from source takes a very long time, anywhere from 30 minutes +to several hours (depending on the machine configuration). It is recommended to +use the premade binary packages on supported operating systems. + +For details, please go the the web site: http://phantomjs.org/download.html. + +EOF + + echo "Do you want to continue (y/n)?" + read continue + if [[ "$continue" != "y" ]]; then + exit 1 + fi + echo + echo +fi + cd src/qt && ./preconfig.sh --jobs $COMPILE_JOBS --qt-config "$QT_CFG" && cd ../.. src/qt/bin/qmake $QMAKE_ARGS make -j$COMPILE_JOBS diff --git a/deploy/build-and-package.sh b/deploy/build-and-package.sh index 8b7fa88e..14691f3f 100755 --- a/deploy/build-and-package.sh +++ b/deploy/build-and-package.sh @@ -11,7 +11,7 @@ echo # This incantation will cause Qt and WebKit and PhantomJS to all build in "release" # mode, with compiler optimisations, but also with debug symbols. (We will strip the # symbols in package.sh.) -CFLAGS=-g CXXFLAGS=-g ./build.sh --qt-config '-webkit-debug' --qmake-args "QMAKE_CFLAGS=-g QMAKE_CXXFLAGS=-g" || exit 1 +CFLAGS=-g CXXFLAGS=-g ./build.sh --confirm --qt-config '-webkit-debug' --qmake-args "QMAKE_CFLAGS=-g QMAKE_CXXFLAGS=-g" || exit 1 # Package the release tarball rm deploy/*.tar.bz2 2>/dev/null