Make qphantom platform plugin static and adjust build scripts

master
Vitaliy Filippov 2015-02-15 12:39:07 +03:00
parent f37c7e29e0
commit cef6c84e00
5 changed files with 17 additions and 135 deletions

129
build.sh
View File

@ -2,9 +2,6 @@
set -e set -e
QT_CFG=''
BUILD_CONFIRM=0
COMPILE_JOBS=1 COMPILE_JOBS=1
MAKEFLAGS_JOBS='' MAKEFLAGS_JOBS=''
@ -34,16 +31,9 @@ if [[ "$COMPILE_JOBS" -gt 8 ]]; then
fi fi
SILENT= SILENT=
QT_CFG=
QTCORE=bundled
QTWEBKIT=bundled
until [[ -z "$1" ]]; do until [[ -z "$1" ]]; do
case $1 in case $1 in
(--qt-config)
shift
QT_CFG+=" $1"
shift;;
(--qmake-args) (--qmake-args)
shift shift
QMAKE_ARGS=$1 QMAKE_ARGS=$1
@ -52,53 +42,18 @@ until [[ -z "$1" ]]; do
shift shift
COMPILE_JOBS=$1 COMPILE_JOBS=$1
shift;; shift;;
(--confirm)
BUILD_CONFIRM=1
shift;;
(--silent) (--silent)
SILENT=silent SILENT=silent
shift;; shift;;
(--qt=system)
QTCORE=system
shift;;
(--qtwebkit=system)
QTCORE=system
QTWEBKIT=system
shift;;
(--*=system | --*=bundled)
QT_CFG+=" $1"
shift;;
"--help") "--help")
cat <<EOF cat <<EOF
Usage: $0 [--qt-config CONFIG] [--jobs NUM] Usage: $0 [--jobs NUM]
--confirm Do not prompt for confirmation of this
very slow build process.
--silent Produce less verbose output. --silent Produce less verbose output.
--jobs NUM How many parallel compile jobs to use. --jobs NUM How many parallel compile jobs to use.
Defaults to the number of CPU cores you have, Defaults to the number of CPU cores you have,
with a maximum of 8. with a maximum of 8.
--qtdeps=system|bundled Use system-provided | bundled libraries for
all of Qt's dependencies. EXPERIMENTAL.
--LIBRARY=system|bundled Use system-provided | bundled LIBRARY.
See src/qt/preconfig.sh for all possible
LIBRARY values. EXPERIMENTAL.
--qt-config OPTION Specify extra config options to be used when
configuring Qt.
--qt=system Use system-provided Qt core libraries.
EXPERIMENTAL, build may not succeed.
Mutually exclusive with --qt-config and all
--LIBRARY= / --qtdeps= options.
--qtwebkit=system Use system-provided QtWebkit.
EXPERIMENTAL, build may not succeed.
Implies --system-qt.
Mutually exclusive with --qt-config and all
--LIBRARY= / --qtdeps= options.
EOF EOF
exit 0 exit 0
;; ;;
@ -108,89 +63,17 @@ EOF
esac esac
done done
if [[ "$QTCORE" = system ]] && [[ -n "$QT_CFG" ]]; then
echo "$0: --qt=system prevents fine-tuning the Qt configuration" >&2
exit 1
fi
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).
We recommend you 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
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=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 "System architecture... ($UNAME_SYSTEM $UNAME_RELEASE $UNAME_MACHINE)"
echo
if [[ "$QTCORE" == "bundled" ]]; then export QMAKE=qmake
export QMAKE=$PWD/src/qt/qtbase/bin/qmake # some Linux distros (e.g. Debian) allow you to parallel-install
( cd src/qt && ./preconfig.sh $QTDEPLIBS $QT_CFG ) # Qt4 and Qt5, using this environment variable to declare which
# one you want
echo export QT_SELECT=qt5
echo "Building Qt..."
echo
( cd src/qt/qtbase && make -j$COMPILE_JOBS $MAKE_S )
else
export QMAKE=qmake
# some Linux distros (e.g. Debian) allow you to parallel-install
# Qt4 and Qt5, using this environment variable to declare which
# one you want
export QT_SELECT=qt5
fi
if [[ "$QTWEBKIT" == "bundled" ]]; then
echo
echo "Building QtWebkit..."
echo
if grep -qEe '-qt-sql-sqlite\>' src/qt/qtbase/config.status; then
export SQLITE3SRCDIR=$PWD/src/qt/qtbase/src/3rdparty/sqlite/
fi
# By default, suppress video and audio-related features.
# They can be reactivated with e.g.
# --qmake-args WEBKIT_CONFIG+='use_gstreamer video'
WEBKIT_DISABLE=
WEBKIT_DISABLE+=' use_glib'
WEBKIT_DISABLE+=' use_gstreamer'
WEBKIT_DISABLE+=' use_gstreamer010'
WEBKIT_DISABLE+=' use_native_fullscreen_video'
WEBKIT_DISABLE+=' legacy_web_audio'
WEBKIT_DISABLE+=' web_audio'
WEBKIT_DISABLE+=' video'
WEBKIT_DISABLE+=' gamepad'
( cd src/qt/qtwebkit &&
$QMAKE "WEBKIT_CONFIG -= $WEBKIT_DISABLE" $QMAKE_ARGS &&
make -j$COMPILE_JOBS $MAKE_S )
fi
echo echo
echo "Building main PhantomJS application..." echo "Building main PhantomJS application..."

View File

@ -1,3 +1,3 @@
TEMPLATE = subdirs TEMPLATE = subdirs
CONFIG += ordered CONFIG += ordered
SUBDIRS += src/phantomjs.pro SUBDIRS += src/qphantom/phantom.pro src/phantomjs.pro

View File

@ -40,6 +40,9 @@
#include <QSslSocket> #include <QSslSocket>
#include <QIcon> #include <QIcon>
#include <QtPlugin>
Q_IMPORT_PLUGIN(PhantomIntegrationPlugin)
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
char **new_argv = (char**) malloc(sizeof(char*) * (3+argc)); char **new_argv = (char**) malloc(sizeof(char*) * (3+argc));

View File

@ -8,15 +8,14 @@ TARGET = phantomjs
QT += network webkitwidgets printsupport QT += network webkitwidgets printsupport
CONFIG += console CONFIG += console
QT += platformsupport-private
LIBS += ../bin/libqphantom.a
DESTDIR = ../bin DESTDIR = ../bin
RESOURCES = phantomjs.qrc \ RESOURCES = phantomjs.qrc \
ghostdriver/ghostdriver.qrc ghostdriver/ghostdriver.qrc
!winrt:!win32: {
QTPLUGIN += qphantom
}
HEADERS += \ HEADERS += \
phantom.h \ phantom.h \
callback.h \ callback.h \

View File

@ -2,18 +2,15 @@ TEMPLATE = lib
TARGET = qphantom TARGET = qphantom
DESTDIR = ../../bin DESTDIR = ../../bin
CONFIG += plugin CONFIG += plugin static
CONFIG += qpa/genericunixfontdatabase
PLUGIN_TYPE = platforms PLUGIN_TYPE = platforms
PLUGIN_CLASS_NAME = PhantomIntegrationPlugin PLUGIN_CLASS_NAME = PhantomIntegrationPlugin
QT += core-private gui-private platformsupport-private QT += platformsupport-private
SOURCES = main.cpp \ SOURCES += main.cpp \
phantomintegration.cpp \ phantomintegration.cpp \
phantombackingstore.cpp phantombackingstore.cpp
HEADERS = phantomintegration.h \ HEADERS += phantomintegration.h \
phantombackingstore.h phantombackingstore.h
OTHER_FILES += phantom.json