Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up documentation, configuration, and CI following S2 version update #263

Merged
merged 21 commits into from
Oct 11, 2024
Merged
Changes from 1 commit
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
Next Next commit
clean up configure script a bit
paleolimbot committed Oct 10, 2024
commit bc10adc39e44f0a2c6a2b98e2214255aa6ca8c73
61 changes: 11 additions & 50 deletions configure
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# Anticonf (tm) script by Jeroen Ooms (2020)

# This configure script finds OpenSSL and Abseil, optionally building
# Abseil if not found.

# Anticonf (tm) script by Jeroen Ooms (2020) for finding OpenSSL
# This script will query 'pkg-config' for the required cflags and ldflags.
# If pkg-config is unavailable or does not find the library, try setting
# INCLUDE_DIR and LIB_DIR manually via e.g:
@@ -8,9 +12,8 @@
PKG_CONFIG_NAME="openssl"
PKG_DEB_NAME="libssl-dev"
PKG_RPM_NAME="openssl-devel"
PKG_CSW_NAME="libssl_dev"
PKG_BREW_NAME="openssl@1.1"
PKG_TEST_FILE="tools/version.c"
PKG_BREW_NAME="openssl"
PKG_TEST_FILE="tools/test_openssl.c"
PKG_LIBS="-lssl -lcrypto"
PKG_CFLAGS=""

@@ -30,16 +33,6 @@ elif [ "$PKGCONFIG_CFLAGS" ] || [ "$PKGCONFIG_LIBS" ]; then
echo "Found pkg-config cflags and libs!"
PKG_CFLAGS=${PKGCONFIG_CFLAGS}
PKG_LIBS=${PKGCONFIG_LIBS}
elif [ `uname` = "Darwin" ]; then
test ! "$CI" && brew --version 2>/dev/null
if [ $? -eq 0 ]; then
BREWDIR=`brew --prefix`
PKG_CFLAGS="-I$BREWDIR/opt/openssl/include -I$BREWDIR/opt/openssl@1.1/include"
PKG_LIBS="-L$BREWDIR/opt/openssl/lib -L$BREWDIR/opt/openssl@1.1/lib $PKG_LIBS"
else
curl -sfL "https://autobrew.github.io/scripts/$PKG_BREW_NAME" > autobrew
. ./autobrew
fi
fi

# Find compiler
@@ -59,7 +52,6 @@ if [ $? -ne 0 ]; then
echo "Configuration failed because $PKG_CONFIG_NAME was not found. Try installing:"
echo " * deb: $PKG_DEB_NAME (Debian, Ubuntu, etc)"
echo " * rpm: $PKG_RPM_NAME (Fedora, CentOS, RHEL)"
echo " * csw: $PKG_CSW_NAME (Solaris)"
echo " * brew: $PKG_BREW_NAME (Mac OSX)"
echo "If $PKG_CONFIG_NAME is already installed, check that 'pkg-config' is in your"
echo "PATH and PKG_CONFIG_PATH contains a $PKG_CONFIG_NAME.pc file. If pkg-config"
@@ -71,45 +63,14 @@ if [ $? -ne 0 ]; then
exit 1
fi

# Try to link against the correct OpenSSL version
if [ -z "$AUTOBREW" ]; then
SONAME=`${CC} -E ${PKG_CFLAGS} src/tests/soname.h | sh | xargs`
if [ "$SONAME" ]; then
if [ `uname` = "Darwin" ]; then
PKG_LIBS_VERSIONED=`echo "${PKG_LIBS}" | sed "s/-lssl/-lssl.${SONAME}/" | sed "s/-lcrypto/-lcrypto.${SONAME}/"`
else
PKG_LIBS_VERSIONED=`echo "${PKG_LIBS}" | sed "s/-lssl/-l:libssl.so.${SONAME}/" | sed "s/-lcrypto/-l:libcrypto.so.${SONAME}/"`
fi

# Test if versioned linking works
${CC} ${PKG_CFLAGS} src/tests/main.c ${PKG_LIBS_VERSIONED} -o src/main.exe 2>/dev/null
if [ $? -eq 0 ]; then PKG_LIBS="${PKG_LIBS_VERSIONED}"; fi
rm src/main.exe || true

# Suppress opensslv3 warnings for now
if [ "$SONAME" = "3" ]; then
PKG_CFLAGS="$PKG_CFLAGS -DOPENSSL_SUPPRESS_DEPRECATED"
fi

fi #SONAME
fi #AUTOBREW

# Check pkg-config for abseil-cpp, but fall back to a cmake build.
# This should possibly be updated to check that the pkg-config detected
# version will actually work; however, the version of abseil that included
# pkg-config files is about the same as the minimum version required here.
# Check pkg-config for abseil-cpp, but fall back to a cmake build
# because a sufficient version of abseil-cpp is not available on
# all platforms (notably, Ubuntu 20.04 and Ubuntu 22.04).
export PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:`pwd`/tools/pkgconfig"

# Allow developers to set R_S2_ABSL_HOME in .Renviron to avoid building
# Abseil on every package rebuild. This can be built from this directory using
# tools/build_absl.sh path/to/dir (then R_S2_ABSL_HOME=path/to/dir in .Renviron)
if [ ! -z "${R_S2_ABSL_HOME}" ]; then
export PKG_CONFIG_PATH="{$R_S2_ABSL_HOME}/lib/pkgconfig:${PKG_CONFIG_PATH}"
fi

echo "** Using PKG_CONFIG_PATH=${PKG_CONFIG_PATH}"

if pkg-config absl_s2 --libs 2>/dev/null; then
if pkg-config absl_s2 --libs >/dev/null 2>/dev/null; then
echo "** Using abseil-cpp from pkg-config"

PKGCONFIG_CFLAGS=`pkg-config --cflags-only-I absl_s2`
12 changes: 6 additions & 6 deletions src/RcppExports.cpp
Original file line number Diff line number Diff line change
@@ -1344,12 +1344,12 @@ BEGIN_RCPP
END_RCPP
}

RcppExport SEXP c_s2_geography_writer_new(void *, void *, void *, void *);
RcppExport SEXP c_s2_handle_geography(void *, void *);
RcppExport SEXP c_s2_handle_geography_tessellated(void *, void *);
RcppExport SEXP c_s2_projection_mercator(void *);
RcppExport SEXP c_s2_projection_orthographic(void *);
RcppExport SEXP c_s2_projection_plate_carree(void *);
RcppExport SEXP c_s2_geography_writer_new(SEXP, SEXP, SEXP, SEXP);
RcppExport SEXP c_s2_handle_geography(SEXP, SEXP);
RcppExport SEXP c_s2_handle_geography_tessellated(SEXP, SEXP);
RcppExport SEXP c_s2_projection_mercator(SEXP);
RcppExport SEXP c_s2_projection_orthographic(SEXP);
RcppExport SEXP c_s2_projection_plate_carree(SEXP);
RcppExport SEXP c_s2_trans_s2_lnglat_new(void);
RcppExport SEXP c_s2_trans_s2_point_new(void);

6 changes: 6 additions & 0 deletions tools/test_absl.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

#include "absl/base/config.h"

#if defined(ABSL_LTS_RELEASE_VERSION) && ABSL_LTS_RELEASE_VERSION < 20230802L
#error "Abseil C++ version is too old"
#endif
File renamed without changes.