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

options_do_configure=1
options_do_build=1
options_do_install=1

if [ "$0" == "-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}"
  CFLAGS_FOR_TARGET="-g -O2 -msoft-float -march=m4k" \
    ../../unpacked/newlib-$newlib_ver/configure \
    --prefix=$prefix_dir \
    --target=$target \
    --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