summaryrefslogtreecommitdiffstats
path: root/bin/build
blob: 8d91a90d9604d455eafe32f0a3dfc09a17179fe6 (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
#!/bin/bash
set -e
set -x
root=$INROOT_DIR
if test -z "$root"; then
  echo "INROOT_DIR not set; run under inroot"
  exit 1
fi
shift || true
if test -d /lib64; then
  libdir=$root/lib64
else
  libdir=$root/lib
fi
configargs="--prefix=$root --libdir=$libdir $@"
if ! test -x configure; then
  if test -f autogen.sh; then
    inroot $root ./autogen.sh $configargs
  else
    autoreconf -f -i
    inroot $root ./configure $configargs
  fi
fi
# We need to rerun configure if the prefix changed
prefix_matches=yes
if test -f config.log; then
  previous_prefix=$(grep '^prefix=' config.log | cut -f 2 -d '=')
  if test previous_prefix != $root; then
    prefix_matches=no
  fi
fi
if ! test -f Makefile || test x$prefix_matches = xno; then
  inroot $root ./configure $configargs
fi
nproc=$(($(grep -c ^processor /proc/cpuinfo) * 2))
make -j $nproc $MAKEARGS