1# This Source Code Form is subject to the terms of the Mozilla Public
2# License, v. 2.0. If a copy of the MPL was not distributed with this file,
3# You can obtain one at http://mozilla.org/MPL/2.0/.
4
5from __future__ import absolute_import, print_function, unicode_literals
6
7from mozboot.base import BaseBootstrapper
8
9
10class OpenBSDBootstrapper(BaseBootstrapper):
11    def __init__(self, version, **kwargs):
12        BaseBootstrapper.__init__(self, **kwargs)
13
14        self.packages = [
15            "gmake",
16            "gtar",
17            "rust",
18            "wget",
19            "unzip",
20            "zip",
21        ]
22
23        self.browser_packages = [
24            "llvm",
25            "nasm",
26            "gtk+3",
27            "dbus-glib",
28            "pulseaudio",
29        ]
30
31    def install_system_packages(self):
32        # we use -z because there's no other way to say "any autoconf-2.13"
33        self.run_as_root(["pkg_add", "-z"] + self.packages)
34
35    def install_browser_packages(self, mozconfig_builder):
36        self.ensure_browser_packages()
37
38    def install_browser_artifact_mode_packages(self, mozconfig_builder):
39        self.ensure_browser_packages(artifact_mode=True)
40
41    def ensure_browser_packages(self, artifact_mode=False):
42        # TODO: Figure out what not to install for artifact mode
43        # we use -z because there's no other way to say "any autoconf-2.13"
44        self.run_as_root(["pkg_add", "-z"] + self.browser_packages)
45
46    def ensure_clang_static_analysis_package(self, state_dir, checkout_root):
47        # TODO: we don't ship clang base static analysis for this platform
48        pass
49
50    def ensure_stylo_packages(self, state_dir, checkout_root):
51        # Clang / llvm already installed as browser package
52        self.run_as_root(["pkg_add", "cbindgen"])
53
54    def ensure_nasm_packages(self, state_dir, checkout_root):
55        # installed via ensure_browser_packages
56        pass
57
58    def ensure_node_packages(self, state_dir, checkout_root):
59        self.run_as_root(["pkg_add", "node"])
60