Changeset 56e4869 for scripts/locker-build
- Timestamp:
- Apr 11, 2009, 6:11:04 PM (15 years ago)
- Branches:
- master, debian, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- f9f065a
- Parents:
- 5c81472
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
scripts/locker-build
r5c81472 r56e4869 1 #!/bin/bash 1 #!/bin/sh 2 3 ######################################################### 4 # Build script to build BarnOwl for the locker. 5 6 # Usage: locker-build [-n] [-o OUTPUT-TGZ] VERSION SOURCE-TARBALL 7 # -n is a dry-run, and drops to a shell in the build directory 8 # -o does the install into a temporary directory and tars it into the 9 # specified tarball instead. 10 # SOURCE-TARBALL is a source tarball, created by do-release 11 # VERSION should be of the form 'barnowl-VERSION' 12 # 13 # TODO: Scrape $VERSION from the tarball 2 14 3 15 die() { 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 16 echo "$@" 2>&1; 17 exit 1; 10 18 } 11 19 20 usage () { 21 echo "Usage: $0 [-n] [-o OUTPUT-TGZ] VERSION SOURCE-TARBALL" 22 exit 2; 23 } 24 25 exittrap() { :; } 26 for sig in 1 2 13 15; do trap "exit $(($sig + 128))" $sig; done 27 trap 'exittrap' EXIT 28 29 SRC_TGZ= 30 OUT_TGZ= 12 31 DRYRUN= 13 if [ "$1" = "-n" ]; then 14 DRYRUN=1 15 shift; 16 fi 32 33 set -- `getopt no: "$@"` 34 [ $? -eq 0 ] || usage 35 36 for opt 37 do 38 case "$opt" in 39 -n) 40 DRYRUN=1; shift ;; 41 -o) 42 OUT_TGZ="$2"; shift 2;; 43 --) 44 shift; break ;; 45 esac 46 done 17 47 18 48 NAME="$1" 19 NAME="${NAME:?Usage: barnowl-locker-build NAME}" 20 TGZ="$2" 49 SRC_TGZ="$2" 50 51 test -z "$NAME" && usage 52 test -z "$SRC_TGZ" && usage 53 21 54 22 55 ATHENA_SYS="${ATHENA_SYS:-$(machtype -S)}" … … 33 66 aklog 34 67 35 mkdir -p /tmp/barnowl.$UID || die "Unable to mkdir" 36 TMPDIR=$(mktemp -d /tmp/barnowl.$UID/buildXXXXXX) || die "Unable to mktemp" 37 cd "$TMPDIR" || die "Unable to cd to $TMPDIR" 68 TMPDIR=$(mktemp -d /tmp/barnowl-build-XXXXXX) || die "Unable to mktemp" 38 69 39 $TAR xzvf "$BARNOWL_TGZ" || die "Unable to untar" 40 cd *; 70 exittrap() { rm -rf "$TMPDIR"; } 41 71 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" 72 $TAR -C "$TMPDIR" -xzvf "$SRC_TGZ" || die "Unable to untar" 45 73 46 ARGS= 74 ( 75 cd "$TMPDIR"/* || die "Unable to cd to $TMPDIR" 47 76 48 # if ! grep -i debian /etc/athena/version >/dev/null 2>&1 ; then 49 # ARGS=--enable-athstatic 50 # fi 77 BARNOWL="/afs/sipb.mit.edu/project/barnowl/arch/$ATHENA_SYS" 78 export PKG_CONFIG_PATH="$BARNOWL/lib/pkgconfig" 51 79 52 # autoreconf || die "autoreconf failed" 53 # autoconf || die "autoconf failed" 80 CFLAGS="-I$BARNOWL/include" \ 81 LDFLAGS="-L$BARNOWL/lib -Wl,-R$BARNOWL/lib" \ 82 ./configure --exec-prefix="/mit/barnowl/arch/$ATHENA_SYS" \ 83 --prefix="/mit/barnowl/builds/$NAME" --mandir=/mit/barnowl/man \ 84 PROTECT_CFLAGS=-fno-stack-protector \ 85 || die "configure failed" 54 86 55 BARNOWL="/afs/sipb.mit.edu/project/barnowl/arch/$ATHENA_SYS" 56 export PKG_CONFIG_PATH="$BARNOWL/lib/pkgconfig" 87 $MAKE clean || die "make clean failed" 57 88 58 CFLAGS="-I$BARNOWL/include" \ 59 LDFLAGS="-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" 89 CPUS=$(athinfo localhost cpuspeed | grep -c MHz) 90 if [ "$CPUS" = 0 ]; then 91 CPUS=1 92 fi 65 93 66 $MAKE clean || die "make cleanfailed"94 $MAKE -j$CPUS EXE=$NAME all || die "make failed" 67 95 68 CPUS=$(athinfo localhost cpuspeed | grep -c MHz) 69 if [ "$CPUS" = 0 ]; then 70 CPUS=1 96 if [ -n "$DRYRUN" ]; then 97 echo "Build completed; Dropping to a shell..." 98 $SHELL 99 else 100 if [ -n "$OUT_TGZ" ]; then 101 mkdir tgz 102 $MAKE EXE=$NAME DESTDIR=tgz install || die "Install failed" 103 else 104 $MAKE EXE=$NAME install || die "Install failed" 105 fi 106 fi 107 ) 108 109 if [ -n "$OUT_TGZ" ]; then 110 $TAR -C "$TMPDIR/"*/tgz -czvf "$OUT_TGZ" . || die "Make tarball failed" 71 111 fi 72 112 73 $MAKE -j$CPUS EXE=$NAME all || die "make failed"74 75 if [ -n "$DRYRUN" ]; then76 echo "Build completed; Dropping to a shell..."77 exec $SHELL;78 else79 if [ -n "$TGZ" ]; then80 mkdir tgz81 $MAKE EXE=$NAME DESTDIR=tgz install || die "Install failed"82 cd tgz && $TAR czvf "$TGZ" . || die "Make tarball failed"83 else84 $MAKE EXE=$NAME install || die "Install failed"85 fi86 fi87 88 cd /tmp89 113 rm -rf "$TMPDIR" 114 exittrap() { :; }
Note: See TracChangeset
for help on using the changeset viewer.