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
+ # prepare build config
24
+ CFG_FLAGS=" --prefix=$MR_BUILD_PREFIX --disable-dependency-tracking --disable-silent-rules --disable-apidoc --enable-static --disable-shared"
25
+ CFLAGS=" $MR_DEFAULT_CFLAGS "
26
+
27
+ if [[ " $MR_DEBUG " == " debug" ]]; then
28
+ CFG_FLAGS=" ${CFG_FLAGS} use_examples=yes"
29
+ fi
30
+
31
+ # for cross compile
32
+ if [[ $( uname -m) != " $MR_ARCH " || " $MR_FORCE_CROSS " ]]; then
33
+ echo " [*] cross compile, on $( uname -m) compile $MR_PLAT $MR_ARCH ."
34
+ # https://www.gnu.org/software/automake/manual/html_node/Cross_002dCompilation.html
35
+ # aarch64-linux-android21
36
+ CFG_FLAGS=" $CFG_FLAGS --host=$MR_FF_ARCH -linux-android$MR_ANDROID_API --with-sysroot=$MR_SYS_ROOT "
37
+ fi
38
+
39
+ echo " ----------------------"
40
+ echo " [*] configurate $LIB_NAME "
41
+ echo " ----------------------"
42
+
43
+ cd $MR_BUILD_SOURCE
44
+
45
+ if [[ -f ' configure' ]]; then
46
+ echo " reuse configure"
47
+ else
48
+ echo " auto generate configure"
49
+ autoreconf -if > /dev/null
50
+ fi
51
+
52
+
53
+ echo
54
+ echo " CC: $MR_TRIPLE_CC "
55
+ echo " CFG_FLAGS: $CFG_FLAGS "
56
+ echo " CFLAGS: $CFLAGS "
57
+ echo
58
+
59
+ export CFLAGS=" $CFLAGS "
60
+ export LDFLAGS=" $CFLAGS "
61
+ export STRIP=" $MR_STRIP "
62
+ export CC=" $MR_TRIPLE_CC "
63
+ export CXX=" $MR_TRIPLE_CXX "
64
+ export AR=" $MR_AR "
65
+ export AS=" $MR_AS "
66
+ export RANLIB=" $MR_RANLIB "
67
+
68
+ ./configure $CFG_FLAGS
69
+
70
+ # ----------------------
71
+ echo " ----------------------"
72
+ echo " [*] compile $LIB_NAME "
73
+ echo " ----------------------"
74
+
75
+ make install -j$MR_HOST_NPROC > /dev/null
0 commit comments