<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[168693] releases/WebKitGTK/webkit-2.4</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/168693">168693</a></dd>
<dt>Author</dt> <dd>gns@gnome.org</dd>
<dt>Date</dt> <dd>2014-05-13 12:25:33 -0700 (Tue, 13 May 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merge 163114 - [GTK] [CMake] Add a &quot;make dist&quot; target
https://bugs.webkit.org/show_bug.cgi?id=116378

Reviewed by Gustavo Noronha Silva.

.:

* Source/PlatformGTK.cmake: A CMake support for executing the make-dist
script and then turning the tarfile into a LZMA compressed file.

Source/WebCore:

* CMakeLists.txt: Don't build WebKitVersion.h for WebKitGTK+. We don't use it
and we don't want to distribute the dependency.

Tools:

Added a script that reads a manifest file an produces a tarball. Also add
the manifest.

* gtk/make-dist.py: Added.
* gtk/manifest.txt: Added.


Conflicts:
        ChangeLog
        Source/WebCore/ChangeLog
        Tools/ChangeLog</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#releasesWebKitGTKwebkit24SourcePlatformGTKcmake">releases/WebKitGTK/webkit-2.4/Source/PlatformGTK.cmake</a></li>
<li><a href="#releasesWebKitGTKwebkit24SourceWebCoreCMakeListstxt">releases/WebKitGTK/webkit-2.4/Source/WebCore/CMakeLists.txt</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#releasesWebKitGTKwebkit24Toolsgtkmakedistpy">releases/WebKitGTK/webkit-2.4/Tools/gtk/make-dist.py</a></li>
<li><a href="#releasesWebKitGTKwebkit24Toolsgtkmanifesttxt">releases/WebKitGTK/webkit-2.4/Tools/gtk/manifest.txt</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="releasesWebKitGTKwebkit24SourcePlatformGTKcmake"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.4/Source/PlatformGTK.cmake (168692 => 168693)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.4/Source/PlatformGTK.cmake        2014-05-13 19:25:09 UTC (rev 168692)
+++ releases/WebKitGTK/webkit-2.4/Source/PlatformGTK.cmake        2014-05-13 19:25:33 UTC (rev 168693)
</span><span class="lines">@@ -52,3 +52,29 @@
</span><span class="cx"> add_custom_target(check
</span><span class="cx">     COMMAND &quot;${TOOLS_DIR}/Scripts/run-gtk-tests&quot;
</span><span class="cx"> )
</span><ins>+
+if (ENABLE_WEBKIT AND ENABLE_WEBKIT2)
+    add_custom_command(
+        OUTPUT ${CMAKE_BINARY_DIR}/webkitgtk-${PROJECT_VERSION}.tar
+        DEPENDS ${TOOLS_DIR}/gtk/make-dist.py
+        DEPENDS ${TOOLS_DIR}/gtk/manifest.txt
+        DEPENDS WebKit
+        DEPENDS WebKit2
+        COMMAND ${TOOLS_DIR}/gtk/make-dist.py
+                --source-dir=${CMAKE_SOURCE_DIR}
+                --build-dir=${CMAKE_BINARY_DIR}
+                --tarball-root=/webkitgtk-${PROJECT_VERSION}
+                -o ${CMAKE_BINARY_DIR}/webkitgtk-${PROJECT_VERSION}.tar
+                ${TOOLS_DIR}/gtk/manifest.txt
+    )
+
+    add_custom_command(
+        OUTPUT ${CMAKE_BINARY_DIR}/webkitgtk-${PROJECT_VERSION}.tar.xz
+        DEPENDS ${CMAKE_BINARY_DIR}/webkitgtk-${PROJECT_VERSION}.tar
+        COMMAND xz -f ${CMAKE_BINARY_DIR}/webkitgtk-${PROJECT_VERSION}.tar
+    )
+
+    add_custom_target(dist
+        DEPENDS ${CMAKE_BINARY_DIR}/webkitgtk-${PROJECT_VERSION}.tar.xz
+    )
+endif ()
</ins></span></pre></div>
<a id="releasesWebKitGTKwebkit24SourceWebCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.4/Source/WebCore/CMakeLists.txt (168692 => 168693)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.4/Source/WebCore/CMakeLists.txt        2014-05-13 19:25:09 UTC (rev 168692)
+++ releases/WebKitGTK/webkit-2.4/Source/WebCore/CMakeLists.txt        2014-05-13 19:25:33 UTC (rev 168693)
</span><span class="lines">@@ -3232,13 +3232,15 @@
</span><span class="cx"> GENERATE_DOM_NAMES(XML ${WEBCORE_DIR}/xml/xmlattrs.in)
</span><span class="cx"> list(APPEND WebCore_SOURCES ${DERIVED_SOURCES_WEBCORE_DIR}/XMLNames.cpp)
</span><span class="cx"> 
</span><del>-add_custom_command(
-    OUTPUT ${DERIVED_SOURCES_WEBCORE_DIR}/WebKitVersion.h
-    MAIN_DEPENDENCY ${WEBKIT_DIR}/scripts/generate-webkitversion.pl
-    DEPENDS ${WEBKIT_DIR}/mac/Configurations/Version.xcconfig
-    COMMAND ${PERL_EXECUTABLE} ${WEBKIT_DIR}/scripts/generate-webkitversion.pl --config ${WEBKIT_DIR}/mac/Configurations/Version.xcconfig --outputDir ${DERIVED_SOURCES_WEBCORE_DIR}
-    VERBATIM)
-list(APPEND WebCore_SOURCES ${DERIVED_SOURCES_WEBCORE_DIR}/WebKitVersion.h)
</del><ins>+if (NOT PORT STREQUAL &quot;GTK&quot;)
+    add_custom_command(
+        OUTPUT ${DERIVED_SOURCES_WEBCORE_DIR}/WebKitVersion.h
+        MAIN_DEPENDENCY ${WEBKIT_DIR}/scripts/generate-webkitversion.pl
+        DEPENDS ${WEBKIT_DIR}/mac/Configurations/Version.xcconfig
+        COMMAND ${PERL_EXECUTABLE} ${WEBKIT_DIR}/scripts/generate-webkitversion.pl --config ${WEBKIT_DIR}/mac/Configurations/Version.xcconfig --outputDir ${DERIVED_SOURCES_WEBCORE_DIR}
+        VERBATIM)
+    list(APPEND WebCore_SOURCES ${DERIVED_SOURCES_WEBCORE_DIR}/WebKitVersion.h)
+endif ()
</ins><span class="cx"> 
</span><span class="cx"> WEBKIT_WRAP_SOURCELIST(${WebCore_IDL_FILES} ${WebCore_SOURCES})
</span><span class="cx"> WEBKIT_WRAP_SOURCELIST(${WebCoreTestSupport_IDL_FILES} ${WebCoreTestSupport_SOURCES})
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit24Toolsgtkmakedistpy"></a>
<div class="addfile"><h4>Added: releases/WebKitGTK/webkit-2.4/Tools/gtk/make-dist.py (0 => 168693)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.4/Tools/gtk/make-dist.py                                (rev 0)
+++ releases/WebKitGTK/webkit-2.4/Tools/gtk/make-dist.py        2014-05-13 19:25:33 UTC (rev 168693)
</span><span class="lines">@@ -0,0 +1,223 @@
</span><ins>+#!/usr/bin/env python
+# Copyright (C) 2014 Igalia S.L.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+
+from __future__ import print_function
+from contextlib import closing
+
+import argparse
+import os
+import re
+import sys
+import tarfile
+
+
+def enum(**enums):
+    return type('Enum', (), enums)
+
+
+class Rule(object):
+    Result = enum(INCLUDE=1, EXCLUDE=2, NO_MATCH=3)
+
+    def __init__(self, type, pattern):
+        self.type = type
+        self.original_pattern = pattern
+        self.pattern = re.compile(pattern)
+
+    def test(self, file):
+        if not(self.pattern.search(file)):
+            return Rule.Result.NO_MATCH
+        return self.type
+
+
+class Ruleset(object):
+    _global_rules = None
+
+    def __init__(self):
+        # By default, accept all files.
+        self.rules = [Rule(Rule.Result.INCLUDE, '.*')]
+
+    @classmethod
+    def global_rules(cls):
+        if not cls._global_rules:
+            cls._global_rules = Ruleset()
+        return cls._global_rules
+
+    @classmethod
+    def add_global_rule(cls, rule):
+        cls.global_rules().add_rule(rule)
+
+    def add_rule(self, rule):
+        self.rules.append(rule)
+
+    def passes(self, file):
+        allowed = False
+        for rule in self.rules:
+            result = rule.test(file)
+            if result == Rule.Result.NO_MATCH:
+                continue
+            allowed = Rule.Result.INCLUDE == result
+        return allowed
+
+
+class File(object):
+    def __init__(self, source_root, tarball_root):
+        self.source_root = source_root
+        self.tarball_root = tarball_root
+
+    def get_files(self):
+        yield (self.source_root, self.tarball_root)
+
+
+class Directory(object):
+    def __init__(self, source_root, tarball_root):
+        self.source_root = source_root
+        self.tarball_root = tarball_root
+        self.rules = Ruleset()
+
+    def add_rule(self, rule):
+        self.rules.add_rule(rule)
+
+    def get_tarball_path(self, filename):
+        return filename.replace(self.source_root, self.tarball_root, 1)
+
+    def get_files(self):
+        for root, dirs, files in os.walk(self.source_root):
+
+            def passes_all_rules(entry):
+                return Ruleset.global_rules().passes(entry) and self.rules.passes(entry)
+
+            to_keep = filter(passes_all_rules, dirs)
+            del dirs[:]
+            dirs.extend(to_keep)
+
+            for file in files:
+                file = os.path.join(root, file)
+                if not passes_all_rules(file):
+                    continue
+                yield (file, self.get_tarball_path(file))
+
+
+class Manifest(object):
+    def __init__(self, manifest_filename, source_root, build_root, tarball_root='/'):
+        self.current_directory = None
+        self.directories = []
+        self.tarball_root = tarball_root
+        self.source_root = os.path.abspath(source_root)
+        self.build_root = os.path.abspath(build_root)
+
+        # Normalize the tarball root so that it starts and ends with a slash.
+        if self.tarball_root.endswith('/'):
+            self.tarball_root = self.tarball_root + '/'
+        if self.tarball_root.startswith('/'):
+            self.tarball_root = '/' + self.tarball_root
+
+        with open(manifest_filename, 'r') as file:
+            for line in file.readlines():
+                self.process_line(line)
+
+    def add_rule(self, rule):
+        if self.current_directory is not None:
+            self.current_directory.add_rule(rule)
+        else:
+            Ruleset.add_global_rule(rule)
+
+    def add_directory(self, directory):
+        self.current_directory = directory
+        self.directories.append(directory)
+
+    def resolve_variables(self, string, strip=False):
+        if strip:
+            return string.replace('$source', '').replace('$build', '')
+
+        string = string.replace('$source', self.source_root)
+        if self.build_root:
+            string = string.replace('$build', self.build_root)
+        elif string.find('$build') != -1:
+            raise Exception('Manifest has $build but build root not given.')
+        return string
+
+    def get_full_source_path(self, source_path):
+        full_source_path = self.resolve_variables(source_path)
+        if not os.path.exists(full_source_path):
+            full_source_path = os.path.join(self.source_root, source_path)
+        if not os.path.exists(full_source_path):
+            raise Exception('Could not find directory %s' % full_source_path)
+        return full_source_path
+
+    def get_full_tarball_path(self, path):
+        path = self.resolve_variables(path, strip=True)
+        return self.tarball_root + path
+
+    def get_source_and_tarball_paths_from_parts(self, parts):
+        full_source_path = self.get_full_source_path(parts[1])
+        if len(parts) &gt; 2:
+            full_tarball_path = self.get_full_tarball_path(parts[2])
+        else:
+            full_tarball_path = self.get_full_tarball_path(parts[1])
+        return (full_source_path, full_tarball_path)
+
+    def process_line(self, line):
+        parts = line.split()
+        if not parts:
+            return
+        if parts[0].startswith(&quot;#&quot;):
+            return
+
+        if parts[0] == &quot;directory&quot; and len(parts) &gt; 1:
+            self.add_directory(Directory(*self.get_source_and_tarball_paths_from_parts(parts)))
+        elif parts[0] == &quot;file&quot; and len(parts) &gt; 1:
+            self.add_directory(File(*self.get_source_and_tarball_paths_from_parts(parts)))
+        elif parts[0] == &quot;exclude&quot; and len(parts) &gt; 1:
+            self.add_rule(Rule(Rule.Result.EXCLUDE, self.resolve_variables(parts[1])))
+        elif parts[0] == &quot;include&quot; and len(parts) &gt; 1:
+            self.add_rule(Rule(Rule.Result.INCLUDE, self.resolve_variables(parts[1])))
+
+    def get_files(self):
+        for directory in self.directories:
+            for file_tuple in directory.get_files():
+                yield file_tuple
+
+    def create_tarfile(self, output):
+        count = 0
+        for file_tuple in self.get_files():
+            count = count + 1
+
+        with closing(tarfile.open(output, 'w')) as tarball:
+            for i, (file_path, tarball_path) in enumerate(self.get_files(), start=1):
+                print('Tarring file {0} of {1}'.format(i, count).ljust(40), end='\r')
+                tarball.add(file_path, tarball_path)
+        print(&quot;Wrote {0}&quot;.format(output).ljust(40))
+
+
+if __name__ == &quot;__main__&quot;:
+    parser = argparse.ArgumentParser(description='Build a distribution bundle.')
+    parser.add_argument('-s', '--source-directory', type=str, default=os.getcwd(),
+                        help='The top-level directory of the source distribution. ' + \
+                              'Directory for relative paths. Defaults to current directory.')
+    parser.add_argument('--tarball-root', type=str, default='/',
+                        help='The top-level path of the tarball. By default files are added to the root of the tarball.')
+    parser.add_argument('-b', '--build-directory', type=str, default=None,
+                        help='The top-level path of directory of the build root. ' + \
+                              'By default there is no build root.')
+    parser.add_argument('-o', type=str, default='out.tar', dest=&quot;output_filename&quot;,
+                        help='The tarfile to produce. By default this is &quot;out.tar&quot;')
+    parser.add_argument('manifest_filename', metavar=&quot;manifest&quot;, type=str, help='The path to the manifest file.')
+
+    arguments = parser.parse_args()
+
+    manifest = Manifest(arguments.manifest_filename, arguments.source_directory, arguments.build_directory, arguments.tarball_root)
+    manifest.create_tarfile(arguments.output_filename)
</ins><span class="cx">Property changes on: releases/WebKitGTK/webkit-2.4/Tools/gtk/make-dist.py
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnexecutable"></a>
<div class="addfile"><h4>Added: svn:executable</h4></div>
<a id="releasesWebKitGTKwebkit24Toolsgtkmanifesttxt"></a>
<div class="addfile"><h4>Added: releases/WebKitGTK/webkit-2.4/Tools/gtk/manifest.txt (0 => 168693)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.4/Tools/gtk/manifest.txt                                (rev 0)
+++ releases/WebKitGTK/webkit-2.4/Tools/gtk/manifest.txt        2014-05-13 19:25:33 UTC (rev 168693)
</span><span class="lines">@@ -0,0 +1,74 @@
</span><ins>+# Global rules
+exclude #$
+exclude ChangeLog
+exclude GNUmakefile
+exclude Makefile
+exclude tags$
+exclude ~$
+exclude \.#$
+exclude \.bak$
+exclude \.cproject$
+exclude \.git$
+exclude \.gitattributes$
+exclude \.gitignore$
+exclude \.gyp$
+exclude \.icns$
+exclude \.lproj$
+exclude \.nib$
+exclude \.o$
+exclude \.order$
+exclude \.pdf$
+exclude \.plist$
+exlucde \.pro\.user$
+exclude \.project$
+exclude \.props$
+exclude \.pyc$
+exclude \.pyo$
+exclude \.settings$
+exclude \.svn$
+exclude \.sw[a-p]$
+exclude \.vcxproj$
+exclude \.xcconfig$
+exclude \.xcodeproj$
+
+directory Source
+exclude Source/WebCore/platform/audio/resources/IRC_Composite_.*\.wav$
+exclude Source/WebCore/bindings/scripts/test
+exclude Source/WebCore/platform/efl/DefaultTheme
+exclude Source/autotools$
+
+# Most of the files in Source/WebKit are not necessary to build GTK+ and
+# the directory includes lots of images, so we're a bit more picky here.
+exclude Source/WebKit/.*
+include Source/WebKit/CMakeLists.txt
+include Source/WebKit/PlatformGTK.cmake
+include Source/WebKit/gtk
+exclude Source/WebKit/gtk/NEWS$
+
+# We do want to include the NEWS, but we want it to be in the root of the archive.
+file Source/WebKit/gtk/NEWS NEWS
+
+directory Tools/gtk
+directory Tools/GtkLauncher
+directory Tools/ImageDiff
+directory Tools/MiniBrowser
+directory Tools/TestWebKitAPI
+
+directory Tools/DumpRenderTree
+exclude Tools/DumpRenderTree/fonts
+
+directory Tools/WebKitTestRunner
+exclude Tools/WebKitTestRunner/fonts/
+
+file CMakeLists.txt
+file Tools/CMakeLists.txt
+file Tools/Scripts/VCSUtils.pm
+file Tools/Scripts/run-gtk-tests
+file Tools/Scripts/webkit-build-directory
+file Tools/Scripts/webkitdirs.pm
+file Tools/jhbuild/jhbuildutils.py
+
+directory $build/Documentation/webkit2gtk/html Documentation/webkit2gtk/html
+directory $build/Documentation/webkit2gtk/html Documentation/webkit2gtk/html
+directory $build/Documentation/webkitgtk/tmpl Documentation/webkitgtk/tmpl
+directory $build/Documentation/webkitgtk/tmpl Documentation/webkitgtk/tmpl
</ins></span></pre>
</div>
</div>

</body>
</html>