1# Copyright (c) Hisilicon Technologies Co., Ltd. 2021-2022. All rights reserved. 2#!/bin/sh 3 4# error out on errors 5set -e 6OUT_DIR="$1" 7BOARD_NAME="$2" 8OS_TYPE="$3" 9CC_PATH="$4" 10 11function main(){ 12 CUR_DIR=$(cd $(dirname "$0");pwd) 13 ROOT_DIR=$CUR_DIR/../../../../../../.. 14 COMPILER_TYPE="clang" 15 export LLVM_COMPILER=y 16 CONFIGURE_FILE=configure_llvm 17 echo "###### $BOARD_NAME:$OS_TYPE ######" 18 19 FF_CONFIG_SH=disable_decoder_config.sh 20 FFMPEG_ORIGN_DIR=$ROOT_DIR/third_party/ffmpeg 21 FFMPEG_DIR=$CUR_DIR/ffmpeg 22 23 ############################################ 24 # copy ffmpeg file to current path 25 ############################################ 26 cp -r $FFMPEG_ORIGN_DIR $CUR_DIR 27 28 ############################################ 29 # copy sh to ffmpeg file patch 30 ############################################ 31 cp $CUR_DIR/$CONFIGURE_FILE $FFMPEG_DIR/configure_temp 32 cp $CUR_DIR/adapt_config.sh $FFMPEG_DIR/adapt_config.sh 33 cp $CUR_DIR/disable_decoder_config.sh $FFMPEG_DIR/disable_decoder_config.sh 34 cp $CUR_DIR/library.mak $FFMPEG_DIR/ffbuild/library.mak 35 cp $CUR_DIR/Makefile_llvm $FFMPEG_DIR/Makefile 36 chmod -R 777 $FFMPEG_DIR 37 cd $FFMPEG_DIR 38 39 ############################################ 40 # run ./disable_decoder_config.sh 41 ############################################ 42 echo "######################" 43 echo "###### run ./disable_decoder_config.sh ######" 44 echo "###### BOARD_NAME=$BOARD_NAME OS_TYPE=$OS_TYPE COMPILER_TYPE=$COMPILER_TYPE CC_PATH=$CC_PATH ######" 45 echo "######################" 46 ./disable_decoder_config.sh $CC_PATH; 47 48 ############################################ 49 # run ./adapt_config.sh 50 ############################################ 51 echo "######################" 52 echo "###### run ./adapt_config.sh ######" 53 echo "######################" 54 ./adapt_config.sh 55 56 ############################################ 57 # make and make install 58 ############################################ 59 echo "######################" 60 echo "###### run make -j16 ######" 61 echo "######################" 62 make -j16 63 64 echo "######################" 65 echo "###### run make install ######" 66 echo "######################" 67 make install 68 69 ############################################# 70 # copy library 71 ############################################# 72 cp -rf $FFMPEG_DIR/install/lib/libavcodec.so $OUT_DIR/ 73 cp -rf $FFMPEG_DIR/install/lib/libavformat.so $OUT_DIR/ 74 cp -rf $FFMPEG_DIR/install/lib/libavutil.so $OUT_DIR/ 75 cp -rf $FFMPEG_DIR/install/lib/libswresample.so $OUT_DIR/ 76 77 cd -; 78 rm -rf $FFMPEG_DIR 79} 80 81main "$@"