Autobuild/Quick Start/build-cmd.sh

From Second Life Wiki
Jump to navigation Jump to search
#!/bin/bash

# turn on verbose debugging output for parabuild logs.
set -x
# make errors fatal
set -e

if [ -z "$AUTOBUILD" ] ; then 
    fail
fi

if [ "$OSTYPE" = "cygwin" ] ; then
    export AUTOBUILD="$(cygpath -u $AUTOBUILD)"
fi

HELLO_VERSION="2.6"
HELLO_SOURCE_DIR="hello-$HELLO_VERSION"
HELLO_ARCHIVE="hello-$HELLO_VERSION.tar.gz"
HELLO_URL="http://ftp.gnu.org/gnu/hello/$HELLO_ARCHIVE"
HELLO_MD5="066ba7113eed3554cde6bc34b7b43e9b" # for hello-2.6.tar.gz

# load autbuild provided shell functions and variables
eval "$("$AUTOBUILD" source_environment)"

fetch_archive "$HELLO_URL" "$HELLO_ARCHIVE" "$HELLO_MD5"
extract "$HELLO_ARCHIVE"

top="$(cd $(dirname $0) ; pwd)"
stage="$(pwd)"

pushd "$HELLO_SOURCE_DIR"
    case "$AUTOBUILD_PLATFORM" in
        "windows")
            fail "GNU hello doesn't really build on windows. I guess I chose a bad example, sorry! -Brad"
        ;;
        "darwin")
            opts='-arch i386 -iwithsysroot /Developer/SDKs/MacOSX10.4u.sdk'
            CFLAGS="$opts" CXXFLAGS="$opts" ./configure  --prefix="$stage"
            make
            make install
        ;;
        "linux")
            # TODO: see darwin notes here above
            CFLAGS=-m32 CXXFLAGS=-m32 CC=gcc-4.1 CXX=g++-4.1 ./configure --prefix="$stage"
            make
            make install
        ;;
    esac
    mkdir -p "$stage/LICENSES"
    cp COPYING "$stage/LICENSES/hello.txt"
popd

pass