|  | 
|  | 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 | 
|  | 22 | +if [ "$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 | 
|  | 25 | +fi | 
|  | 26 | + | 
|  | 27 | +VERSION=$(grep ^Version DESCRIPTION | sed s/Version:\ //) | 
|  | 28 | +# Try to find/download a C++ Arrow binary | 
|  | 29 | +"${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" "tools/winlibs.R" $VERSION | 
|  | 30 | +# If binary not found, script exits nonzero | 
|  | 31 | +if [ $? -ne 0 ]; then | 
|  | 32 | +  # We'll have to install without libarrow. Note to the user how to rectify. | 
|  | 33 | +  echo "------------------------- NOTE ---------------------------" | 
|  | 34 | +  echo "After installation, please run arrow::install_arrow() to install" | 
|  | 35 | +  echo "required runtime libraries" | 
|  | 36 | +  echo "---------------------------------------------------------" | 
|  | 37 | +else | 
|  | 38 | +  # Set the right flags to point to and enable arrow/parquet | 
|  | 39 | +  RWINLIB="../windows/arrow-${VERSION}" | 
|  | 40 | +  PKG_CFLAGS="-I${RWINLIB}/include -DARROW_STATIC -DPARQUET_STATIC -DARROW_R_WITH_PARQUET -DARROW_R_WITH_ARROW" | 
|  | 41 | +  PKG_LIBS="-L${RWINLIB}/lib"'$(subst gcc,,$(COMPILED_BY))$(R_ARCH) '"-L${RWINLIB}/lib"'$(R_ARCH) '"-lparquet -larrow -lthrift -lboost_regex-mt-s -ldouble-conversion -lz -lws2_32" | 
|  | 42 | +fi | 
|  | 43 | + | 
|  | 44 | +echo "*** Writing Makevars.win" | 
|  | 45 | +sed -e "s|@cflags@|$PKG_CFLAGS|" -e "s|@libs@|$PKG_LIBS|" src/Makevars.in > src/Makevars.win | 
|  | 46 | +# Success | 
|  | 47 | +exit 0 | 
0 commit comments