4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews#! /bin/sh
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews# Copyright 2014 Google Inc.
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews# All rights reserved.
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews#
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews# Redistribution and use in source and binary forms, with or without
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews# modification, are permitted provided that the following conditions are
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews# met:
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews#
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews# * Redistributions of source code must retain the above copyright
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews# notice, this list of conditions and the following disclaimer.
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews# * Redistributions in binary form must reproduce the above copyright
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews# notice, this list of conditions and the following disclaimer in the
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews# documentation and/or other materials provided with the distribution.
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews# * Neither the name of Google Inc. nor the names of its contributors
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews# may be used to endorse or promote products derived from this software
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews# without specific prior written permission.
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews#
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrewsset -e -x
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrewssudo apt-get update -qq
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrewssudo apt-get install -y liblua5.2-0 liblua5.2-dev \
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews libsqlite3-0 libsqlite3-dev pkg-config sqlite3
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrewsinstall_from_github() {
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews local project="${1}"; shift
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews local name="${1}"; shift
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews local release="${1}"; shift
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews local distname="${name}-${release}"
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews local baseurl="https://github.com/jmmv/${project}"
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews wget --no-check-certificate \
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews "${baseurl}/releases/download/${distname}/${distname}.tar.gz"
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews tar -xzvf "${distname}.tar.gz"
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews cd "${distname}"
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews ./configure \
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews --disable-developer \
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews --without-atf \
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews --without-doxygen \
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews CPPFLAGS="-I/usr/local/include" \
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews LDFLAGS="-L/usr/local/lib -Wl,-R/usr/local/lib" \
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews PKG_CONFIG_PATH="/usr/local/lib/pkgconfig"
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews make
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews sudo make install
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews cd -
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews rm -rf "${distname}" "${distname}.tar.gz"
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews}
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrewsinstall_from_bintray() {
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews local name="20140803-usr-local-kyua-ubuntu-12-04-amd64-${CC:-gcc}.tar.gz"
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews wget "http://dl.bintray.com/jmmv/kyua/${name}" || return 1
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews sudo tar -xzvp -C / -f "${name}"
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews rm -f "${name}"
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews}
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrewsif ! install_from_bintray; then
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews install_from_github atf atf 0.20
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews install_from_github lutok lutok 0.4
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews install_from_github kyua kyua-testers 0.2
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews install_from_github kyua kyua-cli 0.8
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrewsfi
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews# vim: syntax=sh:expandtab:shiftwidth=4:softtabstop=4