-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path050-build-newlib.sh
executable file
·65 lines (57 loc) · 1.76 KB
/
050-build-newlib.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/env bash
# Build runtime
# parameters:
# - SCRIPT_ROOT
# - SRC_ROOT
# - BUILD_ROOT
# - INSTALL_PREFIX
# requirements:
# - build-base
# - ninja
# - cmake
# - git
# - patch
# - vim
# - python2
# - curl
# - file
set -e
set -o errexit
source ./config.sh
mkdir -p ${BUILD_ROOT}/newlib
cd ${BUILD_ROOT}/newlib
export CC_FOR_TARGET=${INSTALL_PREFIX}/bin/clang
export CXX_FOR_TARGET=${INSTALL_PREFIX}/bin/clang++
export AR_FOR_TARGET=${INSTALL_PREFIX}/bin/llvm-ar
export NM_FOR_TARGET=${INSTALL_PREFIX}/bin/llvm-nm
export RANLIB_FOR_TARGET=${INSTALL_PREFIX}/bin/llvm-ranlib
export READELF_FOR_TARGET=${INSTALL_PREFIX}/bin/llvm-readelf
export CFLAGS_FOR_TARGET="-target ${XTARGET} -mcpu=${XCPU} ${XFPU} ${XABI} ${XOPTFLAGS} -Wno-unused-command-line-argument"
export AS_FOR_TARGET=${INSTALL_PREFIX}/bin/clang
export LD_FOR_TARGET=${INSTALL_PREFIX}/bin/clang
${SRC_ROOT}/newlib/configure \
--host=`cc -dumpmachine`\
--build=`cc -dumpmachine`\
--target=${XTARGET}\
--prefix=${INSTALL_PREFIX}/${XTARGET}/${XCPUDIR}\
--disable-newlib-supplied-syscalls\
--enable-newlib-reent-small\
--disable-newlib-fvwrite-in-streamio\
--disable-newlib-fseek-optimization\
--disable-newlib-wide-orient\
--enable-newlib-nano-malloc\
--disable-newlib-unbuf-stream-opt\
--enable-lite-exit\
--enable-newlib-global-atexit\
--enable-newlib-nano-formatted-io \
--disable-newlib-fvwrite-in-streamio \
--disable-nls
# --disable-newlib-nano-formatted-io \
# --enable-newlib-io-c99-formats \
# --enable-newlib-io-float \
# --disable-newlib-io-long-double \
make
make install
cp -rf ${INSTALL_PREFIX}/${XTARGET}/${XCPUDIR}/${XTARGET}/* \
${INSTALL_PREFIX}/${XTARGET}/${XCPUDIR}/
rm -r ${INSTALL_PREFIX}/${XTARGET}/${XCPUDIR}/${XTARGET}