2020-12-07 15:22:20 +08:00
#!/bin/bash
2021-10-09 18:01:27 +08:00
# Licensed to the LF AI & Data foundation under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
2020-12-07 15:22:20 +08:00
SOURCE = ${ BASH_SOURCE [0] }
while [ -h $SOURCE ] ; do # resolve $SOURCE until the file is no longer a symlink
DIR = $( cd -P $( dirname $SOURCE ) && pwd )
SOURCE = $( readlink $SOURCE )
[ [ $SOURCE != /* ] ] && SOURCE = $DIR /$SOURCE # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR = $( cd -P $( dirname $SOURCE ) && pwd )
# DIR=${DIR}/../internal/storage/cwrapper
CMAKE_BUILD = ${ DIR } /../cwrapper_build
OUTPUT_LIB = ${ DIR } /../internal/storage/cwrapper/output
SRC_DIR = ${ DIR } /../internal/storage/cwrapper
if [ ! -d ${ CMAKE_BUILD } ] ; then
mkdir ${ CMAKE_BUILD }
fi
2021-12-14 10:33:21 +08:00
mkdir -p ${ OUTPUT_LIB }
2020-12-07 15:22:20 +08:00
BUILD_TYPE = "Debug"
2020-12-08 18:51:07 +08:00
CUSTOM_THIRDPARTY_PATH = ""
2020-12-07 15:22:20 +08:00
2020-12-08 18:51:07 +08:00
while getopts "a:b:t:h:f:" arg; do
2020-12-07 15:22:20 +08:00
case $arg in
2020-12-08 18:51:07 +08:00
f)
CUSTOM_THIRDPARTY_PATH = $OPTARG
; ;
2020-12-07 15:22:20 +08:00
t)
BUILD_TYPE = $OPTARG # BUILD_TYPE
; ;
a)
GIT_ARROW_REPO = $OPTARG
; ;
b)
GIT_ARROW_TAG = $OPTARG
; ;
h) # help
echo " -t: build type(default: Debug)
-a: arrow repo( default: https://github.com/apache/arrow.git)
-b: arrow tag( default: apache-arrow-2.0.0)
2020-12-08 18:51:07 +08:00
-f: custom thirdparty path( default: "" )
2020-12-07 15:22:20 +08:00
-h: help
"
exit 0
; ;
?)
echo "ERROR! unknown argument"
exit 1
; ;
esac
done
echo "BUILD_TYPE: " $BUILD_TYPE
2020-12-08 18:51:07 +08:00
echo "CUSTOM_THIRDPARTY_PATH: " $CUSTOM_THIRDPARTY_PATH
2020-12-07 15:22:20 +08:00
2022-03-17 17:17:22 +08:00
# MSYS system
CMAKE_GENERATOR = "Unix Makefiles"
if [ " $MSYSTEM " = = "MINGW64" ] ; then
CMAKE_GENERATOR = "MSYS Makefiles"
fi
2020-12-07 15:22:20 +08:00
pushd ${ CMAKE_BUILD }
2020-12-08 18:51:07 +08:00
CMAKE_CMD = " cmake \
2022-03-17 17:17:22 +08:00
${ CMAKE_EXTRA_ARGS } \
2020-12-08 18:51:07 +08:00
-DCMAKE_INSTALL_PREFIX= ${ OUTPUT_LIB } \
-DCMAKE_BUILD_TYPE= ${ BUILD_TYPE } \
-DCUSTOM_THIRDPARTY_DOWNLOAD_PATH= ${ CUSTOM_THIRDPARTY_PATH } ${ SRC_DIR } "
2022-03-17 17:17:22 +08:00
${ CMAKE_CMD } -G " ${ CMAKE_GENERATOR } "
2020-12-08 18:51:07 +08:00
echo ${ CMAKE_CMD }
if [ [ ! ${ jobs +1 } ] ] ; then
2022-02-09 14:27:46 +08:00
unameOut = " $( uname -s) "
case " ${ unameOut } " in
Linux*) jobs = $( nproc) ; ;
2022-03-17 17:17:22 +08:00
MINGW64*) jobs = $( nproc) ; ;
2022-02-09 14:27:46 +08:00
Darwin*) jobs = $( sysctl -n hw.physicalcpu) ; ;
*) echo " UNKNOWN: ${ unameOut } " ; exit 0;
esac
2020-12-08 18:51:07 +08:00
fi
make -j ${ jobs } && make install