Skip to content

Commit

Permalink
build!
Browse files Browse the repository at this point in the history
  • Loading branch information
paleolimbot committed Sep 20, 2023
1 parent a80ce6f commit ba9ccc9
Show file tree
Hide file tree
Showing 613 changed files with 213 additions and 175,105 deletions.
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@
^README\.Rmd$
^vignettes/articles$
^\.clang-format$
^tools/build$
^tools/dist$
114 changes: 11 additions & 103 deletions configure
Original file line number Diff line number Diff line change
@@ -1,111 +1,19 @@
# Anticonf (tm) script by Jeroen Ooms (2020)
# 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:
# R CMD INSTALL --configure-vars='INCLUDE_DIR=/.../include LIB_DIR=/.../lib'

# Library settings
PKG_CONFIG_NAME="openssl"
PKG_DEB_NAME="libssl-dev"
PKG_RPM_NAME="openssl-devel"
PKG_CSW_NAME="libssl_dev"
PKG_BREW_NAME="[email protected]"
PKG_TEST_FILE="tools/version.c"
PKG_LIBS="-lssl -lcrypto"
PKG_CFLAGS=""
# https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Using-cmake

# Use pkg-config if available
pkg-config ${PKG_CONFIG_NAME} --atleast-version=1.0 2>/dev/null
if [ $? -eq 0 ]; then
PKGCONFIG_CFLAGS=`pkg-config --cflags ${PKG_CONFIG_NAME}`
PKGCONFIG_LIBS=`pkg-config --libs ${PKG_CONFIG_NAME}`
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!"
PKG_CFLAGS="-I$INCLUDE_DIR $PKG_CFLAGS"
PKG_LIBS="-L$LIB_DIR $PKG_LIBS"
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/[email protected]/include"
PKG_LIBS="-L$BREWDIR/opt/openssl/lib -L$BREWDIR/opt/[email protected]/lib $PKG_LIBS"
else
curl -sfL "https://autobrew.github.io/scripts/$PKG_BREW_NAME" > autobrew
. ./autobrew
fi
fi

# Find compiler
CC=`${R_HOME}/bin/R CMD config CC`
CFLAGS=`${R_HOME}/bin/R CMD config CFLAGS`
CPPFLAGS=`${R_HOME}/bin/R CMD config CPPFLAGS`

# For debugging
echo "Testing compiler using PKG_CFLAGS=$PKG_CFLAGS"

# Test configuration
${CC} ${CPPFLAGS} ${PKG_CFLAGS} ${CFLAGS} -E ${PKG_TEST_FILE} >/dev/null 2>configure.log

# Customize the error
if [ $? -ne 0 ]; then
echo "--------------------------- [ANTICONF] --------------------------------"
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"
echo "is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:"
echo "R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'"
echo "-------------------------- [ERROR MESSAGE] ---------------------------"
cat configure.log
echo "--------------------------------------------------------------------"
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}/"`
if [ -d tools/dist ]; then
echo "Already built"
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"
echo "building"
mkdir tools/build && cd tools/build
cmake ../../tools/vendor/s2geography -DS2GEOGRAPHY_S2_SOURCE=BREW -DBUILD_SHARED_LIBS=OFF
cmake --build .
cmake --install . --prefix=../dist
cd ../..
fi

fi #SONAME
fi #AUTOBREW

# Define system endianness (compile-time endianness using system/compiler
# defines isn't detected on Solaris)
# based on endian detection from the feather package by @hadley
R_ENDIAN=`${R_HOME}/bin/Rscript -e 'cat(.Platform$endian)'`
# Trim off any warning messages that Rscript appends in front of the platform endianness
R_ENDIAN=`expr "$R_ENDIAN" : '.*\(little\)$'`
SYS_ENDIAN=""
if [ "$R_ENDIAN" = "little" ]; then
PKG_CFLAGS="$PKG_CFLAGS -DIS_LITTLE_ENDIAN"
else
PKG_CFLAGS="$PKG_CFLAGS -DIS_BIG_ENDIAN"
fi
PKG_LIBS="-L`pwd`/tools/dist/lib -ls2geography -I/opt/homebrew/Cellar/s2geometry/0.10.0_5/lib -ls2 -L/opt/homebrew/Cellar/abseil/20230802.1 -L/opt/homebrew/Cellar/openssl@3/3.1.2/lib -lcrypto -lssl"
PKG_CFLAGS="-I`pwd`/tools/dist/include -I/opt/homebrew/Cellar/s2geometry/0.10.0_5/include -I/opt/homebrew/Cellar/abseil/20230802.1/include -I/opt/homebrew/Cellar/openssl@3/3.1.2/include"

# From apache/arrow/r/configure:
# If on Raspberry Pi, need to manually link against latomic
Expand Down
216 changes: 0 additions & 216 deletions src/Makevars.in
Original file line number Diff line number Diff line change
@@ -1,219 +1,3 @@
PKG_CPPFLAGS = -I../src -DSTRICT_R_HEADERS
PKG_LIBS = @libs@
PKG_CXXFLAGS = @cflags@ -pthread

CXX_STD = CXX11

ABSL_LIBS = absl/base/internal/cycleclock.o \
absl/base/internal/low_level_alloc.o \
absl/base/internal/raw_logging.o \
absl/base/internal/scoped_set_env.o \
absl/base/internal/spinlock_wait.o \
absl/base/internal/spinlock.o \
absl/base/internal/strerror.o \
absl/base/internal/sysinfo.o \
absl/base/internal/thread_identity.o \
absl/base/internal/throw_delegate.o \
absl/base/internal/unscaledcycleclock.o \
absl/base/log_severity.o \
absl/container/internal/hashtablez_sampler_force_weak_definition.o \
absl/container/internal/hashtablez_sampler.o \
absl/container/internal/raw_hash_set.o \
absl/debugging/failure_signal_handler.o \
absl/debugging/internal/address_is_readable.o \
absl/debugging/internal/demangle.o \
absl/debugging/internal/elf_mem_image.o \
absl/debugging/internal/examine_stack.o \
absl/debugging/internal/stack_consumption.o \
absl/debugging/internal/vdso_support.o \
absl/debugging/leak_check.o \
absl/debugging/stacktrace.o \
absl/debugging/symbolize.o \
absl/numeric/int128.o \
absl/profiling/internal/exponential_biased.o \
absl/profiling/internal/periodic_sampler.o \
absl/strings/ascii.o \
absl/strings/charconv.o \
absl/strings/cord_analysis.o \
absl/strings/cord_buffer.o \
absl/strings/cord.o \
absl/strings/escaping.o \
absl/strings/internal/charconv_bigint.o \
absl/strings/internal/charconv_parse.o \
absl/strings/internal/cord_internal.o \
absl/strings/internal/cord_rep_btree_navigator.o \
absl/strings/internal/cord_rep_btree_reader.o \
absl/strings/internal/cord_rep_btree.o \
absl/strings/internal/cord_rep_consume.o \
absl/strings/internal/cord_rep_crc.o \
absl/strings/internal/cord_rep_ring.o \
absl/strings/internal/cordz_functions.o \
absl/strings/internal/cordz_handle.o \
absl/strings/internal/cordz_info.o \
absl/strings/internal/cordz_sample_token.o \
absl/strings/internal/escaping.o \
absl/strings/internal/memutil.o \
absl/strings/internal/ostringstream.o \
absl/strings/internal/pow10_helper.o \
absl/strings/internal/str_format/arg.o \
absl/strings/internal/str_format/bind.o \
absl/strings/internal/str_format/extension.o \
absl/strings/internal/str_format/float_conversion.o \
absl/strings/internal/str_format/output.o \
absl/strings/internal/str_format/parser.o \
absl/strings/internal/utf8.o \
absl/strings/match.o \
absl/strings/numbers.o \
absl/strings/str_cat.o \
absl/strings/str_replace.o \
absl/strings/str_split.o \
absl/strings/string_view.o \
absl/strings/substitute.o \
absl/synchronization/barrier.o \
absl/synchronization/blocking_counter.o \
absl/synchronization/internal/create_thread_identity.o \
absl/synchronization/internal/graphcycles.o \
absl/synchronization/internal/per_thread_sem.o \
absl/synchronization/internal/waiter.o \
absl/synchronization/mutex.o \
absl/synchronization/notification.o \
absl/time/civil_time.o \
absl/time/clock.o \
absl/time/duration.o \
absl/time/format.o \
absl/time/internal/cctz/src/civil_time_detail.o \
absl/time/internal/cctz/src/time_zone_fixed.o \
absl/time/internal/cctz/src/time_zone_format.o \
absl/time/internal/cctz/src/time_zone_if.o \
absl/time/internal/cctz/src/time_zone_impl.o \
absl/time/internal/cctz/src/time_zone_info.o \
absl/time/internal/cctz/src/time_zone_libc.o \
absl/time/internal/cctz/src/time_zone_lookup.o \
absl/time/internal/cctz/src/time_zone_posix.o \
absl/time/internal/cctz/src/zone_info_source.o \
absl/time/time.o \
absl/types/bad_any_cast.o \
absl/types/bad_optional_access.o \
absl/types/bad_variant_access.o

OBJECTS = $(ABSL_LIBS) \
cpp-compat.o \
s2-accessors.o \
s2-bounds.o \
s2-cell.o \
s2-cell-union.o \
s2-constructors-formatters.o \
s2-predicates.o \
s2-transformers.o \
init.o \
RcppExports.o \
s2-geography.o \
s2-lnglat.o \
s2-matrix.o \
wk-impl.o \
s2geography/accessors.o \
s2geography/accessors-geog.o \
s2geography/linear-referencing.o \
s2geography/distance.o \
s2geography/build.o \
s2geography/coverings.o \
s2geography/geography.o \
s2geography/predicates.o \
s2/base/stringprintf.o \
s2/base/strtoint.o \
s2/encoded_s2cell_id_vector.o \
s2/encoded_s2point_vector.o \
s2/encoded_s2shape_index.o \
s2/encoded_string_vector.o \
s2/id_set_lexicon.o \
s2/mutable_s2shape_index.o \
s2/r2rect.o \
s2/s1angle.o \
s2/s1chord_angle.o \
s2/s1interval.o \
s2/s2boolean_operation.o \
s2/s2builder_graph.o \
s2/s2builder.o \
s2/s2builderutil_closed_set_normalizer.o \
s2/s2builderutil_find_polygon_degeneracies.o \
s2/s2builderutil_lax_polygon_layer.o \
s2/s2builderutil_s2point_vector_layer.o \
s2/s2builderutil_s2polygon_layer.o \
s2/s2builderutil_s2polyline_layer.o \
s2/s2builderutil_s2polyline_vector_layer.o \
s2/s2builderutil_snap_functions.o \
s2/s2builderutil_testing.o \
s2/s2cap.o \
s2/s2cell_id.o \
s2/s2cell_index.o \
s2/s2cell_union.o \
s2/s2cell.o \
s2/s2centroids.o \
s2/s2closest_cell_query.o \
s2/s2closest_edge_query.o \
s2/s2closest_point_query.o \
s2/s2contains_vertex_query.o \
s2/s2convex_hull_query.o \
s2/s2coords.o \
s2/s2crossing_edge_query.o \
s2/s2debug.o \
s2/s2earth.o \
s2/s2edge_clipping.o \
s2/s2edge_crosser.o \
s2/s2edge_crossings.o \
s2/s2edge_distances.o \
s2/s2edge_tessellator.o \
s2/s2error.o \
s2/s2furthest_edge_query.o \
s2/s2latlng_rect_bounder.o \
s2/s2latlng_rect.o \
s2/s2latlng.o \
s2/s2lax_loop_shape.o \
s2/s2lax_polygon_shape.o \
s2/s2lax_polyline_shape.o \
s2/s2loop_measures.o \
s2/s2loop.o \
s2/s2max_distance_targets.o \
s2/s2measures.o \
s2/s2metrics.o \
s2/s2min_distance_targets.o \
s2/s2padded_cell.o \
s2/s2point_compression.o \
s2/s2point_region.o \
s2/s2pointutil.o \
s2/s2polygon.o \
s2/s2polyline_alignment.o \
s2/s2polyline_measures.o \
s2/s2polyline_simplifier.o \
s2/s2polyline.o \
s2/s2predicates.o \
s2/s2projections.o \
s2/s2r2rect.o \
s2/s2region_coverer.o \
s2/s2region_intersection.o \
s2/s2region_term_indexer.o \
s2/s2region_union.o \
s2/s2region.o \
s2/s2shape_index_buffered_region.o \
s2/s2shape_index_measures.o \
s2/s2shape_index.o \
s2/s2shape_measures.o \
s2/s2shapeutil_build_polygon_boundaries.o \
s2/s2shapeutil_coding.o \
s2/s2shapeutil_contains_brute_force.o \
s2/s2shapeutil_edge_iterator.o \
s2/s2shapeutil_get_reference_point.o \
s2/s2shapeutil_range_iterator.o \
s2/s2shapeutil_visit_crossing_edge_pairs.o \
s2/s2testing.o \
s2/s2text_format.o \
s2/s2wedge_relations.o \
s2/strings/ostringstream.o \
s2/strings/serialize.o \
s2/util/bits/bit-interleave.o \
s2/util/bits/bits.o \
s2/util/coding/coder.o \
s2/util/coding/varint.o \
s2/util/math/exactfloat/exactfloat.o \
s2/util/math/mathutil.o \
s2/util/units/length-units.o
16 changes: 8 additions & 8 deletions src/RcppExports.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1344,14 +1344,14 @@ BEGIN_RCPP
END_RCPP
}

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();
RcppExport SEXP c_s2_trans_s2_point_new();
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_trans_s2_lnglat_new(void);
RcppExport SEXP c_s2_trans_s2_point_new(void);

static const R_CallMethodDef CallEntries[] = {
{"_s2_cpp_s2_init", (DL_FUNC) &_s2_cpp_s2_init, 0},
Expand Down
Loading

0 comments on commit ba9ccc9

Please sign in to comment.