build-scripts/emscripten-buildbot.sh
author Philipp Wiesemann <philipp.wiesemann@arcor.de>
Tue, 10 Feb 2015 20:40:03 +0100
changeset 9338 86bc1c9a090f
parent 9288 573ebcb470a3
child 10311 848951113551
permissions -rwxr-xr-x
Fixed bug 2873 - Joystick test won't reload after reattach

lectem

-plug in the joystick
-start testjoystick 0
-unplug
-replug

The joystick is detected but doesn't enter the loop anymore since done==SDL_TRUE
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@9283
    50
mkdir buildbot
icculus@9284
    51
pushd buildbot
icculus@9283
    52
icculus@9283
    53
echo "Configuring..."
icculus@9288
    54
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="$PWD/emscripten-sdl2-installed"
icculus@9283
    55
icculus@9283
    56
echo "Building..."
icculus@9283
    57
emmake $MAKE
icculus@9283
    58
icculus@9284
    59
echo "Moving things around..."
icculus@9284
    60
emmake $MAKE install
icculus@9285
    61
# Fix up a few things to a real install path
icculus@9288
    62
perl -w -pi -e "s#$PWD/emscripten-sdl2-installed#/usr/local#g;" ./emscripten-sdl2-installed/lib/libSDL2.la ./emscripten-sdl2-installed/lib/pkgconfig/sdl2.pc ./emscripten-sdl2-installed/bin/sdl2-config
icculus@9284
    63
mkdir -p ./usr
icculus@9288
    64
mv ./emscripten-sdl2-installed ./usr/local
icculus@9284
    65
popd
icculus@9284
    66
tar -cJvvf $TARBALL -C buildbot usr
icculus@9284
    67
rm -rf buildbot
icculus@9283
    68
icculus@9283
    69
exit 0
icculus@9283
    70
icculus@9283
    71
# end of emscripten-buildbot.sh ...
icculus@9283
    72