-
-
Notifications
You must be signed in to change notification settings - Fork 47
Expand file tree
/
Copy pathbuild-newlib.sh
More file actions
56 lines (45 loc) · 1.47 KB
/
build-newlib.sh
File metadata and controls
56 lines (45 loc) · 1.47 KB
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
#!/usr/bin/env bash
#---------------------------------------------------------------------------------
#---------------------------------------------------------------------------------
# build and install newlib
#---------------------------------------------------------------------------------
unset CFLAGS
cd $BUILDDIR
OLD_CC=$CC
OLDCXX=$CXX
unset CC
unset CXX
#---------------------------------------------------------------------------------
# build and install newlib
#---------------------------------------------------------------------------------
mkdir -p ${BUILDDIR}/$target/newlib
cd ${BUILDDIR}/$target/newlib
_target_cflags="-O2 -ffunction-sections -fdata-sections"
if [ $VERSION -eq 2 ]; then
_target_cflags="${_target_cflags} -DCUSTOM_MALLOC_LOCK"
fi
if [ ! -f configured-newlib ]
then
CFLAGS_FOR_TARGET="${_target_cflags}" \
../../newlib-$NEWLIB_VER/configure \
--disable-newlib-supplied-syscalls \
--enable-newlib-mb \
--disable-newlib-wide-orient \
--enable-newlib-register-fini \
--target=$target \
--prefix=$prefix \
|| { echo "Error configuring newlib"; exit 1; }
touch configured-newlib
fi
if [ ! -f built-newlib ]
then
$MAKE || { echo "Error building newlib"; exit 1; }
touch built-newlib
fi
if [ ! -f installed-newlib ]
then
$MAKE install -j1 || { echo "Error installing newlib"; exit 1; }
touch installed-newlib
fi
export CC=$OLD_CC
export CXX=$OLD_CXX