@@ -2098,7 +2098,6 @@ RBIN="${R_HOME}/bin/R"
20982098
20992099
21002100PKG_CONFIG_NAME=" libgit2"
2101- PKG_BREW_NAME=" libgit2"
21022101PKG_LIBS=" -lgit2"
21032102PKG_CFLAGS=" "
21042103
@@ -2165,9 +2164,48 @@ fi
21652164
21662165 if test " x${BREW} " = xyes; then
21672166 BREWDIR=` brew --prefix`
2168- else
2169- curl -sfL " https://autobrew.github.io/scripts/libgit2" > autobrew
2170- . ./autobrew
2167+ PKG_CFLAGS=" -I${BREWDIR} /opt/libgit2/include"
2168+ PKG_LIBS=" -L${BREWDIR} /opt/libgit2/lib ${PKG_LIBS} "
2169+ elif test -z " ${DISABLE_AUTOBREW} " ; then
2170+ # Try to download a static build of libgit2 and use that.
2171+ bottle_ver=" 1.8.1"
2172+ bottle_sha256=" 9419deece3c3b7bec2ed8ed1caa5f4a3f3f1b049a6d17b0a75b2e05128c10fdf"
2173+ bottle_url=" https://github.com/autobrew/bundler/releases/download"
2174+ bottle=" ${bottle_url} /libgit2-${bottle_ver} /libgit2-${bottle_ver} -universal.tar.xz"
2175+
2176+ # Download the bottle
2177+ echo " Download autobrew bundle $( basename ${bottle} ) "
2178+ curl -sSL $bottle -o libs.tar.xz
2179+
2180+ # Verify the checksum of the downloaded bottle
2181+ { printf " %s\n" " $as_me :${as_lineno-$LINENO } : checking SHA256 checksum of downloaded $( basename ${bottle} ) " >&5
2182+ printf %s " checking SHA256 checksum of downloaded $( basename ${bottle} ) ... " >&6 ; }
2183+ : ${bottle_download_sha256=`openssl sha256 libs.tar.xz | sed -e ' s:.*= ::' `}
2184+ if test " x$bottle_download_sha256 " ! = " x$bottle_sha256 " ; then
2185+ { { printf " %s\n" " $as_me :${as_lineno-$LINENO } : error: in '$ac_pwd ':" >&5
2186+ printf " %s\n" " $as_me : error: in '$ac_pwd ':" >&2 ; }
2187+ as_fn_error $? " The SHA256 checksum of $( basename ${bottle} ) didn't match
2188+ See 'config.log' for more details" " $LINENO " 5; }
2189+ fi
2190+ { printf " %s\n" " $as_me :${as_lineno-$LINENO } : result: yes" >&5
2191+ printf " %s\n" " yes" >&6 ; }
2192+
2193+ # General setup
2194+ BREWDIR=" $PWD /.deps"
2195+ mkdir -p $BREWDIR
2196+ tar -xf libs.tar.xz --strip 1 -C $BREWDIR
2197+ rm -f libs.tar.xz
2198+
2199+ PKG_CFLAGS=" -I${BREWDIR} /include"
2200+ PKG_LIBS=" -L${BREWDIR} /lib ${PKG_LIBS} -lssh2 -lcrypto -lcurl -lz -liconv -framework Security"
2201+
2202+ # Prevent linking against other libs in /usr/local/lib
2203+ for FILE in $BREWDIR /lib/* .a; do
2204+ BASENAME=$( basename $FILE )
2205+ LIBNAME=$( echo " ${BASENAME% .* } " | cut -c4-)
2206+ cp -f $FILE $BREWDIR /lib/libbrew$LIBNAME .a
2207+ PKG_LIBS=$( echo $PKG_LIBS | sed " s/-l$LIBNAME /-lbrew$LIBNAME /g" )
2208+ done
21712209 fi
21722210 ;;
21732211 esac
@@ -2199,10 +2237,10 @@ if test "x${libgit2_ver_ok}" = xno; then
21992237 echo "
22002238 -----------------------------------------------------------------------
22012239
2202- Unable to find ' libgit2 >= ${LIBGIT2_MIN_VERSION} ' on this system, please install :
2203- libgit2-dev (package on e.g. Debian and Ubuntu )
2204- libgit2-devel (package on e.g. Fedora, CentOS and RHEL )
2205- libgit2 (Homebrew package on OS X )
2240+ Configuration failed to find libgit2 library. Try installing :
2241+ * brew: libgit2 (MacOS )
2242+ * deb: libgit2-dev (Debian, Ubuntu, etc )
2243+ * rpm: libgit2-devel (Fedora, CentOS, RHEL )
22062244 and try again.
22072245
22082246 If the libgit2 library is installed on your system but the git2r
@@ -2218,16 +2256,6 @@ if test "x${libgit2_ver_ok}" = xno; then
22182256 or download and install git2r in R using
22192257 install.packages('git2r', type='source', configure.vars='LIB_DIR=-L/path/to/libs INCLUDE_DIR=-I/path/to/headers')
22202258
2221- On macOS, another possibility is to let the configuration
2222- automatically download the libgit2 library from the Homebrew
2223- package manager with:
2224-
2225- R CMD INSTALL git2r-.tar.gz --configure-vars='autobrew=yes'
2226- or
2227- R CMD INSTALL git2r/ --configure-vars='autobrew=yes'
2228- or
2229- install.packages('git2r', type='source', configure.vars='autobrew=yes')
2230-
22312259 -----------------------------------------------------------------------
22322260
22332261"
0 commit comments