summaryrefslogtreecommitdiff
path: root/5-build-newlib.sh
blob: 4cbf3a74e387ddbe6baeae955628baed83dc4584 (plain)
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
#!/bin/sh
source ./common
export PATH="$prefix_dir/bin:${PATH:+:${PATH}}"

options_do_configure=1
options_do_build=1
options_do_install=1

if [ "$1" == "-i" ]; then
  options_do_configure=
  options_do_build=
  options_do_install=1
fi

mkdir -p build/newlib-$newlib_ver
cd build/newlib-$newlib_ver
if [ -n "$options_do_configure" ]; then
  echo "Configuring newlib-${newlib_ver}"
  ../../unpacked/newlib-$newlib_ver/configure \
    --prefix=$prefix_dir \
    --target=$target \
    --enable-option-checking \
    --enable-lto \
    --enable-newlib-io-c99-formats \
    --enable-newlib-io-long-long \
    --disable-newlib-atexit-dynamic-alloc \
    --disable-newlib-supplied-syscalls \
    --enable-newlib-reent-small \
    --disable-newlib-fvwrite-in-streamio \
    --disable-newlib-fseek-optimization \
    --disable-newlib-wide-orient \
    --disable-newlib-unbuf-stream-opt \
    --enable-newlib-global-atexit \
    --enable-newlib-retargetable-locking \
    --enable-newlib-global-stdio-streams \
    --disable-newlib-atexit-dynamic-alloc \
    --enable-newlib-nano-formatted-io \
    --with-float=soft \
    --enable-soft-float \
    >configure.log 2>&1
  ret=$?
  if [ $ret -ne 0 ]; then less configure.log; exit 1; fi
fi
if [ -n "$options_do_build" ]; then
  echo "Building newlib-$newlib_ver"
  make -j$jobs >build.log 2>&1
  ret=$?
  if [ $ret -ne 0 ]; then less build.log; exit 1; fi
fi
if [ -n "$options_do_install" ]; then
  echo "Installing newlib-$newlib_ver"
  make install >install.log 2>&1
  ret=$?
  if [ $ret -ne 0 ]; then less install.log; exit 1; fi
fi
if [ -z "$options_do_configure$options_do_build$options_do_install" ]; then
  echo "Nothing to be done for newlib-$newlib_ver"
else
  echo "Done with newlib-$newlib_ver"
fi