Permalink
Browse files

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
  • Loading branch information...
1 parent 7b84e43 commit 59dbd77ef528c57e6eb4aea20b8064b6af897f5e @ariya committed Nov 10, 2012
Showing with 30 additions and 1 deletion.
  1. +29 −0 build.sh
  2. +1 −1 deploy/build-and-package.sh
View
@@ -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
@@ -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

0 comments on commit 59dbd77

Please sign in to comment.