1#!/bin/bash 2 3# Licensed to the Apache Software Foundation (ASF) under one 4# or more contributor license agreements. See the NOTICE file 5# distributed with this work for additional information 6# regarding copyright ownership. The ASF licenses this file 7# to you under the Apache License, Version 2.0 (the 8# "License"); you may not use this file except in compliance 9# with the License. You may obtain a copy of the License at 10# 11# http://www.apache.org/licenses/LICENSE-2.0 12# 13# Unless required by applicable law or agreed to in writing, 14# software distributed under the License is distributed on an 15# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16# KIND, either express or implied. See the License for the 17# specific language governing permissions and limitations 18# under the License. 19 20 21# generate code 22if [ "$ARROW_R_DEV" == "TRUE" ]; then 23 echo "*** Generating code with data-raw/codegen.R" 24 "${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" data-raw/codegen.R 25fi 26 27VERSION=$(grep ^Version DESCRIPTION | sed s/Version:\ //) 28# Try to find/download a C++ Arrow binary, 29# including possibly a local .zip file if RWINLIB_LOCAL is set 30"${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" "tools/winlibs.R" $VERSION $RWINLIB_LOCAL 31# If binary not found, script exits nonzero 32if [ $? -ne 0 ]; then 33 echo "Arrow C++ library was not found" 34fi 35 36# Set the right flags to point to and enable arrow/parquet 37# It's possible that the version of the libarrow binary is not identical to the 38# R version, e.g. if the R build is a patch release, so find what the dir is 39# actually called: 40RWINLIB="../windows/$(ls windows/ | grep ^arrow-)" 41OPENSSL_LIBS="-lcrypto -lcrypt32" 42 43PKG_CFLAGS="-I${RWINLIB}/include -DARROW_STATIC -DPARQUET_STATIC -DARROW_DS_STATIC -DARROW_R_WITH_ARROW" 44PKG_LIBS="-L${RWINLIB}/lib"'$(subst gcc,,$(COMPILED_BY))$(R_ARCH) '"-L${RWINLIB}/lib"'$(R_ARCH) '"-lparquet -larrow_dataset -larrow -lthrift -lsnappy -lz -lzstd -llz4 ${OPENSSL_LIBS} -lws2_32" 45 46# Set any user-defined CXXFLAGS 47if [ "$ARROW_R_CXXFLAGS" ]; then 48 PKG_CFLAGS="$PKG_CFLAGS $ARROW_R_CXXFLAGS" 49fi 50 51echo "*** Writing Makevars.win" 52sed -e "s|@cflags@|$PKG_CFLAGS|" -e "s|@libs@|$PKG_LIBS|" src/Makevars.in > src/Makevars.win 53# Success 54exit 0 55