util/webkit/mkdist-webkit
changeset 0 1918ee327afb
child 3 41300fa6a67c
equal deleted inserted replaced
-1:000000000000 0:1918ee327afb
       
     1 #!/bin/bash
       
     2 
       
     3 die() {
       
     4     echo $*
       
     5     exit 1
       
     6 }
       
     7 
       
     8 default_tag="qtwebkit-4.6-snapshot-22102009"
       
     9 
       
    10 if [ $# -eq 0 ]; then
       
    11     tag="$default_tag"
       
    12 elif [ $# -eq 1 ]; then
       
    13     tag=$1
       
    14 else
       
    15     die "usage: $0 [commit (defaults to $default_tag)]"
       
    16 fi
       
    17 
       
    18 repository=`git config qtwebkit.url`
       
    19 if [ -z "$repository" ]; then
       
    20     die "error: cannot locate webkit git repository. please run git config --global qtwebkit.url /path-or-url/to/webkit/repo"
       
    21 fi
       
    22 
       
    23 excluded_directories="LayoutTests JavaScriptGlue WebKitLibraries WebKitSite WebKitTools WebCore/platform/cf WebCore/platform/gtk WebCore/platform/chromium"
       
    24 excluded_directories="$excluded_directories PageLoadTests"
       
    25 excluded_directories="$excluded_directories BugsSite"
       
    26 excluded_directories="$excluded_directories PlanetWebKit"
       
    27 excluded_directories="$excluded_directories SunSpider"
       
    28 excluded_directories="$excluded_directories WebKitExamplePlugins"
       
    29 
       
    30 excluded_directories="$excluded_directories autotools"
       
    31 excluded_directories="$excluded_directories JavaScriptCore/Makefile"
       
    32 excluded_directories="$excluded_directories Makefile"
       
    33 excluded_directories="$excluded_directories Makefile.shared"
       
    34 excluded_directories="$excluded_directories GNUmakefile.am"
       
    35 excluded_directories="$excluded_directories WebCore/Makefile"
       
    36 excluded_directories="$excluded_directories WebKit/Makefile"
       
    37 
       
    38 excluded_directories="$excluded_directories JavaScriptCore/GNUmakefile.am"
       
    39 excluded_directories="$excluded_directories JavaScriptCore/Configurations"
       
    40 excluded_directories="$excluded_directories JavaScriptCore/JavaScriptCore.exp"
       
    41 excluded_directories="$excluded_directories JavaScriptCore/JavaScriptCore.xcodeproj"
       
    42 excluded_directories="$excluded_directories JavaScriptCore/tests"
       
    43 excluded_directories="$excluded_directories JavaScriptCore/API/tests"
       
    44 excluded_directories="$excluded_directories JavaScriptCore/JavaScriptCore.vcproj"
       
    45 excluded_directories="$excluded_directories JavaScriptCore/JavaScriptCore.gyp"
       
    46 excluded_directories="$excluded_directories JavaScriptCore/wtf/wx"
       
    47 excluded_directories="$excluded_directories JavaScriptCore/wtf/gtk"
       
    48 excluded_directories="$excluded_directories JavaScriptCore/wtf/mac"
       
    49 excluded_directories="$excluded_directories JavaScriptCore/wtf/win"
       
    50 excluded_directories="$excluded_directories JavaScriptCore/wtf/chromium"
       
    51 excluded_directories="$excluded_directories JavaScriptCore/wtf/haiku"
       
    52 
       
    53 excluded_directories="$excluded_directories WebCore/WebCore.vcproj"
       
    54 excluded_directories="$excluded_directories WebCore/WebCore.gyp"
       
    55 excluded_directories="$excluded_directories WebCore/DerivedSources.make"
       
    56 excluded_directories="$excluded_directories WebCore/GNUmakefile.am"
       
    57 excluded_directories="$excluded_directories WebCore/WebCore.base.exp"
       
    58 excluded_directories="$excluded_directories WebCore/WebCore.PluginHostProcess.exp"
       
    59 excluded_directories="$excluded_directories WebCore/WebCore.OrientationEvents.exp"
       
    60 excluded_directories="$excluded_directories WebCore/WebCore.xcodeproj"
       
    61 excluded_directories="$excluded_directories WebCore/Configurations"
       
    62 
       
    63 excluded_directories="$excluded_directories WebCore/bridge/objc"
       
    64 excluded_directories="$excluded_directories WebCore/bridge/testbindings.pro"
       
    65 excluded_directories="$excluded_directories WebCore/bindings/objc"
       
    66 excluded_directories="$excluded_directories WebCore/bindings/v8"
       
    67 
       
    68 excluded_directories="$excluded_directories JavaScriptCore/icu"
       
    69 
       
    70 excluded_directories="$excluded_directories WebCore/icu"
       
    71 # remove CollatorICU from SOURCES in JavaScriptCore.pri first
       
    72 #excluded_directories="$excluded_directories JavaScriptCore/wtf/unicode/icu"
       
    73 
       
    74 excluded_directories="$excluded_directories WebCore/loader/mac"
       
    75 excluded_directories="$excluded_directories WebCore/loader/win"
       
    76 excluded_directories="$excluded_directories WebCore/loader/icon/wince"
       
    77 
       
    78 excluded_directories="$excluded_directories WebCore/page/gtk"
       
    79 excluded_directories="$excluded_directories WebCore/page/mac"
       
    80 excluded_directories="$excluded_directories WebCore/page/wx"
       
    81 excluded_directories="$excluded_directories WebCore/page/chromium"
       
    82 excluded_directories="$excluded_directories WebCore/page/haiku"
       
    83 excluded_directories="$excluded_directories WebCore/page/wince"
       
    84 
       
    85 excluded_directories="$excluded_directories WebCore/history/mac"
       
    86 
       
    87 excluded_directories="$excluded_directories WebCore/editing/mac"
       
    88 excluded_directories="$excluded_directories WebCore/editing/wx"
       
    89 excluded_directories="$excluded_directories WebCore/editing/haiku"
       
    90 
       
    91 excluded_directories="$excluded_directories WebCore/platform/haiku"
       
    92 
       
    93 excluded_directories="$excluded_directories WebCore/platform/text/wx"
       
    94 excluded_directories="$excluded_directories WebCore/platform/text/gtk"
       
    95 excluded_directories="$excluded_directories WebCore/platform/text/chromium"
       
    96 excluded_directories="$excluded_directories WebCore/platform/text/haiku"
       
    97 
       
    98 excluded_directories="$excluded_directories WebCore/platform/sql/chromium"
       
    99 
       
   100 excluded_directories="$excluded_directories WebCore/manual-tests"
       
   101 
       
   102 excluded_directories="$excluded_directories WebCore/platform/network/cf"
       
   103 excluded_directories="$excluded_directories WebCore/platform/network/curl"
       
   104 excluded_directories="$excluded_directories WebCore/platform/network/mac"
       
   105 excluded_directories="$excluded_directories WebCore/platform/network/win"
       
   106 excluded_directories="$excluded_directories WebCore/platform/network/soup"
       
   107 excluded_directories="$excluded_directories WebCore/platform/network/chromium"
       
   108 
       
   109 excluded_directories="$excluded_directories WebCore/platform/graphics/cg"
       
   110 excluded_directories="$excluded_directories WebCore/platform/graphics/cairo"
       
   111 excluded_directories="$excluded_directories WebCore/platform/graphics/gtk"
       
   112 excluded_directories="$excluded_directories WebCore/platform/graphics/wx"
       
   113 excluded_directories="$excluded_directories WebCore/platform/graphics/mac"
       
   114 excluded_directories="$excluded_directories WebCore/platform/graphics/win"
       
   115 excluded_directories="$excluded_directories WebCore/platform/graphics/skia"
       
   116 excluded_directories="$excluded_directories WebCore/platform/graphics/chromium"
       
   117 excluded_directories="$excluded_directories WebCore/platform/graphics/wince"
       
   118 excluded_directories="$excluded_directories WebCore/platform/graphics/haiku"
       
   119 
       
   120 excluded_directories="$excluded_directories WebCore/platform/image-decoders/bmp"
       
   121 excluded_directories="$excluded_directories WebCore/platform/image-decoders/gif"
       
   122 excluded_directories="$excluded_directories WebCore/platform/image-decoders/zlib"
       
   123 excluded_directories="$excluded_directories WebCore/platform/image-decoders/png"
       
   124 excluded_directories="$excluded_directories WebCore/platform/image-decoders/ico"
       
   125 excluded_directories="$excluded_directories WebCore/platform/image-decoders/jpeg"
       
   126 excluded_directories="$excluded_directories WebCore/platform/image-decoders/xbm"
       
   127 excluded_directories="$excluded_directories WebCore/platform/image-decoders/skia"
       
   128 excluded_directories="$excluded_directories WebCore/platform/image-decoders/haiku"
       
   129 
       
   130 excluded_directories="$excluded_directories WebCore/platform/image-encoders/skia"
       
   131 
       
   132 excluded_directories="$excluded_directories WebCore/plugins/gtk"
       
   133 excluded_directories="$excluded_directories WebCore/plugins/chromium"
       
   134 
       
   135 excluded_directories="$excluded_directories WebCore/accessibility/chromium"
       
   136 excluded_directories="$excluded_directories WebCore/accessibility/gtk"
       
   137 excluded_directories="$excluded_directories WebCore/accessibility/mac"
       
   138 excluded_directories="$excluded_directories WebCore/accessibility/win"
       
   139 excluded_directories="$excluded_directories WebCore/accessibility/wx"
       
   140 
       
   141 excluded_directories="$excluded_directories WebCore/storage/wince"
       
   142 
       
   143 excluded_directories="$excluded_directories WebCore/platform/wx"
       
   144 excluded_directories="$excluded_directories WebCore/platform/wince"
       
   145 
       
   146 excluded_directories="$excluded_directories WebKit/qt/Plugins"
       
   147 
       
   148 excluded_directories="$excluded_directories WebKit/gtk"
       
   149 excluded_directories="$excluded_directories WebKit/win"
       
   150 excluded_directories="$excluded_directories WebKit/wx"
       
   151 excluded_directories="$excluded_directories WebKit/cf"
       
   152 excluded_directories="$excluded_directories WebKit/haiku"
       
   153 excluded_directories="$excluded_directories WebKit/chromium"
       
   154 
       
   155 excluded_directories="$excluded_directories WebKit/English.lproj WebKit/WebKit.xcodeproj"
       
   156 excluded_directories="$excluded_directories WebCore/English.lproj"
       
   157 
       
   158 exclude_with_exceptions_list="WebCore/platform/win/:WebCore/platform/win/SystemTimeWin.cpp"
       
   159 
       
   160 excluded_directories="$excluded_directories WebKit/mac/Carbon"
       
   161 excluded_directories="$excluded_directories WebKit/mac/ChangeLog"
       
   162 excluded_directories="$excluded_directories WebKit/mac/ChangeLog-2002-12-03"
       
   163 excluded_directories="$excluded_directories WebKit/mac/ChangeLog-2006-02-09"
       
   164 excluded_directories="$excluded_directories WebKit/mac/ChangeLog-2007-10-14"
       
   165 excluded_directories="$excluded_directories WebKit/mac/DefaultDelegates"
       
   166 excluded_directories="$excluded_directories WebKit/mac/DOM"
       
   167 excluded_directories="$excluded_directories WebKit/mac/ForwardingHeaders"
       
   168 excluded_directories="$excluded_directories WebKit/mac/History"
       
   169 excluded_directories="$excluded_directories WebKit/mac/icu"
       
   170 excluded_directories="$excluded_directories WebKit/mac/Info.plist"
       
   171 excluded_directories="$excluded_directories WebKit/mac/MigrateHeaders.make"
       
   172 excluded_directories="$excluded_directories WebKit/mac/Misc"
       
   173 excluded_directories="$excluded_directories WebKit/mac/Panels"
       
   174 excluded_directories="$excluded_directories WebKit/mac/Plugins"
       
   175 excluded_directories="$excluded_directories WebKit/mac/PublicHeaderChangesFromTiger.txt"
       
   176 excluded_directories="$excluded_directories WebKit/mac/Resources"
       
   177 excluded_directories="$excluded_directories WebKit/mac/Storage"
       
   178 excluded_directories="$excluded_directories WebKit/mac/WebCoreSupport"
       
   179 excluded_directories="$excluded_directories WebKit/mac/WebInspector"
       
   180 excluded_directories="$excluded_directories WebKit/mac/WebKit.exp"
       
   181 excluded_directories="$excluded_directories WebKit/mac/WebKit.order"
       
   182 excluded_directories="$excluded_directories WebKit/mac/WebKitPrefix.h"
       
   183 excluded_directories="$excluded_directories WebKit/mac/WebView"
       
   184 
       
   185 exclude_with_exceptions_list="$exclude_with_exceptions_list WebKit/mac/Configurations/:WebKit/mac/Configurations/Version.xcconfig"
       
   186 
       
   187 files_to_remove=""
       
   188 files_to_remove="$files_to_remove WebKit/qt/Api/qwebnetworkinterface.cpp"
       
   189 files_to_remove="$files_to_remove WebKit/qt/Api/qwebnetworkinterface.h"
       
   190 files_to_remove="$files_to_remove WebKit/qt/Api/qwebnetworkinterface_p.h"
       
   191 files_to_remove="$files_to_remove WebKit/qt/Api/qcookiejar.h"
       
   192 files_to_remove="$files_to_remove WebKit/qt/Api/qcookiejar.cpp"
       
   193 
       
   194 files_to_remove="$files_to_remove WebCore/rendering/RenderThemeMac.mm"
       
   195 files_to_remove="$files_to_remove autogen.sh"
       
   196 files_to_remove="$files_to_remove configure.ac"
       
   197 
       
   198 files_to_remove="$files_to_remove WebKit.pro"
       
   199 
       
   200 files_to_remove="$files_to_remove WebKit/qt/QtLauncher/QtLauncher.pro"
       
   201 files_to_remove="$files_to_remove WebKit/qt/QtLauncher/main.cpp"
       
   202 
       
   203 files_to_remove="$files_to_remove WebKit/qt/QGVLauncher/QGVLauncher.pro"
       
   204 files_to_remove="$files_to_remove WebKit/qt/QGVLauncher/main.cpp"
       
   205 
       
   206 files_to_remove="$files_to_remove JavaScriptCore/AllInOneFile.cpp"
       
   207 files_to_remove="$files_to_remove JavaScriptCore/JavaScriptCoreSources.bkl"
       
   208 files_to_remove="$files_to_remove JavaScriptCore/jscore.bkl"
       
   209 files_to_remove="$files_to_remove JavaScriptCore/jsc.pro"
       
   210 
       
   211 files_to_remove="$files_to_remove WebCore/wscript"
       
   212 files_to_remove="$files_to_remove WebCore/WebCore.ContextMenus.exp"
       
   213 files_to_remove="$files_to_remove WebCore/WebCore.DragSupport.exp"
       
   214 files_to_remove="$files_to_remove WebCore/WebCore.Inspector.exp"
       
   215 files_to_remove="$files_to_remove WebCore/WebCoreSources.bkl"
       
   216 files_to_remove="$files_to_remove WebCore/webcore-base.bkl"
       
   217 files_to_remove="$files_to_remove WebCore/webcore-wx.bkl"
       
   218 
       
   219 require_clean_work_tree() {
       
   220     # test if working tree is dirty
       
   221     git rev-parse --verify HEAD > /dev/null &&
       
   222     git update-index --refresh &&
       
   223     git diff-files --quiet &&
       
   224     git diff-index --cached --quiet HEAD ||
       
   225     die "Working tree is dirty"
       
   226 }
       
   227 
       
   228 which qmake >/dev/null 2>/dev/null
       
   229 if [ "$?" != 0 ]; then
       
   230     die "abort: Could not locate qmake in your PATH"
       
   231 fi
       
   232 
       
   233 test -z "$(git rev-parse --show-cdup)" || {
       
   234        exit=$?
       
   235        echo >&2 "You need to run this command from the toplevel of the working tree."
       
   236        exit $exit
       
   237 }
       
   238 
       
   239 echo "checking working tree"
       
   240 require_clean_work_tree
       
   241 
       
   242 revCount=`git ls-remote $repository | grep $tag | awk '{print $1}' | wc -l`
       
   243 if [ "$revCount" != 1 ]; then
       
   244     die "Cannot parse $tag into a revision. It seems ambiguous".
       
   245 fi
       
   246 
       
   247 rev=`git ls-remote $repository | grep -E "^.+$tag$" | awk '{print $1}'`
       
   248 
       
   249 tarball=`mktemp /tmp/webkit-snapshot.tar.XXXXXX` || exit 1
       
   250 echo "creating $tarball"
       
   251 
       
   252 echo "archiving webkit from $repository $tag ( $rev )"
       
   253 
       
   254 git archive --remote=$repository $rev > $tarball || exit 1
       
   255 
       
   256 echo "removing unwanted files and directories"
       
   257 for dir in $excluded_directories; do
       
   258     echo "    removing $dir"
       
   259     tar --delete --file=$tarball $dir
       
   260 done
       
   261 
       
   262 for item in $exclude_with_exceptions_list; do
       
   263     dir=`echo $item | awk -F : '{print $1}'`
       
   264     include=`echo $item | awk -F : '{print $2}'`
       
   265     echo "    removing $dir except $include"
       
   266     files=`tar --list --file=$tarball $dir | grep -v -E "^$dir\$" | grep -v $include`
       
   267     tar --delete --file=$tarball $files
       
   268 done
       
   269 
       
   270 for file in $files_to_remove; do
       
   271     echo "    removing $file"
       
   272     tar --delete --file=$tarball $file
       
   273 done
       
   274 
       
   275 echo "done!"
       
   276 
       
   277 srcdir=src/3rdparty/webkit
       
   278 absSrcDir=$PWD/$srcdir
       
   279 localDiff=
       
   280 lastImportRevison=
       
   281 
       
   282 echo "replacing $srcdir"
       
   283 if [  -d $srcdir ]; then
       
   284     lastImportRevison=`tail -n 1 src/3rdparty/webkit/VERSION`
       
   285     git ls-files $srcdir | xargs rm
       
   286     git ls-files -z src/3rdparty/webkit | git update-index --force-remove -z --stdin
       
   287     lastImport=`git rev-list --max-count=1 HEAD -- src/3rdparty/webkit/VERSION`
       
   288     changes=`git rev-list --no-merges --reverse $lastImport.. -- src/3rdparty/webkit`
       
   289     localDiff=/tmp/webkit_patch
       
   290     echo -n>$localDiff
       
   291     for change in $changes; do
       
   292         echo "Saving commit $change"
       
   293         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
       
   294         echo "-- " >> $localDiff
       
   295         echo "1.2.3" >> $localDiff
       
   296         echo >> $localDiff
       
   297     done
       
   298     if [ -s $localDiff ]; then
       
   299         echo "Saved locally applied patches to $localDiff"
       
   300     else
       
   301         localDiff=""
       
   302     fi
       
   303 else
       
   304     mkdir -p $srcdir
       
   305 fi
       
   306 
       
   307 (cd $srcdir && tar xf $tarball)
       
   308 git add $srcdir
       
   309 
       
   310 echo "generating extra sources"
       
   311 (
       
   312   for proj in JavaScriptCore WebCore; do
       
   313       cd $absSrcDir/$proj &&
       
   314       rm -rf tmp &&
       
   315       mkdir tmp &&
       
   316       cd tmp &&
       
   317       mkdir -p ../generated &&
       
   318       qmake -o Makefile CONFIG-=QTDIR_build QT_CONFIG+=phonon GENERATED_SOURCES_DIR=`pwd`/../generated  OUTPUT_DIR=`pwd` ../$proj.pro &&
       
   319       make generated_files &&
       
   320       perl -pi -e "s,$absSrcDir/,,g" ../generated/*.cpp ../generated/*.h &&
       
   321       git add ../generated &&
       
   322       cd .. &&
       
   323       rm -rf tmp &&
       
   324       cd ..
       
   325   done
       
   326 )
       
   327 rm -rf $srcdir/WebKitBuild
       
   328 
       
   329 cat >$srcdir/VERSION <<EOT
       
   330 This is a snapshot of the Qt port of WebKit from
       
   331 
       
   332         git://gitorious.org/qtwebkit/qtwebkit.git
       
   333 
       
   334 The commit imported was from the
       
   335 
       
   336         $tag branch/tag
       
   337 
       
   338 and has the sha1 checksum
       
   339 
       
   340         $rev
       
   341 EOT
       
   342 git add $srcdir/VERSION
       
   343 
       
   344 git diff-files --name-only -z | git update-index --remove -z --stdin
       
   345 
       
   346 echo "removing $tarball"
       
   347 rm -f $tarball
       
   348 
       
   349 cat >commitlog.txt <<EOT
       
   350 Updated WebKit from $repository to $tag ( $rev )
       
   351 EOT
       
   352 
       
   353 if [ -d "$repository/.git" -a -n "$lastImportRevison" ]; then
       
   354     echo >>commitlog.txt
       
   355     echo "Changes in WebKit/qt since the last update:" >>commitlog.txt
       
   356     echo >>commitlog.txt
       
   357     git --git-dir=$repository/.git diff $lastImportRevison $rev -- WebKit/qt/ChangeLog | sed -n -e "s,^\+\(.*\),\1,p" >>commitlog.txt
       
   358 fi
       
   359 
       
   360 echo "Changes:"
       
   361 echo
       
   362 git --no-pager diff --name-status --cached $srcdir
       
   363 
       
   364 echo
       
   365 echo "Wrote commitlog.txt. Use with"
       
   366 echo
       
   367 echo "    git commit -e -F commitlog.txt"
       
   368 echo
       
   369 echo "to commit your changes"
       
   370 
       
   371 if [ -n "$localDiff" ]; then
       
   372     echo
       
   373     echo "The changes that were locally stored in Perforce are now stored as a git patch in $localDiff"
       
   374     echo "You may want to appy them with"
       
   375     echo
       
   376     echo "    git am -3 $localDiff"
       
   377     echo
       
   378 fi