Files
openthread/script/bootstrap
T

101 lines
2.9 KiB
Bash
Executable File

#!/bin/sh
#
# Copyright (c) 2017, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of the copyright holder nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
# Description:
# This file installs all needed dependencies and toolchains needed for
# example compilation and programming.
#
# Establish some key directories
srcdir=`dirname ${0}`
abs_srcdir=`pwd`
abs_top_srcdir="${abs_srcdir}"
install_packages_apt()
{
# apt update and install dependencies
sudo apt-get update
sudo apt-get install -y build-essential git make autoconf \
autoconf-archive automake dbus libtool gcc \
g++ gperf flex bison texinfo ncurses-dev \
libexpat-dev python sed python-pip gawk \
libreadline6-dev libreadline6 libdbus-1-dev \
libboost-dev
# add gcc-arm-embedded ppa
sudo add-apt-repository -y ppa:team-gcc-arm-embedded/ppa
sudo apt-get update
sudo apt-get install gcc-arm-embedded
}
install_packages_opkg()
{
echo 'opkg not supported currently' && false
}
install_packages_rpm()
{
echo 'rpm not supported currently' && false
}
install_packages_brew()
{
echo 'macOS not supported currently' && false
}
install_packages_source()
{
echo 'source not supported currently' && false
}
install_packages()
{
PM=source
if which apt-get; then
PM=apt
elif which rpm; then
PM=rpm
elif which opkg; then
PM=opkg
elif which brew; then
PM=brew
fi
install_packages_$PM
}
main()
{
. $BEFORE_HOOK
install_packages
. $AFTER_HOOK
}
main