build-scripts/emscripten-buildbot.sh
author Ryan C. Gordon
Wed, 24 Dec 2014 13:03:20 -0500
changeset 9284 f5fb020fb928
parent 9283 6723e3e133ea
child 9285 559ac7dd4ee4
permissions -rwxr-xr-x
A little more work on the Emscripten buildbot script.

Should upload tarballs now, etc.
     1 #!/bin/bash
     2 
     3 SDKDIR="/emsdk_portable"
     4 ENVSCRIPT="$SDKDIR/emsdk_env.sh"
     5 if [ ! -f "$ENVSCRIPT" ]; then
     6    echo "ERROR: This script expects the Emscripten SDK to be in '$SDKDIR'." 1>&2
     7    exit 1
     8 fi
     9 
    10 TARBALL="$1"
    11 if [ -z $1 ]; then
    12     TARBALL=sdl-emscripten.tar.xz
    13 fi
    14 
    15 cd `dirname "$0"`
    16 cd ..
    17 SDLBASE=`pwd`
    18 
    19 if [ -z "$MAKE" ]; then
    20     OSTYPE=`uname -s`
    21     if [ "$OSTYPE" == "Linux" ]; then
    22         NCPU=`cat /proc/cpuinfo |grep vendor_id |wc -l`
    23         let NCPU=$NCPU+1
    24     elif [ "$OSTYPE" = "Darwin" ]; then
    25         NCPU=`sysctl -n hw.ncpu`
    26     elif [ "$OSTYPE" = "SunOS" ]; then
    27         NCPU=`/usr/sbin/psrinfo |wc -l |sed -e 's/^ *//g;s/ *$//g'`
    28     else
    29         NCPU=1
    30     fi
    31 
    32     if [ -z "$NCPU" ]; then
    33         NCPU=1
    34     elif [ "$NCPU" = "0" ]; then
    35         NCPU=1
    36     fi
    37 
    38     MAKE="make -j$NCPU"
    39 fi
    40 
    41 echo "\$MAKE is '$MAKE'"
    42 
    43 echo "Setting up Emscripten SDK environment..."
    44 source "$ENVSCRIPT"
    45 
    46 echo "Setting up..."
    47 set -x
    48 cd "$SDLBASE"
    49 rm -rf buildbot
    50 rm -rf emscripten-sdl2-installed
    51 mkdir buildbot
    52 pushd buildbot
    53 
    54 echo "Configuring..."
    55 emconfigure ../configure --host=asmjs-unknown-emscripten --disable-assembly --disable-threads --enable-cpuinfo=false CFLAGS="-O2 -Wno-warn-absolute-paths -Wdeclaration-after-statement -Werror=declaration-after-statement" --prefix="$SDLBASE/emscripten-sdl2-installed"
    56 
    57 echo "Building..."
    58 emmake $MAKE
    59 
    60 echo "Moving things around..."
    61 emmake $MAKE install
    62 mkdir -p ./usr
    63 mv "$SDLBASE/emscripten-sdl2-installed" ./usr/local
    64 popd
    65 tar -cJvvf $TARBALL -C buildbot usr
    66 rm -rf buildbot
    67 
    68 exit 0
    69 
    70 # end of emscripten-buildbot.sh ...
    71