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