blob: dace036e834cd5e61802b050e1443812fa52901e [file] [log] [blame]
Matthias Maennichf7d7e4d2019-03-26 11:46:24 +00001#!/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 Maennich25062fc2019-05-29 12:54:46 +010017ABIGAIL_VERSION=fb70149c
Matthias Maennichf7d7e4d2019-03-26 11:46:24 +000018
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
Matthias Maennich11b36172019-04-15 07:45:44 +010032PACKAGES="autoconf elfutils libtool libxml2-dev libdw-dev pkg-config python3"
Matthias Maennichf7d7e4d2019-03-26 11:46:24 +000033# Install the dependencies.
Matthias Maennichbd5e1662019-04-02 11:39:29 +010034if ! dpkg -s ${PACKAGES} > /dev/null 2>&1 ; then
Matthias Maennich02963ac2019-04-15 07:46:55 +010035 sudo apt-get install --yes ${PACKAGES}
Matthias Maennichbd5e1662019-04-02 11:39:29 +010036fi
Matthias Maennichf7d7e4d2019-03-26 11:46:24 +000037
Matthias Maennich7dcb7862019-04-09 15:01:48 +010038# Assert minimum package versions
39if ! 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
43fi
44
Matthias Maennichf7d7e4d2019-03-26 11:46:24 +000045if [ ! -d "${LIBABIGAIL_SRC}" ]; then
46 git clone git://sourceware.org/git/libabigail.git "${LIBABIGAIL_SRC}"
47else
48 git -C ${LIBABIGAIL_SRC} fetch
49fi
50
Matthias Maennich25062fc2019-05-29 12:54:46 +010051git -C ${LIBABIGAIL_SRC} checkout ${ABIGAIL_VERSION}
Matthias Maennichf7d7e4d2019-03-26 11:46:24 +000052
53# Build libabigail
54pushd "${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
63popd
64
65set +x
66
67echo
68echo "Note: Export following environment before running the executables:"
69echo
70echo "export PATH=\"${OUT_DIR}/bin:\${PATH}\""
71echo
72echo