author Nick Alexander <>
Mon, 26 Jan 2015 11:13:49 -0800
changeset 226899 ee25e5277ab6ce76d8cef914bd269d306c8b3cf1
parent 221247 3ecd0c6da57ba01c64ad467781c45d82510e3791
child 233812 c7f6177f04cfe0c62520ee5ac620b0d79e39e981
permissions -rw-r--r--
Bug 1123824 - Include platforms/android-VERSION in suggested mozconfig. r=me,f=psd DONTBUILD NPOTB

# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at

import os
import sys

from mozboot.base import BaseBootstrapper

class DebianBootstrapper(BaseBootstrapper):
    # These are common packages for all Debian-derived distros (such as
    # Ubuntu).

    # Subclasses can add packages to this variable to have them installed.

    # These are common packages for building Firefox for Desktop
    # (browser) for all Debian-derived distros (such as Ubuntu).

    # Subclasses can add packages to this variable to have them installed.

    # These are common packages for building Firefox for Android
    # (mobile/android) for all Debian-derived distros (such as Ubuntu).
        'zlib1g-dev', # mobile/android requires system zlib.
        'wget', # For downloading the Android SDK and NDK.
        'libncurses5:i386', # See comments about i386 below.

    # Subclasses can add packages to this variable to have them installed.

    def __init__(self, version, dist_id):

        self.version = version
        self.dist_id = dist_id

        self.packages = self.COMMON_PACKAGES + self.DISTRO_PACKAGES
        self.browser_packages = self.BROWSER_COMMON_PACKAGES + self.BROWSER_DISTRO_PACKAGES
        self.mobile_android_packages = self.MOBILE_ANDROID_COMMON_PACKAGES + self.MOBILE_ANDROID_DISTRO_PACKAGES

    def install_system_packages(self):

    def install_browser_packages(self):

    def install_mobile_android_packages(self):
        import android

        # Multi-part process:
        # 1. System packages.
        # 2. Android SDK and NDK.
        # 3. Android packages.

        # 1. This is hard to believe, but the Android SDK binaries are 32-bit
        # and that conflicts with 64-bit Debian and Ubuntu installations out of
        # the box.  The solution is to add the i386 architecture.  See
        # "Troubleshooting Ubuntu" at
        self.run_as_root(['dpkg', '--add-architecture', 'i386'])
        # self.apt_update()

        # 2. The user may have an external Android SDK (in which case we save
        # them a lengthy download), or they may have already completed the
        # download. We unpack to ~/.mozbuild/{android-sdk-linux, android-ndk-r8e}.
        mozbuild_path = os.environ.get('MOZBUILD_STATE_PATH', os.path.expanduser(os.path.join('~', '.mozbuild')))
        self.sdk_path = os.environ.get('ANDROID_SDK_HOME', os.path.join(mozbuild_path, 'android-sdk-linux'))
        self.ndk_path = os.environ.get('ANDROID_NDK_HOME', os.path.join(mozbuild_path, 'android-ndk-r8e'))
        self.sdk_url = ''
        is_64bits = sys.maxsize > 2**32
        if is_64bits:
            self.ndk_url = ''
            self.ndk_url = ''
            sdk_path=self.sdk_path, sdk_url=self.sdk_url,
            ndk_path=self.ndk_path, ndk_url=self.ndk_url)

        # 3. We expect the |android| tool to at
        # ~/.mozbuild/android-sdk-linux/tools/android.
        android_tool = os.path.join(self.sdk_path, 'tools', 'android')

    def suggest_mobile_android_mozconfig(self):
        import android

        # The SDK path that mozconfig wants includes platforms/android-21.
        sdk_path = os.path.join(self.sdk_path, 'platforms', android.ANDROID_PLATFORM)

    def _update_package_manager(self):
        self.run_as_root(['apt-get', 'update'])