karldw commented on a change in pull request #11001: URL: https://github.com/apache/arrow/pull/11001#discussion_r697026914
########## File path: r/tools/nixlibs.R ########## @@ -415,10 +389,134 @@ cmake_version <- function(cmd = "cmake") { ) } +turn_off_thirdparty_features <- function(env_vars) { + + # Because these are done as environment variables (as opposed to build flags), + # setting these to "OFF" overrides any previous setting. We don't need to + # check the existing value. + turn_off <- c( + "ARROW_MIMALLOC=OFF", + "ARROW_JEMALLOC=OFF", + "ARROW_PARQUET=OFF", # depends on thrift + "ARROW_DATASET=OFF", # depends on parquet + "ARROW_S3=OFF", + "ARROW_WITH_BROTLI=OFF", + "ARROW_WITH_BZ2=OFF", + "ARROW_WITH_LZ4=OFF", + "ARROW_WITH_SNAPPY=OFF", + "ARROW_WITH_ZLIB=OFF", + "ARROW_WITH_ZSTD=OFF", + "ARROW_WITH_RE2=OFF", + "ARROW_WITH_UTF8PROC=OFF", + # NOTE: this code sets the environment variable ARROW_JSON to "OFF", but + # that setting is will *not* be honored by build_arrow_static.sh until + # ARROW-13768 is resolved. + "ARROW_JSON=OFF", + # The syntax to turn off XSIMD is different. + 'EXTRA_CMAKE_FLAGS="-DARROW_SIMD_LEVEL=NONE"' + ) + if (Sys.getenv("EXTRA_CMAKE_FLAGS") != "") { + # Error rather than overwriting EXTRA_CMAKE_FLAGS + # (Correctly inserting the flag into an existing quoted string is tricky) + stop("Sorry, setting EXTRA_CMAKE_FLAGS is not supported at this time.") + } + paste(env_vars, paste(turn_off, collapse = " ")) +} + +set_thirdparty_urls <- function(env_vars) { + deps_dir <- Sys.getenv("ARROW_THIRDPARTY_DEPENDENCY_DIR") + files <- list.files(deps_dir, full.names = FALSE) + if (length(files) == 0) { + # This will be true if the variable is unset, if it's set but the directory + # doesn't exist, or if it exists but is empty. + return(env_vars) + } + dep_names <- c( + "absl", # not used; seems to be a dependency of gRPC + "aws-sdk-cpp", + "aws-checksums", + "aws-c-common", + "aws-c-event-stream", + "boost", + "brotli", + "bzip2", + "cares", # not used; "a dependency of gRPC" + "gbenchmark", # not used; "Google benchmark, for testing" + "gflags", # not used; "for command line utilities (formerly Googleflags)" + "glog", # not used; "for logging" + "grpc", # not used; "for remote procedure calls" + "gtest", # not used; "Googletest, for testing" + "jemalloc", + "lz4", + "mimalloc", + "orc", # not used; "for Apache ORC format support" + "protobuf", # not used; "Google Protocol Buffers, for data serialization" + "rapidjson", + "re2", + "snappy", + "thrift", + "utf8proc", + "xsimd", + "zlib", + "zstd" + ) + dep_regex <- paste0("^(", paste(dep_names, collapse = "|"), ").*") + # If there were extra files in the folder (not matching our regex) drop them. + files <- files[grepl(dep_regex, files, perl = TRUE)] + # Convert e.g. "thrift-0.13.0.tar.gz" to ARROW_THRIFT_URL + # Note that if there's no file called thrift*, we won't add + # ARROW_THRIFT_URL to env_vars. + url_env_varname <- sub(dep_regex, "ARROW_\\1_URL", files, perl = TRUE) + url_env_varname <- toupper(gsub("-", "_", url_env_varname, fixed = TRUE)) + # Special case: ARROW_AWSSDK_URL for aws-sdk-cpp-<version>.tar.gz + url_env_varname <- sub("ARROW_AWS_SDK_CPP_URL", "ARROW_AWSSDK_URL", url_env_varname, fixed = TRUE) Review comment: This isn't the most clear. Let me know if you want a different approach! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org