Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

merge back PR 9898 fix non-root build script for ensure-libpq... #9958

Merged
merged 1 commit into from
Jan 21, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions scripts/helpers/eosio.sh
Original file line number Diff line number Diff line change
Expand Up @@ -312,29 +312,32 @@ function ensure-libpq-and-libpqxx() {
fi

if [[ $ARCH == "Linux" ]]; then
if [[ $CURRENT_USER != "root" ]] ; then
LIBPQ_SUDO="$SUDO_LOCATION"
fi
if [[ $NAME == "Amazon Linux" ]]; then
#install libpq
if [ ! -d /usr/include/libpq ]; then
amazon-linux-extras enable postgresql11 && \
yum install -y libpq-devel
$LIBPQ_SUDO amazon-linux-extras enable postgresql11 && \
$LIBPQ_SUDO yum install -y libpq-devel
fi
EXTRA_CMAKE_FLAGS="-DPostgreSQL_TYPE_INCLUDE_DIR=/usr/include/libpq"
elif [[ $NAME == "CentOS Linux" ]]; then
#install libpq
if [ ! -d /usr/pgsql-13 ]; then
CENTOS_VERSION=$(rpm -E %{rhel})
yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-$CENTOS_VERSION-x86_64/pgdg-redhat-repo-latest.noarch.rpm
[ $CENTOS_VERSION -lt 8 ] || dnf -qy module disable postgresql
yum install -y postgresql13-devel
$LIBPQ_SUDO yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-$CENTOS_VERSION-x86_64/pgdg-redhat-repo-latest.noarch.rpm
[ $CENTOS_VERSION -lt 8 ] || $LIBPQ_SUDO dnf -qy module disable postgresql
$LIBPQ_SUDO yum install -y postgresql13-devel
fi
export PostgreSQL_ROOT=/usr/pgsql-13
export PKG_CONFIG_PATH=/usr/pgsql-13/lib/pkgconfig
elif [[ $NAME == "Ubuntu" ]]; then
# install libpq
if [ ! -d /usr/include/postgresql ]; then
echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list && \
if [ ! -d /usr/include/postgresql ]; then
$LIBPQ_SUDO bash -c 'source /etc/os-release; echo "deb http://apt.postgresql.org/pub/repos/apt ${VERSION_CODENAME}-pgdg main" > /etc/apt/sources.list.d/pgdg.list && \
curl -sL https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - && \
apt-get update && apt-get -y install libpq-dev
apt-get update && apt-get -y install libpq-dev'
fi
EXTRA_CMAKE_FLAGS="-DPostgreSQL_TYPE_INCLUDE_DIR=/usr/include/postgresql"
fi
Expand Down