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