Parametrize run-with-jhbuild and update-webkitgtk-libs with platform --gtk/--efl
authorkubo@profusion.mobi <kubo@profusion.mobi@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 15 Mar 2012 14:58:55 +0000 (14:58 +0000)
committerkubo@profusion.mobi <kubo@profusion.mobi@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 15 Mar 2012 14:58:55 +0000 (14:58 +0000)
https://bugs.webkit.org/show_bug.cgi?id=79673

Preparatory work for bringing jhbuild enabled build to EFL port.

Patch by Dominik Röttsches <dominik.rottsches@linux.intel.com> on 2012-03-15
Reviewed by Philippe Normand.

* Scripts/update-webkit-libs-jhbuild: Copied from Tools/Scripts/update-webkitgtk-libs.
* Scripts/update-webkitgtk-libs:
* gtk/run-with-jhbuild:
* jhbuild/jhbuild-wrapper: Copied from Tools/gtk/run-with-jhbuild.
(top_level_path):
(jhbuild_installed):
(jhbuild_cloned):
(jhbuild_at_expected_revision):
(update_jhbuild):
(clone_jhbuild):
(install_jhbuild):
(update_webkit_libs_jhbuild):
(determine_platform):
(ensure_jhbuild):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@110846 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/Scripts/update-webkit-libs-jhbuild [new file with mode: 0755]
Tools/Scripts/update-webkitgtk-libs
Tools/gtk/run-with-jhbuild
Tools/jhbuild/jhbuild-wrapper [new file with mode: 0755]

index 8443f1c..80670c4 100644 (file)
@@ -1,3 +1,27 @@
+2012-03-15  Dominik Röttsches  <dominik.rottsches@linux.intel.com>
+
+        Parametrize run-with-jhbuild and update-webkitgtk-libs with platform --gtk/--efl
+        https://bugs.webkit.org/show_bug.cgi?id=79673
+
+        Preparatory work for bringing jhbuild enabled build to EFL port.
+
+        Reviewed by Philippe Normand.
+
+        * Scripts/update-webkit-libs-jhbuild: Copied from Tools/Scripts/update-webkitgtk-libs.
+        * Scripts/update-webkitgtk-libs:
+        * gtk/run-with-jhbuild:
+        * jhbuild/jhbuild-wrapper: Copied from Tools/gtk/run-with-jhbuild.
+        (top_level_path):
+        (jhbuild_installed):
+        (jhbuild_cloned):
+        (jhbuild_at_expected_revision):
+        (update_jhbuild):
+        (clone_jhbuild):
+        (install_jhbuild):
+        (update_webkit_libs_jhbuild):
+        (determine_platform):
+        (ensure_jhbuild):
+
 2012-03-15  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         [GTK] Add command line options to run-gtk-tests script
diff --git a/Tools/Scripts/update-webkit-libs-jhbuild b/Tools/Scripts/update-webkit-libs-jhbuild
new file mode 100755 (executable)
index 0000000..7e2440a
--- /dev/null
@@ -0,0 +1,61 @@
+#!/usr/bin/perl -w
+# Copyright (C) 2011 Igalia S.L.
+# Copyright (C) 2012 Intel Corporation
+#
+# 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
+
+use FindBin;
+use lib $FindBin::Bin;
+use webkitdirs;
+use Getopt::Long;
+
+my $platformEfl = 0;
+my $platformGtk = 0;
+
+my $getOptionsResult = GetOptions(
+    'efl' => \$platformEfl,
+    'gtk' => \$platformGtk
+    );
+
+my $platform = "";
+if (!$getOptionsResult) {
+    die "No platform specified for " . basename($0) .". Use --gtk or --efl.\n";
+} else {
+    if ($platformEfl) {
+        $platform = "efl";
+    }
+    if ($platformGtk) {
+        $platform = "gtk";
+    }
+}
+
+delete $ENV{AR_FLAGS} if exists $ENV{AR_FLAGS};
+
+chdir(relativeScriptsDir() . "/../jhbuild") or die $!;
+
+my @ensureJhbuildArgs = ("./jhbuild-wrapper", "--".$platform, "echo", "Ensured jhbuild setup.");
+if (system(@ensureJhbuildArgs) != 0) {
+    die "Failed to ensure jhbuild installed.\n";
+}
+
+chdir(relativeScriptsDir() . "/../".$platform) or die $!;
+
+my %prettyPlatform = ( "efl" => "EFL", "gtk" => "GTK+" );
+print "Updating " . $prettyPlatform{$platform} . " port dependencies using jhbuild...\n";
+my @jhbuildArgs = ("../../WebKitBuild/Dependencies/Root/bin/jhbuild", "--no-interact", "-f", "jhbuildrc");
+push(@jhbuildArgs, @ARGV[2..-1]);
+if (system(@jhbuildArgs) != 0) {
+    die "Running jhbuild failed.\n"
+}
index 8033c62..bb62011 100755 (executable)
@@ -1,5 +1,6 @@
 #!/usr/bin/perl -w
 # Copyright (C) 2011 Igalia S.L.
+# Copyright (C) 2012 Intel Corporation
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -19,18 +20,5 @@ use FindBin;
 use lib $FindBin::Bin;
 use webkitdirs;
 
-delete $ENV{AR_FLAGS} if exists $ENV{AR_FLAGS};
-
-chdir(relativeScriptsDir() . "/../gtk") or die $!;
-
-my @ensureJhbuildArgs = ("./run-with-jhbuild", "echo", "Ensured jhbuild setup.");
-if (system(@ensureJhbuildArgs) != 0) {
-    die "Failed to ensure jhbuild installed.\n";
-}
-
-print "Updating GTK+ port dependencies using jhbuild...\n";
-my @jhbuildArgs = ("../../WebKitBuild/Dependencies/Root/bin/jhbuild", "--no-interact", "-f", "jhbuildrc");
-push(@jhbuildArgs, @ARGV[1..-1]);
-if (system(@jhbuildArgs) != 0) {
-    die "Running jhbuild failed.\n"
-}
+my $scriptsDir = relativeScriptsDir();
+system("perl", "$scriptsDir/update-webkit-libs-jhbuild", "--gtk", sys.argv) == 0 or die $!;
index 5f88ed0..fdf6f0f 100755 (executable)
@@ -1,6 +1,7 @@
 #!/usr/bin/env python
 # Copyright (C) 2011 Igalia S.L.
 # Copyright (C) 2012 Gustavo Noronha Silva <gns@gnome.org>
+# Copyright (C) 2012 Intel Corporation
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
 import common
-import os
 import subprocess
 import sys
 
-
-jhbuild_revision = '1eedc423f75c605224b430579e4c303292199507'
-
-installation_prefix = os.path.abspath(common.top_level_path('WebKitBuild', 'Dependencies', 'Root'))
-source_path = os.path.abspath(common.top_level_path('WebKitBuild', 'Dependencies', 'Source'))
-jhbuild_source_path = os.path.join(source_path, 'jhbuild')
-jhbuild_path = common.top_level_path('WebKitBuild', 'Dependencies', 'Root', 'bin', 'jhbuild')
-
-
-def jhbuild_installed():
-    return os.path.exists(jhbuild_path)
-
-
-def jhbuild_cloned():
-    return os.path.exists(jhbuild_source_path)
-
-
-def jhbuild_at_expected_revision():
-    process = subprocess.Popen(['git', 'rev-list', 'HEAD^..'], cwd=jhbuild_source_path,
-                               stdout=subprocess.PIPE, stderr=subprocess.PIPE)
-    output, err = process.communicate()
-    if process.returncode != 0:
-        raise Exception('failed to find jhbuild revision: %s' % err)
-
-    return output.strip() == jhbuild_revision
-
-
-def update_jhbuild():
-    process = subprocess.Popen(['git', 'remote', 'update', 'origin'], cwd=jhbuild_source_path)
-    process.wait()
-    if process.returncode != 0:
-        raise Exception('jhbuild remote update origin failed with return code: %i' % process.returncode)
-
-    process = subprocess.Popen(['git', 'checkout', '%s' % jhbuild_revision],
-                               cwd=jhbuild_source_path)
-    process.wait()
-    if process.returncode != 0:
-        raise Exception('failed to checkout treeish %s: %i' % (jhbuild_revision, process.returncode))
-
-
-def clone_jhbuild():
-    if not os.path.exists(source_path):
-        os.makedirs(source_path)
-    if not os.path.exists(installation_prefix):
-        os.makedirs(installation_prefix)
-
-    process = subprocess.Popen(['git', 'clone', 'git://git.gnome.org/jhbuild'], cwd=source_path)
-    process.wait()
-    if process.returncode != 0:
-        raise Exception('jhbuild git clone failed with return code: %i' % process.returncode)
-
-
-def install_jhbuild():
-    # jhbuild is really unhappy about having MAKE defined to something like 'make -j4'
-    # so we just undefine it here.
-    env_without_make = dict(os.environ)
-    if 'MAKE' in env_without_make:
-        del env_without_make['MAKE']
-
-    process = subprocess.Popen(['./autogen.sh', '--prefix=%s' % installation_prefix],
-                               cwd=jhbuild_source_path, env=env_without_make)
-    process.wait()
-    if process.returncode != 0:
-        raise Exception('jhbuild configure failed with return code: %i' % process.returncode)
-
-    process = subprocess.Popen(['make', 'install'], cwd=jhbuild_source_path, env=env_without_make)
-    process.wait()
-    if process.returncode != 0:
-        raise Exception('jhbuild configure failed with return code: %i' % process.returncode)
-
-
-def update_webkitgtk_libs():
-    process = subprocess.Popen(common.top_level_path('Tools', 'Scripts', 'update-webkitgtk-libs'))
-    process.wait()
-    if process.returncode != 0:
-        raise Exception('jhbuild configure failed with return code: %i' % process.returncode)
-
-
-def ensure_jhbuild():
-    if not jhbuild_cloned():
-        clone_jhbuild()
-        update_jhbuild()
-        install_jhbuild()
-        update_webkitgtk_libs()
-    elif not jhbuild_installed() \
-            or not jhbuild_at_expected_revision():
-        update_jhbuild()
-        install_jhbuild()
-
-
-ensure_jhbuild()
-
-
-process = subprocess.Popen([jhbuild_path, '--no-interact', '-f', common.top_level_path('Tools', 'gtk', 'jhbuildrc'), 'run'] + sys.argv[1:])
+jhbuild_wrapper = common.top_level_path('Tools', 'jhbuild', 'jhbuild-wrapper')
+process = subprocess.Popen([jhbuild_wrapper, '--gtk'] + sys.argv[1:])
 process.wait()
 sys.exit(process.returncode)
-
-
-
diff --git a/Tools/jhbuild/jhbuild-wrapper b/Tools/jhbuild/jhbuild-wrapper
new file mode 100755 (executable)
index 0000000..d48db85
--- /dev/null
@@ -0,0 +1,140 @@
+#!/usr/bin/env python
+# Copyright (C) 2011 Igalia S.L.
+# Copyright (C) 2012 Gustavo Noronha Silva <gns@gnome.org>
+# Copyright (C) 2012 Intel Corporation
+#
+# 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
+
+import os
+import subprocess
+import sys
+
+
+top_level_dir = None
+
+
+def top_level_path(*args):
+    global top_level_dir
+    if not top_level_dir:
+        top_level_dir = os.path.join(os.path.dirname(__file__), '..', '..')
+    return os.path.join(*(top_level_dir,) + args)
+
+
+jhbuild_revision = '1eedc423f75c605224b430579e4c303292199507'
+
+installation_prefix = os.path.abspath(top_level_path('WebKitBuild', 'Dependencies', 'Root'))
+source_path = os.path.abspath(top_level_path('WebKitBuild', 'Dependencies', 'Source'))
+jhbuild_source_path = os.path.join(source_path, 'jhbuild')
+jhbuild_path = top_level_path('WebKitBuild', 'Dependencies', 'Root', 'bin', 'jhbuild')
+platform = None;
+
+
+def jhbuild_installed():
+    return os.path.exists(jhbuild_path)
+
+
+def jhbuild_cloned():
+    return os.path.exists(jhbuild_source_path)
+
+
+def jhbuild_at_expected_revision():
+    process = subprocess.Popen(['git', 'rev-list', 'HEAD^..'], cwd=jhbuild_source_path,
+                               stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+    output, err = process.communicate()
+    if process.returncode != 0:
+        raise Exception('failed to find jhbuild revision: %s' % err)
+
+    return output.strip() == jhbuild_revision
+
+
+def update_jhbuild():
+    process = subprocess.Popen(['git', 'remote', 'update', 'origin'], cwd=jhbuild_source_path)
+    process.wait()
+    if process.returncode != 0:
+        raise Exception('jhbuild remote update origin failed with return code: %i' % process.returncode)
+
+    process = subprocess.Popen(['git', 'checkout', '%s' % jhbuild_revision],
+                               cwd=jhbuild_source_path)
+    process.wait()
+    if process.returncode != 0:
+        raise Exception('failed to checkout treeish %s: %i' % (jhbuild_revision, process.returncode))
+
+
+def clone_jhbuild():
+    if not os.path.exists(source_path):
+        os.makedirs(source_path)
+    if not os.path.exists(installation_prefix):
+        os.makedirs(installation_prefix)
+
+    process = subprocess.Popen(['git', 'clone', 'git://git.gnome.org/jhbuild'], cwd=source_path)
+    process.wait()
+    if process.returncode != 0:
+        raise Exception('jhbuild git clone failed with return code: %i' % process.returncode)
+
+
+def install_jhbuild():
+    # jhbuild is really unhappy about having MAKE defined to something like 'make -j4'
+    # so we just undefine it here.
+    env_without_make = dict(os.environ)
+    if 'MAKE' in env_without_make:
+        del env_without_make['MAKE']
+
+    process = subprocess.Popen(['./autogen.sh', '--prefix=%s' % installation_prefix],
+                               cwd=jhbuild_source_path, env=env_without_make)
+    process.wait()
+    if process.returncode != 0:
+        raise Exception('jhbuild configure failed with return code: %i' % process.returncode)
+
+    process = subprocess.Popen(['make', 'install'], cwd=jhbuild_source_path, env=env_without_make)
+    process.wait()
+    if process.returncode != 0:
+        raise Exception('jhbuild configure failed with return code: %i' % process.returncode)
+
+
+def update_webkit_libs_jhbuild():
+    process = subprocess.Popen([top_level_path('Tools', 'Scripts', 'update-webkit-libs-jhbuild'), '--' + platform])
+    process.wait()
+    if process.returncode != 0:
+        raise Exception('jhbuild configure failed with return code: %i' % process.returncode)
+
+
+def determine_platform():
+    if '--efl' in sys.argv:
+        return "efl";
+    if '--gtk' in sys.argv:
+        return "gtk";
+    raise ValueError('No platform specified for jhbuild-wrapper.')
+
+
+def ensure_jhbuild():
+    if not jhbuild_cloned():
+        clone_jhbuild()
+        update_jhbuild()
+        install_jhbuild()
+        update_webkit_libs_jhbuild()
+    elif not jhbuild_installed() \
+            or not jhbuild_at_expected_revision():
+        update_jhbuild()
+        install_jhbuild()
+
+try:
+    platform = determine_platform()
+except ValueError as e:
+    sys.exit(e)
+ensure_jhbuild()
+
+process = subprocess.Popen([jhbuild_path, '--no-interact', '-f', top_level_path('Tools', platform, 'jhbuildrc'), 'run'] + sys.argv[2:])
+process.wait()
+sys.exit(process.returncode)