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 6import sys 7 8from mozboot.base import BaseBootstrapper 9 10 11class FreeBSDBootstrapper(BaseBootstrapper): 12 def __init__(self, version, flavor, **kwargs): 13 BaseBootstrapper.__init__(self, **kwargs) 14 self.version = int(version.split('.')[0]) 15 self.flavor = flavor.lower() 16 17 self.packages = [ 18 'autoconf213', 19 'gmake', 20 'gtar', 21 'mercurial', 22 'npm', 23 'pkgconf', 24 'py%s%s-sqlite3' % sys.version_info[0:2], 25 'rust', 26 'watchman', 27 'zip', 28 ] 29 30 self.browser_packages = [ 31 'dbus-glib', 32 'gconf2', 33 'gtk2', 34 'gtk3', 35 'libXt', 36 'mesa-dri', # depends on llvm* 37 'pulseaudio', 38 'v4l_compat', 39 'yasm', 40 ] 41 42 if not self.which('as'): 43 self.packages.append('binutils') 44 45 if not self.which('unzip'): 46 self.packages.append('unzip') 47 48 def pkg_install(self, *packages): 49 command = ['pkg', 'install'] 50 if self.no_interactive: 51 command.append('-y') 52 53 command.extend(packages) 54 self.run_as_root(command) 55 56 def install_system_packages(self): 57 self.pkg_install(*self.packages) 58 59 def install_browser_packages(self): 60 self.ensure_browser_packages() 61 62 def install_browser_artifact_mode_packages(self): 63 self.ensure_browser_packages(artifact_mode=True) 64 65 def ensure_browser_packages(self, artifact_mode=False): 66 # TODO: Figure out what not to install for artifact mode 67 self.pkg_install(*self.browser_packages) 68 69 def ensure_stylo_packages(self, state_dir, checkout_root): 70 # Already installed as browser package 71 pass 72 73 def upgrade_mercurial(self, current): 74 self.pkg_install('mercurial') 75