⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 259863 in webkit


Ignore:
Timestamp:
Apr 10, 2020, 4:04:47 AM (6 years ago)
Author:
Philippe Normand
Message:

[Flatpak SDK] Generate one IceCC archive per toolchain
https://bugs.webkit.org/show_bug.cgi?id=210189

Reviewed by Žan Doberšek.

Add a utility option to webkit-flatpak so it regenerated
toolchains without needing a full SDK reinstall. Also we now
generate a self-contained toolchain archive embedding GCC and one
embedding CLang.

  • flatpak/flatpakutils.py:

(WebkitFlatpak.load_from_args):
(WebkitFlatpak.init):
(WebkitFlatpak.run_in_sandbox):
(WebkitFlatpak.setup_icecc):
(WebkitFlatpak.setup_dev_env):

Location:
trunk/Tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r259862 r259863  
     12020-04-10  Philippe Normand  <pnormand@igalia.com>
     2
     3        [Flatpak SDK] Generate one IceCC archive per toolchain
     4        https://bugs.webkit.org/show_bug.cgi?id=210189
     5
     6        Reviewed by Žan Doberšek.
     7
     8        Add a utility option to webkit-flatpak so it regenerated
     9        toolchains without needing a full SDK reinstall. Also we now
     10        generate a self-contained toolchain archive embedding GCC and one
     11        embedding CLang.
     12
     13        * flatpak/flatpakutils.py:
     14        (WebkitFlatpak.load_from_args):
     15        (WebkitFlatpak.__init__):
     16        (WebkitFlatpak.run_in_sandbox):
     17        (WebkitFlatpak.setup_icecc):
     18        (WebkitFlatpak.setup_dev_env):
     19
    1202020-04-10  Philippe Normand  <pnormand@igalia.com>
    221
  • trunk/Tools/flatpak/flatpakutils.py

    r259862 r259863  
    394394        general.add_argument('--available', action='store_true', dest="check_available", help='Check if required dependencies are available.'),
    395395        general.add_argument("--use-icecream", dest="use_icecream", help="Use the distributed icecream (icecc) compiler.", action="store_true")
     396        general.add_argument("-r", "--regenerate-toolchains", dest="regenerate_toolchains", action="store_true",
     397                             help="Regenerate IceCC distribuable toolchain archives")
    396398
    397399        debugoptions = parser.add_argument_group("Debugging")
     
    445447
    446448        self.use_icecream = False
    447         self.icc_version = None
     449        self.icc_version = {}
     450        self.regenerate_toolchains = False
    448451
    449452    def execute_command(self, args, stdout=None, stderr=None):
     
    486489        self.flatpak_build_path = os.environ["FLATPAK_USER_DIR"]
    487490
    488         build_root = os.path.join(self.source_root, 'WebKitBuild')
    489         self.build_path = os.path.join(build_root, self.platform, self.build_type)
     491        self.build_root = os.path.join(self.source_root, 'WebKitBuild')
     492        self.build_path = os.path.join(self.build_root, self.platform, self.build_type)
    490493        self.config_file = os.path.join(self.flatpak_build_path, 'webkit_flatpak_config.json')
    491494
     
    536539
    537540        gst_builddir = os.path.join(self.sandbox_source_root, "WebKitBuild", 'gst-build')
    538         if not os.path.exists(os.path.join(self.source_root, 'WebKitBuild', 'gst-build', 'build.ninja')):
     541        if not os.path.exists(os.path.join(self.build_root, 'gst-build', 'build.ninja')):
    539542            if not building:
    540543                raise RuntimeError('Trying to enter gst-build env from %s but it is not built, make sure to rebuild webkit.' % gst_dir)
     
    688691            flatpak_command.append(share_network_option)
    689692
    690         if self.use_icecream:
     693        if self.use_icecream and not self.regenerate_toolchains:
    691694            _log.debug('Enabling the icecream compiler')
    692695            if share_network_option not in flatpak_command:
     
    696699            n_cores = multiprocessing.cpu_count() * 3
    697700            _log.debug('Following icecream recommendation for the number of cores to use: %d' % n_cores)
     701            toolchain_name = os.environ.get("CC", "gcc")
     702            toolchain_path = self.icc_version[toolchain_name]
     703            if not os.path.isfile(toolchain_path):
     704                Console.error_message("%s is not a valid IceCC toolchain. Please run webkit-flatpak -r")
     705                return 1
    698706            forwarded.update({
    699707                "CCACHE_PREFIX": "icecc",
    700                 "ICECC_VERSION": self.icc_version,
     708                "ICECC_VERSION": toolchain_path,
    701709                "NUMBER_OF_PROCESSORS": n_cores,
    702710            })
     
    758766            json.dump(json_config, config)
    759767
    760     def setup_icecc(self):
     768    def setup_icecc(self, name):
    761769        with tempfile.NamedTemporaryFile() as tmpfile:
    762             self.run_in_sandbox('icecc', '--build-native', stdout=tmpfile, cwd=self.source_root)
     770            toolchain_path = "/usr/bin/%s" % name
     771            self.run_in_sandbox('icecc', '--build-native', toolchain_path, stdout=tmpfile, cwd=self.source_root)
    763772            tmpfile.flush()
    764773            tmpfile.seek(0)
    765774            icc_version_filename, = re.findall(r'.*creating (.*)', tmpfile.read())
    766             self.icc_version = os.path.join(self.source_root, icc_version_filename)
     775            toolchains_directory = os.path.join(self.build_root, "Toolchains")
     776            if not os.path.isdir(toolchains_directory):
     777                os.makedirs(toolchains_directory)
     778            archive_filename = os.path.join(toolchains_directory, "webkit-sdk-%s-%s" % (name, icc_version_filename))
     779            os.rename(icc_version_filename, archive_filename)
     780            self.icc_version[name] = archive_filename
     781            Console.message("Created %s self-contained toolchain archive", archive_filename)
    767782
    768783    def setup_dev_env(self):
    769784        if not os.path.exists(os.path.join(self.flatpak_build_path, "runtime", "org.webkit.Sdk")) or self.update:
    770785            self.install_all()
    771             if self.use_icecream:
    772                 self.setup_icecc()
     786            regenerate_toolchains = True
     787        else:
     788            regenerate_toolchains = self.regenerate_toolchains
     789
     790        if regenerate_toolchains:
     791            self.icc_version = {}
     792            self.setup_icecc("gcc")
     793            self.setup_icecc("clang")
    773794            self.save_config()
    774795
Note: See TracChangeset for help on using the changeset viewer.