Rationalize handshake between build.sh and preconfig.sh.

* build.sh now handles building qt and qtwebkit.
 * preconfig.sh is now only responsible for accumulating arguments
   to pass to qt's configure script.
 * preconfig.sh doesn't have command line arguments of its own;
   anything on its command line will be passed directly to qt's
   configure script.
 * first pass of adjustments to the qt configure parameters
   to try to get a more static build - unfortunately, system
   sqlite, libz, libpng, and libexpat are still getting pulled
   in somehow (mostly via fontconfig, I think).

Part of issue #12467.
2.0
Zack Weinberg 2014-08-14 08:35:45 -04:00 committed by Ariya Hidayat
parent 615f33c9c4
commit 9254f6855e
2 changed files with 66 additions and 81 deletions

View File

@ -54,8 +54,7 @@ until [ -z "$1" ]; do
BUILD_CONFIRM=1
shift;;
"--silent")
SILENT='--silent'
QT_CFG+=" -silent"
SILENT=silent
shift;;
"--system-qtwebkit")
QTWEBKIT=system
@ -77,7 +76,7 @@ until [ -z "$1" ]; do
esac
done
if [[ "$QTWEBKIT" = system ]] && [[ -n "$QT_CFG" ]] && [[ "$QT_CFG" != " -silent" ]]; then
if [[ "$QTWEBKIT" = system ]] && [[ -n "$QT_CFG" ]]; then
echo "$0: options --qt-config and --system-qtwebkit are mutually exclusive" >&2
exit 1
fi
@ -105,25 +104,36 @@ EOF
echo
fi
echo
echo "Building PhantomJS. Please wait..."
echo
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
MAKE_S=""
if [[ "$SILENT" == "silent" ]]; then
MAKE_S="-s"
QT_CFG+=" -silent"
fi
echo "System architecture... ($UNAME_SYSTEM $UNAME_RELEASE $UNAME_MACHINE)"
echo
if [[ "$QTWEBKIT" == "bundled" ]]; then
export QMAKE=$PWD/src/qt/qtbase/bin/qmake
export SQLITE3SRCDIR=$PWD/src/qt/qtbase/3rdparty/sqlite/
( cd src/qt &&
./preconfig.sh --jobs $COMPILE_JOBS --qt-config "$QT_CFG" $SILENT )
( cd src/qt && ./preconfig.sh $QT_CFG )
echo
echo "Building Qt..."
echo
( cd src/qt/qtbase && make -j$COMPILE_JOBS $MAKE_S )
echo
echo "Building QtWebkit..."
echo
( cd src/qt/qtwebkit &&
$QMAKE $QMAKE_ARGS &&
make -j$COMPILE_JOBS )
make -j$COMPILE_JOBS $MAKE_S )
else
export QMAKE=qmake
# some Linux distros (e.g. Debian) allow you to parallel-install
@ -132,7 +142,8 @@ else
export QT_SELECT=qt5
fi
echo "Building main PhantomJS application. Please wait..."
echo
echo "Building main PhantomJS application..."
echo
$QMAKE $QMAKE_ARGS
make -j$COMPILE_JOBS

View File

@ -1,62 +1,73 @@
#!/usr/bin/env bash
pushd qtbase
COMPILE_JOBS=4
set -e
QT_CFG=''
QT_CFG+=' -opensource' # Use the open-source license
QT_CFG+=' -confirm-license' # Silently acknowledge the license confirmation
QT_CFG+=' -v' # Makes it easier to see what header dependencies are missing
QT_CFG+=' -static'
QT_CFG+=' -static' # No shared libraries
QT_CFG+=' -qpa phantom' # Default to our custom QPA platform
if [[ $OSTYPE != darwin* ]]; then
QT_CFG+=' -fontconfig' # Fontconfig for better font matching
QT_CFG+=' -icu' # ICU for QtWebKit (which provides the OSX headers) but not QtBase
fi
QT_CFG+=' -release' # Build only for release (no debugging support)
QT_CFG+=' -nomake examples' # Don't build any examples
QT_CFG+=' -nomake tools' # Don't built the tools
QT_CFG+=' -no-c++11' # Build fails on mac right now with C++11
QT_CFG+=' -nomake tools' # Don't build the tools
if [[ $OSTYPE == darwin* ]]; then
QT_CFG+=' -no-c++11' # Build fails on mac right now with C++11
fi
# Unnecessary Qt modules
QT_CFG+=' -no-opengl'
QT_CFG+=' -no-openvg'
QT_CFG+=' -no-egl'
QT_CFG+=' -no-eglfs'
QT_CFG+=' -no-opengl'
QT_CFG+=' -no-sql-sqlite2'
# Unnecessary Qt features
QT_CFG+=' -D QT_NO_GRAPHICSVIEW'
QT_CFG+=' -D QT_NO_GRAPHICSEFFECT'
QT_CFG+=' -no-qml-debug'
# Unix
QT_CFG+=' -no-dbus' # Disable D-Bus feature
QT_CFG+=' -no-glib' # No need for Glib integration
QT_CFG+=' -no-gtkstyle' # Disable theming integration with Gtk+
QT_CFG+=' -no-cups' # Disable CUPs support
# Unnecessary Unix-specific features
QT_CFG+=' -no-cups'
QT_CFG+=' -no-dbus'
QT_CFG+=' -no-directfb'
QT_CFG+=' -no-evdev'
QT_CFG+=' -no-glib'
QT_CFG+=' -no-gtkstyle'
QT_CFG+=' -no-kms'
QT_CFG+=' -no-libudev'
QT_CFG+=' -no-linuxfb'
QT_CFG+=' -no-mtdev'
QT_CFG+=' -no-nis'
QT_CFG+=' -no-pkg-config'
QT_CFG+=' -no-sm'
QT_CFG+=' -no-xcb'
QT_CFG+=' -no-xcb-xlib'
QT_CFG+=' -no-xinerama'
QT_CFG+=' -no-xkb'
QT_CFG+=' -no-xcb'
QT_CFG+=' -no-pkg-config'
QT_CFG+=' -no-kms'
QT_CFG+=' -no-linuxfb'
QT_CFG+=' -no-directfb'
QT_CFG+=' -no-mtdev'
QT_CFG+=' -no-libudev'
QT_CFG+=' -no-egl'
QT_CFG+=' -no-evdev'
# Use the bundled libraries, vs system-installed
# Note: pcre cannot be disabled, even though webkit has its own regex engine
# Note: as best I can tell, webkitcore has a hard dependency on sqlite
QT_CFG+=' -qt-harfbuzz'
QT_CFG+=' -qt-libjpeg'
QT_CFG+=' -qt-libpng'
QT_CFG+=' -qt-pcre'
QT_CFG+=' -qt-sql-sqlite'
QT_CFG+=' -qt-zlib'
# Explicitly compile with SSL support, so build will fail if headers are missing
# Explicitly compile with support for certain optional features enabled,
# so the build will fail if headers are missing.
QT_CFG+=' -openssl'
if [[ $OSTYPE != darwin* ]]; then
# These are reported to be unnecessary and/or not work correctly
# on Darwin.
QT_CFG+=' -icu'
QT_CFG+=' -fontconfig'
fi
# Useless styles
QT_CFG+=' -D QT_NO_STYLESHEET'
QT_CFG+=' -D QT_NO_STYLE_CDE'
@ -64,47 +75,10 @@ QT_CFG+=' -D QT_NO_STYLE_CLEANLOOKS'
QT_CFG+=' -D QT_NO_STYLE_MOTIF'
QT_CFG+=' -D QT_NO_STYLE_PLASTIQUE'
SILENT=''
# Qt's configure's idea of "silent" is still quite noisy.
case "$*" in
(*-silent*) exec >& /dev/null ;;
esac
until [ -z "$1" ]; do
case $1 in
"--qt-config")
shift
QT_CFG+=" $1"
shift;;
"--jobs")
shift
COMPILE_JOBS=$1
shift;;
"--silent")
SILENT='-s'
QT_CFG+=" -silent"
shift;;
"--help")
echo "Usage: $0 [--qt-config CONFIG] [--jobs NUM]"
echo
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
exit 0
;;
*)
echo "Unrecognised option: $1"
exit 1;;
esac
done
# For parallelizing the bootstrapping process, e.g. qmake and friends.
export MAKEFLAGS=-j$COMPILE_JOBS
if [ -z "$SILENT" ]; then
./configure -prefix $PWD $QT_CFG
else
echo "Setting up Qt. Please wait..."
./configure -prefix $PWD $QT_CFG &> /dev/null
fi
echo
echo "Building Qt and WebKit. Please wait..."
make -j$COMPILE_JOBS $SILENT
cd qtbase
exec ./configure -prefix $PWD $QT_CFG "$@"