summaryrefslogtreecommitdiffstats
path: root/util/webkit/mkdist-webkit
blob: cfbde0067c56e328339896bf42789f7709273695 (plain)
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
#!/bin/bash

repository="git://git.dev.troll.no/webkit-mirror"
tag="qtwebkit-merged-into-qt-4-4"

excluded_directories="LayoutTests JavaScriptGlue WebKitLibraries WebKitSite WebKitTools WebCore/platform/cf WebCore/platform/gtk WebCore/platform/chromium"
excluded_directories="$excluded_directories PageLoadTests"
excluded_directories="$excluded_directories BugsSite"
excluded_directories="$excluded_directories PlanetWebKit"
excluded_directories="$excluded_directories SunSpider"
excluded_directories="$excluded_directories WebKitExamplePlugins"

excluded_directories="$excluded_directories autotools"
excluded_directories="$excluded_directories JavaScriptCore/Makefile"
excluded_directories="$excluded_directories Makefile"
excluded_directories="$excluded_directories Makefile.shared"
excluded_directories="$excluded_directories GNUmakefile.am"
excluded_directories="$excluded_directories WebCore/Makefile"
excluded_directories="$excluded_directories WebKit/Makefile"

excluded_directories="$excluded_directories JavaScriptCore/GNUmakefile.am"
excluded_directories="$excluded_directories JavaScriptCore/Configurations"
excluded_directories="$excluded_directories JavaScriptCore/JavaScriptCore.exp"
excluded_directories="$excluded_directories JavaScriptCore/JavaScriptCore.xcodeproj"
excluded_directories="$excluded_directories JavaScriptCore/tests"
excluded_directories="$excluded_directories JavaScriptCore/API/tests"
excluded_directories="$excluded_directories JavaScriptCore/JavaScriptCore.vcproj"
excluded_directories="$excluded_directories JavaScriptCore/wtf/wx"
excluded_directories="$excluded_directories JavaScriptCore/wtf/gtk"
excluded_directories="$excluded_directories JavaScriptCore/wtf/mac"
excluded_directories="$excluded_directories JavaScriptCore/wtf/win"

excluded_directories="$excluded_directories WebCore/WebCore.vcproj"
excluded_directories="$excluded_directories WebCore/DerivedSources.make"
excluded_directories="$excluded_directories WebCore/GNUmakefile.am"
excluded_directories="$excluded_directories WebCore/WebCore.base.exp"
excluded_directories="$excluded_directories WebCore/WebCore.xcodeproj"
excluded_directories="$excluded_directories WebCore/Configurations"

excluded_directories="$excluded_directories WebCore/bridge/objc"
excluded_directories="$excluded_directories WebCore/bridge/testbindings.pro"
excluded_directories="$excluded_directories WebCore/bindings/objc"

excluded_directories="$excluded_directories JavaScriptCore/icu"

excluded_directories="$excluded_directories WebCore/icu"
# remove CollatorICU from SOURCES in JavaScriptCore.pri first
#excluded_directories="$excluded_directories JavaScriptCore/wtf/unicode/icu"

excluded_directories="$excluded_directories WebCore/loader/mac"
excluded_directories="$excluded_directories WebCore/loader/win"

excluded_directories="$excluded_directories WebCore/page/gtk"
excluded_directories="$excluded_directories WebCore/page/mac"
excluded_directories="$excluded_directories WebCore/page/wx"

excluded_directories="$excluded_directories WebCore/history/mac"

excluded_directories="$excluded_directories WebCore/editing/mac"
excluded_directories="$excluded_directories WebCore/editing/wx"

excluded_directories="$excluded_directories WebCore/platform/text/wx"
excluded_directories="$excluded_directories WebCore/platform/text/gtk"


excluded_directories="$excluded_directories WebCore/manual-tests"

excluded_directories="$excluded_directories WebCore/platform/network/cf"
excluded_directories="$excluded_directories WebCore/platform/network/curl"
excluded_directories="$excluded_directories WebCore/platform/network/mac"
excluded_directories="$excluded_directories WebCore/platform/network/win"
excluded_directories="$excluded_directories WebCore/platform/network/soup"

excluded_directories="$excluded_directories WebCore/platform/graphics/cg"
excluded_directories="$excluded_directories WebCore/platform/graphics/cairo"
excluded_directories="$excluded_directories WebCore/platform/graphics/gtk"
excluded_directories="$excluded_directories WebCore/platform/graphics/wx"
excluded_directories="$excluded_directories WebCore/platform/graphics/mac"
excluded_directories="$excluded_directories WebCore/platform/graphics/win"
excluded_directories="$excluded_directories WebCore/platform/graphics/skia"

excluded_directories="$excluded_directories WebCore/platform/image-decoders/bmp"
excluded_directories="$excluded_directories WebCore/platform/image-decoders/gif"
excluded_directories="$excluded_directories WebCore/platform/image-decoders/zlib"
excluded_directories="$excluded_directories WebCore/platform/image-decoders/png"
excluded_directories="$excluded_directories WebCore/platform/image-decoders/ico"
excluded_directories="$excluded_directories WebCore/platform/image-decoders/jpeg"
excluded_directories="$excluded_directories WebCore/platform/image-decoders/xbm"

excluded_directories="$excluded_directories WebCore/plugins/wx"
excluded_directories="$excluded_directories WebCore/plugins/gtk"

excluded_directories="$excluded_directories WebCore/platform/symbian WebCore/platform/wx"
excluded_directories="$excluded_directories WebKit/gtk"
excluded_directories="$excluded_directories WebKit/win"
excluded_directories="$excluded_directories WebKit/mac"
excluded_directories="$excluded_directories WebKit/wx"
excluded_directories="$excluded_directories WebKit/cf"

excluded_directories="$excluded_directories WebCore/svg/graphics/cg"
excluded_directories="$excluded_directories WebCore/svg/graphics/cairo"
excluded_directories="$excluded_directories WebCore/svg/graphics/filters/cg"
excluded_directories="$excluded_directories WebCore/svg/graphics/mac"

excluded_directories="$excluded_directories WebKit/English.lproj WebKit/WebKit.xcodeproj"
excluded_directories="$excluded_directories WebCore/English.lproj"

exclude_with_exceptions_list="WebCore/platform/win/:WebCore/platform/win/SystemTimeWin.cpp"

files_to_remove=""
files_to_remove="$files_to_remove WebKit/qt/Api/qwebnetworkinterface.cpp"
files_to_remove="$files_to_remove WebKit/qt/Api/qwebnetworkinterface.h"
files_to_remove="$files_to_remove WebKit/qt/Api/qwebnetworkinterface_p.h"
files_to_remove="$files_to_remove WebKit/qt/Api/qcookiejar.h"
files_to_remove="$files_to_remove WebKit/qt/Api/qcookiejar.cpp"

files_to_remove="$files_to_remove WebCore/rendering/RenderThemeMac.mm"
files_to_remove="$files_to_remove acinclude.m4"
files_to_remove="$files_to_remove autogen.sh"
files_to_remove="$files_to_remove configure.ac"

files_to_remove="$files_to_remove WebKit.pro"

files_to_remove="$files_to_remove JavaScriptCore/jsc.pro"

files_to_remove="$files_to_remove WebKit/qt/QtLauncher/QtLauncher.pro"
files_to_remove="$files_to_remove WebKit/qt/QtLauncher/main.cpp"

files_to_remove="$files_to_remove JavaScriptCore/AllInOneFile.cpp"
files_to_remove="$files_to_remove JavaScriptCore/JavaScriptCore.scons"
files_to_remove="$files_to_remove JavaScriptCore/JavaScriptCoreSources.bkl"
files_to_remove="$files_to_remove JavaScriptCore/SConstruct"
files_to_remove="$files_to_remove JavaScriptCore/jscore.bkl"

files_to_remove="$files_to_remove WebCore/SConstruct"
files_to_remove="$files_to_remove WebCore/WebCore.scons"
files_to_remove="$files_to_remove WebCore/WebCoreSources.bkl"
files_to_remove="$files_to_remove WebCore/webcore-base.bkl"
files_to_remove="$files_to_remove WebCore/webcore-wx.bkl"

if [ $# -eq 1 ]; then
    tag=$1
fi

if [ $# -eq 2 ]; then
    repository=$1
    tag=$2
fi

die() {
    echo $*
    exit 1
}

require_clean_work_tree() {
    # test if working tree is dirty
    git rev-parse --verify HEAD > /dev/null &&
    git update-index --refresh &&
    git diff-files --quiet &&
    git diff-index --cached --quiet HEAD ||
    die "Working tree is dirty"
}

which qmake >/dev/null 2>/dev/null
if [ "$?" != 0 ]; then
    die "abort: Could not locate qmake in your PATH"
fi

test -z "$(git rev-parse --show-cdup)" || {
       exit=$?
       echo >&2 "You need to run this command from the toplevel of the working tree."
       exit $exit
}

echo "checking working tree"
require_clean_work_tree

revCount=`git ls-remote $repository | grep $tag | awk '{print $1}' | wc -l`
if [ "$revCount" != 1 ]; then
    die "Cannot parse $tag into a revision. It seems ambiguous".
fi

rev=`git ls-remote $repository | grep -E "^.+$tag$" | awk '{print $1}'`

tarball=`mktemp /tmp/webkit-snapshot.tar` || exit 1
echo "creating $tarball"

echo "archiving webkit from $repository $tag ( $rev )"

git archive --remote=$repository $rev > $tarball || exit 1

echo "removing unwanted files and directories"
for dir in $excluded_directories; do
    echo "    removing $dir"
    tar --delete --file=$tarball $dir
done

for item in $exclude_with_exceptions_list; do
    dir=`echo $item | awk -F : '{print $1}'`
    include=`echo $item | awk -F : '{print $2}'`
    echo "    removing $dir except $include"
    files=`tar --list --file=$tarball $dir | grep -v -E "^$dir\$" | grep -v $include`
    tar --delete --file=$tarball $files
done

for file in $files_to_remove; do
    echo "    removing $file"
    tar --delete --file=$tarball $file
done

echo "done!"

srcdir=src/3rdparty/webkit
absSrcDir=$PWD/$srcdir
localDiff=
lastImportRevison=

echo "replacing $srcdir"
if [  -d $srcdir ]; then
    lastImportRevison=`tail -n 1 src/3rdparty/webkit/VERSION`
    git ls-files $srcdir | xargs rm
    git ls-files -z src/3rdparty/webkit | git update-index --force-remove -z --stdin
    lastImport=`git rev-list --max-count=1 HEAD -- src/3rdparty/webkit/VERSION`
    changes=`git rev-list --no-merges --reverse $lastImport.. -- src/3rdparty/webkit`
    localDiff=/tmp/webkit_patch
    echo -n>$localDiff
    for change in $changes; do
        echo "Saving commit $change"
        git show -p --stat "--pretty=format:%nFrom %H Mon Sep 17 00:00:00 2001%nFrom: %an <%ae>%nDate: %ad%nSubject: Re-apply change $change by %an%n%n%s%n%b%n" $change -- src/3rdparty/webkit >> $localDiff
        echo "-- " >> $localDiff
        echo "1.2.3" >> $localDiff
        echo >> $localDiff
    done
    if [ -s $localDiff ]; then
        echo "Saved locally applied patches to $localDiff"
    else
        localDiff=""
    fi
else
    mkdir -p $srcdir
fi

(cd $srcdir && tar xf $tarball)
git add $srcdir

echo "generating extra sources"
(
  for proj in JavaScriptCore WebCore; do
      cd $absSrcDir/$proj &&
      rm -rf tmp &&
      mkdir tmp &&
      cd tmp &&
      mkdir -p ../generated &&
      qmake -o Makefile QT_CONFIG+=phonon GENERATED_SOURCES_DIR=`pwd`/../generated  OUTPUT_DIR=`pwd` ../$proj.pro &&
      make generated_files &&
      perl -pi -e "s,$absSrcDir/,,g" ../generated/*.cpp ../generated/*.h &&
      git add ../generated &&
      cd .. &&
      rm -rf tmp &&
      cd ..
  done
)
rm -rf $srcdir/WebKitBuild

cat >$srcdir/VERSION <<EOT
This is a snapshot of the Qt port of WebKit from

        git://code.staikos.net/webkit

The commit imported was from the

        $tag branch/tag

and has the sha1 checksum

        $rev
EOT
git add $srcdir/VERSION

git diff-files --name-only -z | git update-index --remove -z --stdin

echo "removing $tarball"
rm -f $tarball

cat >commitlog.txt <<EOT
Updated WebKit from $repository to $tag ( $rev )
EOT

if [ -d "$repository/.git" -a -n "$lastImportRevison" ]; then
    echo >>commitlog.txt
    echo "Changes in WebKit since the last update:" >>commitlog.txt
    echo >>commitlog.txt
    git --git-dir=$repository/.git ls-files | egrep "ChangeLog$" | xargs git --git-dir=$repository/.git diff $lastImportRevison $rev -- | sed -n -e "s,^\+\(.*\),\1,p" >>commitlog.txt
fi

echo "Changes:"
echo
git --no-pager diff --name-status --cached $srcdir

echo
echo "Wrote commitlog.txt. Use with"
echo
echo "    git commit -e -F commitlog.txt"
echo
echo "to commit your changes"

if [ -n "$localDiff" ]; then
    echo
    echo "The changes that were locally stored in Perforce are now stored as a git patch in $localDiff"
    echo "You may want to appy them with"
    echo
    echo "    git am -3 $localDiff"
    echo
fi