diff options
Diffstat (limited to 'WebKitTools/wx/build-wxwebkit')
-rwxr-xr-x | WebKitTools/wx/build-wxwebkit | 130 |
1 files changed, 101 insertions, 29 deletions
diff --git a/WebKitTools/wx/build-wxwebkit b/WebKitTools/wx/build-wxwebkit index 05557a8..0fb5b89 100755 --- a/WebKitTools/wx/build-wxwebkit +++ b/WebKitTools/wx/build-wxwebkit @@ -33,7 +33,7 @@ set -o errexit scriptDir="$(cd $(dirname $0);pwd)" WK_ROOT=$scriptDir/../.. -WK_ROOTDIR=$WK_ROOT +WK_ROOTDIR="$WK_ROOT" cd $scriptDir @@ -41,7 +41,13 @@ if [ -z $WEBKITOUTPUTDIR ]; then WEBKITOUTPUTDIR=`cd $WK_ROOT/WebKitTools/Scripts; perl -e "use webkitdirs; print productDir()"` fi -WINDEPS="pthreads/lib/pthreadVC2.dll icu/bin/icuuc34.dll icu/bin/icudt34.dll libcurl/*.dll sqlite3/sqlite3.dll" +WKWINLIBS=WebKitLibraries/win +WINDEPS=" $WKWINLIBS/lib/pthreadVC2.dll" +WINDEPS="$WINDEPS $WKWINLIBS/bin/icuuc34.dll $WKWINLIBS/bin/icudt34.dll $WKWINLIBS/bin/icuin34.dll" +WINDEPS="$WINDEPS $WKWINLIBS/bin/libcurl.dll $WKWINLIBS/bin/libeay32.dll $WKWINLIBS/bin/ssleay32.dll $WKWINLIBS/bin/zlib1.dll" +WINDEPS="$WINDEPS $WKWINLIBS/lib/sqlite3.dll" +WINDEPS="$WINDEPS $WKWINLIBS/bin/libxml2.dll $WKWINLIBS/bin/libxslt.dll" +WINDEPS="$WINDEPS $WKWINLIBS/bin/iconv.dll" # TODO: check that we are running from the root of the source tree... @@ -57,6 +63,9 @@ if [ $OSTYPE == cygwin ]; then echo "Error, you must set WXWIN to your wxWidgets root directory." exit 1 fi + if [ -z $WX_PREFIX ]; then + WX_PREFIX=$WXWIN + fi if [ -z $BAKEFILE_PATHS ]; then export BAKEFILE_PATHS=$WXWIN/build/bakefiles/wxpresets fi @@ -103,6 +112,7 @@ fi #---------------------------------------------------------------------- # process command line args +build_type_set=0 do_bake=0 do_prep=0 @@ -111,6 +121,7 @@ do_build=0 do_clean=0 do_install=0 use_wxgc=0 +debug=1 wxdebug=0 wxpython=0 make_args='' @@ -139,31 +150,62 @@ if [ $do_bake == 0 -a $do_prep == 0 -a $do_build == 0 -a $do_clean == 0 ]; then do_bake=1; do_prep=1; do_build=1 fi +if [ -f $WK_ROOT/WebKitBuild/Configuration ]; then + BUILD_TYPE=`cat $WK_ROOT/WebKitBuild/Configuration` + echo "Configuration is: $BUILD_TYPE" + + if [ $BUILD_TYPE == "Release" ]; then + debug=0 + fi + if [ $BUILD_TYPE == "Debug" ]; then + debug=1 + fi + +fi + function do_make { dir=$1 cxxflags=$2 olddir=$PWD shift shift + # NOTE: If we try to do make clean after the Bakefiles were cleaned out, or before they were + # first generated, we will get errors about missing files, so we need to check that the + # makefile exists before running it. if [ $OSTYPE == cygwin ]; then cd $dir - nmake -f makefile.vc CXXFLAGS="$cxxflags" $@ + if [ -f makefile.vc ]; then + nmake -f makefile.vc CXXFLAGS="$cxxflags" $@ + fi cd $olddir else - make -C $dir -f GNUmakefile $MAKE_ARGS CXXFLAGS="$cxxflags" $@ + if [ -f $dir/GNUmakefile ]; then + make -C $dir -f GNUmakefile $MAKE_ARGS CXXFLAGS="$cxxflags" $@ + fi fi if [ $? != 0 ]; then exit $? fi } +# output the first parameter that is a dir and exists +function find_existing_dir { + for arg in $*; do + tester=$arg + if [ $OSTYPE == cygwin ]; then + tester=`cygpath -u $arg` + fi + if [ -d $tester ]; then + echo $arg + return + fi + done +} + + olddir=$PWD -if [ $do_clean == 1 ]; then - rm -rf $WK_ROOT/JavaScriptCore/DerivedSources - rm -rf $WK_ROOT/WebCore/DerivedSources - rm -rf $WK_ROOT/WebCore/include/JavaScriptCore -else +if [ $do_clean != 1 ]; then mkdir -p $WEBKITOUTPUTDIR/build @@ -230,25 +272,32 @@ if [ $do_build == 1 -o $do_clean == 1 ]; then wxdebug=1 fi - PLATFORM_OS="win" - if [ "${OSTYPE:0:6}" == "darwin" ]; then + if [ "${OSTYPE:0:6}" == "cygwin" ]; then + PLATFORM_OS="win" + elif [ "${OSTYPE:0:6}" == "darwin" ]; then PLATFORM_OS="mac" else PLATFORM_OS="linux" + use_wxgc=1 # Linux requires us to use wxgc to get proper drawing. fi WINDEPS="$WINDEPS $WXWIN/lib/vc_dll/wxmsw28u${WX_EXT}_core_vc.dll $WXWIN/lib/vc_dll/wxbase28u${WX_EXT}_vc.dll" - # NOTE: If we try to do make clean after the Bakefiles were cleaned out, or before they were - # first generated, we will get errors about missing files. - # FIXME: Make the check more robust. - if [ -f $WK_ROOT/JavaScriptCore/GNUmakefile ]; then - do_make $WK_ROOT/JavaScriptCore "-DBUILDING_WX__=1 $WXGC_DEFINE" WX_DEBUG=$wxdebug WEBKIT_ROOT=$WK_ROOTDIR PLATFORM_OS=$PLATFORM_OS $other_args - do_make $WK_ROOT/WebCore "-DBUILDING_WX__=1 $WXGC_DEFINE" WX_DEBUG=$wxdebug WEBKIT_ROOT=$WK_ROOTDIR PLATFORM_OS=$PLATFORM_OS $other_args - do_make $WK_ROOT/WebKit/wx "-DBUILDING_WX__=1 -DWXMAKINGDLL_WEBKIT=1 $WXGC_DEFINE" WX_DEBUG=$wxdebug WEBKIT_ROOT=$WK_ROOTDIR PLATFORM_OS=$PLATFORM_OS $other_args - do_make $WK_ROOT/WebKitTools/wx/browser "-DBUILDING_WX__=1 -DWXUSINGDLL_WEBKIT=1 $WXGC_DEFINE" WX_DEBUG=$wxdebug WEBKIT_ROOT=$WK_ROOTDIR PLATFORM_OS=$PLATFORM_OS $other_args + do_make $WK_ROOT/JavaScriptCore "-DBUILDING_WX__=1 $WXGC_DEFINE" WX_DEBUG=$wxdebug DEBUG=$debug WEBKIT_ROOT=$WK_ROOTDIR PLATFORM_OS=$PLATFORM_OS $other_args + + mkdir -p $WEBKITOUTPUTDIR/JavaScriptCore + cp -p $WK_ROOT/JavaScriptCore/API/*.h $WEBKITOUTPUTDIR/JavaScriptCore/ + + do_make $WK_ROOT/WebCore "-DBUILDING_WX__=1 $WXGC_DEFINE" WX_DEBUG=$wxdebug WEBKIT_ROOT=$WK_ROOTDIR DEBUG=$debug PLATFORM_OS=$PLATFORM_OS $other_args + do_make $WK_ROOT/WebKit/wx "-DBUILDING_WX__=1 -DWXMAKINGDLL_WEBKIT=1 $WXGC_DEFINE" WX_DEBUG=$wxdebug DEBUG=$debug WEBKIT_ROOT=$WK_ROOTDIR PLATFORM_OS=$PLATFORM_OS $other_args + do_make $WK_ROOT/WebKitTools/wx/browser "-DBUILDING_WX__=1 -DWXUSINGDLL_WEBKIT=1 $WXGC_DEFINE" WX_DEBUG=$wxdebug DEBUG=$debug WEBKIT_ROOT=$WK_ROOTDIR PLATFORM_OS=$PLATFORM_OS $other_args + + if [ $do_clean == 1 ]; then + rm -rf $WK_ROOT/JavaScriptCore/DerivedSources + rm -rf $WK_ROOT/WebCore/DerivedSources + rm -rf $WK_ROOT/WebCore/include/JavaScriptCore fi - + if [ $do_build == 1 ]; then if [ "${OSTYPE:0:6}" = "darwin" ]; then cd $WEBKITOUTPUTDIR @@ -262,7 +311,9 @@ if [ $do_build == 1 -o $do_clean == 1 ]; then fi if [ $wxpython == 1 ]; then - SWIG=`which swig` + if [ -z $SWIG ]; then + SWIG=`which swig` + fi if [ ! -f "$SWIG" ]; then echo "ERROR: Cannot find SWIG. Make sure that SWIG 1.3.29 is located on your path."; @@ -276,12 +327,29 @@ if [ $do_build == 1 -o $do_clean == 1 ]; then if [ "${OSTYPE:0:6}" == "cygwin" ]; then WEBKIT_INCLUDE="-I`cygpath -d $WK_ROOT/WebKit/wx`" fi - $SWIG $SWIG_FLAGS -I$WX_PREFIX/include/wx-2.8/wx/wxPython/i_files $WEBKIT_INCLUDE -o webview.cpp webview.i - #$SWIG -I$WX_PREFIX/include/wx-2.8/wx/wxPython/i_files $WEBKIT_INCLUDE -xml -o webview.xml webview.i - - PY_INCLUDE=`python -c "import distutils.sysconfig; print distutils.sysconfig.get_python_inc()"` - PY_VERSION=`python -c "import sys; print str(sys.version_info[0]) + str(sys.version_info[1])"` + # Determine which include path to use for wxPython's *.i files + # Options are: + # wxPython installed on a posix system + # the wxPython win32 devel tarball + # a wx source tree from a tarball where wxPython is in the wx dir + # a wx source tree from SVN where wxPython is a sibling of the wx dir + WXPY_INCLUDE=`find_existing_dir \ + $WX_PREFIX/include/wx-2.8/wx/wxPython/i_files \ + $WX_PREFIX/include/wx/wxPython/i_files \ + $WX_PREFIX/wxPython/src \ + $WX_PREFIX/../wxPython/src` + if [ -z $WXPY_INCLUDE ]; then + echo "ERROR: Unable to find wxPython's *.i files" + exit 1 + fi + + # Run SWIG + $SWIG $SWIG_FLAGS -I$WXPY_INCLUDE $WEBKIT_INCLUDE -o webview.cpp webview.i + cp webview.py $WEBKITOUTPUTDIR/webview.py + + PY_INCLUDE=`python -c "import sys,distutils.sysconfig; sys.stdout.write(distutils.sysconfig.get_python_inc())"` + PY_VERSION=`python -c "import sys; sys.stdout.write(str(sys.version_info[0]) + str(sys.version_info[1]))"` PY_LIBDIR=`python -c "import distutils.sysconfig; import sys; sys.stdout.write(distutils.sysconfig.PREFIX)"` if [ "${OSTYPE:0:6}" == "cygwin" ]; then @@ -290,8 +358,8 @@ if [ $do_build == 1 -o $do_clean == 1 ]; then PY_LIBDIR="$PY_LIBDIR/lib" fi - do_make $WK_ROOT/WebKit/wx/bindings/python "-DBUILDING_WX__=1 -DWXUSINGDLL=1 -DWXUSINGDLL_WEBKIT=1 -I$PY_INCLUDE $WXGC_DEFINE" \ - WX_DEBUG=$wxdebug WEBKIT_ROOT=$WK_ROOTDIR PLATFORM_OS=$PLATFORM_OS PYTHON_VERSION=$PY_VERSION PYTHON_LIBDIR=$PY_LIBDIR $other_args + do_make $WK_ROOT/WebKit/wx/bindings/python "-DBUILDING_WX__=1 -DWXUSINGDLL=1 -DWXUSINGDLL_WEBKIT=1 -I$PY_INCLUDE -I$WX_PREFIX/wxPython/include -I$WX_PREFIX/../wxPython/include $WXGC_DEFINE" \ + WX_DEBUG=$wxdebug DEBUG=$debug WEBKIT_ROOT=$WK_ROOTDIR PLATFORM_OS=$PLATFORM_OS PYTHON_VERSION=$PY_VERSION PYTHON_LIBDIR=$PY_LIBDIR $other_args if [ "${OSTYPE:0:6}" == "cygwin" ]; then if [ -f $WEBKITOUTPUTDIR/_webview.pyd -a -f $WEBKITOUTPUTDIR/_webview.dll ]; then rm $WEBKITOUTPUTDIR/_webview.pyd @@ -304,7 +372,11 @@ if [ $do_build == 1 -o $do_clean == 1 ]; then if [ "$OSTYPE" == "cygwin" ]; then echo "Copying necessary DLLs to run test and sample applications..." cd $WK_ROOT - cp $WINDEPS $WEBKITOUTPUTDIR + cp $WINDEPS `cygpath -u $WEBKITOUTPUTDIR` + chmod +x `cygpath -u $WEBKITOUTPUTDIR/`*.dll + if [ -e `cygpath -u $WEBKITOUTPUTDIR/_webview.dll` ]; then + mv `cygpath -u $WEBKITOUTPUTDIR/_webview.dll` `cygpath -u $WEBKITOUTPUTDIR/_webview.pyd` + fi fi BROWSERAPP="wxBrowser" |