1*c697fb7fSBrooks Davis#! /bin/sh 2*c697fb7fSBrooks Davis# Copyright 2014 Google Inc. 3*c697fb7fSBrooks Davis# All rights reserved. 4*c697fb7fSBrooks Davis# 5*c697fb7fSBrooks Davis# Redistribution and use in source and binary forms, with or without 6*c697fb7fSBrooks Davis# modification, are permitted provided that the following conditions are 7*c697fb7fSBrooks Davis# met: 8*c697fb7fSBrooks Davis# 9*c697fb7fSBrooks Davis# * Redistributions of source code must retain the above copyright 10*c697fb7fSBrooks Davis# notice, this list of conditions and the following disclaimer. 11*c697fb7fSBrooks Davis# * Redistributions in binary form must reproduce the above copyright 12*c697fb7fSBrooks Davis# notice, this list of conditions and the following disclaimer in the 13*c697fb7fSBrooks Davis# documentation and/or other materials provided with the distribution. 14*c697fb7fSBrooks Davis# * Neither the name of Google Inc. nor the names of its contributors 15*c697fb7fSBrooks Davis# may be used to endorse or promote products derived from this software 16*c697fb7fSBrooks Davis# without specific prior written permission. 17*c697fb7fSBrooks Davis# 18*c697fb7fSBrooks Davis# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19*c697fb7fSBrooks Davis# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20*c697fb7fSBrooks Davis# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21*c697fb7fSBrooks Davis# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22*c697fb7fSBrooks Davis# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23*c697fb7fSBrooks Davis# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24*c697fb7fSBrooks Davis# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25*c697fb7fSBrooks Davis# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26*c697fb7fSBrooks Davis# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27*c697fb7fSBrooks Davis# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28*c697fb7fSBrooks Davis# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29*c697fb7fSBrooks Davis 30*c697fb7fSBrooks Davisset -e -x 31*c697fb7fSBrooks Davis 32*c697fb7fSBrooks Davisinstall_deps() { 33*c697fb7fSBrooks Davis sudo apt-get update -qq 34*c697fb7fSBrooks Davis 35*c697fb7fSBrooks Davis local pkgsuffix= 36*c697fb7fSBrooks Davis local packages= 37*c697fb7fSBrooks Davis if [ "${ARCH?}" = i386 ]; then 38*c697fb7fSBrooks Davis pkgsuffix=:i386 39*c697fb7fSBrooks Davis packages="${packages} gcc-multilib" 40*c697fb7fSBrooks Davis packages="${packages} g++-multilib" 41*c697fb7fSBrooks Davis fi 42*c697fb7fSBrooks Davis packages="${packages} doxygen" 43*c697fb7fSBrooks Davis packages="${packages} gdb" 44*c697fb7fSBrooks Davis packages="${packages} liblua5.2-0${pkgsuffix}" 45*c697fb7fSBrooks Davis packages="${packages} liblua5.2-dev${pkgsuffix}" 46*c697fb7fSBrooks Davis packages="${packages} libsqlite3-0${pkgsuffix}" 47*c697fb7fSBrooks Davis packages="${packages} libsqlite3-dev${pkgsuffix}" 48*c697fb7fSBrooks Davis packages="${packages} pkg-config${pkgsuffix}" 49*c697fb7fSBrooks Davis packages="${packages} sqlite3" 50*c697fb7fSBrooks Davis sudo apt-get install -y ${packages} 51*c697fb7fSBrooks Davis} 52*c697fb7fSBrooks Davis 53*c697fb7fSBrooks Davisinstall_from_github() { 54*c697fb7fSBrooks Davis local project="${1}"; shift 55*c697fb7fSBrooks Davis local name="${1}"; shift 56*c697fb7fSBrooks Davis local release="${1}"; shift 57*c697fb7fSBrooks Davis 58*c697fb7fSBrooks Davis local distname="${name}-${release}" 59*c697fb7fSBrooks Davis 60*c697fb7fSBrooks Davis local baseurl="https://github.com/jmmv/${project}" 61*c697fb7fSBrooks Davis wget --no-check-certificate \ 62*c697fb7fSBrooks Davis "${baseurl}/releases/download/${distname}/${distname}.tar.gz" 63*c697fb7fSBrooks Davis tar -xzvf "${distname}.tar.gz" 64*c697fb7fSBrooks Davis 65*c697fb7fSBrooks Davis local archflags= 66*c697fb7fSBrooks Davis [ "${ARCH?}" != i386 ] || archflags=-m32 67*c697fb7fSBrooks Davis 68*c697fb7fSBrooks Davis cd "${distname}" 69*c697fb7fSBrooks Davis ./configure \ 70*c697fb7fSBrooks Davis --disable-developer \ 71*c697fb7fSBrooks Davis --without-atf \ 72*c697fb7fSBrooks Davis --without-doxygen \ 73*c697fb7fSBrooks Davis CFLAGS="${archflags}" \ 74*c697fb7fSBrooks Davis CPPFLAGS="-I/usr/local/include" \ 75*c697fb7fSBrooks Davis CXXFLAGS="${archflags}" \ 76*c697fb7fSBrooks Davis LDFLAGS="-L/usr/local/lib -Wl,-R/usr/local/lib" \ 77*c697fb7fSBrooks Davis PKG_CONFIG_PATH="/usr/local/lib/pkgconfig" 78*c697fb7fSBrooks Davis make 79*c697fb7fSBrooks Davis sudo make install 80*c697fb7fSBrooks Davis cd - 81*c697fb7fSBrooks Davis 82*c697fb7fSBrooks Davis rm -rf "${distname}" "${distname}.tar.gz" 83*c697fb7fSBrooks Davis} 84*c697fb7fSBrooks Davis 85*c697fb7fSBrooks Davisinstall_from_bintray() { 86*c697fb7fSBrooks Davis case "${ARCH?}" in 87*c697fb7fSBrooks Davis amd64) 88*c697fb7fSBrooks Davis name="20160204-usr-local-kyua-ubuntu-12-04-amd64-${CC?}.tar.gz" 89*c697fb7fSBrooks Davis ;; 90*c697fb7fSBrooks Davis i386) 91*c697fb7fSBrooks Davis name="20160714-usr-local-kyua-ubuntu-12-04-i386-${CC?}.tar.gz" 92*c697fb7fSBrooks Davis ;; 93*c697fb7fSBrooks Davis *) 94*c697fb7fSBrooks Davis echo "ERROR: Unknown ARCH value ${ARCH}" 1>&2 95*c697fb7fSBrooks Davis exit 1 96*c697fb7fSBrooks Davis ;; 97*c697fb7fSBrooks Davis esac 98*c697fb7fSBrooks Davis wget "http://dl.bintray.com/jmmv/kyua/${name}" || return 1 99*c697fb7fSBrooks Davis sudo tar -xzvp -C / -f "${name}" 100*c697fb7fSBrooks Davis rm -f "${name}" 101*c697fb7fSBrooks Davis} 102*c697fb7fSBrooks Davis 103*c697fb7fSBrooks Davisinstall_deps 104*c697fb7fSBrooks Davisif ! install_from_bintray; then 105*c697fb7fSBrooks Davis install_from_github atf atf 0.20 106*c697fb7fSBrooks Davis install_from_github lutok lutok 0.4 107*c697fb7fSBrooks Davis install_from_github kyua kyua-testers 0.2 108*c697fb7fSBrooks Davis install_from_github kyua kyua-cli 0.8 109*c697fb7fSBrooks Davisfi 110