blob: 68703e1f2b2babe7a6ee80f9ff9f92c515a94ec6 [file] [log] [blame]
commit-queue@webkit.org28fe8402014-02-24 15:45:27 +00001#!/usr/bin/env python
2# Copyright (C) 2011 Igalia S.L.
3# Copyright (C) 2012 Intel Corporation
4#
5# This library is free software; you can redistribute it and/or
6# modify it under the terms of the GNU Lesser General Public
7# License as published by the Free Software Foundation; either
8# version 2 of the License, or (at your option) any later version.
9#
10# This library is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13# Lesser General Public License for more details.
14#
15# You should have received a copy of the GNU Lesser General Public
16# License along with this library; if not, write to the Free Software
17# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
19import multiprocessing
20import sys
21import os
ossy@webkit.org6e91f9b2015-11-20 11:38:10 +000022import platform
commit-queue@webkit.org28fe8402014-02-24 15:45:27 +000023
24
25script_dir = None
26
27
28def script_path(*args):
29 global script_dir
30 if not script_dir:
31 script_dir = os.path.join(os.path.dirname(__file__), '..', 'Scripts')
32 return os.path.join(*(script_dir,) + args)
33
34
35def top_level_path(*args):
36 return os.path.join(*((os.path.join(os.path.dirname(__file__), '..', '..'),) + args))
37
38
ossy@webkit.org6e91f9b2015-11-20 11:38:10 +000039def init(jhbuildrc_globals, jhbuild_platform):
commit-queue@webkit.org28fe8402014-02-24 15:45:27 +000040
ossy@webkit.org6e91f9b2015-11-20 11:38:10 +000041 __tools_directory = os.path.join(os.path.dirname(__file__), "../", jhbuild_platform)
commit-queue@webkit.org28fe8402014-02-24 15:45:27 +000042 sys.path.insert(0, __tools_directory)
43
44 jhbuildrc_globals["build_policy"] = 'updated'
45
clopez@igalia.comc307d3e2020-07-08 10:41:54 +000046 __moduleset_file_name = 'jhbuild.modules'
47 if 'WEBKIT_JHBUILD_MODULESET' in os.environ:
48 __moduleset_file_name = 'jhbuild-%s.modules' % os.environ['WEBKIT_JHBUILD_MODULESET']
49 __moduleset_file_path = os.path.join(__tools_directory, __moduleset_file_name)
50 if not os.path.isfile(__moduleset_file_path):
51 raise RuntimeError("Can't find the moduleset in path %s" % __moduleset_file_path)
52 __moduleset_file_uri = 'file://' + __moduleset_file_path
53
commit-queue@webkit.org28fe8402014-02-24 15:45:27 +000054 __extra_modulesets = os.environ.get("WEBKIT_EXTRA_MODULESETS", "").split(",")
55 jhbuildrc_globals["moduleset"] = [__moduleset_file_uri, ]
56 if __extra_modulesets != ['']:
57 jhbuildrc_globals["moduleset"].extend(__extra_modulesets)
58
59 __extra_modules = os.environ.get("WEBKIT_EXTRA_MODULES", "").split(",")
clopez@igalia.comc307d3e2020-07-08 10:41:54 +000060
61 base_dependency_suffix = 'testing'
62 if 'WEBKIT_JHBUILD_MODULESET' in os.environ:
63 base_dependency_suffix = os.environ['WEBKIT_JHBUILD_MODULESET']
64
65 jhbuildrc_globals["modules"] = ['webkit' + jhbuild_platform + '-' + base_dependency_suffix + '-dependencies', ]
commit-queue@webkit.org28fe8402014-02-24 15:45:27 +000066 if __extra_modules != ['']:
67 jhbuildrc_globals["modules"].extend(__extra_modules)
68
69 if 'WEBKIT_OUTPUTDIR' in os.environ:
ossy@webkit.org6e91f9b2015-11-20 11:38:10 +000070 jhbuildrc_globals["checkoutroot"] = checkoutroot = os.path.abspath(os.path.join(os.environ['WEBKIT_OUTPUTDIR'], 'Dependencies' + jhbuild_platform.upper(), 'Source'))
71 jhbuildrc_globals["prefix"] = os.path.abspath(os.path.join(os.environ['WEBKIT_OUTPUTDIR'], 'Dependencies' + jhbuild_platform.upper(), 'Root'))
commit-queue@webkit.org28fe8402014-02-24 15:45:27 +000072 else:
ossy@webkit.org6e91f9b2015-11-20 11:38:10 +000073 jhbuildrc_globals["checkoutroot"] = checkoutroot = os.path.abspath(top_level_path('WebKitBuild', 'Dependencies' + jhbuild_platform.upper(), 'Source'))
74 jhbuildrc_globals["prefix"] = os.path.abspath(top_level_path('WebKitBuild', 'Dependencies' + jhbuild_platform.upper(), 'Root'))
commit-queue@webkit.org28fe8402014-02-24 15:45:27 +000075
76 jhbuildrc_globals["nonotify"] = True
77 jhbuildrc_globals["notrayicon"] = True
mrobinson@webkit.orgbd8267b2014-03-11 15:09:12 +000078
79 if 'NUMBER_OF_PROCESSORS' in os.environ:
80 jhbuildrc_globals['jobs'] = os.environ['NUMBER_OF_PROCESSORS']
81
commit-queue@webkit.org7eeaafd2020-07-20 21:24:41 +000082 if os.environ.get("WEBKIT_JHBUILD_MODULESET") != "minimal":
83 # Avoid runtime conflicts with GStreamer system-wide plugins. We want
84 # to use only the plugins we build in JHBuild.
85 os.environ['GST_PLUGIN_SYSTEM_PATH'] = ''
mrobinson@webkit.orgbd8267b2014-03-11 15:09:12 +000086
mrobinson@webkit.orgbd8267b2014-03-11 15:09:12 +000087 addpath = jhbuildrc_globals['addpath']
mrobinson@webkit.orgbd8267b2014-03-11 15:09:12 +000088
89 prefix = jhbuildrc_globals['prefix']
90 addpath('CMAKE_PREFIX_PATH', prefix)
mcatanzaro@igalia.com43105002015-12-07 18:54:33 +000091 addpath('CMAKE_LIBRARY_PATH', os.path.join(prefix, 'lib'))
commit-queue@webkit.org9c559a22014-03-21 14:44:10 +000092
93 if 'JHBUILD_MIRROR' in os.environ:
94 jhbuildrc_globals['dvcs_mirror_dir'] = os.environ['JHBUILD_MIRROR']
95 jhbuildrc_globals['tarballdir'] = os.environ['JHBUILD_MIRROR']
ossy@webkit.org6e91f9b2015-11-20 11:38:10 +000096
97 if 'x86_64' in platform.machine():
98 jhbuildrc_globals['conditions'].add('x86_64')
calvaris@igalia.com3215a5c2020-07-10 14:57:57 +000099
100 if 'JHBUILD_ENABLE_THUNDER' in os.environ:
101 jhbuild_enable_thunder = os.environ['JHBUILD_ENABLE_THUNDER'].lower()
102 if jhbuild_enable_thunder == 'yes' or jhbuild_enable_thunder == '1' or jhbuild_enable_thunder == 'true':
103 jhbuildrc_globals['conditions'].add('Thunder')