Matthias Maennich | f7d7e4d | 2019-03-26 11:46:24 +0000 | [diff] [blame] | 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 | |
Matthias Maennich | 25062fc | 2019-05-29 12:54:46 +0100 | [diff] [blame^] | 17 | ABIGAIL_VERSION=fb70149c |
Matthias Maennich | f7d7e4d | 2019-03-26 11:46:24 +0000 | [diff] [blame] | 18 | |
| 19 | NUM_CORES=$(cat /proc/cpuinfo | grep -c proc) |
| 20 | BASE_DIR=$(readlink -f $(dirname $0)) |
| 21 | OUT_DIR="${BASE_DIR}/abigail-inst/${ABIGAIL_VERSION}" |
| 22 | LIBABIGAIL_SRC="${BASE_DIR}/abigail-src" |
| 23 | |
| 24 | # Check output dir. |
| 25 | if [ -e "${OUT_DIR}" ]; then |
| 26 | echo "WARN: ${OUT_DIR} exists. Press enter to continue or Ctrl-C to abort." |
| 27 | read |
| 28 | fi |
| 29 | |
| 30 | set -x |
| 31 | |
Matthias Maennich | 11b3617 | 2019-04-15 07:45:44 +0100 | [diff] [blame] | 32 | PACKAGES="autoconf elfutils libtool libxml2-dev libdw-dev pkg-config python3" |
Matthias Maennich | f7d7e4d | 2019-03-26 11:46:24 +0000 | [diff] [blame] | 33 | # Install the dependencies. |
Matthias Maennich | bd5e166 | 2019-04-02 11:39:29 +0100 | [diff] [blame] | 34 | if ! dpkg -s ${PACKAGES} > /dev/null 2>&1 ; then |
Matthias Maennich | 02963ac | 2019-04-15 07:46:55 +0100 | [diff] [blame] | 35 | sudo apt-get install --yes ${PACKAGES} |
Matthias Maennich | bd5e166 | 2019-04-02 11:39:29 +0100 | [diff] [blame] | 36 | fi |
Matthias Maennich | f7d7e4d | 2019-03-26 11:46:24 +0000 | [diff] [blame] | 37 | |
Matthias Maennich | 7dcb786 | 2019-04-09 15:01:48 +0100 | [diff] [blame] | 38 | # Assert minimum package versions |
| 39 | if ! dpkg --compare-versions \ |
| 40 | $(dpkg-query --showformat='${Version}' --show libdw-dev) ge 0.165 ; then |
| 41 | echo "ERROR: Minimum version of v0.165 for libdw-dev not met!" |
| 42 | exit 1 |
| 43 | fi |
| 44 | |
Matthias Maennich | f7d7e4d | 2019-03-26 11:46:24 +0000 | [diff] [blame] | 45 | if [ ! -d "${LIBABIGAIL_SRC}" ]; then |
| 46 | git clone git://sourceware.org/git/libabigail.git "${LIBABIGAIL_SRC}" |
| 47 | else |
| 48 | git -C ${LIBABIGAIL_SRC} fetch |
| 49 | fi |
| 50 | |
Matthias Maennich | 25062fc | 2019-05-29 12:54:46 +0100 | [diff] [blame^] | 51 | git -C ${LIBABIGAIL_SRC} checkout ${ABIGAIL_VERSION} |
Matthias Maennich | f7d7e4d | 2019-03-26 11:46:24 +0000 | [diff] [blame] | 52 | |
| 53 | # Build libabigail |
| 54 | pushd "${LIBABIGAIL_SRC}" |
| 55 | #git clean -dfx |
| 56 | autoreconf -i --force |
| 57 | mkdir -p build/ |
| 58 | pushd build/ |
| 59 | ../configure --prefix="${OUT_DIR}" --enable-cxx11=yes --disable-shared |
| 60 | # make -j${NUM_CORES} |
| 61 | make -j${NUM_CORES} install-exec |
| 62 | popd |
| 63 | popd |
| 64 | |
| 65 | set +x |
| 66 | |
| 67 | echo |
| 68 | echo "Note: Export following environment before running the executables:" |
| 69 | echo |
| 70 | echo "export PATH=\"${OUT_DIR}/bin:\${PATH}\"" |
| 71 | echo |
| 72 | echo |