1+ #! /usr/bin/env bash
2+ #
3+ # Copyright (C) 2021 Matt Reach<qianlongxu@gmail.com>
4+
5+ # Licensed under the Apache License, Version 2.0 (the "License");
6+ # you may not use this file except in compliance with the License.
7+ # You may obtain a copy of the License at
8+ #
9+ # http://www.apache.org/licenses/LICENSE-2.0
10+ #
11+ # Unless required by applicable law or agreed to in writing, software
12+ # distributed under the License is distributed on an "AS IS" BASIS,
13+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+ # See the License for the specific language governing permissions and
15+ # limitations under the License.
16+ #
17+
18+ set -e
19+
20+ THIS_DIR=$( DIRNAME=$( dirname " $0 " ) ; cd " $DIRNAME " ; pwd)
21+ cd " $THIS_DIR "
22+
23+ echo " ----------------------"
24+ echo " [*] configure $LIB_NAME "
25+ echo " ----------------------"
26+
27+ cd $MR_BUILD_SOURCE
28+
29+ cd dolby_vision
30+
31+ build_dir=" ${MR_BUILD_SOURCE} /dolby_vision_build"
32+ rm -rf " $build_dir "
33+ mkdir -p " $build_dir "
34+ cd " $build_dir "
35+
36+ export CC=" $MR_CC "
37+ export CXX=" $MR_CXX "
38+ export CFLAGS=" -fPIC $CFLAGS "
39+ export CXXFLAGS=" -fPIC $CXXFLAGS "
40+
41+ if [[ " $MR_DEBUG " == " debug" ]]; then
42+ build_type=" debug"
43+ else
44+ build_type=" release"
45+ fi
46+
47+ echo " ----------------------"
48+ echo " [*] compile $LIB_NAME "
49+ echo " ---------------------"
50+ echo " CC: $MR_CC "
51+ echo " CFLAGS: $CFLAGS "
52+ echo " build_type: $build_type "
53+ echo " prefix: $MR_BUILD_PREFIX "
54+ echo " ----------------------"
55+
56+ MANIFEST_PATH=" ${MR_BUILD_SOURCE} /dolby_vision/Cargo.toml"
57+
58+ arch_target () {
59+ local arch=" $1 "
60+ case " $arch " in
61+ arm64)
62+ echo " aarch64-apple-ios"
63+ ;;
64+ arm64_simulator)
65+ echo " aarch64-apple-ios-sim"
66+ ;;
67+ x86_64_simulator)
68+ echo " x86_64-apple-ios"
69+ ;;
70+ * )
71+ echo " $arch -apple-ios"
72+ ;;
73+ esac
74+ }
75+
76+ target=$( arch_target " $MR_ARCH " )
77+
78+ cargo cinstall \
79+ --manifest-path=" $MANIFEST_PATH " \
80+ --target=" $target " \
81+ --prefix=" $MR_BUILD_PREFIX " \
82+ --lib \
83+ --library-type=staticlib \
84+ --release \
85+ --no-default-features \
86+ --features capi
87+
88+ echo " ----------------------"
89+ echo " [*] install $LIB_NAME "
90+ echo " ----------------------"
0 commit comments