1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
|
#!/bin/bash
# Copyright (C) 2007 Robin Dunn, Kevin Ollivier All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Driver for the wxWebKit build process.
set -o errexit
#set -o xtrace
#----------------------------------------------------------------------
# Set up the environment
scriptDir="$(cd $(dirname $0);pwd)"
WK_ROOT=$scriptDir/../..
WK_ROOTDIR=$WK_ROOT
cd $scriptDir
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"
# TODO: check that we are running from the root of the source tree...
# cygpath will bork if the dir doesn't exist...
mkdir -p $WEBKITOUTPUTDIR
if [ $OSTYPE == cygwin ]; then
EXE=.exe
WK_ROOTDIR=`cygpath -d $WK_ROOT`
WEBKITOUTPUTDIR=`cygpath -d $WEBKITOUTPUTDIR`
export WEBKITOUTPUTDIR
if [ -z $WXWIN ]; then
echo "Error, you must set WXWIN to your wxWidgets root directory."
exit 1
fi
if [ -z $BAKEFILE_PATHS ]; then
export BAKEFILE_PATHS=$WXWIN/build/bakefiles/wxpresets
fi
LINKER=`which link`
if [ "$LINKER" = "/usr/bin/link" ]; then
echo "WARNING: wxWebKit builds using MSVC on Windows, but it looks like"
echo "you have the GCC linker on your path. If /usr/bin/link does NOT point"
echo "to the MSVC linker, you need to move it or change your path to pick up"
echo "Microsoft's link.exe program first."
fi
else
export WEBKITOUTPUTDIR
WX_PREFIX=`wx-config --prefix`
if [ ! -d "$WX_PREFIX" ]; then
echo "ERROR: Cannot find your wxWidgets installation."
echo "Make sure wx-config is on your PATH and points to a valid wxWidgets installation."
exit 1
fi
CONFIG=`wx-config --selected-config`
if [ "${CONFIG:0:4}" != "gtk2" -a "${CONFIG:0:3}" != "mac" ]; then
echo "ERROR: This configuration '$CONFIG' is not currently supported by wxWebKit. Please use the win, mac, or gtk2 port depending on your platform."
exit 1
fi
if [ ! -d "$WX_PREFIX/share/bakefile" ]; then
echo "ERROR: wxWidgets installation does not have wxpresets."
echo "wx-config is pointing to an installation that does not have Bakefile presets installed. Run `wx-config --version` to ensure your wxWidgets is of version 2.8+."
exit 1
fi
if [ -z $BAKEFILE_PATHS ]; then
export BAKEFILE_PATHS=$WX_PREFIX/share/bakefile
fi
fi
# after all that, make sure that BAKEFILE_PATHS was either set
# previously, or by the code above
if [ -z $BAKEFILE_PATHS ]; then
echo "Error, you must set BAKEFILE_PATHS to the directory containing wxpresets."
exit 1
fi
#----------------------------------------------------------------------
# process command line args
do_bake=0
do_prep=0
do_extras=0
do_build=0
do_clean=0
do_install=0
use_wxgc=0
wxdebug=0
wxpython=0
make_args=''
other_args=''
for flag in $*; do
case $flag in
bake) do_bake=1 ;;
prep) do_prep=1 ;;
build) do_build=1 ;;
all) do_extras=1; do_bake=1; do_prep=1; do_build=1 ;;
clean) other_args=clean; do_clean=1 ;;
wxgc) use_wxgc=1 ;;
wxdebug) wxdebug=1 ;;
wxpython) wxpython=1 ;;
wxpython-install) wxpython_install=1 ;;
*) export $flag ;; #other_args='$other_args "$flag"' ;;
esac
done
#----------------------------------------------------------------------
# if no arguments were passed, do a full build.
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
function do_make {
dir=$1
cxxflags=$2
olddir=$PWD
shift
shift
if [ $OSTYPE == cygwin ]; then
cd $dir
nmake -f makefile.vc CXXFLAGS="$cxxflags" $@
cd $olddir
else
make -C $dir -f GNUmakefile $MAKE_ARGS CXXFLAGS="$cxxflags" $@
fi
if [ $? != 0 ]; then
exit $?
fi
}
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
mkdir -p $WEBKITOUTPUTDIR/build
if [ $do_bake == 1 ]; then
# bakefile stuff
cd $WK_ROOT/WebKit/wx
bakefile_gen
# we need to do this because Bakefile doesn't know which
# platform it's running on with GNU format, and so it defaults
# to the standard Unix file endings and linker args.
if [ "${OSTYPE:0:6}" = "darwin" ]; then
sed "s/libwebcore-wx.so/libwebcore-wx.dylib/" < $WK_ROOT/WebCore/GNUmakefile > temp
mv temp $WK_ROOT/WebCore/GNUmakefile
sed "s/\-shared/\-dynamiclib/" < $WK_ROOT/WebCore/GNUmakefile > temp
mv temp $WK_ROOT/WebCore/GNUmakefile
sed "s/libwxwebkit.so/libwxwebkit.dylib/" < $WK_ROOT/WebKit/wx/GNUmakefile > temp
mv temp $WK_ROOT/WebKit/wx/GNUmakefile
sed "s/\-shared/\-dynamiclib/" < $WK_ROOT/WebKit/wx/GNUmakefile > temp
mv temp $WK_ROOT/WebKit/wx/GNUmakefile
fi
fi
if [ $do_prep == 1 ]; then
# Other preparation steps
# since the buildbot will wipe the build tree clean sometimes, we need to reinstall
# the dependencies if they aren't installed.
if [ "${OSTYPE:0:6}" == "darwin" ]; then
$WK_ROOT/WebKitTools/wx/install-unix-extras
fi
cd $WK_ROOT/JavaScriptCore
./make-generated-sources.sh
if [ $? != 0 ]; then
exit $?
fi
cd $WK_ROOT/WebCore
./make-generated-sources.sh platform/wx/wx-encodings.txt
if [ $? != 0 ]; then
exit $?
fi
fi
fi
if [ $do_build == 1 -o $do_clean == 1 ]; then
# Build steps
WXGC_DEFINE=""
if [ $use_wxgc == 1 ]; then
WXGC_DEFINE="-DWTF_USE_WXGC=1"
fi
WX_EXT=
if [ "${OSTYPE:0:6}" == "cygwin" -a $wxdebug == 1 ]; then
WX_EXT=d
fi
if [ "${OSTYPE:0:6}" == "cygwin" -a $wxpython == 1 ]; then
other_args=WX_PYTHON=1
WX_EXT=h
wxdebug=1
fi
PLATFORM_OS="win"
if [ "${OSTYPE:0:6}" == "darwin" ]; then
PLATFORM_OS="mac"
else
PLATFORM_OS="linux"
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
fi
if [ $do_build == 1 ]; then
if [ "${OSTYPE:0:6}" = "darwin" ]; then
cd $WEBKITOUTPUTDIR
mkdir -p wxBrowser.app/Contents/MacOS
mkdir -p wxBrowser.app/Contents/Frameworks
cp wxBrowser wxBrowser.app/Contents/MacOS
install_name_tool -change libwxwebkit.dylib @executable_path/../Frameworks/libwxwebkit.dylib wxBrowser.app/Contents/MacOS/wxBrowser
if [ ! -f "$WEBKITOUTPUTDIR/libwxwebkit.dylib" ]; then
ln -s $WEBKITOUTPUTDIR/libwxwebkit.dylib wxBrowser.app/Contents/Frameworks
fi
fi
if [ $wxpython == 1 ]; then
SWIG=`which swig`
if [ ! -f "$SWIG" ]; then
echo "ERROR: Cannot find SWIG. Make sure that SWIG 1.3.29 is located on your path.";
exit 1;
fi
cd $WK_ROOT/WebKit/wx/bindings/python
SWIG_FLAGS=`python -c "import wx.build.config; import string; print string.join(wx.build.config.swig_args, ' ')"`
WEBKIT_INCLUDE="-I$WK_ROOT/WebKit/wx"
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])"`
PY_LIBDIR=`python -c "import distutils.sysconfig; import sys; sys.stdout.write(distutils.sysconfig.PREFIX)"`
if [ "${OSTYPE:0:6}" == "cygwin" ]; then
PY_LIBDIR="$PY_LIBDIR\\Libs"
else
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
if [ "${OSTYPE:0:6}" == "cygwin" ]; then
if [ -f $WEBKITOUTPUTDIR/_webview.pyd -a -f $WEBKITOUTPUTDIR/_webview.dll ]; then
rm $WEBKITOUTPUTDIR/_webview.pyd
mv $WEBKITOUTPUTDIR/_webview.dll $WEBKITOUTPUTDIR/_webview.pyd
fi
fi
fi
if [ "$OSTYPE" == "cygwin" ]; then
echo "Copying necessary DLLs to run test and sample applications..."
cd $WK_ROOT
cp $WINDEPS $WEBKITOUTPUTDIR
fi
BROWSERAPP="wxBrowser"
if [ "${OSTYPE:0:6}" == "darwin" ]; then
BROWSERAPP="wxBrowser.app/Contents/MacOS/wxBrowser"
fi
echo ""
echo ""
echo "--- BUILD COMPLETE ---"
echo ""
echo "Next steps:"
echo ""
echo "-- Run '$WK_ROOT/WebKitTools/Scripts/run-javascriptcore-tests --wx' to ensure JSCore tests pass."
echo ""
echo "-- Run $WEBKITOUTPUTDIR/$BROWSERAPP to test your wxWebKit build."
echo ""
echo ""
fi
fi
if [ $do_clean == 1 ]; then
cd $WK_ROOT/WebKit/wx
bakefile_gen --clean
fi
cd $olddir
|