-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:r-spatial/s2
- Loading branch information
Showing
660 changed files
with
77,350 additions
and
9,139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
tools/vendor/abseil-cpp linguist-vendored |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,6 @@ | |
.vscode | ||
docs | ||
configure.log | ||
.cache | ||
compile_commands.json | ||
windows |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
#!/bin/sh | ||
rm -f src/Makevars configure.log autobrew | ||
rm `find src -name *.o` | ||
rm `find src -name "*.o"` | ||
rm `find src -name "*.a"` | ||
rm `find src -name "*.tmp"` | ||
rm -rf tools/build | ||
rm -rf tools/dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
|
||
# On R 4.3 and 4.4, Abseil can be resolved using pkg-config. Otherwise, | ||
# build a copy of Abseil-cpp using CMake. | ||
if pkg-config absl_base --libs 2>/dev/null; then | ||
echo "Using Abseil from RTools via pkg-config" | ||
else | ||
# Build the libraries | ||
CMAKE_INSTALL_PREFIX="`pwd`/tools/dist" | ||
WIN_CPPFLAGS="-DABSL_FORCE_WAITER_MODE=4" tools/build_absl.sh "${CMAKE_INSTALL_PREFIX}" | ||
|
||
# Remove the build directory (its existence causes a check warning on R 4.2) | ||
rm -rf tools/build | ||
fi | ||
|
||
# On R 4.3 and 4.4, OpenSSL can be resolved using pkg-config. Otherwise, | ||
# Use rwinlibs to download a static library for that toolchain. | ||
if pkg-config openssl --libs 2>/dev/null; then | ||
echo "Using openssl from RTools via pkg-config" | ||
else | ||
"${R_HOME}/bin/Rscript.exe" "tools/winlibs.R" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,166 +1,30 @@ | ||
|
||
library(tidyverse) | ||
tag <- "20220623.1" | ||
tag <- "20230802.2" | ||
|
||
# download Abseil | ||
source_url <- glue::glue("https://github.com/abseil/abseil-cpp/archive/refs/tags/{tag}.zip") | ||
curl::curl_download(source_url, "data-raw/abseil-cpp-source.zip") | ||
unzip("data-raw/abseil-cpp-source.zip", exdir = "data-raw") | ||
|
||
|
||
absl_copy <- function(src, dst) { | ||
src_files <- list.files(src, "\\.(cc|h|inc)$", recursive = TRUE) %>% | ||
str_subset("_test(ing)?\\.(cc|h)$", negate = TRUE) %>% | ||
str_subset("test_", negate = TRUE) %>% | ||
str_subset("_benchmark", negate = TRUE) | ||
|
||
dst_files <- file.path(dst, src_files) | ||
dst_dirs <- unique(dirname(dst_files)) | ||
for (d in sort(dst_dirs)) { | ||
if (!dir.exists(d)) dir.create(d, recursive = TRUE) | ||
} | ||
|
||
stopifnot(all(file.copy(file.path(src, src_files), dst_files))) | ||
} | ||
|
||
unlink("src/absl", recursive = TRUE) | ||
|
||
absl_copy( | ||
glue::glue("data-raw/abseil-cpp-{tag}/absl/container"), | ||
"src/absl/container" | ||
) | ||
|
||
absl_copy( | ||
glue::glue("data-raw/abseil-cpp-{tag}/absl/base"), | ||
"src/absl/base" | ||
) | ||
|
||
absl_copy( | ||
glue::glue("data-raw/abseil-cpp-{tag}/absl/meta"), | ||
"src/absl/meta" | ||
) | ||
|
||
absl_copy( | ||
glue::glue("data-raw/abseil-cpp-{tag}/absl/synchronization"), | ||
"src/absl/synchronization" | ||
) | ||
|
||
absl_copy( | ||
glue::glue("data-raw/abseil-cpp-{tag}/absl/time"), | ||
"src/absl/time" | ||
) | ||
|
||
absl_copy( | ||
glue::glue("data-raw/abseil-cpp-{tag}/absl/strings"), | ||
"src/absl/strings" | ||
) | ||
|
||
absl_copy( | ||
glue::glue("data-raw/abseil-cpp-{tag}/absl/utility"), | ||
"src/absl/utility" | ||
) | ||
|
||
absl_copy( | ||
glue::glue("data-raw/abseil-cpp-{tag}/absl/debugging"), | ||
"src/absl/debugging" | ||
) | ||
|
||
absl_copy( | ||
glue::glue("data-raw/abseil-cpp-{tag}/absl/memory"), | ||
"src/absl/memory" | ||
) | ||
|
||
absl_copy( | ||
glue::glue("data-raw/abseil-cpp-{tag}/absl/types"), | ||
"src/absl/types" | ||
) | ||
|
||
absl_copy( | ||
glue::glue("data-raw/abseil-cpp-{tag}/absl/numeric"), | ||
"src/absl/numeric" | ||
) | ||
|
||
absl_copy( | ||
glue::glue("data-raw/abseil-cpp-{tag}/absl/algorithm"), | ||
"src/absl/algorithm" | ||
) | ||
|
||
absl_copy( | ||
glue::glue("data-raw/abseil-cpp-{tag}/absl/functional"), | ||
"src/absl/functional" | ||
) | ||
|
||
absl_copy( | ||
glue::glue("data-raw/abseil-cpp-{tag}/absl/profiling"), | ||
"src/absl/profiling" | ||
) | ||
|
||
absl_objects <- list.files("src/absl", ".cc$", recursive = TRUE) %>% | ||
file.path("absl", .) %>% | ||
str_subset("\\.cc$") %>% | ||
str_replace("\\.cc$", ".o") %>% | ||
paste0(collapse = " \\\n ") %>% | ||
paste0("ABSL_LIBS = ", .) | ||
|
||
clipr::write_clip(absl_objects) | ||
usethis::edit_file("src/Makevars.win") | ||
usethis::edit_file("src/Makevars.in") | ||
|
||
# Edits needed to make CMD check happy | ||
|
||
# Pragmas | ||
fix_pragmas <- function(f) { | ||
content <- readr::read_file(f) | ||
content <- stringr::str_replace_all(content, "\n#pragma", "\n// #pragma") | ||
readr::write_file(content, f) | ||
} | ||
|
||
fix_pragmas("src/absl/base/internal/invoke.h") | ||
fix_pragmas("src/absl/container/inlined_vector.h") | ||
fix_pragmas("src/absl/container/internal/inlined_vector.h") | ||
fix_pragmas("src/absl/functional/internal/any_invocable.h") | ||
fix_pragmas("src/absl/types/internal/optional.h") | ||
fix_pragmas("src/absl/container/internal/counting_allocator.h") | ||
|
||
# Aborts | ||
fix_aborts <- function(f) { | ||
content <- readr::read_file(f) | ||
content <- stringr::str_replace_all(content, fixed("abort()"), "throw std::runtime_error(\"abort()\")") | ||
readr::write_file(content, f) | ||
} | ||
|
||
fix_aborts("src/absl/base/internal/raw_logging.cc") | ||
fix_aborts("src/absl/base/internal/sysinfo.cc") | ||
fix_aborts("src/absl/debugging/symbolize_elf.inc") | ||
|
||
# Manual updates | ||
|
||
# The symbolizer implementation causes some trouble. We don't use this feature here | ||
# and there seems to be a way to turn it off completely. Do this. | ||
usethis::edit_file("src/absl/debugging/symbolize.cc") | ||
|
||
# On Windows, R.h defines a macro 'Free', which we have to undefine | ||
usethis::edit_file("src/absl/base/internal/low_level_alloc.h") | ||
|
||
# On Windows with rtools35 (i.e., very old GCC with incomplete C++11), a reference | ||
# to std::get_time() causes compilation error. We don't need strptime here, so just | ||
# return nullptr in this function. | ||
usethis::edit_file("src/absl/time/internal/cctz/src/time_zone_format.cc") | ||
|
||
# Windows builds have some additional issues with format strings. These are all within | ||
# absl logger functions...just remove the definition of ABSL_RAW_LOG(...). | ||
usethis::edit_file("src/absl/base/internal/raw_logging.h") | ||
|
||
# Fix a workaround for older gcc that causes a check warning. The bug that the | ||
# workaround is addressing only applies to old gcc, so only use that bit of code | ||
# for old gcc | ||
usethis::edit_file("src/absl/container/internal/raw_hash_set.h") | ||
|
||
# CRAN compiles with -Wpedantic, so we can't use the __int128 intrinsic type | ||
# undefine ABSL_HAVE_INTRINSIC_INT128 here: | ||
usethis::edit_file("src/absl/base/config.h") | ||
|
||
# The use of ABSL_HAVE_CPP_ATTRIBUTE() with ABSL_FALLTHROUGH_INTENDED | ||
# here uses C++17 attributes even if -std=c++17 is not set, | ||
# which causes CRAN warnings with -Wpedantic | ||
usethis::edit_file("src/absl/base/attributes.h") | ||
unzip("data-raw/abseil-cpp-source.zip", exdir = "tools/vendor") | ||
file.rename(glue::glue("tools/vendor/abseil-cpp-{tag}"), "tools/vendor/abseil-cpp") | ||
|
||
# prune unused components | ||
unlink("tools/vendor/abseil-cpp/.github", recursive = TRUE) | ||
unlink("tools/vendor/abseil-cpp/.clang-format") | ||
unlink("tools/vendor/abseil-cpp/ci", recursive = TRUE) | ||
unlink(list.files("tools/vendor/abseil-cpp", "\\.py$", full.names = TRUE)) | ||
unlink( | ||
list.files( | ||
"tools/vendor/abseil-cpp/absl", "_test.cc$", | ||
full.names = TRUE, | ||
recursive = TRUE | ||
) | ||
) | ||
unlink( | ||
list.files( | ||
"tools/vendor/abseil-cpp/absl", "_benchmark.cc$", | ||
full.names = TRUE, | ||
recursive = TRUE | ||
) | ||
) | ||
unlink("tools/vendor/abseil-cpp/absl/time/internal/cctz/testdata", recursive = TRUE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
*.so | ||
*.dll | ||
Makevars | ||
s2/libs2static.a |
Oops, something went wrong.