1# 编译前请先设置参数
2sys_root=$DRAGONOS_SYSROOT
3mpc_path=请填写mpc的路径
4
5# 要安装到的目录
6PREFIX=/usr
7current_path=$(pwd)
8
9if [ ! -d ${mpc_path} ]; then
10    echo "Error: ${mpc_path} not found"
11    exit 1
12fi
13
14if [ ! -d ${sysroot} ]; then
15    echo "Error: ${sysroot} not found"
16    exit 1
17fi
18
19cd ${mpc_path}
20autoreconf --install || exit 1
21autoconf
22sed -i 's/ios[*]/ios* | dragonos* /' build-aux/config.sub
23
24cd ${current_path}
25
26mkdir -p build || exit 1
27mkdir -p ${PREFIX} || exit 1
28
29cd build
30${mpc_path}/configure --prefix=${PREFIX} --host=x86_64-dragonos --target=x86_64-dragonos --with-mpfr=$sys_root/usr --with-gmp=$sys_root/usr || exit 1
31make -j $(nproc) || exit 1
32make DESTDIR=${sys_root} install || exit 1
33make clean
34cd ..
35rm -rf build