1+ #! /usr/bin/env bash
2+ #
3+ # Copyright (C) 2021 Matt Reach<[email protected] >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 " === [$0 ] check env begin==="
24+ env_assert " MR_ARCH"
25+ env_assert " MR_BUILD_NAME"
26+ env_assert " MR_CC"
27+ env_assert " MR_BUILD_SOURCE"
28+ env_assert " MR_BUILD_PREFIX"
29+ env_assert " MR_SYS_ROOT"
30+ env_assert " MR_HOST_NPROC"
31+ echo " MR_DEBUG:$MR_DEBUG "
32+ echo " ===check env end==="
33+
34+ CFG_FLAGS=" --prefix=$MR_BUILD_PREFIX --enable-static --disable-shared --silent"
35+ CFLAGS=" $MR_OTHER_CFLAGS "
36+
37+ # for cross compile
38+ if [[ $( uname -m) != " $MR_ARCH " || " $MR_FORCE_CROSS " ]]; then
39+ echo " [*] cross compile, on $( uname -m) compile $MR_PLAT $MR_ARCH ."
40+ # https://www.gnu.org/software/automake/manual/html_node/Cross_002dCompilation.html
41+ CFLAGS=" $CFLAGS -isysroot $MR_SYS_ROOT "
42+ CFG_FLAGS=" $CFG_FLAGS --host=$MR_ARCH -apple-darwin --with-sysroot=$MR_SYS_ROOT "
43+ fi
44+
45+ cd $MR_BUILD_SOURCE
46+
47+ echo
48+ echo " CC: $MR_CC "
49+ echo " CFG_FLAGS: $CFG_FLAGS "
50+ echo " CFLAGS: $CFLAGS "
51+ echo
52+
53+ echo " ----------------------"
54+ echo " [*] configurate $LIB_NAME "
55+ echo " ----------------------"
56+
57+ echo " generate configure"
58+
59+ ./autogen.sh 1> /dev/null
60+
61+ ./configure $CFG_FLAGS \
62+ CC=" $MR_TRIPLE_CC " \
63+ CFLAGS=" $CFLAGS " \
64+ LDFLAGS=" $CFLAGS " 1> /dev/null
65+
66+ # ----------------------
67+ echo " ----------------------"
68+ echo " [*] compile $LIB_NAME "
69+ echo " ----------------------"
70+
71+ make -j$MR_HOST_NPROC install 1> /dev/null
0 commit comments