Skip to content

Commit

Permalink
ARROW-7864: [R] Make sure bundled installation works even if there ar…
Browse files Browse the repository at this point in the history
…e system packages

Closes #6603 from nealrichardson/pc-version-check

Authored-by: Neal Richardson <neal.p.richardson@gmail.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
  • Loading branch information
nealrichardson authored and kou committed Mar 13, 2020
1 parent ca369a3 commit dba6f34
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions r/configure
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,15 @@ LOCAL_AUTOBREW=`echo $LOCAL_AUTOBREW | tr '[:upper:]' '[:lower:]'`
FORCE_AUTOBREW=`echo $FORCE_AUTOBREW | tr '[:upper:]' '[:lower:]'`
ARROW_USE_PKG_CONFIG=`echo $ARROW_USE_PKG_CONFIG | tr '[:upper:]' '[:lower:]'`

VERSION=`grep ^Version DESCRIPTION | sed s/Version:\ //`
UNAME=`uname -s`

# generate code
if [ "$ARROW_R_DEV" = "true" ]; then
echo "*** Generating code with data-raw/codegen.R"
${R_HOME}/bin/Rscript data-raw/codegen.R
fi

UNAME=`uname -s`

if [ "$LOCAL_AUTOBREW" = "true" ]; then
# LOCAL_AUTOBREW means use the script in tools/
# If you want to use a local apache-arrow.rb formula, do:
Expand All @@ -62,7 +63,7 @@ fi

# Note that cflags may be empty in case of success
if [ "$INCLUDE_DIR" ] || [ "$LIB_DIR" ]; then
echo "Found INCLUDE_DIR and/or LIB_DIR!"
echo "*** Using INCLUDE_DIR/LIB_DIR"
PKG_CFLAGS="-I$INCLUDE_DIR $PKG_CFLAGS"
PKG_LIBS="-L$LIB_DIR $PKG_LIBS"
else
Expand All @@ -74,18 +75,29 @@ else
fi

if [ "$PKGCONFIG_CFLAGS" ] || [ "$PKGCONFIG_LIBS" ]; then
echo "Arrow C++ libraries found via pkg-config"
echo "*** Arrow C++ libraries found via pkg-config"
PKG_CFLAGS="$PKGCONFIG_CFLAGS"
PKG_LIBS=${PKGCONFIG_LIBS}

# Check for version mismatch
PC_LIB_VERSION=`pkg-config --modversion arrow`
echo $PC_LIB_VERSION | grep -e 'SNAPSHOT$' >/dev/null 2>&1
# If on a release (i.e. not SNAPSHOT) and version != R package version, warn
if [ $? -eq 1 ] && [ "$PC_LIB_VERSION" != "$VERSION" ]; then
echo "**** Warning: library version mismatch"
echo "**** C++ is $PC_LIB_VERSION but R is $VERSION"
echo "**** If installation fails, upgrade the C++ library to match"
echo "**** or retry with ARROW_USE_PKG_CONFIG=false"
fi
else
if [ "$UNAME" = "Darwin" ]; then
if [ "$FORCE_AUTOBREW" != "true" ] && [ "`command -v brew`" ] && [ "`brew ls --versions ${PKG_BREW_NAME}`" != "" ]; then
echo "Using Homebrew ${PKG_BREW_NAME}"
echo "*** Using Homebrew ${PKG_BREW_NAME}"
BREWDIR=`brew --prefix`
else
echo "Downloading ${PKG_BREW_NAME}"
echo "*** Downloading ${PKG_BREW_NAME}"
if [ -f "autobrew" ]; then
echo "Using local manifest for ${PKG_BREW_NAME}"
echo "**** Using local manifest for ${PKG_BREW_NAME}"
else
curl -sfL "https://jeroen.github.io/autobrew/$PKG_BREW_NAME" > autobrew
if [ $? -ne 0 ]; then
Expand All @@ -100,7 +112,6 @@ else
PKG_CFLAGS="-I$BREWDIR/opt/$PKG_BREW_NAME/include"
PKG_LIBS="-L$BREWDIR/opt/$PKG_BREW_NAME/lib $PKG_LIBS"
elif [ "$UNAME" = "Linux" ]; then
VERSION=`grep ^Version DESCRIPTION | sed s/Version:\ //`
if [ "${LIBARROW_DOWNLOAD}" = "" ] && [ "${NOT_CRAN}" != "" ]; then
export LIBARROW_DOWNLOAD=$NOT_CRAN
fi
Expand Down

0 comments on commit dba6f34

Please sign in to comment.