source: scripts/locker-build @ 5c81472

debianrelease-1.10release-1.4release-1.5release-1.6release-1.7release-1.8release-1.9
Last change on this file since 5c81472 was 5c81472, checked in by Nelson Elhage <nelhage@mit.edu>, 15 years ago
Import barnowl-locker-* from /mit/nelhage/bin/
  • Property mode set to 100755
File size: 2.1 KB
Line 
1#!/bin/bash
2
3die() {
4      echo "$1" 2>&1;
5      if [ ! -z "$TMPDIR" ]
6      then
7          echo "The failed build can be found in $TMPDIR"
8      fi
9      exit -1
10}
11
12DRYRUN=
13if [ "$1" = "-n" ]; then
14    DRYRUN=1
15    shift;
16fi
17
18NAME="$1"
19NAME="${NAME:?Usage: barnowl-locker-build NAME}"
20TGZ="$2"
21
22ATHENA_SYS="${ATHENA_SYS:-$(machtype -S)}"
23
24if [ "$(uname)" = "SunOS" ]; then
25    MAKE=gmake
26    TAR=gtar
27else
28    MAKE=make
29    TAR=tar
30fi
31
32attach barnowl
33aklog
34
35mkdir -p /tmp/barnowl.$UID || die "Unable to mkdir"
36TMPDIR=$(mktemp -d /tmp/barnowl.$UID/buildXXXXXX) || die "Unable to mktemp"
37cd "$TMPDIR"                         || die "Unable to cd to $TMPDIR"
38
39$TAR xzvf "$BARNOWL_TGZ" || die "Unable to untar"
40cd *;
41
42# git archive --remote="$REPOURL" --format=tar $BRANCH | $TAR xf - || die "Unable to create archive"
43# svn co file:///mit/barnowl/src/svn/$REPOPATH/owl/ barnowl || die "Unable to checkout"
44# cd barnowl                           || die "Unable to cd"
45
46ARGS=
47
48# if ! grep -i debian /etc/athena/version >/dev/null 2>&1 ; then
49#     ARGS=--enable-athstatic
50# fi
51
52# autoreconf         || die "autoreconf failed"
53# autoconf        || die "autoconf failed"
54
55BARNOWL="/afs/sipb.mit.edu/project/barnowl/arch/$ATHENA_SYS"
56export PKG_CONFIG_PATH="$BARNOWL/lib/pkgconfig"
57
58CFLAGS="-I$BARNOWL/include" \
59LDFLAGS="-L$BARNOWL/lib -Wl,-R$BARNOWL/lib" \
60./configure --exec-prefix="/mit/barnowl/arch/$ATHENA_SYS" \
61            --prefix="/mit/barnowl/builds/$NAME" --mandir=/mit/barnowl/man \
62            PROTECT_CFLAGS=-fno-stack-protector \
63            $ARGS \
64            || die "configure failed"
65
66$MAKE clean  || die "make clean failed"
67
68CPUS=$(athinfo localhost cpuspeed | grep -c MHz)
69if [ "$CPUS" = 0 ]; then
70   CPUS=1
71fi
72
73$MAKE -j$CPUS EXE=$NAME all || die "make failed"
74
75if [ -n "$DRYRUN" ]; then
76    echo "Build completed; Dropping to a shell..."
77    exec $SHELL;
78else
79    if [ -n "$TGZ" ]; then
80        mkdir tgz
81        $MAKE EXE=$NAME DESTDIR=tgz install || die "Install failed"
82        cd tgz && $TAR czvf "$TGZ" . || die "Make tarball failed"
83    else
84        $MAKE EXE=$NAME install || die "Install failed"
85    fi
86fi
87
88cd /tmp
89rm -rf "$TMPDIR"
Note: See TracBrowser for help on using the repository browser.