build-scripts/emscripten-buildbot.sh
author Ryan C. Gordon <icculus@icculus.org>
Wed, 24 Dec 2014 12:49:35 -0500
changeset 9283 6723e3e133ea
child 9284 f5fb020fb928
permissions -rwxr-xr-x
Added buildbot script for Emscripten port.
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@9283
    10
cd `dirname "$0"`
icculus@9283
    11
cd ..
icculus@9283
    12
SDLBASE=`pwd`
icculus@9283
    13
icculus@9283
    14
if [ -z "$MAKE" ]; then
icculus@9283
    15
    OSTYPE=`uname -s`
icculus@9283
    16
    if [ "$OSTYPE" == "Linux" ]; then
icculus@9283
    17
        NCPU=`cat /proc/cpuinfo |grep vendor_id |wc -l`
icculus@9283
    18
        let NCPU=$NCPU+1
icculus@9283
    19
    elif [ "$OSTYPE" = "Darwin" ]; then
icculus@9283
    20
        NCPU=`sysctl -n hw.ncpu`
icculus@9283
    21
    elif [ "$OSTYPE" = "SunOS" ]; then
icculus@9283
    22
        NCPU=`/usr/sbin/psrinfo |wc -l |sed -e 's/^ *//g;s/ *$//g'`
icculus@9283
    23
    else
icculus@9283
    24
        NCPU=1
icculus@9283
    25
    fi
icculus@9283
    26
icculus@9283
    27
    if [ -z "$NCPU" ]; then
icculus@9283
    28
        NCPU=1
icculus@9283
    29
    elif [ "$NCPU" = "0" ]; then
icculus@9283
    30
        NCPU=1
icculus@9283
    31
    fi
icculus@9283
    32
icculus@9283
    33
    MAKE="make -j$NCPU"
icculus@9283
    34
fi
icculus@9283
    35
icculus@9283
    36
echo "\$MAKE is '$MAKE'"
icculus@9283
    37
icculus@9283
    38
echo "Setting up Emscripten SDK environment..."
icculus@9283
    39
source "$ENVSCRIPT"
icculus@9283
    40
icculus@9283
    41
echo "Setting up..."
icculus@9283
    42
set -e
icculus@9283
    43
set -x
icculus@9283
    44
cd "$SDLBASE"
icculus@9283
    45
rm -rf buildbot
icculus@9283
    46
mkdir buildbot
icculus@9283
    47
cd buildbot
icculus@9283
    48
icculus@9283
    49
echo "Configuring..."
icculus@9283
    50
emconfigure ../configure --host=asmjs-unknown-emscripten --disable-assembly --disable-threads --enable-cpuinfo=false CFLAGS="-O2 -Wno-warn-absolute-paths"
icculus@9283
    51
icculus@9283
    52
echo "Building..."
icculus@9283
    53
emmake $MAKE
icculus@9283
    54
icculus@9283
    55
set +x
icculus@9283
    56
echo "Done! The library is in $SDLBASE/buildbot/build/.libs/libSDL2.a ..."
icculus@9283
    57
icculus@9283
    58
exit 0
icculus@9283
    59
icculus@9283
    60
# end of emscripten-buildbot.sh ...
icculus@9283
    61