1#!/bin/bash -e 2 3# Copyright (C) 2019 The Android Open Source Project 4# 5# Licensed under the Apache License, Version 2.0 (the "License"); 6# you may not use this file except in compliance with the License. 7# You may obtain a copy of the License at 8# 9# http://www.apache.org/licenses/LICENSE-2.0 10# 11# Unless required by applicable law or agreed to in writing, software 12# distributed under the License is distributed on an "AS IS" BASIS, 13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14# See the License for the specific language governing permissions and 15# limitations under the License. 16 17ABIGAIL_VERSION=1.6 18 19NUM_CORES=$(cat /proc/cpuinfo | grep -c proc) 20BASE_DIR=$(readlink -f $(dirname $0)) 21OUT_DIR="${BASE_DIR}/abigail-inst/${ABIGAIL_VERSION}" 22LIBABIGAIL_SRC="${BASE_DIR}/abigail-src" 23 24# Check output dir. 25if [ -e "${OUT_DIR}" ]; then 26 echo "WARN: ${OUT_DIR} exists. Press enter to continue or Ctrl-C to abort." 27 read 28fi 29 30set -x 31 32PACKAGES="libxml2-dev elfutils libdw-dev" 33# Install the dependencies. 34if ! dpkg -s ${PACKAGES} > /dev/null 2>&1 ; then 35 sudo apt-get install ${PACKAGES} 36fi 37 38if [ ! -d "${LIBABIGAIL_SRC}" ]; then 39 git clone git://sourceware.org/git/libabigail.git "${LIBABIGAIL_SRC}" 40else 41 git -C ${LIBABIGAIL_SRC} fetch 42fi 43 44git -C ${LIBABIGAIL_SRC} checkout libabigail-${ABIGAIL_VERSION} 45 46# Build libabigail 47pushd "${LIBABIGAIL_SRC}" 48 #git clean -dfx 49 autoreconf -i --force 50 mkdir -p build/ 51 pushd build/ 52 ../configure --prefix="${OUT_DIR}" --enable-cxx11=yes --disable-shared 53# make -j${NUM_CORES} 54 make -j${NUM_CORES} install-exec 55 popd 56popd 57 58set +x 59 60echo 61echo "Note: Export following environment before running the executables:" 62echo 63echo "export PATH=\"${OUT_DIR}/bin:\${PATH}\"" 64echo 65echo 66