1#!/bin/bash 2# Copyright (c) 2021 Huawei Device Co., Ltd. 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15set -e 16echo "++++++++++++++++++++++++++++++++++" 17echo "build llvm" 18#date +%F ' '%H:%M:%S 19#echo $@ 20 21BIN_PATH=$(cd $(dirname $0);pwd) 22JSRUNTIME_HOME=$(dirname $(dirname ${BIN_PATH})) 23BASE_HOME=${JSRUNTIME_HOME}/../../ 24 25echo ${BIN_PATH} 26echo ${BASE_HOME} 27 28if [ ! -d "${BASE_HOME}/third_party/third_party_llvm-project" ]; then 29 cd ${BASE_HOME}/third_party 30 dd if=/dev/zero of=/tmp/mem.swap bs=1M count=4096 31 git clone git@gitee.com:openharmony-sig/third_party_llvm-project.git -b llvmorg-12.0.1-ark 32fi 33 34cd ${BASE_HOME}/third_party/third_party_llvm-project 35if [ ! -d "build" ];then 36 mkdir build && cd build 37 cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DBUILD_ARK_GC_SUPPORT=ON -DLLVM_ENABLE_TERMINFO=OFF DLLVM_STATIC_LINK_CXX_STDLIB=OFF -DLLVM_ENABLE_ZLIB=OFF ../llvm 38 ninja 39else 40 cd build 41 if [ ! -d "lib" ]; then 42 rm -rf * 43 cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DBUILD_ARK_GC_SUPPORT=ON -DLLVM_ENABLE_TERMINFO=OFF DLLVM_STATIC_LINK_CXX_STDLIB=OFF -DLLVM_ENABLE_ZLIB=OFF ../llvm 44 ninja 45 fi 46fi 47 48echo "++++++++++++++++++++++++++++++++++" 49